/* Definitive dark theme: cream and carbon alternating bands. */
html[data-theme="dark"] {
    --sj-canvas: #F2F0EA;
    --sj-raised: #E7E2D8;
    --sj-surface: #FFFCF7;
    --sj-deep: #121212;
    --sj-mid: #E3DDD2;
    --sj-hover: #DDD6C8;
    --sj-border: rgba(18, 18, 18, 0.12);
    --sj-ink: #121212;
    --sj-muted: #5C574F;
    --sj-lead-warm: #3F3A34;
    --accent: #C96B3C;
    --accent-marketing: #C96B3C;
}
html[data-theme="dark"] body {
    background-color: var(--sj-canvas);
    color: var(--sj-ink);
}
html[data-theme="dark"] #header {
    background-color: rgba(242, 240, 234, 0.92) !important;
    border-bottom-color: rgba(18, 18, 18, 0.08) !important;
    color: #121212;
}

/* Cream and carbon alternate; burnt on cream, pumpkin on carbon. */
html[data-theme="dark"] #hero.sj-hero {
    --sj-hero-bg: #F2F0EA;
    --sj-hero-text: #121212;
    --sj-hero-muted: #5c574f;
    --sj-hero-accent: #C96B3C;
    background: #F2F0EA !important;
}
html[data-theme="dark"] #hero.sj-hero .hero__media { background: #E7E2D8; }
html[data-theme="dark"] #hero.sj-hero .hero__media::before {
    background:
        linear-gradient(90deg, #F2F0EA 0%, rgba(242, 240, 234, 0.72) 8%, transparent 28%),
        linear-gradient(270deg, #F2F0EA 0%, rgba(242, 240, 234, 0.4) 6%, transparent 18%) !important;
}
html[data-theme="dark"] #header .text-white,
html[data-theme="dark"] #header .text-gray-300,
html[data-theme="dark"] #problem .text-white,
html[data-theme="dark"] #problem .problem-lead,
html[data-theme="dark"] #how-it-works h2,
html[data-theme="dark"] .story-block:nth-child(odd) .story-copy h2 {
    color: #121212 !important;
}
html[data-theme="dark"] .story-block:nth-child(odd) :is(.story-lead, .story-note) { color: #5c574f !important; }
html[data-theme="dark"] .story-block:nth-child(even),
html[data-theme="dark"] #workouts .editorial-split,
html[data-theme="dark"] #running .editorial-split,
html[data-theme="dark"] #cta,
html[data-theme="dark"] #cta-wellness,
html[data-theme="dark"] #footer {
    background: #121212 !important;
    color: #F2F0EA;
}
html[data-theme="dark"] .story-block:nth-child(even) .story-copy h2,
html[data-theme="dark"] #workouts h2,
html[data-theme="dark"] #running h2,
html[data-theme="dark"] :is(#cta, #cta-wellness, #footer) .text-white {
    color: #F2F0EA !important;
}
html[data-theme="dark"] .story-block:nth-child(even) :is(.story-lead, .story-note),
html[data-theme="dark"] #workouts .editorial-split-lead,
html[data-theme="dark"] #running .editorial-split-lead {
    color: #d9d4ca !important;
}
html[data-theme="dark"] #nutrition,
html[data-theme="dark"] #nutrition.editorial-split,
html[data-theme="dark"] #wellness .editorial-split,
html[data-theme="dark"] #faq {
    background: #F2F0EA !important;
    color: #121212;
}
html[data-theme="dark"] :is(#nutrition, #wellness, #faq) :is(h2, .text-white, .faq-intro h2, .faq-section-title, .faq-question-text) {
    color: #121212 !important;
}
html[data-theme="dark"] :is(#nutrition, #wellness) .text-vibrant-orange,
html[data-theme="dark"] .story-block:nth-child(odd) .text-vibrant-orange { color: #C96B3C !important; }
html[data-theme="dark"] :is(#workouts, #running) .text-vibrant-orange,
html[data-theme="dark"] .story-block:nth-child(even) .text-vibrant-orange { color: #F07729 !important; }
html[data-theme="dark"] :is(#nutrition, #wellness, #faq, #problem) .sj-store-btn--outline {
    border-color: #121212;
    color: #121212;
}
/* Both store links start outlined and share the same interaction color. */
html[data-theme="dark"] #hero.sj-hero .hero-cta-buttons .hero-btn {
    background: transparent;
    border-color: #121212;
    color: #121212;
}
html[data-theme="dark"] #hero.sj-hero .hero-cta-buttons .hero-btn:is(:hover, :focus, :active) {
    background: #C96B3C;
    border-color: #C96B3C;
    color: #121212;
}
html[data-theme="dark"] #hero.sj-hero .hero-cta-buttons .hero-btn:focus-visible {
    outline: 2px solid #121212;
    outline-offset: 3px;
}
html[data-theme="dark"] .promo-ticker { background: #121212 !important; color: #F2F0EA !important; }

/* A paper header needs the black brand asset, including on phones. */
html[data-theme="dark"] #header .header-logo--light { display: block !important; }
html[data-theme="dark"] #header .header-logo--dark { display: none !important; }
html[data-theme="dark"] #header :is(.theme-toggle-btn, .header-menu-btn, #lang-select) {
    color: #121212 !important;
}
html[data-theme="dark"] #header .header-lang__code {
    color: #121212;
    background: #FFFCF7;
    border-color: rgba(18, 18, 18, 0.18);
}

