/* ========================================
       1. CSS Variables & Reset
    ======================================== */
    :root {
      /* Colors - Light Theme */
      --color-primary: #1B4D3E;
      --color-secondary: #C9A227;
      --color-accent: #D4A574;
      --color-bg: #F8F6F2;
      --color-text: #2D2D2D;
      --color-text-secondary: #5A5A5A;
      --color-surface: #FFFFFF;
      --color-border: #E0DCD6;
      --color-success: #10B981;
      --color-warning: #F59E0B;
      --color-danger: #DC2626;
      
      /* Typography */
      --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
      --font-mono: 'JetBrains Mono', monospace;
      
      /* Spacing */
      --section-gap: clamp(3rem, 6vw, 5rem);
      --content-max-width: 770px;
      --sidebar-width: 220px;
      
      /* Shadows */
      --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
      --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
      --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
    
    /* --- AUTO-FORCED DARK THEME --- */
    --color-bg: #1A1A1A;
        --color-text: #E8E6E3;
        --color-text-secondary: #A0A0A0;
        --color-surface: #242424;
        --color-border: #3A3A3A;
        --color-primary: #2D7A65;
        --color-secondary: #D4B347;
        --color-accent: #B8926A;
}

    

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

    html {
      scroll-behavior: smooth;
    }

    body {
      font-family: var(--font-body);
      font-size: clamp(0.875rem, 1.5vw, 1rem);
      line-height: 1.7;
      color: var(--color-text);
      background-color: var(--color-bg);
      -webkit-font-smoothing: antialiased;
    }

    /* ========================================
       2. General Typography
    ======================================== */
    h1 {
      font-size: clamp(2rem, 5vw, 3rem);
      font-weight: 700;
      line-height: 1.15;
      letter-spacing: -0.02em;
      color: var(--color-text);
    }

    h2 {
      font-size: clamp(1.5rem, 3vw, 2rem);
      font-weight: 600;
      line-height: 1.25;
      color: var(--color-text);
      margin-top: 0;
      margin-bottom: 1rem;
      scroll-margin-top: 2rem;
    }

    h3 {
      font-size: clamp(1.125rem, 2vw, 1.5rem);
      font-weight: 600;
      line-height: 1.3;
      color: var(--color-text);
      margin-top: 2rem;
      margin-bottom: 0.75rem;
      scroll-margin-top: 2rem;
    }

    p {
      text-align: left;
      margin-bottom: 1.25rem;
    }

    a {
      color: var(--color-primary);
      text-decoration: underline;
      text-underline-offset: 2px;
      transition: color 0.2s ease;
    }

    a:hover {
      color: var(--color-secondary);
    }

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

    strong {
      font-weight: 600;
    }

    em {
      font-style: italic;
    }

    ul, ol {
      text-align: left;
      margin-bottom: 1.25rem;
      padding-left: 1.5rem;
    }

    li {
      margin-bottom: 0.5rem;
    }

    blockquote {
      text-align: left;
      border-left: 3px solid var(--color-primary);
      padding-left: 1.25rem;
      margin: 1.5rem 0;
      font-style: italic;
      color: var(--color-text-secondary);
    }

    table {
      width: 100%;
      border-collapse: collapse;
      margin: 1.5rem 0;
      font-size: 0.9rem;
    }

    th, td {
      text-align: left;
      padding: 0.75rem 1rem;
      border-bottom: 1px solid var(--color-border);
    }

    th {
      font-weight: 600;
      background-color: var(--color-surface);
      color: var(--color-text);
    }

    tbody tr:nth-child(even) {
      background-color: rgba(0,0,0,0.02);
    }

    @media (prefers-color-scheme: dark) {
      tbody tr:nth-child(even) {
        background-color: rgba(255,255,255,0.02);
      }
    }

    figure {
      margin: 2rem auto;
      max-width: 100%;
    }

    figcaption {
      text-align: center;
      font-size: 0.85rem;
      color: var(--color-text-secondary);
      margin-top: 0.75rem;
    }

    /* ========================================
       3. Layout - Main Grid with Sidebar
    ======================================== */
    header {
      padding: 0;
    }

    main {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      align-items: flex-start; /* Важно, чтобы оглавление не разъезжалось и "липло" */
      gap: 3rem;
      max-width: calc(var(--content-max-width) + var(--sidebar-width) + 6rem);
      margin: 0 auto;
      padding: 0 1.5rem;
    }

    /* Оглавление (если оно есть, займет свои 220px слева) */
    [data-content="toc"] {
      width: var(--sidebar-width);
      flex: 0 0 auto;
    }

    /* Блок Hero (принудительно растягиваем на весь экран) */
    [data-content="hero"] {
      flex: 0 0 100vw;
    }

    /* Статьи и контент (автоматически центрируются, если нет меню!) */
    main > *:not([data-content="toc"]):not([data-content="hero"]) {
      flex: 1 1 0%;
      min-width: 0;
      max-width: var(--content-max-width);
      width: 100%;
    }

    @media (max-width: 900px) {
      main {
        flex-direction: column;
        padding: 0 1rem;
      }
      [data-content="toc"] {
        width: 100%;
      }
    }

    /* ========================================
       4. Data-content Sections
    ======================================== */
    [data-content] {
      max-width: var(--content-max-width);
      margin-left: auto;
      margin-right: auto;
      padding: var(--section-gap) 0;
    }

    [data-content]:first-of-type {
      padding-top: 0;
    }

    main > *:not([data-content="toc"]) {
      grid-column: 2;
    }

    @media (max-width: 900px) {
      [data-content] {
        padding: calc(var(--section-gap) * 0.75) 0;
      }
    }

    /* ========================================
       5. Components
    ======================================== */
    
    /* Info Box */
    .info-box {
      background-color: var(--color-surface);
      border-left: 4px solid var(--color-primary);
      padding: 1.25rem 1.5rem;
      margin: 1.5rem 0;
      border-radius: 0 6px 6px 0;
      box-shadow: var(--shadow-sm);
    }

    .info-box p {
      margin-bottom: 0;
      text-align: left;
      color: var(--color-text);
    }

    .info-box p:not(:last-child) {
      margin-bottom: 0.75rem;
    }

    /* Stat Card */
    .stat-card {
      display: inline-block;
      background-color: var(--color-surface);
      padding: 1.25rem 1.75rem;
      margin: 0.5rem 0.5rem 0.5rem 0;
      border-radius: 8px;
      box-shadow: var(--shadow-md);
      text-align: center;
    }

    .stat-card p:first-child {
      font-family: var(--font-mono);
      font-size: 1.75rem;
      font-weight: 700;
      color: var(--color-primary);
      margin-bottom: 0.25rem;
      text-align: center;
    }

    .stat-card p:last-child {
      font-size: 0.8rem;
      color: var(--color-text-secondary);
      margin-bottom: 0;
      text-align: center;
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }

    /* Callout */
    .callout {
      background-color: rgba(245, 158, 11, 0.1);
      border-left: 4px solid var(--color-warning);
      padding: 1.25rem 1.5rem;
      margin: 1.5rem 0;
      border-radius: 0 6px 6px 0;
    }

    .callout p {
      margin-bottom: 0;
      text-align: left;
      color: var(--color-text);
    }

    @media (prefers-color-scheme: dark) {
      .callout {
        background-color: rgba(245, 158, 11, 0.08);
      }
    }

    /* Comparison Grid */
    .comparison-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 1rem;
      margin: 1.5rem 0;
    }

    .comparison-grid > div {
      background-color: var(--color-surface);
      padding: 1.25rem;
      border-radius: 8px;
      border: 1px solid var(--color-border);
    }

    .comparison-grid p {
      margin-bottom: 0.5rem;
      text-align: left;
      color: var(--color-text);
    }

    .comparison-grid p:last-child {
      margin-bottom: 0;
    }

    .comparison-grid p strong {
      color: var(--color-primary);
    }

    @media (max-width: 600px) {
      .comparison-grid {
        grid-template-columns: 1fr;
      }
    }

    /* Card Grid */
    .card-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 1rem;
      margin: 1.5rem 0;
    }

    .card-grid > div {
      background-color: var(--color-surface);
      padding: 1.5rem;
      border-radius: 8px;
      box-shadow: var(--shadow-sm);
      border: 1px solid var(--color-border);
    }

    .card-grid p {
      text-align: left;
      color: var(--color-text);
    }

    /* Key Takeaway */
    .key-takeaway {
      border-top: 2px solid var(--color-primary);
      padding-top: 1rem;
      margin: 2rem 0;
    }

    .key-takeaway p {
      font-size: clamp(1.125rem, 2vw, 1.25rem);
      font-weight: 600;
      line-height: 1.5;
      margin-bottom: 0;
      text-align: left;
      color: var(--color-text);
    }

    /* Fun Fact */
    .fun-fact {
      position: relative;
      padding-left: 1.5rem;
      margin: 1.5rem 0;
    }

    .fun-fact::before {
      content: "—";
      position: absolute;
      left: 0;
      top: 0;
      color: var(--color-primary);
      font-weight: 600;
    }

    .fun-fact p {
      font-style: italic;
      color: var(--color-text-secondary);
      margin-bottom: 0;
      text-align: left;
    }

    /* Glossary Term */
    .glossary-term {
      display: flex;
      align-items: baseline;
      gap: 0.75rem;
      margin: 1rem 0;
    }

    .glossary-term .term {
      font-family: var(--font-mono);
      color: var(--color-primary);
      text-decoration: underline;
      text-underline-offset: 3px;
      white-space: nowrap;
    }

    .glossary-term .definition {
      color: var(--color-text-secondary);
    }

    @media (max-width: 500px) {
      .glossary-term {
        flex-direction: column;
        gap: 0.25rem;
      }
    }

    /* Dos and Donts */
    .dos-donts {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 1rem;
      margin: 1.5rem 0;
    }

    .dos-donts > div {
      padding: 1.25rem;
      border-radius: 8px;
    }

    .dos-donts > div:first-child {
      background-color: rgba(16, 185, 129, 0.1);
      border-top: 3px solid var(--color-success);
    }

    .dos-donts > div:last-child {
      background-color: rgba(220, 38, 38, 0.1);
      border-top: 3px solid var(--color-danger);
    }

    .dos-donts h4 {
      font-size: 0.9rem;
      font-weight: 600;
      margin-bottom: 0.75rem;
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }

    .dos-donts > div:first-child h4 {
      color: var(--color-success);
    }

    .dos-donts > div:last-child h4 {
      color: var(--color-danger);
    }

    .dos-donts ul {
      margin-bottom: 0;
      padding-left: 1.25rem;
    }

    .dos-donts li {
      color: var(--color-text);
    }

    @media (max-width: 600px) {
      .dos-donts {
        grid-template-columns: 1fr;
      }
    }

    @media (prefers-color-scheme: dark) {
      .dos-donts > div:first-child {
        background-color: rgba(16, 185, 129, 0.08);
      }
      .dos-donts > div:last-child {
        background-color: rgba(220, 38, 38, 0.08);
      }
    }

    /* Pre-bet Checklist */
    .pre-bet-checklist {
      margin: 2rem 0;
    }

    .pre-bet-checklist h4 {
      font-size: 0.85rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--color-primary);
      margin-bottom: 1rem;
    }

    .pre-bet-checklist ul {
      position: relative;
      border-left: 2px solid var(--color-border);
      padding-left: 1.75rem;
      margin-bottom: 0;
      list-style: none;
    }

    .pre-bet-checklist li {
      position: relative;
      padding: 0.5rem 0;
      color: var(--color-text);
    }

    .pre-bet-checklist li::before {
      content: "\2610";
      position: absolute;
      left: -1.75rem;
      transform: translateX(-50%);
      color: var(--color-primary);
      background-color: var(--color-bg);
      padding: 0 0.25rem;
    }

    /* At a Glance */
    .at-a-glance {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 0;
      margin: 2rem 0;
      border: 1px solid var(--color-border);
      border-radius: 8px;
      overflow: hidden;
    }

    .at-a-glance > div {
      padding: 1.25rem;
      text-align: center;
      background-color: var(--color-surface);
    }

    .at-a-glance > div:not(:last-child) {
      border-right: 1px solid var(--color-border);
    }

    .at-a-glance h5 {
      font-family: var(--font-mono);
      font-size: 1.25rem;
      font-weight: 600;
      color: var(--color-primary);
      margin-bottom: 0.5rem;
    }

    .at-a-glance p {
      font-size: 0.85rem;
      color: var(--color-text-secondary);
      margin-bottom: 0;
      text-align: center;
    }

    @media (max-width: 600px) {
      .at-a-glance {
        grid-template-columns: 1fr;
      }
      .at-a-glance > div:not(:last-child) {
        border-right: none;
        border-bottom: 1px solid var(--color-border);
      }
    }

    /* Worked Example */
    .worked-example {
      background-color: var(--color-surface);
      padding: 1.75rem;
      margin: 2rem 0;
      border-radius: 8px;
      box-shadow: var(--shadow-md);
    }

    .worked-example h4 {
      font-size: 1rem;
      font-weight: 600;
      margin-bottom: 1.25rem;
      color: var(--color-text);
    }

    .worked-example .step {
      padding: 1rem 0;
      border-bottom: 1px dashed var(--color-border);
    }

    .worked-example .step:last-of-type {
      border-bottom: none;
    }

    .worked-example .step-num {
      font-family: var(--font-mono);
      font-size: 0.75rem;
      color: var(--color-text-secondary);
      text-transform: uppercase;
      letter-spacing: 0.1em;
    }

    .worked-example p {
      margin-bottom: 0;
      text-align: left;
      color: var(--color-text);
    }

    .worked-example code {
      font-family: var(--font-mono);
      background-color: var(--color-bg);
      padding: 0.2rem 0.4rem;
      border-radius: 3px;
      font-size: 0.9em;
    }

    .worked-example .result {
      font-weight: 600;
      color: var(--color-primary);
      font-size: 1.1rem;
    }

    /* Section Bridge */
    .section-bridge {
      text-align: center;
      margin: 2.5rem 0;
      position: relative;
    }

    .section-bridge::before,
    .section-bridge::after {
      content: "—";
      color: var(--color-accent);
      padding: 0 0.5rem;
    }

    .section-bridge p {
      display: inline;
      font-style: italic;
      color: var(--color-primary);
      margin-bottom: 0;
    }

    /* Odds Example - Inverted Block */
    .odds-example {
      background-color: var(--color-primary);
      color: var(--color-bg);
      padding: 1.5rem;
      margin: 1.5rem 0;
      border-radius: 8px;
      text-align: center;
    }

    .odds-example p {
      color: var(--color-bg);
      margin-bottom: 0.75rem;
      text-align: center;
    }

    .odds-example p:last-child {
      margin-bottom: 0;
    }

    .odds-example strong {
      font-family: var(--font-mono);
    }

    @media (prefers-color-scheme: dark) {
      .odds-example {
        background-color: #1B4D3E;
        color: #F8F6F2;
      }
      .odds-example p {
        color: #F8F6F2;
      }
    }

    /* TL;DR Block */
    .tldr {
      background-color: var(--color-surface);
      border-left: 4px solid var(--color-secondary);
      padding: 1.5rem 2rem;
      margin: 2rem 0;
      border-radius: 0 8px 8px 0;
    }

    .tldr h2 {
      font-size: clamp(1.125rem, 2vw, 1.25rem);
      font-weight: 600;
      margin-bottom: 1rem;
      color: var(--color-text);
    }

    .tldr ul {
      margin-bottom: 0;
    }

    .tldr li {
      color: var(--color-text);
    }

    /* ========================================
       6. Hero Section
    ======================================== */
    [data-content="hero"] {
      grid-column: 1 / -1 !important;
      width: 100vw;
      margin-left: calc(50% - 50vw);
      max-width: none;
      padding: clamp(3rem, 8vw, 5rem) 1.5rem;
      background: 
        linear-gradient(to bottom, transparent 60%, var(--color-bg) 100%),
        repeating-linear-gradient(
          90deg,
          transparent,
          transparent 30px,
          rgba(27, 77, 62, 0.03) 30px,
          rgba(27, 77, 62, 0.03) 31px
        ),
        repeating-linear-gradient(
          0deg,
          transparent,
          transparent 30px,
          rgba(27, 77, 62, 0.03) 30px,
          rgba(27, 77, 62, 0.03) 31px
        ),
        var(--color-bg);
      text-align: center;
    }

    [data-content="hero"] .hero-inner {
      max-width: var(--content-max-width);
      margin: 0 auto;
    }

    [data-content="hero"] .meta-badges {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 1rem;
      flex-wrap: wrap;
      margin-bottom: 1.5rem;
    }

    [data-content="hero"] .date-badge {
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
      font-size: 0.75rem;
      font-weight: 500;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--color-text-secondary);
      background-color: var(--color-surface);
      padding: 0.4rem 0.8rem;
      border-radius: 4px;
      border: 1px solid var(--color-border);
    }

    [data-content="hero"] .trust-marker {
      font-size: 0.7rem;
      font-weight: 500;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--color-primary);
    }

    [data-content="hero"] h1 {
      margin-bottom: 1.5rem;
    }

    [data-content="hero"] .hero-description {
      font-size: clamp(1rem, 2vw, 1.125rem);
      color: var(--color-text-secondary);
      max-width: 600px;
      margin: 0 auto 2rem;
      text-align: center;
    }

    [data-content="hero"] .hero-image {
      max-width: 100%;
      height: auto;
      display: block;
      margin: 2rem auto 0;
      border-radius: 8px;
      box-shadow: var(--shadow-lg);
    }

    [data-content="hero"] figcaption {
      margin-top: 1rem;
    }

    [data-content="hero"] .start-reading-btn {
      display: inline-block;
      background-color: var(--color-primary);
      color: var(--color-bg);
      padding: 0.75rem 1.5rem;
      border-radius: 6px;
      text-decoration: none;
      font-weight: 500;
      font-size: 0.9rem;
      margin-top: 1.5rem;
      transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    [data-content="hero"] .start-reading-btn:hover {
      transform: translateY(-2px);
      box-shadow: var(--shadow-md);
      color: var(--color-bg);
    }

    @media (prefers-color-scheme: dark) {
      [data-content="hero"] {
        background: 
          linear-gradient(to bottom, transparent 60%, var(--color-bg) 100%),
          repeating-linear-gradient(
            90deg,
            transparent,
            transparent 30px,
            rgba(45, 122, 101, 0.05) 30px,
            rgba(45, 122, 101, 0.05) 31px
          ),
          repeating-linear-gradient(
            0deg,
            transparent,
            transparent 30px,
            rgba(45, 122, 101, 0.05) 30px,
            rgba(45, 122, 101, 0.05) 31px
          ),
          var(--color-bg);
      }
      [data-content="hero"] .start-reading-btn {
        background-color: var(--color-primary);
        color: #F8F6F2;
      }
      [data-content="hero"] .start-reading-btn:hover {
        color: #F8F6F2;
      }
    }

    /* ========================================
       7. TOC - Sidebar
    ======================================== */
    [data-content="toc"] {
      grid-column: 1;
      grid-row: 2 / 100;
      position: relative;
      top: 2rem;
      max-height: calc(100vh - 4rem);
      overflow-y: auto;
      padding: 1.5rem;
      background-color: var(--color-surface);
      border-radius: 8px;
      border: 1px solid var(--color-border);
      align-self: start;

      scrollbar-width: thin;
      scrollbar-color: var(--color-border) transparent;
    }

    [data-content="toc"]::-webkit-scrollbar {
      width: 4px;
    }

    [data-content="toc"]::-webkit-scrollbar-track {
      background: transparent;
    }

    [data-content="toc"]::-webkit-scrollbar-thumb {
      background-color: var(--color-border);
      border-radius: 4px;
    }

    [data-content="toc"] h2 {
      font-size: 0.75rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--color-text-secondary);
      margin-bottom: 1rem;
      padding-bottom: 0.5rem;
      border-bottom: 1px solid var(--color-border);
    }

    [data-content="toc"] nav ul {
      list-style: none;
      padding: 0;
      margin: 0;
    }

    [data-content="toc"] nav > ul > li {
      margin-bottom: 0.75rem;
    }

    [data-content="toc"] nav a {
      font-size: 0.85rem;
      color: var(--color-text);
      text-decoration: none;
      display: block;
      padding: 0.25rem 0;
      transition: color 0.2s ease;
    }

    [data-content="toc"] nav a:hover {
      color: var(--color-primary);
    }

    [data-content="toc"] nav ul ul {
      padding-left: 0.75rem;
      margin-top: 0.5rem;
    }

    [data-content="toc"] nav ul ul a {
      font-size: 0.8rem;
      color: var(--color-text-secondary);
    }

    [data-content="toc"] nav ul ul a:hover {
      color: var(--color-primary);
    }

    @media (max-width: 900px) {
      [data-content="toc"] {
        position: static;
        max-height: none;
        overflow-y: visible;
        margin-bottom: 2rem;
      }
    }

    /* ========================================
       8. FAQ Accordion
    ======================================== */
    details {
      margin-bottom: 0;
      border-bottom: 1px solid var(--color-border);
      interpolate-size: allow-keywords;
    }

    details:first-of-type {
      border-top: 1px solid var(--color-border);
    }

    summary {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 1.25rem 0;
      cursor: pointer;
      font-weight: 500;
      color: var(--color-text);
      list-style: none;
    }

    summary::-webkit-details-marker {
      display: none;
    }

    summary::after {
      content: "+";
      font-size: 1.25rem;
      font-weight: 400;
      color: var(--color-primary);
      transition: transform 0.3s ease;
    }

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

    summary:focus {
      outline: 2px solid var(--color-primary);
      outline-offset: 2px;
    }

    summary:hover {
      color: var(--color-primary);
    }

    ::details-content {
      opacity: 0;
      block-size: 0;
      overflow: hidden;
      transition: 
        opacity 0.3s ease,
        block-size 0.3s ease,
        content-visibility 0.3s ease allow-discrete;
    }

    details[open]::details-content {
      opacity: 1;
      block-size: auto;
    }

    details > div {
      padding-bottom: 1.25rem;
    }

    details > div p {
      color: var(--color-text);
    }

    @supports not selector(::details-content) {
      @keyframes fade-in {
        from { opacity: 0; }
        to { opacity: 1; }
      }
      details[open] > *:not(summary) {
        animation: fade-in 0.3s ease forwards;
      }
    }

    /* ========================================
       9. Images
    ======================================== */
    .hero-image {
      max-width: 100%;
      height: auto;
      display: block;
      margin: 0 auto;
    }

    .article-image {
      max-width: 100%;
      height: auto;
      display: block;
      border-radius: 6px;
    }


    /* ========================================
       11. Media Queries
    ======================================== */
    @media (max-width: 600px) {
      :root {
        --section-gap: 2.5rem;
      }

      h1 {
        font-size: 1.75rem;
      }

      .stat-card {
        display: block;
        margin-right: 0;
      }
    }

