/*
 * Site theme: the homepage's night-and-day look for every other page.
 * Loaded after each page's own <style>, so it remaps the old template tokens
 * (--color-*) and restyles the shared parts: nav, page header, install block,
 * call-to-action band, FAQ headings and footer. Page-specific layouts stay
 * in each page. The homepage has its own styles and does not load this file.
 */

:root {
    --color-background: #fbf7f1;
    --color-surface: #ffffff;
    --color-surface-warm: #f3eadd;
    --color-accent: #8a5a10;
    --color-honey: #f0b54a;
    --color-text-primary: #241c14;
    --color-text-secondary: #5f5244;
    --color-text-muted: #6f6152;
    --color-on-accent: #ffffff;
    --color-fits: #2c7f48;
    --shadow-soft: 0 4px 20px rgba(36, 28, 20, 0.06);
    --shadow-medium: 0 20px 44px rgba(36, 28, 20, 0.1);

    --night-0: #0d0a07;
    --night-1: #16110c;
    --night-2: #211912;
    --cream: #f6eee2;
    --cream-2: rgba(246, 238, 226, 0.74);
    --cream-3: rgba(246, 238, 226, 0.5);
    --gold: #f0b54a;
    --line: rgba(36, 28, 20, 0.1);

    --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
    --sans: ui-rounded, 'SF Pro Rounded', 'Nunito', system-ui, -apple-system, sans-serif;
    --night-sky:
        radial-gradient(1.2px 1.2px at 22px 34px, rgba(255, 236, 200, 0.75), transparent 60%) 0 0 / 300px 300px,
        radial-gradient(1px 1px at 140px 92px, rgba(255, 236, 200, 0.6), transparent 60%) 0 0 / 300px 300px,
        radial-gradient(1.6px 1.6px at 210px 18px, rgba(255, 236, 200, 0.7), transparent 60%) 0 0 / 300px 300px,
        radial-gradient(1px 1px at 76px 180px, rgba(255, 236, 200, 0.5), transparent 60%) 0 0 / 300px 300px,
        radial-gradient(1.3px 1.3px at 260px 220px, rgba(255, 236, 200, 0.6), transparent 60%) 0 0 / 300px 300px,
        radial-gradient(900px 420px at 80% 30%, rgba(240, 181, 74, 0.16), transparent 62%),
        radial-gradient(700px 380px at 8% 0%, rgba(150, 120, 190, 0.12), transparent 60%),
        linear-gradient(180deg, var(--night-0) 0%, var(--night-1) 100%);
    color-scheme: light;
}

/* Dark mode: the same tokens, remapped. Pages use the tokens, never fixed light colors. */
@media (prefers-color-scheme: dark) {
    :root {
        --color-background: #120e0a;
        --color-surface: #1b1510;
        --color-surface-warm: #221a13;
        --color-accent: #f0b54a;
        --color-honey: #f0b54a;
        --color-text-primary: #f3eadc;
        --color-text-secondary: #bcae9b;
        --color-text-muted: #a89a87;
        --color-on-accent: #1b1208;
        --color-fits: #74c890;
        --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.3);
        --shadow-medium: 0 20px 44px rgba(0, 0, 0, 0.4);
        --line: rgba(243, 234, 220, 0.1);
        color-scheme: dark;
    }
}

/* Page changes fade instead of flashing; the nav stays put */
@view-transition { navigation: auto; }
nav { view-transition-name: site-nav; }

@media (prefers-reduced-motion: reduce) {
    ::view-transition-group(*),
    ::view-transition-old(*),
    ::view-transition-new(*) { animation: none !important; }
}

body {
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: clip;
}

h1, h2, h3,
.page-header h1, .hero h1, .content h1, .content h2,
.cta h2, .ub-install h2, .section-title, .faq h2, .faq-section h2 {
    font-family: var(--serif) !important;
    font-weight: 500 !important;
    letter-spacing: -0.015em;
}

/* Navigation: the homepage's dark glass bar */
nav {
    background: rgba(13, 10, 7, 0.9);
    -webkit-backdrop-filter: saturate(140%) blur(16px);
    backdrop-filter: saturate(140%) blur(16px);
    border-bottom: 1px solid rgba(246, 238, 226, 0.08);
}

