/* Firekeep — shared foundation for every page on the site.
 *
 * Tokens, reset, nav, buttons and footer live here and NOWHERE else. Two pages
 * each carrying their own copy of the palette is how the marketing page and the
 * docs drift apart one hex at a time; the product repo already learned this the
 * expensive way. Page-specific layout stays inline in its own page.
 *
 * The palette is lifted from the product dashboard's Graphite Pro tokens so the
 * product, the page that sells it, and the docs that explain it are visibly one
 * thing.
 */

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

:root {
    --bg-deep: #0A0B0E;
    --bg: #0E0F12;
    --surface: #16181D;
    --surface-raised: #1D2026;
    --border: #282C33;
    --border-subtle: #1B1E23;
    --text: #E6E8EC;
    --text-secondary: #9AA0AB;
    /* #626873 (the dashboard's value) measures 3.17:1 on --bg-deep and fails
       WCAG AA for normal text. Same hue family, 5.14:1. */
    --text-dim: #7B838F;
    --accent: #FF7A2F;
    --accent-2: #E2620F;
    --accent-bright: #FFA05C;
    --accent-muted: rgba(255, 122, 47, 0.12);
    --accent-shadow: rgba(255, 122, 47, 0.22);
    --green: #46C77F;
    --amber: #E8C547;
    --red: #F2555A;

    --font-body: 'DM Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
    --transition: 160ms cubic-bezier(0.4, 0, 0.2, 1);

    --gutter: clamp(20px, 5vw, 64px);
    --section-y: clamp(64px, 9vw, 112px);
    --measure: 1180px;
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: 0.01ms !important; }
}

body {
    background: var(--bg-deep); color: var(--text);
    font-family: var(--font-body); font-size: 16px; line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 var(--gutter); }

a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.skip-link {
    position: fixed; top: 10px; left: 12px; z-index: 100;
    transform: translateY(-160%); padding: 9px 14px; border-radius: 7px;
    background: var(--accent); color: var(--bg-deep); font-weight: 700;
    transition: transform var(--transition);
}
.skip-link:focus { transform: translateY(0); }

/* ─── nav ─────────────────────────────────────────────────────────────── */
.nav {
    position: sticky; top: 0; z-index: 50;
    background: rgba(10, 11, 14, 0.82); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
}
.nav-inner { display: flex; align-items: center; gap: 12px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand img { width: 27px; height: 27px; display: block; }
.brand span { font-family: var(--font-mono); font-size: 16px; font-weight: 700; letter-spacing: -0.5px; }
.nav-links { margin-left: auto; display: flex; align-items: center; gap: 30px; }
/* :not(.btn) matters. `.nav-links a` is (0,1,1) and `.btn-primary` is (0,1,0),
   so without it the nav rule out-specifies the button and paints the CTA's
   label --text-secondary: grey on ember, ~1.9:1, effectively invisible. */
.nav-links a:not(.btn) { font-size: 14px; color: var(--text-secondary); transition: color var(--transition); }
.nav-links a:not(.btn):hover { color: var(--text); }
.nav-links a.current { color: var(--accent); }
.nav-toggle { display: none; }

/* ─── buttons ─────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 600;
    font-family: var(--font-body); border: 1px solid transparent; cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
    white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--bg-deep); }
.btn-primary:hover { background: var(--accent-bright); }
.btn-ghost { border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 8px 15px; font-size: 13px; }

/* ─── terminal / code ─────────────────────────────────────────────────── */
.term {
    background: #08090B; border: 1px solid var(--border);
    border-radius: 10px; overflow: hidden;
}
.term-bar {
    display: flex; align-items: center; gap: 8px; padding: 9px 14px;
    border-bottom: 1px solid var(--border-subtle); background: var(--surface);
}
.term-bar b { font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--text-dim); }
.copy {
    margin-left: auto; background: none; border: 1px solid var(--border); color: var(--text-dim);
    min-width: 44px; min-height: 30px; font-family: var(--font-mono); font-size: 10px;
    padding: 3px 9px; border-radius: 5px;
    cursor: pointer; transition: all var(--transition);
}
.copy:hover { color: var(--accent); border-color: var(--accent); }
.copy:disabled { cursor: not-allowed; color: var(--text-dim); border-color: var(--border); opacity: .68; }
.copy.done { color: var(--green); border-color: var(--green); }
.copy.failed { color: var(--red); border-color: var(--red); }
.term-body {
    padding: 15px 16px; font-family: var(--font-mono); font-size: 13px;
    line-height: 1.85; overflow-x: auto; white-space: pre;
}
.term-body .p { color: var(--accent); user-select: none; }
.term-body .c { color: var(--text-dim); }

/* ─── footer ──────────────────────────────────────────────────────────── */
footer { border-top: 1px solid var(--border-subtle); padding: 42px 0; margin-top: var(--section-y); }
.foot { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.foot .brand img { width: 22px; height: 22px; }
.foot .brand span { font-size: 14px; }
.foot-links { margin-left: auto; display: flex; flex-wrap: wrap; gap: 24px; font-size: 13.5px; color: var(--text-dim); }
.foot-links a:hover { color: var(--text-secondary); }
.foot-legal { margin-top: 22px; font-size: 12.5px; color: var(--text-dim); }

@media (max-width: 760px) {
    .nav-links { display: none; }
    .nav-links.open {
        display: flex; position: absolute; top: 64px; left: 0; right: 0;
        flex-direction: column; align-items: stretch; gap: 0;
        background: var(--bg-deep); border-bottom: 1px solid var(--border); padding: 8px var(--gutter) 18px;
    }
    .nav-links.open a { padding: 12px 0; border-bottom: 1px solid var(--border-subtle); }
    .nav-links.open .btn { margin-top: 12px; }
    .nav-toggle {
        display: inline-flex; align-items: center; justify-content: center; margin-left: auto;
        min-width: 44px; min-height: 44px; background: none; border: 1px solid var(--border);
        color: var(--text); border-radius: 7px; padding: 7px 10px; cursor: pointer;
    }
    .nav-toggle svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; }
    .copy { min-height: 44px; }
}
