/* =============================================================================
   Base — reset, typography, layout primitives, buttons, focus. Depends on tokens.css.
   ============================================================================= */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: var(--step-0);
    line-height: var(--lh-body);
    font-kerning: normal;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    overflow-x: clip;
}
img, svg, video, picture { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
p, li, h1, h2, h3, h4, blockquote { overflow-wrap: break-word; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
table { border-collapse: collapse; }

/* ---- Typography ---- */
h1, h2, h3, h4 { line-height: var(--lh-heading); letter-spacing: -0.025em; font-weight: 700; text-wrap: balance; }
h1 { font-size: var(--step-4); line-height: var(--lh-tight); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }
p { text-wrap: pretty; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
strong { font-weight: 650; }
.lead { font-size: var(--step-1); color: var(--text-2); max-width: 60ch; }
.eyebrow {
    display: inline-flex; align-items: center; gap: 0.6em;
    font-family: var(--font-sans); font-size: var(--step--1); font-weight: 650;
    letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent);
}
.d-hl { color: var(--accent); }
.mono { font-family: var(--font-mono); font-feature-settings: "zero" 1; }
.tnum { font-variant-numeric: tabular-nums lining-nums; }
.muted { color: var(--text-muted); }

/* ---- Layout ---- */
.container { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }
.container--narrow { width: min(100% - 2 * var(--gutter), var(--container-narrow)); margin-inline: auto; }
.section { padding-block: var(--space-2xl); }
.section--tight { padding-block: var(--space-xl); }
.stack > * + * { margin-top: var(--flow, var(--space-s)); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--space-xs); align-items: center; }
.section-head { max-width: 46rem; margin-bottom: var(--space-xl); }
.section-head > * + * { margin-top: var(--space-xs); }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head--center .lead { margin-inline: auto; }

/* ---- Accessibility ---- */
.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute; left: var(--space-s); top: -100%; z-index: 100;
    padding: var(--space-2xs) var(--space-s); background: var(--navy); color: #fff; border-radius: var(--radius-s);
}
.skip-link:focus { top: var(--space-s); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: var(--radius-xs); }

/* ---- Buttons (min target 44×44, WCAG 2.5.8) ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
    min-height: 2.875rem; padding: 0.7em 1.25em;
    border: 1px solid transparent; border-radius: var(--radius-s);
    font-weight: 600; font-size: var(--step-0); line-height: 1.1; text-decoration: none; white-space: nowrap;
    transition: background-color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out),
        color var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.btn:active { transform: translateY(1px); }
.btn { max-width: 100%; }
@media (max-width: 30rem) { .btn { white-space: normal; text-align: center; } } /* long labels wrap on small phones instead of widening the page */
.btn--primary { background: var(--accent-strong); color: var(--accent-contrast); }
.btn--primary:hover { background: var(--blue-hover); }
.band-dark .btn--primary:hover { background: var(--sky-text); }
.btn--secondary { border-color: var(--border-control); color: var(--text); background: transparent; }
.btn--secondary:hover { border-color: var(--text); }
.btn--ghost { color: var(--accent); padding-inline: 0.25em; min-height: 2.75rem; }
.btn--ghost:hover { text-decoration: underline; }
.btn .arrow { transition: transform var(--dur-1) var(--ease-out); }
.btn:hover .arrow { transform: translateX(3px); }

/* ---- Motif: lab-paper grid ---- */
.grid-paper {
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: var(--grid-size) var(--grid-size);
}

/* ---- Status stamp (released / rejected / hold) ---- */
.stamp {
    display: inline-flex; align-items: center; gap: 0.4em;
    padding: 0.2em 0.55em; border: 1.5px solid currentColor; border-radius: var(--radius-xs);
    font-family: var(--font-mono); font-size: var(--step--2); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
}
.stamp--pass { color: var(--pass); }
.stamp--fail { color: var(--fail); }
.stamp--hold { color: var(--hold); }

/* ---- Reveal on scroll (JS adds .is-visible; no-JS and reduced-motion see content immediately) ---- */
@media (prefers-reduced-motion: no-preference) {
    .js .reveal { opacity: 0; transform: translateY(14px); transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out); }
    .js .reveal.is-visible { opacity: 1; transform: none; }
}

/* ---- Product wordmark: every visible "Swat iQua Suite" (wrapped server-side by brand_highlight()) ---- */
.brand-name {
    white-space: nowrap; font-weight: 700; color: var(--navy);
    background: linear-gradient(180deg, transparent 52%, rgb(1 160 222 / 0.18) 52%, rgb(1 160 222 / 0.18) 92%, transparent 92%);
    padding-inline: 0.06em; border-radius: 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.brand-name__q { color: var(--blue); }
h1 .brand-name, h2 .brand-name, h3 .brand-name { font-weight: inherit; }
.d-hl .brand-name, .d-hl .brand-name__q, a .brand-name, a .brand-name__q, .eyebrow .brand-name, .eyebrow .brand-name__q { color: inherit; }
.btn .brand-name, .eyebrow .brand-name { background: none; padding: 0; }
.d-hero .brand-name, .d-cta .brand-name, .band-dark .brand-name, .site-footer .brand-name {
    color: #fff; background: linear-gradient(180deg, transparent 52%, rgb(1 160 222 / 0.34) 52%, rgb(1 160 222 / 0.34) 92%, transparent 92%);
}
.d-hero .brand-name__q, .d-cta .brand-name__q, .band-dark .brand-name__q, .site-footer .brand-name__q { color: var(--sky-text); }
.d-hero .d-hl .brand-name, .band-dark .d-hl .brand-name { color: inherit; }

/* <picture> wraps AVIF + WebP sources but never adds a box of its own (keeps every img layout unchanged). */
picture { display: contents; }
main:focus { outline: none; }
