/* ==========================================================================
   webncode.dk — design system, 2026
   Spec: docs/design-2026.md
   ========================================================================== */

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

/* ---------- Tokens (light, default) ---------- */
:root {
    --bg: #f5f3ee;
    --bg-elev: #ffffff;
    --bg-sunken: #ece9e0;
    --ink: #111110;
    --ink-2: #3a3a37;
    --ink-3: #6f6f69;
    --line: #e3dfd4;
    --line-strong: #c9c4b4;
    --accent: #c8842b;
    --accent-soft: #f3deb6;
    --accent-ink: #1a1208;
    --danger: #b53a2a;
    --ok: #2d7a4a;

    --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

    --page-max: 1240px;
    --col-prose: 68ch;
    --pad-x: clamp(1.25rem, 4vw, 2.5rem);
    --section-gap: clamp(4rem, 9vw, 9rem);

    --radius-sm: 4px;
    --radius-md: 6px;

    --easing: cubic-bezier(0.4, 0, 0.2, 1);
    --dur-fast: 140ms;
    --dur: 220ms;

    color-scheme: light;
}

/* ---------- Tokens (dark) ---------- */
:root[data-theme="dark"] {
    --bg: #0c0c0a;
    --bg-elev: #15140f;
    --bg-sunken: #07070a;
    --ink: #ede9dd;
    --ink-2: #b8b3a3;
    --ink-3: #807c70;
    --line: #27251d;
    --line-strong: #3a372c;
    --accent: #e6a53b;
    --accent-soft: #4a3614;
    --accent-ink: #0c0c0a;
    --danger: #d97259;
    --ok: #4ea872;

    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --bg: #0c0c0a;
        --bg-elev: #15140f;
        --bg-sunken: #07070a;
        --ink: #ede9dd;
        --ink-2: #b8b3a3;
        --ink-3: #807c70;
        --line: #27251d;
        --line-strong: #3a372c;
        --accent: #e6a53b;
        --accent-soft: #4a3614;
        --accent-ink: #0c0c0a;
        color-scheme: dark;
    }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
img, svg, video { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }

/* ---------- Base ---------- */
body {
    font-family: var(--font-sans);
    font-size: 1.0625rem; /* 17px */
    line-height: 1.6;
    color: var(--ink);
    background: var(--bg);
    font-feature-settings: "ss01", "cv11";
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    transition: background-color var(--dur) var(--easing), color var(--dur) var(--easing);
}

::selection { background: var(--accent); color: var(--accent-ink); }

a {
    color: var(--ink);
    text-decoration: none;
    text-decoration-skip-ink: auto;
    background-image: linear-gradient(currentColor, currentColor);
    background-repeat: no-repeat;
    background-position: 0 100%;
    background-size: 100% 1px;
    transition: color var(--dur-fast) var(--easing), background-size var(--dur) var(--easing);
}
a:hover { color: var(--accent); }
a.is-clean,
.nav a,
.btn,
.no-underline {
    background-image: none;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5 {
    font-family: var(--font-sans);
    font-weight: 600;
    color: var(--ink);
    line-height: 1.1;
    letter-spacing: -0.025em;
    margin: 0 0 0.75rem;
}
h1 { font-size: clamp(2rem, 5vw, 3.25rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3vw, 2.125rem); }
h3 { font-size: clamp(1.15rem, 2vw, 1.375rem); }
h4 { font-size: 1.0625rem; }

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

small, .small { font-size: 0.875rem; }
.mono, code, kbd, pre { font-family: var(--font-mono); }
.mono { font-size: 0.875rem; letter-spacing: 0; }
.muted { color: var(--ink-3); }
.eyebrow {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-3);
    margin: 0 0 0.5rem;
}

hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 2rem 0;
}

/* ---------- Layout ---------- */
.shell {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 0 var(--pad-x);
}
.shell--prose {
    max-width: calc(var(--col-prose) + (var(--pad-x) * 2));
}

.section {
    padding: var(--section-gap) 0;
}
.section--tight { padding: clamp(2rem, 5vw, 4rem) 0; }
.section + .section { padding-top: 0; }
.section--tight + .section:not(.section--tight) { padding-top: var(--section-gap); }

