
@layer base, components, utilities;

:root {
    --bg: #ffffff;
    --fg: #111111;
    --muted: #555555;
    --accent: #0b5fff;
    --border: #e6e6e6;

    --step--1: clamp(0.85rem, 0.8rem + 0.2vw, 0.95rem);
    --step-0:  clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
    --step-1:  clamp(1.25rem, 1.1rem + 0.8vw, 1.5rem);
    --step-2:  clamp(1.6rem, 1.3rem + 1.4vw, 2rem);
    --step-3:  clamp(2rem, 1.6rem + 2vw, 2.6rem);

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;

    --radius: 10px;
    --container: 72ch;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b0b0b; --fg: #f2f2f2; --muted: #a9a9a9;
        --accent: #76a5ff; --border: #222;
    }
}

@layer base {
    html { font-size: 100%; }
    body {
        margin: 0;
        font: 400 var(--step-0)/1.7 -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
        color: var(--fg);
        background: var(--bg);
    }

    img, svg, video { max-width: 100%; height: auto; }
    * { box-sizing: border-box; }

    .container { max-width: var(--container); margin-inline: auto; padding-inline: var(--space-5); }

    h1, h2, h3 { line-height: 1.2; margin: var(--space-6) 0 var(--space-3); }
    h1 { font-size: var(--step-3); }
    h2 { font-size: var(--step-2); }
    h3 { font-size: var(--step-1); }
    p, ul, ol, pre, blockquote, figure, table { margin: 0 0 var(--space-5); }

    a { color: var(--accent); text-underline-offset: 0.12em; }
    a:hover { text-decoration-thickness: 2px; }

    code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
    pre { padding: var(--space-4); background: color-mix(in oklab, var(--fg) 6%, transparent); border-radius: var(--radius); overflow: auto; }

    hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-6) 0; }

    blockquote {
        margin-inline: 0; padding-inline: var(--space-5);
        border-inline-start: 3px solid var(--border); color: var(--muted);
    }

    :focus-visible { outline: 3px solid color-mix(in oklab, var(--accent) 60%, transparent); outline-offset: 2px; }

    /* simple table */
    table { width: 100%; border-collapse: collapse; }
    th, td { text-align: left; padding: .6rem; border-bottom: 1px solid var(--border); }
    thead th { color: var(--muted); font-weight: 600; }
}

@layer components {
    .site-header {
        border-bottom: 1px solid var(--border);
        background: var(--bg);
        padding-block: var(--space-4);
    }
    .nav { display: flex; align-items: center; justify-content: space-between; }
    .brand { font-weight: 700; font-size: var(--step-1); text-decoration: none; color: var(--fg); }
    .nav-right { display: flex; gap: var(--space-5); }
    .nav-right a { text-decoration: none; color: var(--muted); font-weight: 500; }
    .nav-right a:is(:hover,:focus-visible) { color: var(--accent); }

    .hero { padding-block: calc(var(--space-6) * 1.5); }
    .hero .kicker { letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-size: var(--step--1); }
    .hero h1 { margin-top: var(--space-2); }
    .actions { display: flex; gap: var(--space-4); flex-wrap: wrap; }

    .btn {
        display: inline-block; padding: .5em 1em; border-radius: var(--radius);
        border: 1px solid var(--border); background: transparent; color: var(--fg);
        text-decoration: none; font-weight: 600;
        cursor: pointer;
    }
    .btn:is(:hover,:focus-visible) { border-color: var(--accent); }
    .btn.primary { background: var(--accent); color: white; border-color: transparent; }
    .btn.primary:is(:hover,:focus-visible) { filter: brightness(0.95); }
    .btn.disabled {
        opacity: 0.5;
        cursor: not-allowed;
        pointer-events: none;
        filter: grayscale(1);
        border-color: var(--border);
    }

    .card {
        padding: var(--space-5); border: 1px solid color-mix(in oklab, var(--bg) 60%, var(--accent)); border-radius: var(--radius);
        background: color-mix(in oklab, var(--bg) 98%, var(--fg));
    }
    .grid { display: grid; gap: var(--space-5); }
    @container (min-width: 48rem) {
        .grid.cols-2 { grid-template-columns: 1fr 1fr; }
        .grid.cols-3 { grid-template-columns: repeat(3,1fr); }
    }

    .callout {
        border-left: 4px solid var(--accent);
        background: color-mix(in oklab, var(--accent) 6%, var(--bg));
        padding: var(--space-4) var(--space-5);
        border-radius: var(--radius);
    }

    .field { display: grid; gap: .35rem; }
    input[type="text"], input[type="email"], select, textarea, input[type="number"] {
        padding: .6rem .7rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--fg);
        width: 100%;
    }
    label { font-weight: 600; font-size: 0.9em; }

    details { border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem; background: color-mix(in oklab, var(--bg) 96%, var(--fg)); }
    summary { cursor: pointer; font-weight: 600; }

    .prose :where(p + p) { margin-top: var(--space-4); }
    .lead { font-size: var(--step-1); color: var(--muted); }
}

@layer utilities {
    .stack > * + * { margin-top: var(--space-5); }
    .center { display: grid; place-items: center; }
    .mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
    .muted { color: var(--muted); }
    .measure { max-width: 65ch; }
    .mb-5 { margin-bottom: var(--space-5); }
}