/* =========================================
   1. Variables & Reset
   ========================================= */
:root {
    --color-primary: #3cb371;
    --color-primary-light: #50d890;
    --color-primary-dark: #2d8a3e;

    --color-accent: #f0c14b;
    --color-accent-light: #ffd966;

    --color-bg: #121212;         
    --color-bg-alt: #1e1e1e;     
    --color-surface: #252525;    

    --color-text: #e8e8e8;       
    --color-text-muted: #a0a0a0; 
    --color-border: #333333;   

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;

    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    --font-body: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-heading: 'Segoe UI', system-ui, -apple-system, sans-serif;

    --max-width: 900px;
    --header-height: 80px;

    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2.5rem;
    --spacing-xl: 4rem;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.7;
    min-height: 100vh;
    padding-top: var(--header-height); 
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover, a:focus {
    color: var(--color-primary-light);
}

a:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* =========================================
   2. Layout & Typography
   ========================================= */

main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing-lg) var(--spacing-md);
}

header h1 {
    font-family: var(--font-heading);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

header p {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    max-width: 700px;
    margin: 0 auto;
}

/* =========================================
   3. Content Elements (TOC, FAQ, Aside)
   ========================================= */

nav[aria-label="Indice dei contenuti"] {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

nav[aria-label="Indice dei contenuti"] strong {
    display: block;
    font-size: 1rem;
    color: var(--color-text);
    margin-bottom: var(--spacing-sm);
}

nav[aria-label="Indice dei contenuti"] ol {
    list-style: decimal;
    padding-left: var(--spacing-md);
}

nav[aria-label="Indice dei contenuti"] li {
    margin-bottom: var(--spacing-xs);
    color: var(--color-text-muted);
}

nav[aria-label="Indice dei contenuti"] a {
    font-size: 0.95rem;
}

section {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
}

section:last-of-type {
    border-bottom: none;
}

h2 {
    font-family: var(--font-heading);
    font-size: clamp(1.4rem, 3vw, 1.75rem);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--spacing-md);
    padding-top: var(--spacing-sm);
}

h3 {
    font-family: var(--font-heading);
    font-size: clamp(1.15rem, 2.5vw, 1.35rem);
    font-weight: 600;
    color: var(--color-text);
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
}

article {
    color: var(--color-text);
}

article p {
    margin-bottom: var(--spacing-md);
    text-align: justify;
    hyphens: auto;
}

article p:last-child {
    margin-bottom: 0;
}

/* MARK style updated for Dark Mode */
mark {
    background: linear-gradient(120deg, rgba(240, 193, 75, 0.3) 0%, rgba(240, 193, 75, 0.3) 100%);
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-position: 0 0;
    color: var(--color-accent-light);
    padding: 0 4px;
    border-radius: 2px;
}

.faq-section details {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-sm);
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.faq-section details:hover {
    box-shadow: var(--shadow-sm);
}

.faq-section details[open] {
    box-shadow: var(--shadow-md);
}

.faq-section summary {
    padding: var(--spacing-md);
    cursor: pointer;
    font-weight: 500;
    color: var(--color-text);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background var(--transition);
}

.faq-section summary::-webkit-details-marker {
    display: none;
}

.faq-section summary::after {
    content: '+';
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--color-primary);
    transition: transform var(--transition);
}

.faq-section details[open] summary::after {
    transform: rotate(45deg);
}

.faq-section summary:hover {
    background: var(--color-surface);
}

.faq-section details > div {
    padding: 0 var(--spacing-md) var(--spacing-md);
    color: var(--color-text-muted);
    line-height: 1.7;
}

aside {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
    color: white;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin: var(--spacing-xl) 0;
}

aside strong {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-size: 1rem;
}

aside p {
    font-size: 0.95rem;
    opacity: 0.95;
    margin: 0;
}

aside a {
    color: var(--color-accent-light);
}

aside a:hover {
    color: white;
}

@media (max-width: 600px) {
    main {
        padding: var(--spacing-md) var(--spacing-sm);
    }
    
    section {
        margin-bottom: var(--spacing-lg);
        padding-bottom: var(--spacing-md);
    }
}

/* ============================================
   5. IMAGES STYLES
   ============================================ */