/* =========================================
   UNIVERSAL DESKTOP & MOBILE MENU + LOGO
   ========================================= */

/* Header Base */
.site-header {
    background-color: var(--color-bg);
    border-bottom: 1px solid var(--color-border, #333);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-navigation-bar {
    max-width: 950px; /* Optimized width to keep menu centered but separated */
    margin: 0 auto;
    padding: 15px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Pushes logo left and burger/menu right */
}

/* --- LOGO FIXES --- */
.site-logo img {
    max-height: 55px; /* Optimal height for most logos */
    width: auto !important; /* Prevents squishing */
    display: block;
    transition: transform 0.2s ease;
}

.site-logo img:hover {
    transform: scale(1.02);
}

/* --- DESKTOP MENU --- */
.site-nav--desktop {
    display: none; /* Hidden on mobile by default */
}

@media (min-width: 769px) {
    .site-nav--desktop {
        display: block;
    }
    .mobile-controls {
        display: none; /* Hide burger on desktop */
    }
    
    .menu-desktop {
        display: flex;
        gap: 30px;
        list-style: none;
        margin: 0;
        padding: 0;
    }
    
    .menu-desktop a {
        text-decoration: none;
        color: var(--color-text);
        font-family: var(--font-body, sans-serif);
        font-weight: 500;
        font-size: 16px;
        transition: color 0.2s ease;
    }
    
    .menu-desktop a:hover {
        color: var(--color-accent);
    }
}

/* --- MOBILE BURGER BUTTON --- */
.burger {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 5px;
    z-index: 1000;
}

.burger span {
    display: block;
    width: 28px;
    height: 3px;
    background-color: var(--color-text);
    transition: transform 0.3s ease, opacity 0.3s ease;
    border-radius: 2px;
}

/* Burger Animation to X */
.burger.is-active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}
.burger.is-active span:nth-child(2) {
    opacity: 0;
}
.burger.is-active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* --- MOBILE MENU SLIDER --- */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%; /* Hidden off-screen */
    width: 85%;
    max-width: 400px;
    height: 100vh;
    background-color: var(--color-bg);
    box-shadow: -5px 0 20px rgba(0,0,0,0.5);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999;
    overflow-y: auto;
    padding: 60px 30px;
}

