/* Custom CSS for Remco Heite Schaaktoernooi */

:root {
    --chess-white: #FFFFFF;
    --chess-black: #000000;
    --chess-blue: #1E3A8A;
    --chess-yellow: #FBBF24;
    --chess-dark-blue: #0F172A;
    --chess-gray: #6B7280;
}

/* Base Styles */
body {
    font-family: 'Inter', sans-serif;
    color: var(--chess-black);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
}

/* Header */
.menu-header {
    background: var(--chess-white);
    border-bottom: 2px solid var(--chess-blue);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-chess {
    font-size: 2rem;
    color: var(--chess-blue);
}

.logo-text {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.2;
    color: var(--chess-black);

}

.nav-link {
    font-weight: 600;
    color: var(--chess-black) !important;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--chess-blue) !important;
}

/* Hero Section */
.chess-hero {
    background: linear-gradient(135deg, var(--chess-dark-blue) 0%, var(--chess-blue) 100%);
    position: relative;
    overflow: hidden;
}

.hero-title {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 1rem;
    color: var(--chess-white);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--chess-yellow);
    margin-bottom: 2rem;
}

.hero-info {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--chess-white);
}

.info-item i {
    color: var(--chess-yellow);
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.uk-button-primary {
    background: var(--chess-yellow);
    color: var(--chess-black);
    border: 2px solid var(--chess-yellow);
    font-weight: 600;
}

.uk-button-primary:hover {
    background: transparent;
    color: var(--chess-yellow);
    border-color: var(--chess-yellow);
}

.uk-button-default {
    background: transparent;
    color: var(--chess-white);
    border: 2px solid var(--chess-white);
    font-weight: 600;
}

.uk-button-default:hover {
    background: var(--chess-white);
    color: var(--chess-black);
}

.chess-board-hero {
    display: flex;
    justify-content: center;
    align-items: center;
}

.chess-board {
    display: inline-block;
    border: 4px solid var(--chess-white);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.chess-row {
    display: flex;
}

.chess-square {
    width: 40px;
    height: 40px;
}

.chess-square.light {
    background: var(--chess-white);
}

.chess-square.dark {
    background: var(--chess-blue);
}

/* Tournament Types */
.tournament-types {
    background: var(--chess-white);
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--chess-dark-blue);
}

.tournament-card {
    padding: 2rem;
    border-radius: 10px;
    background: var(--chess-white);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-top: 4px solid transparent;
}

.tournament-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.school-tournament {
    border-top-color: var(--chess-blue);
}

.open-tournament {
    border-top-color: var(--chess-yellow);
}

.invited-tournament {
    border-top-color: var(--chess-black);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.school-tournament .card-icon {
    color: var(--chess-blue);
}

.open-tournament .card-icon {
    color: var(--chess-yellow);
}

.invited-tournament .card-icon {
    color: var(--chess-black);
}

/* Live Section */
.live-section {
    background: linear-gradient(135deg, var(--chess-black) 0%, var(--chess-gray) 100%);
}

.live-card, .results-card {
    padding: 2rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.live-card h3, .results-card h3 {
    color: var(--chess-white);
    margin-bottom: 1rem;
}

.live-card p, .results-card p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1.5rem;
}

/* News Section */
.news-card {
    background: var(--chess-white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.news-card:hover {
    transform: translateY(-5px);
}

.news-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.news-content {
    padding: 1.5rem;
}

.news-content h3 a {
    color: var(--chess-dark-blue);
    text-decoration: none;
}

.news-content h3 a:hover {
    color: var(--chess-blue);
}

.read-more {
    color: var(--chess-blue);
    font-weight: 600;
    text-decoration: none;
}

.read-more:hover {
    text-decoration: underline;
}

/* Gallery Section */
.gallery-section {
    background: var(--chess-dark-blue);
}

.gallery-item {
    display: block;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

/* Footer */
.chess-footer {
    background: var(--chess-black);
    color: var(--chess-white);
    padding: 3rem 0 1rem;
}

.chess-footer h5 {
    color: var(--chess-yellow);
    margin-bottom: 1rem;
}

.chess-footer a {
    color: var(--chess-white);
    text-decoration: none;
}

.chess-footer a:hover {
    color: var(--chess-yellow);
}

.footer-bottom {
    border-top: 1px solid var(--chess-gray);
    padding-top: 2rem;
    margin-top: 2rem;
    text-align: center;
}

/* Markdown Body */
.markdown-body {
    font-family: 'Inter', sans-serif;
    line-height: 1.7;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    color: var(--chess-dark-blue);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.markdown-body a {
    color: var(--chess-blue);
}

.markdown-body a:hover {
    color: var(--chess-dark-blue);
}

/* Cards in lists */
.card {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.card-img-top {
    border-radius: 10px 10px 0 0;
}

.card-title a {
    color: var(--chess-dark-blue);
    text-decoration: none;
}

.card-title a:hover {
    color: var(--chess-blue);
}

/* Pagination Styles */
.pagination {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 2rem 0;
    margin: 0;
}

.pagination li {
    margin: 0 0.25rem;
}

.pagination a {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--chess-blue);
    border-radius: 5px;
    color: var(--chess-blue);
    text-decoration: none;
    transition: all 0.3s ease;
}

.pagination a:hover {
    background: var(--chess-blue);
    color: var(--chess-white);
}

.pagination .active a {
    background: var(--chess-blue);
    color: var(--chess-white);
}

/* List Page Styles */
.list-page {
    padding: 3rem 0;
}

.page-header {
    margin-bottom: 3rem;
    text-align: center;
}

.page-title {
    color: var(--chess-dark-blue);
    margin-bottom: 1rem;
}

.page-description {
    color: var(--chess-gray);
    font-size: 1.2rem;
}

/* Single Page Styles */
.single-page {
    padding: 3rem 0;
}

.article-header {
    margin-bottom: 2rem;
}

.article-title {
    color: var(--chess-dark-blue);
    margin-bottom: 1rem;
    font-size: 2.5rem;
}

.article-meta {
    color: var(--chess-gray);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.article-content {
    line-height: 1.8;
    font-size: 1.1rem;
}

.article-content h2 {
    color: var(--chess-dark-blue);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--chess-yellow);
    padding-bottom: 0.5rem;
}

.article-content h3 {
    color: var(--chess-blue);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.article-content blockquote {
    border-left: 4px solid var(--chess-yellow);
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: var(--chess-gray);
}

.article-content code {
    background: rgba(30, 58, 138, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

.article-content pre {
    background: var(--chess-dark-blue);
    color: var(--chess-white);
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 2rem 0;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
}

.article-content th,
.article-content td {
    padding: 0.75rem;
    border: 1px solid var(--chess-gray);
    text-align: left;
}

.article-content th {
    background: var(--chess-blue);
    color: var(--chess-white);
    font-weight: 600;
}

.article-content tr:nth-child(even) {
    background: rgba(30, 58, 138, 0.05);
}

/* Blog Specific Styles */
.blog-list {
    background: var(--chess-white);
}

.blog-post-card {
    background: var(--chess-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.blog-post-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.blog-post-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.blog-post-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.blog-post-title {
    margin-bottom: 1rem;
    line-height: 1.3;
}

.blog-post-title a {
    color: var(--chess-dark-blue);
    text-decoration: none;
    transition: color 0.3s ease;
}

.blog-post-title a:hover {
    color: var(--chess-blue);
}

.blog-post-excerpt {
    color: var(--chess-gray);
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.blog-post-meta {
    color: var(--chess-gray);
    font-size: 0.85rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding-top: 1rem;
    margin-top: auto;
}

/* Related Articles Styles */
.related-articles {
    background: rgba(30, 58, 138, 0.05);
    padding: 3rem 0;
    margin-top: 3rem;
}

.related-title {
    color: var(--chess-dark-blue);
    margin-bottom: 2rem;
    text-align: center;
}

.related-article-card {
    background: var(--chess-white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    height: 100%;
}

.related-article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.related-article-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.related-article-content {
    padding: 1.25rem;
}

.related-article-title {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.related-article-title a {
    color: var(--chess-dark-blue);
    text-decoration: none;
}

.related-article-title a:hover {
    color: var(--chess-blue);
}

.related-article-excerpt {
    color: var(--chess-gray);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Archive Styles */
.archive-section {
    padding: 3rem 0;
}

.archive-year {
    color: var(--chess-blue);
    margin: 2.5rem 0 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--chess-yellow);
}

.archive-list {
    list-style: none;
    padding: 0;
}

.archive-item {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.archive-item:last-child {
    border-bottom: none;
}

.archive-date {
    color: var(--chess-gray);
    font-size: 0.9rem;
    margin-right: 1rem;
}

.archive-link {
    color: var(--chess-dark-blue);
    text-decoration: none;
    font-weight: 500;
}

.archive-link:hover {
    color: var(--chess-blue);
}

/* Contact Form Styles */
.contact-form {
    background: var(--chess-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--chess-dark-blue);
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--chess-blue);
}

.submit-btn {
    background: var(--chess-blue);
    color: var(--chess-white);
    border: none;
    padding: 1rem 2rem;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.submit-btn:hover {
    background: var(--chess-dark-blue);
}

/* Results Table Styles */
.results-table {
    background: var(--chess-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.table-header {
    background: var(--chess-blue);
    color: var(--chess-white);
    padding: 1.5rem;
}

.table-title {
    margin: 0;
    font-size: 1.5rem;
}

.results-table table {
    width: 100%;
    border-collapse: collapse;
}

.results-table th {
    background: var(--chess-dark-blue);
    color: var(--chess-white);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.results-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.results-table tr:hover {
    background: rgba(30, 58, 138, 0.05);
}

/* Tournament Categories */
.tournament-category {
    margin-bottom: 3rem;
}

.category-header {
    background: var(--chess-blue);
    color: var(--chess-white);
    padding: 1rem 1.5rem;
    border-radius: 8px 8px 0 0;
}

.category-title {
    margin: 0;
    font-size: 1.3rem;
}

/* Utility Classes */
.text-chess-blue { color: var(--chess-blue); }
.text-chess-yellow { color: var(--chess-yellow); }
.text-chess-black { color: var(--chess-black); }
.text-chess-white { color: var(--chess-white); }

.bg-chess-blue { background: var(--chess-blue); }
.bg-chess-yellow { background: var(--chess-yellow); }
.bg-chess-black { background: var(--chess-black); }
.bg-chess-white { background: var(--chess-white); }

.border-chess-blue { border-color: var(--chess-blue); }
.border-chess-yellow { border-color: var(--chess-yellow); }

/* Animation for chess pieces */
@keyframes movePiece {
    0% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0); }
}

.animate-chess-piece {
    animation: movePiece 2s ease-in-out infinite;
}

/* Print Styles */
@media print {
    .menu-header,
    .chess-footer,
    .hero-buttons {
        display: none;
    }

    .chess-hero {
        background: none;
        color: black;
    }

    .hero-title {
        color: black;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --chess-blue: #0000FF;
        --chess-yellow: #FFFF00;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .hero-info {
        flex-direction: column;
        gap: 1rem;
    }

    .hero-buttons {
        flex-direction: column;
    }

    .chess-square {
        width: 30px;
        height: 30px;
    }
}
/* ====== ADAPTIVE PATCH (CSS-only, no HTML changes) ====== */

/* 1) Минимальная "bootstrap-like" сетка для legacy-разметки */
.container { width: 100%; margin-left: auto; margin-right: auto; padding-left: 12px; padding-right: 12px; }
@media (min-width: 576px){ .container{ max-width: 540px; } }
@media (min-width: 768px){ .container{ max-width: 720px; } }
@media (min-width: 992px){ .container{ max-width: 960px; } }
@media (min-width: 1200px){ .container{ max-width: 1140px; } }

.row { display: flex; flex-wrap: wrap; margin-left: -12px; margin-right: -12px; }
.row > [class^="col-"] { padding-left: 12px; padding-right: 12px; box-sizing: border-box; width: 100%; }

/* gap эмуляция для .g-4 */
.row.g-4 { margin-left: -8px; margin-right: -8px; }
.row.g-4 > [class^="col-"] { padding-left: 8px; padding-right: 8px; }

/* Колонки из твоего HTML */
@media (min-width: 768px){ .col-md-6 { flex: 0 0 50%; max-width: 50%; } }
@media (min-width: 992px){ .col-lg-3 { flex: 0 0 25%; max-width: 25%; } }

/* Пара утилит, которые часто встречаются */
.h-100 { height: 100%; }
.shadow-sm { box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,.075); }
.fw-semibold { font-weight: 600; }
.mb-2 { margin-bottom: .5rem; } .mb-3 { margin-bottom: 1rem; }
.my-4 { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.my-5 { margin-top: 3rem; margin-bottom: 3rem; }

/* 2) Шапка: перенос/скролл меню на узких экранах */
@media (max-width: 960px){
    .uk-navbar-right { max-width: 100%; }
    .uk-navbar-nav { flex-wrap: wrap; gap: .25rem .75rem; }
    .uk-navbar-nav > li > a { padding: 8px 10px; font-size: 0.95rem; }
    .logo-text { font-size: 1rem; line-height: 1.2; display: none; }
    .logo-chess { font-size: 1.6rem; }
}
@media (max-width: 480px){
    .uk-navbar-nav { overflow-x: auto; white-space: nowrap; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
    .uk-navbar-nav > li { flex: 0 0 auto; }
}

/* 3) Шахматная доска: grid вместо фиксированных px */
.chess-board {
    display: grid !important;
    grid-template-columns: repeat(8, 1fr);
    width: min(90vw, 520px);
    aspect-ratio: 1 / 1;
    border: 4px solid var(--chess-white);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}
.chess-row { display: contents !important; }
.chess-square {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
}
@media (max-width: 768px){
    .chess-board { width: min(92vw, 420px); }
}

/* 4) Картинки в карточках новостей/галерее — мягче на мобилке */
@media (max-width: 480px){
    .news-card img,
    .gallery-item img,
    .blog-post-image { height: 140px; }
}

/* 5) Fluid типографика героя */
.hero-title { font-size: clamp(2rem, 4vw + 1rem, 3.5rem) !important; }

/* ==== MOBILE H-SCROLL KILLER (CSS-only) ==== */

/* 1) Глобально не даём странице расползаться по X */
html, body {
    max-width: 100%;
    overflow-x: clip; /* лучше, чем hidden */
}
@supports not (overflow: clip) {
    html, body { overflow-x: hidden; } /* фоллбек для старых браузеров */
}

/* 2) Если где-то .row без .container — убираем отрицательные отступы */
@media (max-width: 576px) {
    .row { margin-left: 0 !important; margin-right: 0 !important; }
}

/* 3) Длинные элементы не растягивают вьюпорт */
img, svg, video, canvas, iframe { max-width: 100%; height: auto; }
h1, h2, h3, h4, h5, h6, p, li, a, figcaption, small, .text, .card-text {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* 4) Горизонтальная прокрутка у меню — только внутри него, не всей страницы */
.uk-navbar-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.uk-navbar-nav::-webkit-scrollbar { display: none; }

/* 5) Шахматная доска никогда не шире контейнера */
.chess-board { max-width: 100%; }

/* 6) На очень узких экранах компенсируем возможные внешние negative margins сеток UIkit */
@media (max-width: 576px) {
    [uk-grid] { margin-left: 0 !important; margin-right: 0 !important; }
}


/* ==== CHESSBOARD — FINAL FIX (CSS-only) ==== */

/* 1) Сбрасываем старые фикс-размеры */
.chess-square { width: auto !important; height: auto !important; }

/* 2) Доска: grid, без vw во избежание горизонтального скролла */
.chess-board {
    display: grid !important;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    width: 100% !important;        /* вместо min(90vw, ...) */
    max-width: 520px;               /* верхний предел */
    aspect-ratio: 1 / 1;            /* всегда квадратная */
    margin: 0 auto;                 /* центрирование */
    box-sizing: border-box;
    overflow: hidden;               /* на всякий случай */
}

/* 3) Ряды становятся «прозрачными» для grid */
.chess-row { display: contents !important; }

/* 4) Клетки — чистые квадраты без внешних отступов */
.chess-square {
    aspect-ratio: 1 / 1;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
}

/* 5) Игнорируем ручные цвета из HTML */
.chess-square.light,
.chess-square.dark { background: transparent !important; }

/* 6) Генерируем шахматный узор (по структуре DOM) */
.chess-board > .chess-row:nth-child(odd)  .chess-square:nth-child(odd),
.chess-board > .chess-row:nth-child(even) .chess-square:nth-child(even) {
    background: var(--chess-white) !important;
}
.chess-board > .chess-row:nth-child(odd)  .chess-square:nth-child(even),
.chess-board > .chess-row:nth-child(even) .chess-square:nth-child(odd) {
    background: var(--chess-blue) !important;
}

/* 7) Фоллбек, если браузер не умеет display: contents */
@supports not (display: contents) {
    .chess-board { display: block !important; }
    .chess-row   { display: flex !important; }
    .chess-square{ flex: 0 0 12.5%; }
}

/* 8) (Опционально) На очень узких экранах можно сузить максимум */
@media (max-width: 480px){
    .chess-board { max-width: 420px; } /* останется 100% контейнера */
}