/* Общие стили */
.article-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    transition: transform 0.3s, box-shadow 0.3s;
}

.article-image:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.image-container {
    margin: var(--spacing-lg) 0;
    overflow: hidden;
    border-radius: var(--radius-md);
}

/* Hero */
.hero-image-container {
    margin: 0 0 var(--spacing-xl) 0;
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
}

.hero-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transition: transform 0.4s;
}

.hero-image:hover {
    transform: scale(1.02);
}

/* Specific Images */
.surfaces-image { border: 1px solid var(--color-border); }
.surfaces-image:hover { transform: translateY(-3px) scale(1.01); }

.tournaments-image-container { text-align: center; }
.tournaments-image { max-width: 600px; margin: 0 auto; }
.tournaments-image:hover { transform: translateY(-5px); box-shadow: 0 12px 40px rgba(0,0,0,0.15); }

.strategies-image { border: 1px solid var(--color-border); }

.image-caption {
    display: block;
    text-align: center;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-top: var(--spacing-sm);
    font-style: italic;
}

/* Animations */
.article-image, .hero-image {
    opacity: 1;
    animation: fadeInImage 0.5s ease-out;
}

@keyframes fadeInImage {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .tournaments-image { max-width: 100%; }
    .article-image:hover, .hero-image:hover { transform: none; }
}

/* =========================================
   6. HEADER & DESKTOP MENU
   ========================================= */

/* Header Container - Fixed & Glassmorphism */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background-color: rgba(15, 15, 15, 0.9); 
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px 0;
    transition: all 0.3s ease;
    text-align: left; 
    margin-bottom: 0; 
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Logo */
.site-logo a {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.site-logo span {
    color: var(--color-primary-light); 
}

/* Desktop Menu */
ul.menu-desktop {
    display: flex;
    gap: 30px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.menu-desktop li a {
    color: #e0e0e0;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 5px;
    position: relative;
    transition: color 0.3s ease;
}

.menu-desktop li.current-menu-item a,
.menu-desktop li a:hover {
    color: #ffffff;
}

.menu-desktop li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--color-primary-light);
    transition: width 0.3s ease;
}

.menu-desktop li a:hover::after,
.menu-desktop li.current-menu-item a::after {
    width: 100%;
}

/* =========================================
   7. MOBILE MENU & BURGER
   ========================================= */

.mobile-controls {
    display: none;
}

/* Burger Button Styles */
.burger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1002; 
}

.burger span {
    display: block;
    width: 30px;
    height: 3px;
    margin-bottom: 5px;
    background-color: #fff;
    border-radius: 3px;
    transition: all 0.3s ease;
    transform-origin: left;
}

/* Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
    z-index: 1001; 
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
}

.mobile-menu-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

/* Sliding Panel */
.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 85%;
    max-width: 400px;
    height: 100vh;
    background-color: #1a1a1a; 
    z-index: 1002; 
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1);
    box-shadow: -5px 0 20px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
}

.mobile-menu.is-open {
    transform: translateX(0);
}

.mobile-menu__close {
    align-self: flex-end;
    background: none;
    border: none;
    color: #fff;
    font-size: 30px;
    padding: 20px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s;
}

.mobile-menu__close:hover {
    color: var(--color-primary-light);
}

.mobile-menu__inner {
    padding: 20px 40px;
    overflow-y: auto;
}

.menu-mobile {
    display: flex;
    flex-direction: column;
    gap: 20px;
    list-style: none;
}

.menu-mobile li a {
    font-size: 22px;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    display: block;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 10px;
    transition: color 0.3s, padding-left 0.3s;
}

.menu-mobile li a:hover {
    color: var(--color-primary-light);
    padding-left: 10px;
    border-color: var(--color-primary-light);
}

/* Burger Animation State */
.burger.is-active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.burger.is-active span:nth-child(2) { opacity: 0; }
.burger.is-active span:nth-child(3) { transform: rotate(-45deg) translate(7px, -6px); }

/* =========================================
   8. RESPONSIVE LOGIC
   ========================================= */

@media (max-width: 992px) {
    .site-nav--desktop {
        display: none !important; /* Усилил правило, чтобы меню точно скрывалось */
    }
    
    .mobile-controls {
        display: block; 
    }
}