.grid { display: grid; gap: clamp(1rem, 2vw, 2rem); }
.grid--12 { grid-template-columns: repeat(12, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid--auto { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--2-1 { grid-template-columns: 1.4fr 1fr; }

@media (max-width: 720px) {
    .grid--2 { grid-template-columns: 1fr; }
    .grid--2-1 { grid-template-columns: 1fr; }
    .grid--12 { grid-template-columns: 1fr; }
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: saturate(140%) blur(10px);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    border-bottom: 1px solid transparent;
    transition: border-color var(--dur) var(--easing);
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.site-header__inner {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 1rem var(--pad-x);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}
.brand {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: -0.02em;
    color: var(--ink);
    display: inline-flex;
    align-items: baseline;
    line-height: 1;
}
.brand .brand__word { display: inline-block; }
.brand .brand__amp {
    font-family: var(--font-sans);
    font-style: italic;
    font-weight: 500;
    font-size: 1.25em;
    color: var(--accent);
    margin: 0 0.08em;
    display: inline-block;
    transform-origin: 50% 60%;
    transition: transform var(--dur) var(--easing), color var(--dur) var(--easing);
}
.brand:hover { color: var(--ink); }
.brand:hover .brand__amp { transform: rotate(-8deg); }

.nav {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 2vw, 1.75rem);
}
.nav a {
    color: var(--ink-2);
    font-size: 0.9375rem;
    position: relative;
    padding: 0.25rem 0;
    transition: color var(--dur-fast) var(--easing);
}
.nav a:hover { color: var(--ink); }
.nav a.is-active { color: var(--ink); }
.nav a.is-active::after {
    content: "";
    position: absolute;
    bottom: -0.25rem;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
}

.theme-toggle {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-2);
    border: 1px solid var(--line);
    transition: border-color var(--dur-fast) var(--easing), color var(--dur-fast) var(--easing), background-color var(--dur-fast) var(--easing);
}
.theme-toggle:hover { color: var(--ink); border-color: var(--line-strong); background: var(--bg-elev); }
.theme-toggle svg { width: 1rem; height: 1rem; }

.nav-toggle {
    display: none;
    width: 2.25rem;
    height: 2.25rem;
    align-items: center;
    justify-content: center;
    color: var(--ink-2);
}
.nav-toggle svg { width: 1.25rem; height: 1.25rem; }

@media (max-width: 720px) {
    .nav-toggle { display: inline-flex; }
    .nav {
        position: absolute;
        top: 100%;
        right: var(--pad-x);
        background: var(--bg-elev);
        border: 1px solid var(--line);
        border-radius: var(--radius-md);
        padding: 0.75rem 1.25rem;
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
        transform: translateY(0.5rem);
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--dur) var(--easing), transform var(--dur) var(--easing);
    }
    .nav.is-open {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }
}

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--line);
    margin-top: var(--section-gap);
    padding: 3rem 0 2rem;
    color: var(--ink-2);
    font-size: 0.9375rem;
}
.site-footer__grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: 2rem;
    align-items: start;
}
@media (max-width: 800px) {
    .site-footer__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .site-footer__grid { grid-template-columns: 1fr; }
}
.site-footer h4 {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-3);
    font-weight: 500;
    margin: 0 0 0.75rem;
}
.site-footer__brand { color: var(--ink); }
.site-footer__brand .mono { color: var(--ink-3); display: block; margin-top: 0.25rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.site-footer a { color: var(--ink-2); }
.site-footer a:hover { color: var(--accent); }
.site-footer__bottom {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8125rem;
    color: var(--ink-3);
    font-family: var(--font-mono);
}
.site-footer__admin {
    display: inline-flex;
    align-items: center;
    margin-left: 0.6rem;
    padding: 0.15rem;
    color: var(--ink-3);
    opacity: 0.45;
    transition: opacity 0.15s ease, color 0.15s ease;
}
.site-footer__admin:hover,
.site-footer__admin:focus-visible { opacity: 1; color: var(--accent); }
.site-footer__admin .icon { width: 14px; height: 14px; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---------- Utility ---------- */
.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;
}
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-6 { margin-top: 3rem; }
.text-center { text-align: center; }

/* Hide visually but keep for ATs */
.hp { position: absolute; left: -9999px; top: -9999px; height: 0; width: 0; overflow: hidden; }
