/* ============================================================
   base.css — Design tokens, reset, typography
   engsim.app
   ============================================================ */

/* ── Design tokens ─────────────────────────────────────────── */
:root {
    /* Brand */
    --brand-primary: #1a2f5e;
    --brand-accent: #2563eb;
    --brand-accent-h: #1d4ed8;

    /* Surfaces */
    --bg-page: #f8f9fb;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --bg-hover: #f1f4f9;

    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-on-accent: #ffffff;

    /* Borders */
    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    /* Status */
    --color-success: #16a34a;
    --color-warning: #d97706;
    --color-danger: #dc2626;

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 40px;
    --space-2xl: 64px;

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, .08), 0 2px 4px rgba(0, 0, 0, .04);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, .10), 0 4px 8px rgba(0, 0, 0, .04);

    /* Nav height — used for scroll offset */
    --nav-h: 60px;

    /* Transitions */
    --transition: 150ms ease;
}

/* ── Dark mode tokens ───────────────────────────────────────── */
body.dark {
    --bg-page: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #1e293b;
    --bg-hover: #263348;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border: #334155;
    --border-strong: #475569;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, .4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, .5);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-h) + 16px);
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-page);
    transition: background var(--transition), color var(--transition);
    min-height: 100vh;
}

img,
svg {
    display: block;
    max-width: 100%;
}

a {
    color: var(--brand-accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input,
select,
textarea {
    font-family: inherit;
}

ul,
ol {
    list-style: none;
}

/* ── Typography scale ───────────────────────────────────────── */
h1,
h2,
h3,
h4 {
    line-height: 1.25;
    font-weight: 700;
    color: var(--text-primary);
}

h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
}

h2 {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
}

h3 {
    font-size: 1.125rem;
}

h4 {
    font-size: 1rem;
}

p {
    color: var(--text-secondary);
    line-height: 1.7;
}

code,
kbd {
    font-family: var(--font-mono);
    font-size: .875em;
    background: var(--bg-hover);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

/* ── Utility classes ────────────────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container--narrow {
    max-width: 800px;
}

.text-muted {
    color: var(--text-muted);
}

.text-accent {
    color: var(--brand-accent);
}

/* ── Ad slots ───────────────────────────────────────────────── */
.ad-slot {
    background: var(--bg-hover);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: .75rem;
    letter-spacing: .05em;
    text-transform: uppercase;
    min-height: 90px;
    margin: var(--space-xl) 0;
}

.ad-slot--leaderboard {
    min-height: 90px;
}

.ad-slot--rectangle {
    min-height: 250px;
    max-width: 336px;
}

/* ── Skip link (accessibility) ──────────────────────────────── */
.skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-md);
    background: var(--brand-accent);
    color: #fff;
    padding: var(--space-sm) var(--space-md);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    font-weight: 600;
    z-index: 9999;
    transition: top .15s;
}

.skip-link:focus {
    top: 0;
}