/* ==========================================================================
   Base: reset, typography, layout primitives, atmosphere
   ========================================================================== */

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

* { margin: 0; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 6rem;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: var(--step-0);
    font-weight: 400;
    line-height: 1.6;
    font-optical-sizing: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 100dvh;
}

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

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

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

/* --- Atmosphere: film grain over the whole page -----------------------
   The dark would read flat and cheap without it. This is the one texture
   that makes the charcoal feel like charcoal.
   ------------------------------------------------------------------- */
body::after {
    content: "";
    position: fixed;
    inset: -50%;
    z-index: var(--z-grain);
    pointer-events: none;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
    will-change: transform;
    animation: grain 7s steps(1) infinite;
}

@keyframes grain {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-2%, -3%); }
    20% { transform: translate(-4%, 2%); }
    30% { transform: translate(2%, -4%); }
    40% { transform: translate(-1%, 3%); }
    50% { transform: translate(-3%, 1%); }
    60% { transform: translate(3%, 0); }
    70% { transform: translate(0, 2%); }
    80% { transform: translate(1%, -1%); }
    90% { transform: translate(-2%, 2%); }
}

@media (prefers-reduced-motion: reduce) {
    body::after { animation: none; }
}

/* --- Typography ------------------------------------------------------- */

.display,
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    overflow-wrap: break-word;
    min-width: 0;
    font-weight: 700;
    line-height: 0.95;
    letter-spacing: var(--track-display);
    text-transform: uppercase;
    text-wrap: balance;
}

h1 { font-size: var(--step-6); }
h2 { font-size: var(--step-5); }
h3 { font-size: var(--step-3); line-height: 1.05; }
h4 { font-size: var(--step-2); line-height: 1.1; letter-spacing: var(--track-heading); }
h5, h6 { font-size: var(--step-0); letter-spacing: var(--track-label); }

.display--hero {
    font-size: var(--step-7);
    line-height: 0.86;
}

.display--xl { font-size: var(--step-6); }
.display--lg { font-size: var(--step-5); }
.display--md { font-size: var(--step-4); }

p { text-wrap: pretty; }

.lede {
    font-size: var(--step-2);
    line-height: 1.5;
    color: var(--bone);
    max-width: 46ch;
}

.prose { max-width: var(--measure); }
.prose > * + * { margin-top: var(--space-5); }
.prose a { color: var(--brass-light); text-underline-offset: 0.2em; }

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

/* Eyebrow: small, wide, brass. The label that sits above every section. */
.eyebrow {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: var(--step--2);
    letter-spacing: var(--track-eyebrow);
    text-transform: uppercase;
    color: var(--brass);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.eyebrow--plain { display: block; }

/* The numeral marker. 01, 02, 03. This is the broadcast detail. */
.marker {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: var(--step--2);
    letter-spacing: 0.1em;
    color: var(--brass);
    font-variant-numeric: tabular-nums;
}

.label {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--step--2);
    letter-spacing: var(--track-label);
    text-transform: uppercase;
}

/* --- Links ------------------------------------------------------------ */

a { color: inherit; text-decoration-thickness: 1px; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--brass);
    outline-offset: 3px;
    border-radius: var(--radius-1);
}

/* Brass underline that wipes in from the left. */
.link-wipe {
    position: relative;
    text-decoration: none;
    padding-bottom: 2px;
}

.link-wipe::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background: var(--brass);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--dur-base) var(--ease-out);
}

.link-wipe:hover::after,
.link-wipe:focus-visible::after { transform: scaleX(1); }

/* --- Layout primitives ------------------------------------------------ */

.shell {
    width: 100%;
    min-width: 0;
    max-width: var(--shell);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.shell--narrow { max-width: var(--shell-narrow); }
.shell--wide { max-width: 1600px; }

.section { padding-block: var(--section-y); position: relative; }
.section--tight { padding-block: calc(var(--section-y) * 0.55); }
.section--flush-top { padding-top: 0; }

.section--paper {
    background: var(--paper);
    color: var(--ink);
}

.section--paper .eyebrow,
.section--paper .marker { color: var(--brass-deep); }

.section--paper .muted { color: var(--ink-dim); }

.stack > * + * { margin-top: var(--flow, var(--space-5)); }
.stack--tight { --flow: var(--space-3); }
.stack--loose { --flow: var(--space-7); }

.cluster {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    gap: var(--space-4);
    align-items: center;
}

.grid { display: grid; gap: var(--space-6); }
.grid > * { min-width: 0; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }

/* The brass hairline. Used instead of boxes wherever possible. */
.rule {
    height: 1px;
    background: linear-gradient(90deg, var(--brass) 0%, var(--ash-line) 60%, transparent 100%);
    border: 0;
}

.rule--faint { background: var(--ash-line); }
.rule--full { background: var(--ash-line); }

/* Section head: marker, eyebrow and rule on one line. */
.section-head {
    display: grid;
    gap: var(--space-4);
    margin-bottom: var(--space-7);
}

.section-head__top {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.section-head__top .rule { flex: 1; }

/* --- Ember glow. Warm bloom so the dark never goes flat. ------------- */
.glow {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.glow::before {
    content: "";
    position: absolute;
    width: 90vw;
    max-width: 1100px;
    aspect-ratio: 1;
    left: 50%;
    top: 50%;
    translate: -50% -50%;
    background: radial-gradient(circle, rgb(200 145 47 / 0.13) 0%, rgb(192 52 31 / 0.06) 38%, transparent 68%);
    filter: blur(30px);
}

.glow--top::before { top: 0; }
.glow--left::before { left: 10%; }
.glow--ember::before {
    background: radial-gradient(circle, rgb(192 52 31 / 0.16) 0%, rgb(140 100 32 / 0.07) 40%, transparent 70%);
}

.section > .shell { position: relative; z-index: 1; }

/* --- Reveal on scroll -------------------------------------------------- */
[data-reveal] {
    opacity: 0;
    transform: translateY(28px);
    transition:
        opacity var(--dur-reveal) var(--ease-out),
        transform var(--dur-reveal) var(--ease-out);
    transition-delay: var(--reveal-delay, 0ms);
}

[data-reveal].is-revealed {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    [data-reveal] { opacity: 1; transform: none; }
}

/* --- Utilities --------------------------------------------------------- */

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

.skip-link {
    position: absolute;
    top: 0; left: 50%;
    translate: -50% -120%;
    z-index: var(--z-modal);
    background: var(--brass);
    color: var(--smoke);
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-display);
    font-size: var(--step--2);
    letter-spacing: var(--track-label);
    text-transform: uppercase;
    text-decoration: none;
    transition: translate var(--dur-base) var(--ease-out);
}

.skip-link:focus { translate: -50% 0; }

.text-center { text-align: center; }
.text-brass { color: var(--brass); }
.text-ember { color: var(--ember-light); }
.text-sage { color: var(--sage-light); }
.nowrap { white-space: nowrap; }
.full-bleed { width: 100vw; margin-inline: calc(50% - 50vw); }

/* A short rule beside an eyebrow. Fixed at desktop, shrinks on a phone so the
   phrase beside it keeps its line. */
.rule--short {
    width: 3rem;
    flex: none;
}

@media (max-width: 560px) {
    .rule--short {
        width: auto;
        flex: 1 1 1rem;
        min-width: 0.75rem;
    }
}
