/* ═══════════════════════════════════════════════════════════════
   BIT CRYPTIC — DUSK TERMINAL shared layer (tokens, themes, nav,
   windows, buttons, sections, footer, reveal). Linked by / and
   /field-guide — edit HERE, never fork per page.
   ═══════════════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════════════
   BIT CRYPTIC — DUSK TERMINAL DESIGN SYSTEM v1.0
   Source of truth for all CSS tokens
   ═══════════════════════════════════════════════════════════════ */
:root {
    color-scheme: dark;
    --bg-deep-ink: #0B1021;
    --bg-slate-hud: #161B2E;
    --accent-amber: #F2C14E;
    --accent-mint: #64D9A0;
    --accent-orange: #FB923C;
    --accent-coral: #F87171;
    --border-hud: #2A3553;
    --text-primary: #E2E8F0;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;
    --text-dim: #64748B;
    --ink: #0B1021;
    /* the one ink — never themed */
    --text-on-accent: var(--ink);
    /* amber as TEXT forks per theme (gold on light); amber FILLS stay --accent-amber */
    --accent-amber-text: var(--accent-amber);
    --mint-fill: #64D9A0;
    --surface-veil: rgba(11, 16, 33, 0.6);
    --nav-bg: rgba(11, 16, 33, 0.8);
    --nav-bg-solid: rgba(11, 16, 33, 0.95);
    --mint-tint-bg: rgba(100, 217, 160, 0.08);
    --mint-tint-border: rgba(100, 217, 160, 0.15);
    --amber-tint-bg: rgba(242, 193, 78, 0.04);
    --focus-border: var(--accent-amber);
    --focus-ring: rgba(242, 193, 78, 0.12);
    --selection-bg: rgba(242, 193, 78, 0.25);
    --clue-text-shadow: 0 0 20px rgba(242, 193, 78, 0.15);
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;
    --border-subtle: 1px solid var(--border-hud);
    --glow-gold: 0 0 15px rgba(242, 193, 78, 0.05);
    --glow-gold-md: 0 0 30px rgba(242, 193, 78, 0.1);
    --glow-gold-lg: 0 0 50px rgba(242, 193, 78, 0.15);
    --glow-mint: 0 0 20px rgba(100, 217, 160, 0.08);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-elevated: 0 12px 48px rgba(0, 0, 0, 0.4);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-base: 250ms;
    --duration-slow: 400ms;
    /* ── FIELD GUIDE TAB PALETTE — brand extension, approved & shipped
       2026-07-10. Eight chapter-tab hues: the four accents plus four
       siblings in the same lightness band. Used only by /field-guide.
       Fills carry ink labels; *-text forks dark on light (same law as
       --accent-amber-text). ── */
    --tab-amber: #F2C14E;
    --tab-amber-text: var(--accent-amber-text);
    --tab-violet: #A78BFA;
    --tab-violet-text: #A78BFA;
    --tab-sky: #6FC3E0;
    --tab-sky-text: #6FC3E0;
    --tab-coral: #F87171;
    --tab-coral-text: #F87171;
    --tab-sand: #D9B48A;
    --tab-sand-text: #D9B48A;
    --tab-mint: #64D9A0;
    --tab-mint-text: var(--accent-mint);
    --tab-rose: #E88DA3;
    --tab-rose-text: #E88DA3;
    --tab-orange: #FB923C;
    --tab-orange-text: #FB923C;
}

/* Light mode — brand-book light palette. NOTE the naming wart:
   --bg-deep-ink resolves to CREAM here (kept so 1400 lines of CSS
   don't need renaming). Amber is never text on light (law) —
   --accent-amber-text darkens to gold. */
[data-theme="light"] {
    color-scheme: light;
    --bg-deep-ink: #F4F1EA;
    --bg-slate-hud: #FBFAF6;
    --border-hud: rgba(11, 16, 33, 0.14);
    --text-primary: #0B1021;
    --text-secondary: rgba(11, 16, 33, 0.78);
    --text-muted: rgba(11, 16, 33, 0.60);
    --text-dim: rgba(11, 16, 33, 0.42);
    --accent-mint: #2E9C6B;
    --accent-amber-text: #B07A1E;
    --surface-veil: rgba(11, 16, 33, 0.04);
    --nav-bg: rgba(244, 241, 234, 0.85);
    --nav-bg-solid: rgba(244, 241, 234, 0.97);
    --mint-tint-bg: rgba(46, 156, 107, 0.10);
    --mint-tint-border: rgba(46, 156, 107, 0.25);
    --amber-tint-bg: rgba(176, 122, 30, 0.06);
    --focus-border: #B07A1E;
    --focus-ring: rgba(176, 122, 30, 0.18);
    --selection-bg: rgba(242, 193, 78, 0.45);
    --clue-text-shadow: none;
    --glow-gold: none;
    --glow-gold-md: none;
    --glow-gold-lg: none;
    --glow-mint: none;
    --shadow-card: 0 4px 24px rgba(11, 16, 33, 0.10);
    --shadow-elevated: 0 12px 48px rgba(11, 16, 33, 0.16);
    /* field-guide tab hues as TEXT darken on cream (fills stay saturated);
       amber/mint -text already fork via the tokens above */
    --tab-violet-text: #6D4FC2;
    --tab-sky-text: #1B7FA8;
    --tab-coral-text: #C13B3B;
    --tab-sand-text: #8A6B3F;
    --tab-rose-text: #B0436B;
    --tab-orange-text: #C2410C;
}

