/* ============================================================
   RESET — modern, minimal, opinionated where it helps.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    /* Anchored sections shouldn't hide under the fixed nav. */
    scroll-padding-top: 6rem;
    /* `clip` — NOT `hidden`. overflow-x:hidden forces overflow-y to `auto`,
       which turns <html>/<body> into scroll containers and silently breaks
       every `position: sticky` descendant (the pinned hero, the article TOC,
       the case-study rail). `clip` suppresses horizontal overflow without
       creating a scroll box. */
    overflow-x: clip;
}

@supports not (overflow-x: clip) {
    html, body { overflow-x: hidden; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

body {
    min-height: 100svh;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-ui);
    font-size: var(--text-base);
    line-height: var(--leading-body);
    font-synthesis-weight: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: clip;   /* see the note on <html> above */
    transition: background-color var(--dur) var(--ease-out-quart),
                color var(--dur) var(--ease-out-quart);
}

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

img, video { height: auto; }

input, button, textarea, select {
    font: inherit;
    color: inherit;
}

button { background: none; border: none; padding: 0; cursor: pointer; }

p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: var(--leading-tight); }

ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

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

table { border-collapse: collapse; width: 100%; }

hr {
    border: none;
    border-top: 1px solid var(--line);
    margin: var(--s-8) 0;
}

::selection {
    background: var(--selection-bg);
    color: var(--selection-fg);
}

/* Focus: never remove it, only make it good. */
:focus { outline: none; }
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 3px;
}

/* Skip link — first tab stop on every page. */
.skip-link {
    position: absolute;
    left: var(--s-4);
    top: -100px;
    z-index: var(--z-toast);
    padding: var(--s-3) var(--s-4);
    background: var(--fg);
    color: var(--bg);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: var(--tracking-mono);
    transition: top var(--dur-fast) var(--ease-out-quart);
}
.skip-link:focus-visible { top: var(--s-4); }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* Scrollbar — subtle, matches the surface it sits on. */
@supports selector(::-webkit-scrollbar) {
    ::-webkit-scrollbar { width: 10px; height: 10px; }
    ::-webkit-scrollbar-track { background: var(--bg-sunken); }
    ::-webkit-scrollbar-thumb {
        background: var(--line-strong);
        border-radius: 99px;
        border: 2px solid var(--bg-sunken);
    }
    ::-webkit-scrollbar-thumb:hover { background: var(--fg-faint); }
}
html { scrollbar-color: var(--line-strong) var(--bg-sunken); scrollbar-width: thin; }