/* Keep the social icon readable against its own circle, independently of the footer. */
html[data-theme="dark"] #footer .footer-instagram {
    background: #242424 !important;
    color: #F2F0EA !important;
    border: 1px solid #5C574F;
}
html[data-theme="dark"] #footer .footer-instagram:is(:hover, :focus-visible) {
    background: #F07729 !important;
    color: #121212 !important;
    border-color: #F07729;
}
html[data-theme="dark"] #footer .footer-instagram:focus-visible {
    outline: 2px solid #F2F0EA;
    outline-offset: 3px;
}

/* Your full picture: one carbon band for the copy and the existing dark diagram. */
html[data-theme="dark"] #athlete-context {
    --accent: #F07729;
    background: #121212;
    color: #F2F0EA;
    color-scheme: dark;
}
html[data-theme="dark"] #athlete-context .editorial-split {
    background: #121212 !important;
}
html[data-theme="dark"] #athlete-context :is(h2, .context-model-points li) {
    color: #F2F0EA !important;
}
html[data-theme="dark"] #athlete-context .editorial-split-lead {
    color: #D9D4CA !important;
}
html[data-theme="dark"] #athlete-context .context-act-kicker {
    color: #B7B2A8;
}
html[data-theme="dark"] #athlete-context :is(.eyebrow, .text-vibrant-orange, .context-model-bridge) {
    color: #F07729 !important;
}
html[data-theme="dark"] #athlete-context .context-model-points li::before {
    color: #F07729;
    background: #352319;
}

/* The following guidance section returns to paper, with matching card tokens. */
html[data-theme="dark"] #tracking-intelligence {
    --intel-canvas: #F2F0EA;
    --intel-surface: #FFFCF7;
    --intel-surface-alt: #E7E2D8;
    --intel-icon-bg: #E7E2D8;
    --intel-ink: #121212;
    --intel-muted: #5C574F;
    --intel-accent: #9D4924;
    --intel-accent-strong: #9D4924;
    --intel-accent-soft: #F2E4D8;
    --intel-accent-border: #C9A58D;
    --intel-divider: #D3CBC0;
    background: var(--intel-canvas) !important;
    color: var(--intel-ink);
    border-top-color: var(--intel-divider);
}
html[data-theme="dark"] #tracking-intelligence .eyebrow {
    color: var(--intel-accent-strong);
}
html[data-theme="dark"] #tracking-intelligence .intelligence-example-icon {
    color: var(--intel-ink);
}
html[data-theme="dark"] #tracking-intelligence .intelligence-example--payoff .intelligence-example-icon {
    color: #FFFFFF;
}
html[data-theme="dark"] :is(#nutrition, #wellness, #faq) :is(.editorial-split-lead, .text-gray-300, .text-gray-400, .faq-answer) {
    color: #5C574F !important;
}

/* Expanded navigation follows the paper header; the mobile hero mirrors light mode. */
@media (max-width: 767px) {
    html[data-theme="dark"] #header #mobile-nav-panel {
        background: #F2F0EA;
        color: #121212;
        border-top-color: rgba(18, 18, 18, 0.12);
    }
    html[data-theme="dark"] #header #mobile-nav-panel :is(.mobile-nav-link, .mobile-nav-theme) {
        color: #121212 !important;
    }
    html[data-theme="dark"] #header #mobile-nav-panel :is(.mobile-nav-link, .mobile-nav-theme):is(:hover, :focus-visible) {
        background: #E7E2D8;
    }
    html[data-theme="dark"] #header #mobile-nav-panel :is(.mobile-nav-link, .mobile-nav-theme):focus-visible {
        outline: 2px solid #121212;
        outline-offset: 2px;
    }
    /* Match the existing light mobile hero in mobile-hero.css, including the image. */
    html[data-theme="dark"] #hero.sj-hero {
        --sj-hero-bg: #0c0c0c;
        --sj-hero-text: #ffffff;
        --sj-hero-muted: rgba(255, 255, 255, 0.72);
        --sj-hero-accent: #ea580c;
        background: var(--sj-hero-bg) !important;
        color: #fff;
    }
    html[data-theme="dark"] #hero.sj-hero :is(.hero__headline, .hero__title) {
        color: var(--sj-hero-text) !important;
    }
    html[data-theme="dark"] #hero.sj-hero .hero__support {
        color: rgba(255, 255, 255, 0.72) !important;
    }
    html[data-theme="dark"] #hero.sj-hero .hero__availability {
        color: rgba(255, 255, 255, 0.62) !important;
    }
    html[data-theme="dark"] #hero.sj-hero .hero__eyebrow {
        color: var(--sj-hero-accent) !important;
    }
    html[data-theme="dark"] #hero.sj-hero .hero__media {
        background: var(--sj-hero-bg);
    }
    html[data-theme="dark"] #hero.sj-hero .hero__image {
        opacity: 1;
        filter: none;
    }
    html[data-theme="dark"] #hero.sj-hero .hero__media::before {
        background: linear-gradient(
            180deg,
            rgba(12, 12, 12, 0.58) 0%,
            rgba(12, 12, 12, 0.78) 55%,
            rgba(12, 12, 12, 0.96) 100%
        ) !important;
    }
}