[data-theme="light"] body::after {
    display: none;
    /* scanlines are dark-chrome only */
}

[data-theme="light"] .bc-window::after {
    display: none;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background: var(--bg-deep-ink);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: clip;
    /* clip, not hidden — hidden creates a scroll container and breaks
       position:sticky descendants (the /field-guide type nav) */
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(0deg,
            rgba(255, 255, 255, 0.012) 0px,
            rgba(255, 255, 255, 0.012) 1px,
            transparent 1px,
            transparent 3px);
    pointer-events: none;
    z-index: 9999;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: var(--accent-amber-text);
    text-decoration: none;
    transition: color var(--duration-fast) ease;
}

a:hover {
    color: var(--accent-orange);
}

button {
    font-family: inherit;
    cursor: pointer;
}

input {
    font-family: inherit;
}

::selection {
    background: var(--selection-bg);
    color: var(--text-primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg, 24px);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ═══════════════════════════════════════════════════════════════
   BC WINDOW
   ═══════════════════════════════════════════════════════════════ */
.bc-window {
    position: relative;
    background: var(--bg-slate-hud);
    border: var(--border-subtle);
    border-radius: var(--radius);
    box-shadow: var(--glow-gold);
    overflow: hidden;
}

.bc-window::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg,
            rgba(255, 255, 255, 0.018) 0px,
            rgba(255, 255, 255, 0.018) 2px,
            transparent 2px,
            transparent 4px);
    pointer-events: none;
    z-index: 2;
}

.bc-window__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px var(--space-md, 16px);
    background: var(--surface-veil);
    border-bottom: var(--border-subtle);
    position: relative;
    z-index: 3;
}

.bc-window__header--tinted {
    background: var(--surface-veil);
}

.bc-window__dots {
    display: flex;
    gap: 6px;
}

.bc-window__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.bc-window__dot--red {
    background: var(--accent-coral);
}

.bc-window__dot--yellow {
    background: var(--accent-amber);
}

.bc-window__dot--green {
    background: var(--mint-fill);
}

.bc-window__handle {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 400;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bc-window__body {
    padding: var(--space-xl, 32px);
    position: relative;
    z-index: 1;
}

/* ═══════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════ */
@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: var(--glow-gold);
    }

    50% {
        box-shadow: var(--glow-gold-md);
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.cursor-blink {
    display: inline-block;
    width: 9px;
    height: 18px;
    background: var(--accent-amber);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 1s step-end infinite;
}

.cursor-blink--small {
    width: 7px;
    height: 14px;
}

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm, 8px);
    font-family: var(--font-body);
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    transition: all var(--duration-base) var(--ease-out);
    text-decoration: none;
    white-space: nowrap;
}

.btn--lg {
    font-size: 16px;
    padding: 14px 32px;
}

.btn--md {
    font-size: 14px;
    padding: 12px 28px;
}

.btn--sm {
    font-size: 12px;
    padding: 8px 20px;
}

.btn--primary {
    background: var(--accent-amber);
    color: var(--text-on-accent);
    box-shadow: 0 4px 20px rgba(242, 193, 78, 0.25);
}

.btn--primary:hover {
    background: var(--accent-orange);
    color: #fff;
    box-shadow: 0 6px 28px rgba(251, 146, 60, 0.35);
    transform: translateY(-2px);
}

.btn--primary:active {
    transform: translateY(0);
}

.btn--ghost {
    background: transparent;
    color: var(--text-muted);
    border: var(--border-subtle);
}

.btn--ghost:hover {
    border-color: var(--accent-mint);
    color: var(--accent-mint);
    box-shadow: var(--glow-mint);
}

.btn--mono {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

/* ═══════════════════════════════════════════════════════════════
   NAVIGATION
   ═══════════════════════════════════════════════════════════════ */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--nav-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: var(--border-subtle);
    transition: background var(--duration-base) ease;
}

.nav--scrolled {
    background: var(--nav-bg-solid);
}

.nav__theme {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--accent-mint);
    background: transparent;
    border: var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    margin-left: var(--space-md, 16px);
    transition: border-color var(--duration-fast) ease, color var(--duration-fast) ease;
    white-space: nowrap;
}

