/* ============================================================
   base.css — tokens, reset, typography, layout, prose
   Loaded on EVERY page. Pairs with components.css.
   Single source of truth for design tokens.
   ============================================================ */

/* ===== SELF-HOSTED FONTS (SIL OFL — commercial-clean) ===== */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/assets/fonts/Inter-Variable.woff2') format('woff2');
}

@font-face {
    font-family: 'Geist Mono';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/assets/fonts/GeistMono-Variable.woff2') format('woff2');
}

/* ===== ROOT VARIABLES ===== */
/* ============================================================
   OBSIDIAN — the design system (Apple-grade, dark).
   Tie-breaker for every decision: one near-black ground, ONE light
   (purple, once per viewport max), everything else grayscale Inter
   type + mono numbers. Borderless-first; depth = edge, not shadow.
   Big text tightens tracking; body/labels loosen. Whitespace is the
   design. If two things fight, delete one and add space.
   ============================================================ */
:root {
    /* GROUNDS — 3 only. ~90% of the page is --bg-primary. */
    --bg-primary: #0a0a0b;
    --bg-secondary: #101012;        /* barely-there section alternation */
    --bg-card: #151517;             /* the only raised surface (whisper of violet) */
    --bg-card-hover: #1a1a1d;

    /* INK — 3 hard steps. Body off full-white is what makes headings pop. */
    --text-primary: #f5f5f7;        /* Apple's off-white — headings + key lines */
    --text-secondary: #a1a1aa;      /* body */
    --text-muted: #8b8b96;          /* captions/labels/meta (AA-safe) */
    --text-muted-strong: #71717a;   /* large/non-essential only */

    /* THE ONE LIGHT — the entire color budget. Purple once per viewport. */
    --accent-primary: #8b5cf6;
    --accent-secondary: #a78bfa;    /* ONLY for text-links-on-dark contrast, not a 2nd brand purple */
    --accent-strong: #7c3aed;
    --accent-glow: rgba(139, 92, 246, 0.30);
    --accent-soft: rgba(139, 92, 246, 0.15);
    --accent-faint: rgba(139, 92, 246, 0.1);

    /* LINES — almost subliminal. */
    --border-color: rgba(255, 255, 255, 0.06);
    --border-color-hover: rgba(255, 255, 255, 0.12);

    /* Typography — one system: Inter (UI) + Geist Mono (data/eyebrows). */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    /* Type scale — ~6 sizes, 3 weights (400/600/700). Tracking tightens with size. */
    --fs-label: 0.75rem;                                 /* 12px eyebrow/caption (mono) */
    --fs-small: 0.875rem;
    --fs-body: 1.0625rem;                                /* 17px — Apple baseline, the 'expensive' difference */
    --fs-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.5rem);   /* 20 → 24px intro line */
    --fs-h3: 1.25rem;
    --fs-h2: clamp(2rem, 4vw, 2.75rem);                  /* 32 → 44px section headline */
    --fs-h1: clamp(3rem, 6.5vw, 5rem);                   /* 48 → 80px hero */
    --fs-eyebrow: var(--fs-label);
    /* the giant mono figure for THE NUMBER */
    --fs-mega: clamp(4rem, 12vw, 9rem);

    /* Radius — two only: 16px surfaces, 999px pills. */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 999px;

    /* Depth = edge-definition, not floating boxes. */
    --elev-1: 0 0 0 1px var(--border-color);
    --elev-2: 0 0 0 1px var(--border-color-hover);
    --glass-blur: blur(20px);
    --inset-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.03);

    /* Spacing — strict 4px scale, biased roomy. */
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-6: 24px;
    --space-8: 32px;
    --space-12: 48px;
    --space-16: 64px;
    --space-20: 80px;
    --space-24: 96px;
    --space-32: 128px;
    --section-padding: clamp(6rem, 12vw, 10rem);         /* 96 → 160px, one idea per scroll */
    --container-width: 1120px;                            /* tighter reads more composed */
    --container-narrow: 680px;                            /* long-form reading measure */
    --measure-headline: 768px;                            /* hero/section headline width */

    /* Transitions — restrained. */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s cubic-bezier(0.28, 0.11, 0.32, 1);
    --transition-slow: 0.6s cubic-bezier(0.28, 0.11, 0.32, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    font-size: var(--fs-body);
    line-height: 1.6;
    letter-spacing: 0.012em;
    color: var(--text-secondary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* Accessible focus state (added — was missing) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--accent-secondary);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ===== LAYOUT ===== */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

section {
    padding: var(--section-padding) 0;
}

/* ===== TYPOGRAPHY =====
   Apple rule: tracking TIGHTENS as size grows; display type ~solid (1.05–1.10).
   Only 3 weights (400/600/700). 600 is the workhorse; 700 the hero line only. */
h1,
h2,
h3 {
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

h1 {
    font-size: var(--fs-h1);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.03em;
}

h2 {
    font-size: var(--fs-h2);
    line-height: 1.07;
    letter-spacing: -0.025em;
    margin-bottom: 1rem;
}

h3 {
    font-size: var(--fs-h3);
    line-height: 1.1;
    margin-bottom: 0.75rem;
}

.section-intro {
    font-size: var(--fs-lead);
    color: var(--text-secondary);
    line-height: 1.35;
    letter-spacing: -0.01em;
    max-width: 640px;
    margin-bottom: 3rem;
}

/* ===== PROSE (long-form blog reading) =====
   Scoped to .prose so it never leaks into landing layouts. */
.prose {
    max-width: var(--container-narrow);
    margin: 0 auto;
    color: var(--text-secondary);
    font-size: var(--fs-lead);
    line-height: 1.8;
}

.prose h2 {
    color: var(--text-primary);
    font-size: clamp(1.6rem, 3vw, 2rem);
    margin: 2.75rem 0 1rem;
}

.prose h3 {
    color: var(--text-primary);
    font-size: 1.35rem;
    margin: 2rem 0 0.75rem;
}

.prose p {
    margin-bottom: 1.5rem;
}

.prose a {
    color: var(--accent-secondary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.prose a:hover {
    color: var(--accent-primary);
}

.prose ul,
.prose ol {
    margin: 0 0 1.5rem 1.25rem;
}

.prose ul {
    list-style: disc;
}

.prose ol {
    list-style: decimal;
}

.prose li {
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
}

.prose strong {
    color: var(--text-primary);
    font-weight: 600;
}

.prose blockquote {
    margin: 2rem 0;
    padding: 1rem 1.5rem;
    border-left: 3px solid var(--accent-primary);
    background: var(--bg-card);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--text-primary);
    font-style: italic;
}

.prose code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.875em;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.15em 0.4em;
}

.prose pre {
    margin: 1.75rem 0;
    padding: 1.25rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow-x: auto;
}

.prose pre code {
    background: none;
    border: none;
    padding: 0;
}

.prose img,
.prose figure {
    margin: 2rem 0;
    border-radius: var(--radius-md);
}

.prose figcaption {
    margin-top: 0.5rem;
    font-size: var(--fs-small);
    color: var(--text-muted);
    text-align: center;
}

/* ===== ANIMATIONS (shared) ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeInUp 0.6s ease forwards;
}

/* ===== BUTTON RIPPLE (triggered via JS) ===== */
@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ===== SCROLL REVEAL (set via JS) ===== */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}
