﻿/* ========================
       RESET & TOKENS
    ======================== */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      --bg:           #fdfcf9;
      --bg-alt:       #f7f5f0;
      --bg-elevated:  #f0ede7;
      --text:         #1c1a17;
      --text-strong:  #0d0c0a;
      --text-muted:   #6b6560;
      --text-faint:   #b5b0a8;
      --accent:       #9a6b00;
      --accent-dim:   rgba(154,107,0,0.07);
      --accent-border:rgba(154,107,0,0.2);
      --blue:         #1e3f6e;
      --blue-dim:     rgba(30,63,110,0.06);
      --green:        #1f5c3a;
      --green-dim:    rgba(31,92,58,0.07);
      --border:       rgba(0,0,0,0.07);
      --border-med:   rgba(0,0,0,0.11);
      --border-strong:rgba(0,0,0,0.16);
      --serif:        'Source Serif 4', Georgia, serif;
      --sans:         'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
      --mono:         'JetBrains Mono', 'Courier New', monospace;
      --display:      'DM Serif Display', Georgia, serif;
      --col:          840px;
      --wide:         940px;
    }

    html { scroll-behavior: smooth; }

    body {
      background: var(--bg);
      color: var(--text);
      font-family: var(--serif);
      font-size: 1.05rem;
      line-height: 1.75;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
    }

    /* ========================
       PROGRESS BAR
    ======================== */
    #progress-bar {
      position: fixed;
      top: 0; left: 0;
      height: 2px;
      width: 0%;
      background: var(--accent);
      z-index: 1000;
      transition: width 0.08s linear;
    }

    /* ========================
       STICKY NAV
    ======================== */
    #sticky-nav {
      position: fixed;
      top: 0; left: 0; right: 0;
      z-index: 900;
      background: rgba(253,252,249,0.92);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      border-bottom: 1px solid var(--border-med);
      transform: translateY(-100%);
      transition: transform 0.22s ease;
    }
    #sticky-nav.visible { transform: translateY(0); }

    .nav-inner {
      max-width: var(--wide);
      margin: 0 auto;
      padding: 0 2rem;
      height: 50px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 2rem;
    }
    .nav-title {
      font-family: var(--sans);
      font-size: 0.72rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.14em;
      color: var(--accent);
      white-space: nowrap;
      flex-shrink: 0;
    }
    .nav-links {
      display: flex;
      gap: 0.15rem;
      overflow-x: auto;
      scrollbar-width: none;
    }
    .nav-links::-webkit-scrollbar { display: none; }
    .nav-links a {
      font-family: var(--sans);
      font-size: 0.76rem;
      font-weight: 500;
      color: var(--text-muted);
      text-decoration: none;
      padding: 0.3rem 0.65rem;
      border-radius: 5px;
      white-space: nowrap;
      transition: color 0.15s, background 0.15s;
    }
    .nav-links a:hover {
      color: var(--text-strong);
      background: rgba(255,255,255,0.05);
    }

    /* ========================
       HERO
    ======================== */
    #hero {
      min-height: 55vh;
      display: flex;
      flex-direction: column;
      justify-content: flex-end;
      align-items: center;
      text-align: center;
      max-width: var(--wide);
      margin: 0 auto;
      padding: 4rem 2rem 5rem;
      border-bottom: 1px solid var(--border);
    }
    #hero h1 {
      font-family: var(--display);
      font-size: clamp(2.4rem, 5vw, 4rem);
      color: var(--text-strong);
      line-height: 1.08;
      letter-spacing: -0.01em;
      max-width: 720px;
      margin-bottom: 1.5rem;
    }
    .hero-byline {
      font-family: var(--sans);
      font-size: 0.88rem;
      font-weight: 500;
      color: #6b6560;
      letter-spacing: 0.03em;
      margin-bottom: 2rem;
    }
    .hero-sub {
      font-family: var(--serif);
      font-size: 1.1rem;
      color: #6b6560;
      max-width: 560px;
      line-height: 1.65;
      margin-bottom: 2.25rem;
    }

    /* Stat strip */
    .stat-strip {
      display: flex;
      flex-wrap: wrap;
      gap: 0.75rem;
      max-width: 560px;
    }
    .stat-item {
      flex: 1;
      min-width: 110px;
      background: rgba(0,0,0,0.03);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 0.9rem 1.1rem;
      text-align: center;
    }
    .stat-num {
      display: block;
      font-family: var(--sans);
      font-size: 1.7rem;
      font-weight: 700;
      letter-spacing: -0.04em;
      color: var(--text-strong);
      line-height: 1;
      margin-bottom: 0.3rem;
    }
    .stat-desc {
      display: block;
      font-family: var(--sans);
      font-size: 0.72rem;
      letter-spacing: 0;
      color: #6b6560;
    }

    /* ========================
       SECTIONS
    ======================== */
    section {
      padding: 2.75rem 0;
      border-bottom: 1px solid var(--border);
    }
    section:last-of-type { border-bottom: none; }

    .section-tag {
      font-family: var(--sans);
      font-size: 0.67rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.17em;
      color: var(--accent);
      max-width: var(--wide);
      margin: 0 auto 1.5rem;
      padding: 0 2rem;
    }

    /* ========================
       PROSE COLUMN
    ======================== */
    .prose {
      max-width: var(--col);
      margin: 0 auto;
      padding: 0 2rem;
    }
    .prose h2 {
      font-family: var(--display);
      font-size: 1.9rem;
      color: var(--text-strong);
      line-height: 1.18;
      letter-spacing: -0.01em;
      margin-bottom: 0.9rem;
    }
    .prose h3 {
      font-family: var(--sans);
      font-size: 0.78rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--text-muted);
      margin-top: 1.75rem;
      margin-bottom: 0.6rem;
    }
    .prose p { margin-bottom: 0.9rem; }
    .prose p:last-child { margin-bottom: 0; }
    .prose strong { font-weight: 600; color: var(--text-strong); }
    .prose em { font-style: italic; }
    .prose ul, .prose ol {
      padding-left: 1.5rem;
      margin-bottom: 0.9rem;
    }
    .prose li { margin-bottom: 0.3rem; }
    .prose a { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }

    /* ========================
       CHART CONTAINER
    ======================== */
    .chart-wrap {
      max-width: var(--wide);
      margin: 2rem auto;
      padding: 0 1.5rem;
    }
    .chart-wrap iframe {
      width: 100%;
      border: 1px solid var(--border-med);
      border-radius: 10px;
      display: block;
      overflow: hidden;
      box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    }
    .caption {
      font-family: var(--sans);
      font-size: 0.78rem;
      color: var(--text-muted);
      line-height: 1.55;
      margin-top: 0.8rem;
      padding: 0 0.25rem;
      max-width: var(--col);
    }

    /* ========================
       TABLES
    ======================== */
    .prose table, .data-table {
      width: 100%;
      border-collapse: collapse;
      font-family: var(--sans);
      font-size: 0.84rem;
      margin: 1.1rem 0;
      border: 1px solid var(--border-med);
      border-radius: 8px;
      overflow: hidden;
    }
    .prose table th, .data-table th {
      font-size: 0.67rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.09em;
      padding: 0.65rem 1rem;
      text-align: left;
      background: rgba(0,0,0,0.03);
      border-bottom: 1px solid var(--border-med);
      color: var(--text-strong);
    }
    .prose table td, .data-table td {
      padding: 0.5rem 1rem;
      border-bottom: 1px solid var(--border);
      color: var(--text);
      vertical-align: top;
    }
    .prose table tr:last-child td, .data-table tr:last-child td { border-bottom: none; }
    .prose table tr:hover td, .data-table tr:hover td { background: rgba(255,255,255,0.018); }

    /* ========================
       CODE
    ======================== */
    pre {
      background: var(--bg-alt);
      border: 1px solid var(--border-med);
      border-radius: 8px;
      padding: 1.2rem 1.5rem;
      overflow-x: auto;
      margin: 1.5rem 0;
      font-family: var(--mono);
      font-size: 0.82rem;
      line-height: 1.7;
      color: #2d3748;
    }
    code {
      font-family: var(--mono);
      font-size: 0.83em;
      background: var(--bg-alt);
      border: 1px solid var(--border-med);
      border-radius: 4px;
      padding: 0.12em 0.4em;
      color: var(--blue);
    }
    pre code { background: none; border: none; padding: 0; font-size: inherit; color: inherit; }

    /* ========================
       CALLOUTS
    ======================== */
    .callout {
      border-left: 2px solid var(--text-faint);
      padding: 0.1rem 0 0.1rem 1.25rem;
      margin: 1rem 0;
      color: var(--text-muted);
      font-style: italic;
    }
    .callout p:last-child { margin-bottom: 0; }

    .finding {
      border-left: 2px solid var(--green);
      padding: 0.1rem 0 0.1rem 1.25rem;
      margin: 1rem 0;
    }
    .finding p:last-child { margin-bottom: 0; }

    /* ========================
       HYPOTHESIS BLOCK
    ======================== */
    .hyp-block {
      margin: 1.1rem 0;
      font-family: var(--sans);
      font-size: 0.875rem;
    }
    .hyp-row {
      display: flex;
      gap: 1.5rem;
      padding: 0.55rem 0;
      border-bottom: 1px solid var(--border);
      align-items: baseline;
    }
    .hyp-row:last-child { border-bottom: none; }
    .hyp-label {
      width: 140px;
      flex-shrink: 0;
      font-size: 0.67rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.09em;
      color: var(--text-faint);
    }
    .hyp-val { color: var(--text); flex: 1; line-height: 1.6; }
    .hyp-title {
      text-align: center;
      font-family: var(--sans);
      font-size: 0.68rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--accent);
      margin: 0 0 0.5rem;
    }

    /* ========================
       MODEL METRICS
    ======================== */
    .metrics-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 2rem;
      margin: 1.75rem 0;
    }
    .metric-card { }
    .metric-card .model-label {
      font-family: var(--sans);
      font-size: 0.67rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--text-faint);
      margin-bottom: 0.5rem;
    }
    .metric-card .acc-num {
      font-family: var(--sans);
      font-size: 2.75rem;
      font-weight: 700;
      letter-spacing: -0.06em;
      line-height: 1;
      margin-bottom: 0.15rem;
    }
    .metric-card.baseline .acc-num { color: var(--text-strong); }
    .metric-card.final .acc-num { color: var(--accent); }
    .metric-card .acc-label {
      font-family: var(--sans);
      font-size: 0.67rem;
      color: var(--text-faint);
      text-transform: uppercase;
      letter-spacing: 0.08em;
      margin-bottom: 1rem;
      border-bottom: 1px solid var(--border);
      padding-bottom: 0.75rem;
    }
    .metric-card table {
      width: 100%;
      border-collapse: collapse;
      font-family: var(--sans);
      font-size: 0.77rem;
    }
    .metric-card table th {
      font-size: 0.63rem;
      text-transform: uppercase;
      letter-spacing: 0.07em;
      color: var(--text-faint);
      font-weight: 600;
      text-align: right;
      padding: 0.28rem 0.4rem;
      border-bottom: 1px solid var(--border);
    }
    .metric-card table th:first-child { text-align: left; }
    .metric-card table td {
      text-align: right;
      padding: 0.28rem 0.4rem;
      border-bottom: 1px solid var(--border);
      color: var(--text);
    }
    .metric-card table td:first-child { text-align: left; font-weight: 500; }
    .metric-card table tr:last-child td { border-bottom: none; }

    .improvement-strip {
      color: var(--text-muted);
      font-family: var(--sans);
      font-size: 0.875rem;
      line-height: 1.7;
      margin: 1.75rem 0;
      padding-top: 1rem;
      border-top: 1px solid var(--border);
    }
    .improvement-strip strong { color: var(--text-strong); }

    /* ========================
       CONCLUSION FINDINGS
    ======================== */
    .finding-item {
      margin: 1.1rem 0;
      padding-left: 0;
    }
    .finding-num {
      font-family: var(--sans);
      font-size: 0.67rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.12em;
      color: var(--text-faint);
      margin-bottom: 0.4rem;
    }
    .finding-text {
      font-family: var(--serif);
      font-size: 1.05rem;
      line-height: 1.8;
      color: var(--text);
    }
    .finding-text strong { color: var(--text-strong); font-weight: 600; }

    /* ========================
       FOOTER
    ======================== */
    footer {
      max-width: var(--wide);
      margin: 0 auto;
      padding: 3rem 2rem;
      text-align: center;
      font-family: var(--sans);
      font-size: 0.76rem;
      color: #6b6560;
      border-top: 1px solid var(--border);
    }
    footer a { color: var(--text-muted); text-decoration: none; }
    footer a:hover { color: var(--accent); }

    /* ========================
       UTILS
    ======================== */
    .divider {
      height: 1px;
      background: var(--border);
      max-width: var(--col);
      margin: 2.75rem auto;
      padding: 0 2rem;
    }
    .mt { margin-top: 1.75rem; }

    /* ========================
       MOBILE
    ======================== */
    @media (max-width: 640px) {
      :root { --col: 100%; --wide: 100%; }

      /* Nav */
      .nav-inner { padding: 0 1rem; height: 44px; }
      .nav-title { display: none; }
      .nav-links a { font-size: 0.68rem; padding: 0.2rem 0.4rem; }

      /* Hero */
      #hero {
        min-height: auto;
        padding: 2.5rem 1.25rem 2.5rem;
        text-align: left;
        align-items: flex-start;
      }
      #hero h1 { font-size: 2rem; margin-bottom: 0.75rem; }
      .hero-byline { font-size: 0.8rem; margin-bottom: 0.75rem; }
      .hero-sub { font-size: 0.95rem; margin-bottom: 1.5rem; }
      .stat-strip { gap: 0.5rem; max-width: 100%; }
      .stat-item { min-width: calc(50% - 0.25rem); flex: none; padding: 0.7rem 0.75rem; }
      .stat-num { font-size: 1.4rem; }
      .stat-desc { font-size: 0.67rem; }

      /* Sections */
      section { padding: 1.75rem 0; }
      .section-tag { padding: 0 1.25rem; margin-bottom: 1rem; }
      .prose { padding: 0 1.25rem; }
      .chart-wrap { padding: 0 0.75rem; margin: 1.25rem auto; }

      /* Typography */
      .prose h2 { font-size: 1.5rem; }
      .prose h3 { margin-top: 1.25rem; }
      .prose p { margin-bottom: 0.75rem; }

      /* iframes — use aspect ratio on mobile */
      .chart-wrap iframe {
        height: auto !important;
        aspect-ratio: 4 / 3;
        min-height: 280px;
      }

      /* Tables — horizontal scroll */
      .prose table, .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 0.78rem;
      }

      /* Code blocks */
      pre, .prose pre { font-size: 0.75rem; padding: 0.75rem; }

      /* Callouts */
      .callout, .finding { padding: 0.75rem 1rem; }

      /* Hypothesis rows */
      .hyp-block { font-size: 0.82rem; }
      .hyp-row { flex-direction: column; gap: 0.15rem; padding: 0.5rem 0; }
      .hyp-label { width: auto; font-size: 0.62rem; }
      .hyp-title { font-size: 0.62rem; }

      /* Grids */
      .metrics-grid { grid-template-columns: 1fr; gap: 0.75rem; }
      .model-grid { grid-template-columns: 1fr; }
      .metric-card { padding: 1rem; }

      /* Footer */
      footer { padding: 1.75rem 1.25rem; font-size: 0.72rem; }
    }