/* ============================================================
   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 ===== */
:root {
    /* Colors - Dark, sophisticated palette */
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-card: #16161a;
    --bg-card-hover: #1c1c21;

    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #8b8b96;          /* nudged lighter than #71717a for WCAG AA on dark */
    --text-muted-strong: #71717a;   /* original muted — use only on large/non-essential text */

    --accent-primary: #8b5cf6;
    --accent-secondary: #a78bfa;
    --accent-strong: #7c3aed;
    --accent-glow: rgba(139, 92, 246, 0.3);
    --accent-soft: rgba(139, 92, 246, 0.15);
    --accent-faint: rgba(139, 92, 246, 0.1);

    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-hover: rgba(255, 255, 255, 0.15);

    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    /* Type scale (fluid) */
    --fs-eyebrow: 0.8125rem;
    --fs-small: 0.875rem;
    --fs-body: 1rem;
    --fs-lead: 1.125rem;
    --fs-h3: 1.25rem;
    --fs-h2: clamp(2rem, 4vw, 2.75rem);
    --fs-h1: clamp(2.5rem, 6vw, 4rem);

    /* Radius scale */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 999px;

    /* Elevation / glass recipe */
    --elev-1: 0 2px 12px rgba(0, 0, 0, 0.25);
    --elev-2: 0 8px 32px rgba(0, 0, 0, 0.35);
    --glass-blur: blur(20px);
    --inset-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.04);

    /* Spacing */
    --section-padding: clamp(4rem, 10vw, 8rem);
    --container-width: 1200px;
    --container-narrow: 760px;       /* long-form reading measure */

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    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 ===== */
h1,
h2,
h3 {
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 {
    font-size: var(--fs-h1);
}

h2 {
    font-size: var(--fs-h2);
    margin-bottom: 1rem;
}

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

.section-intro {
    font-size: var(--fs-lead);
    color: var(--text-secondary);
    max-width: 600px;
    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;
    }
}