@media print {
    .site-header { position: static; background: white; color: black; }
    .site-logo a { color: black; }
    .menu-desktop, .mobile-controls, .mobile-menu { display: none; }
    body { padding-top: 0; }
}

/* =========================================
   9. NEW FOOTER STYLES (4 Columns)
   ========================================= */

.site-footer {
    background-color: #111111; 
    color: #b0b0b0; 
    padding: 60px 0 0 0;
    font-size: 0.9rem;
    border-top: 3px solid var(--color-primary); 
    margin-top: auto; 
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 50px 20px;
    display: grid;
    grid-template-columns: repeat(4, 1fr); 
    gap: 30px;
}

.footer-heading {
    font-family: var(--font-heading);
    color: var(--color-accent); 
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 20px;
    letter-spacing: 0.5px;
    margin-top: 0; 
}

.footer-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-list li {
    margin-bottom: 12px;
    line-height: 1.5;
}

.footer-list a {
    color: #b0b0b0;
    text-decoration: none;
    transition: all 0.2s ease;
}

.footer-list a:hover {
    color: #ffffff;
    padding-left: 5px; 
}

.warning-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #d6d6d6;
}

.warning-list .icon {
    font-size: 1.1rem;
}

.footer-bottom {
    background-color: #131111;
    padding: 20px 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.footer-bottom p {
    margin: 0;
    font-size: 0.8rem;
    color: #666;
}

@media (max-width: 992px) {
    .footer-inner {
        grid-template-columns: repeat(2, 1fr); 
    }
}

@media (max-width: 600px) {
    .footer-inner {
        grid-template-columns: 1fr; 
        gap: 40px;
    }
    
    .site-footer {
        padding-top: 40px;
        text-align: center; 
    }
    
    .warning-list li {
        justify-content: center; 
    }

    .footer-list a:hover {
        padding-left: 0; 
        color: var(--color-accent);
    }
}

/* =========================================
   404 PAGE STYLES (Tennis Theme)
   ========================================= */

.error-404-wrapper {
    min-height: 60vh; 
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--spacing-lg) var(--spacing-md);
}

.error-404-content {
    max-width: 600px;
    margin: 0 auto;
}

/* Typography */
.error-code {
    font-size: 6rem;
    line-height: 1;
    font-weight: 800;
    color: var(--color-accent); 
    margin: 0;
    opacity: 0.9;
    text-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.error-title {
    font-size: 2.5rem;
    color: var(--color-text);
    margin: 10px 0 20px;
    font-weight: 700;
}

.error-text {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    margin-bottom: 40px;
}

/* Button Style */
.btn-404 {
    display: inline-block;
    background-color: var(--color-primary);
    color: #fff;
    padding: 12px 30px;
    border-radius: var(--radius-lg);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(60, 179, 113, 0.3); 
}

.btn-404:hover {
    background-color: var(--color-primary-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(60, 179, 113, 0.5);
    color: #fff;
}

/* =========================
   PURE CSS TENNIS BALL
   ========================= */
.tennis-ball-404 {
    width: 100px;
    height: 100px;
    background: #ccff00; 
    background: radial-gradient(circle at 35% 35%, #eaff00, #ccff00, #aacc00);
    border-radius: 50%;
    margin: 0 auto 20px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: bounce 2s infinite ease-in-out;
    overflow: hidden;
}

.ball-line {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 6px solid #fff;
    opacity: 0.8;
    background: transparent;
    box-sizing: border-box;
}

.ball-line:first-child {
    left: 65%;
    width: 70%;
    height: 70%;
    top: 15%;
}

.ball-line.line-2 {
    right: 65%;
    width: 70%;
    height: 70%;
    top: 15%;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Hide Home link on Homepage */
body.home .menu-item-home,
body.home li.current-menu-item.menu-item-home {
    display: none !important;
}

#crumbs {
    padding: 10px 0;
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
    text-align: center; 
}

#crumbs a {
    text-decoration: none;
    color: #0073aa; 
}

#crumbs a:hover {
    text-decoration: underline;
}

#crumbs .current {
    font-weight: bold;
    color: rgb(255, 255, 255);
}