.mobile-menu.is-open {
    right: 0; /* Slide in */
}

.mobile-menu__close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    font-size: 36px;
    line-height: 1;
    color: var(--color-text);
    cursor: pointer;
    transition: color 0.2s ease;
}

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

.menu-mobile {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.menu-mobile a {
    text-decoration: none;
    color: var(--color-text);
    font-size: 20px;
    font-family: var(--font-display, sans-serif);
    font-weight: 600;
    display: block;
    transition: color 0.2s ease, padding-left 0.2s ease;
}

.menu-mobile a:hover {
    color: var(--color-accent);
    padding-left: 10px; /* Nice slide effect on hover */
}

/* --- OVERLAY --- */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px); /* Beautiful blur effect */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s;
    z-index: 998;
}

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

/* =========================================
   FOOTER STYLES (Green & Gold Grid Theme)
   ========================================= */
.site-footer {
    background-color: var(--color-surface); /* Используем цвет карточек */
    border-top: 3px solid var(--color-secondary); /* Золотая акцентная линия */
    padding: 60px 20px 20px;
    margin-top: 60px;
    color: var(--color-text-secondary);
    font-family: var(--font-body);
    /* Если футер попадает в грид main, заставляем его растянуться на всю ширину */
    grid-column: 1 / -1; 
}