.nav-container { gap: 28px; }
.nav-container .logo { margin-right: auto; }
.logo { color: var(--cream); }
.logo img { width: 34px !important; height: 34px !important; border-radius: 9px; }
.logo span { font-family: var(--serif); font-size: 23px !important; font-weight: 600 !important; letter-spacing: -0.01em; }

.nav-links { gap: 26px; }
.nav-links a { color: var(--cream-2); font-size: 15px; }
.nav-links a:hover { color: var(--cream); }
nav .back-link { color: var(--gold); }

.nav-cta {
    text-decoration: none;
    background: var(--gold);
    color: #1b1208;
    font-size: 14px;
    font-weight: 800;
    padding: 9px 16px;
    border-radius: 999px;
    white-space: nowrap;
    transition: transform 0.2s, background 0.2s;
}

.nav-cta:hover { transform: translateY(-1px); background: #f6c46a; }

/* Page header: a night band behind the title, full width */
:is(.page-header, .tool-header, .tool-hero, body > .hero) {
    position: relative;
    isolation: isolate;
    color: var(--cream-2);
    padding-bottom: 76px !important;
    margin-bottom: 56px;
}

:is(.page-header, .tool-header, .tool-hero, body > .hero)::before {
    content: '';
    position: absolute;
    z-index: -1;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 100vw;
    transform: translateX(-50%);
    background: var(--night-sky);
}

:is(.page-header, .tool-header, .tool-hero, body > .hero) h1 {
    color: var(--cream);
    font-size: clamp(36px, 5vw, 60px) !important;
    line-height: 1.05 !important;
    letter-spacing: -0.025em;
}

:is(.page-header, .tool-header, .tool-hero, body > .hero) h1 span { color: var(--gold); font-style: italic; font-weight: 400; }
:is(.page-header, .tool-header, .tool-hero, body > .hero) :is(p, li, .subtitle, .lead) { color: var(--cream-2); }
:is(.page-header, .tool-header, .tool-hero, body > .hero) a { color: var(--gold); }
:is(.page-header, .tool-header, .tool-hero, body > .hero) :is(.breadcrumb, .breadcrumb a, .meta, small) { color: var(--cream-3); }

/* Install block: a night card */
.ub-install {
    background: var(--night-sky) !important;
    border: 1px solid rgba(246, 238, 226, 0.1) !important;
    border-radius: 28px !important;
    box-shadow: 0 12px 32px rgba(36, 28, 20, 0.1) !important;
    color: var(--cream);
    padding: 40px 28px !important;
}

.ub-install h2 { color: var(--cream); }
.ub-install p { color: var(--cream-2) !important; }
.ub-install .ub-install-note { color: var(--cream-3) !important; }
.ub-install a:not(.ub-install-badges a) { color: var(--gold); }

/* Call-to-action band */
.cta + .ub-install-wrap { margin-top: 64px; }

.cta {
    background: var(--night-sky) !important;
    color: var(--cream) !important;
}

.cta h2 { color: var(--cream); }
.cta p { color: var(--cream-2); opacity: 1 !important; }

/* Footer */
footer {
    background: var(--night-0) !important;
    color: var(--cream-3) !important;
    border-top: 1px solid rgba(246, 238, 226, 0.08);
}

footer a { color: var(--cream-2); }
footer a:hover { color: var(--cream); }
.footer-links h4 {
    font-size: 13px !important;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cream-3);
}
.footer-links a { color: var(--cream-2) !important; }
.footer-links a:hover { color: var(--cream) !important; }
.footer-brand p { color: var(--cream-3) !important; }
.footer-bottom { color: var(--cream-3) !important; border-top-color: rgba(246, 238, 226, 0.08) !important; }

/* Sources for the caffeine amounts a tool shows (written by scripts/build-drinks.py) */
.drink-sources {
    max-width: 1000px;
    margin: 28px auto 0;
    padding: 0 24px;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--color-text-muted);
}

.drink-sources a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