.nav__theme:hover {
    border-color: var(--accent-mint);
}

.nav__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg, 24px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

/* Expanded wordmark — live text + CSS, never an image (brand law).
   The solve box is a FILL: solid amber in both themes, always square. */
.nav__logo {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 19px;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    padding-right: 0.55em;
}

.nav__logo:hover {
    color: var(--text-primary);
}

.nav__logo__box {
    width: 0.5em;
    height: 0.5em;
    background: var(--accent-amber);
    margin-left: 0.24em;
    transform: translateY(0.05em);
    flex-shrink: 0;
}

.nav__links {
    display: flex;
    align-items: center;
    gap: var(--space-xl, 32px);
    list-style: none;
    margin-left: auto;
}

.nav__links a {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    transition: color var(--duration-fast) ease;
}

.nav__links a:hover {
    color: var(--accent-amber-text);
}

.nav__cta {
    font-family: var(--font-mono) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    color: var(--text-on-accent) !important;
    background: var(--accent-amber);
    padding: 7px 18px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.02em;
    transition: all var(--duration-base) ease !important;
}

.nav__cta:hover {
    background: var(--accent-orange);
    color: #fff !important;
    box-shadow: 0 4px 16px rgba(251, 146, 60, 0.3);
    transform: translateY(-1px);
}

.nav__toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: var(--space-sm, 8px);
    cursor: pointer;
}

.nav__toggle svg {
    width: 24px;
    height: 24px;
}

/* ═══════════════════════════════════════════════════════════════
   SECTIONS
   ═══════════════════════════════════════════════════════════════ */
.section {
    padding: var(--space-5xl, 128px) 0;
    position: relative;
}

.section--alt {
    background: rgba(22, 27, 46, 0.35);
}

.section__label {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent-mint);
    margin-bottom: var(--space-md, 16px);
    display: flex;
    align-items: center;
    gap: var(--space-sm, 8px);
}

.section__label::before {
    content: '//';
    color: var(--text-dim);
}

.section__title {
    font-family: var(--font-heading);
    font-size: clamp(28px, 4.5vw, 48px);
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-primary);
    margin-bottom: var(--space-md, 16px);
}

.section__title span {
    color: var(--accent-amber-text);
}

.section__desc {
    font-size: 16px;
    color: var(--text-muted);
    max-width: 560px;
    line-height: 1.7;
}

.section__header {
    margin-bottom: var(--space-3xl, 64px);
}

.section__header--center {
    text-align: center;
}

.section__header--center .section__desc {
    margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════ */
.footer {
    border-top: var(--border-subtle);
    padding: var(--space-2xl, 48px) 0;
}

.footer__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-lg, 24px);
}

.footer__left {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: var(--space-sm, 8px);
}

.footer__left .accent {
    color: var(--accent-amber-text);
}

.footer__links {
    display: flex;
    gap: var(--space-lg, 24px);
    list-style: none;
}

.footer__links a {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer__links a:hover {
    color: var(--accent-amber-text);
}

/* ═══════════════════════════════════════════════════════════════
   GRADIENT BORDER
   ═══════════════════════════════════════════════════════════════ */
.gradient-border {
    position: relative;
    padding: 2px;
    border-radius: calc(var(--radius) + 2px);
    background: linear-gradient(135deg, var(--accent-amber), var(--accent-orange), var(--mint-fill), var(--accent-amber));
    background-size: 300% 300%;
    animation: gradientShift 6s ease infinite;
}

.gradient-border__inner {
    background: var(--bg-slate-hud);
    border-radius: var(--radius);
}

/* ═══════════════════════════════════════════════════════════════
   SCROLL REVEAL
   ═══════════════════════════════════════════════════════════════ */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.reveal--visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal--delay-1 {
    transition-delay: 0.1s;
}

.reveal--delay-2 {
    transition-delay: 0.2s;
}

.reveal--delay-3 {
    transition-delay: 0.3s;
}

.reveal--delay-4 {
    transition-delay: 0.4s;
}

.reveal--delay-5 {
    transition-delay: 0.5s;
}

/* ── shared responsive (nav, footer, section) ── */
@media (max-width: 768px) {
    .nav__links {
        display: none;
    }

    .nav__toggle {
        display: block;
    }

    .nav__theme {
        margin-left: auto;
    }

    .nav__links--open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--nav-bg-solid);
        backdrop-filter: blur(16px);
        border-bottom: var(--border-subtle);
        padding: var(--space-lg, 24px);
        gap: var(--space-md, 16px);
    }

    .footer__inner {
        flex-direction: column;
        text-align: center;
    }

    .footer__links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .section {
        padding: var(--space-3xl, 64px) 0;
    }
}