.footer-container {
    max-width: calc(var(--content-max-width) + var(--sidebar-width) + 3rem);
    margin: 0 auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    margin-bottom: 50px;
}

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

@media (min-width: 1024px) {
    .footer-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }
}

.footer-title {
    color: var(--color-text);
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    margin-top: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-body);
}

.footer-text {
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    color: var(--color-text-secondary);
}

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

.footer-list li {
    margin-bottom: 0.75rem;
}

.footer-list a {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease, transform 0.2s ease;
    display: inline-block;
}

/* Эффект сдвига вправо и окрашивания в золото при наведении */
.footer-list a:hover {
    color: var(--color-secondary);
    transform: translateX(5px); 
}

.footer-bottom {
    border-top: 1px solid var(--color-border);
    padding-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-bottom p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    text-align: left;
}

/* Кнопка "Наверх" в новом строгом стиле */
.back-to-top-btn {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-mono);
}

.back-to-top-btn:hover {
    background: var(--color-secondary);
    color: #1A1A1A; /* Темный цвет текста для контраста на золотом фоне */
    border-color: var(--color-secondary);
}

@media (max-width: 600px) {
    .footer-bottom {
        flex-direction: column;
        justify-content: center;
        text-align: center;
    }
    .footer-bottom p {
        text-align: center;
    }
}

body {
  overflow-x: clip;
}

/* ========================================
   12. MOBILE OVERFLOW FIX
======================================== */
html, body {
    overflow-x: hidden !important;
    width: 100%;
    position: relative;
}

@media (max-width: 900px) {
    [data-content="hero"] {
        width: 100% !important;
        margin-left: 0 !important;
        flex: 1 1 auto !important;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    main, article, .cl-article {
        max-width: 100vw !important;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }
    
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}