/* ==========================================================================
   Base — reset, document defaults, typography primitives, utilities
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--s-8);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: var(--t-base);
  line-height: var(--leading-body);
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

/* The browser's own [hidden] rule is a plain author-level `display: none`, so
   ANY rule of ours that sets a display — .field, a.card, .section — silently
   beats it and the element stays on screen. Everything on this site that hides
   and shows itself uses the hidden attribute, so this has to win outright. */
[hidden] { display: none !important; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: var(--leading-tight);
  margin: 0 0 var(--s-4);
  text-wrap: balance;
}
h1 { font-size: var(--t-4xl); }
h2 { font-size: var(--t-3xl); }
h3 { font-size: var(--t-xl); font-family: var(--font-ui); font-weight: 600;
     letter-spacing: -0.01em; }
h4 { font-size: var(--t-lg); font-family: var(--font-ui); font-weight: 600; }

p { margin: 0 0 var(--s-4); max-width: var(--measure); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent-bright); text-decoration-color: var(--border-gold);
    text-underline-offset: 0.22em; transition: color var(--dur-fast) var(--ease); }
a:hover { color: var(--c-gold-bright); text-decoration-color: currentColor; }

ul, ol { margin: 0 0 var(--s-4); padding-left: var(--s-5); }
li + li { margin-top: var(--s-2); }

hr {
  border: 0; height: 1px; margin: var(--s-7) 0;
  background: linear-gradient(90deg, transparent, var(--border-gold), transparent);
}

blockquote {
  margin: var(--s-6) 0; padding-left: var(--s-5);
  border-left: 2px solid var(--border-gold);
  font-family: var(--font-display); font-size: var(--t-xl);
  font-style: italic; color: var(--fg);
}

/* Focus — always visible, always gold. Never remove. */
:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

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

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

.wrap { width: min(100% - (var(--gutter) * 2), var(--width-page)); margin-inline: auto; }
.wrap--narrow { width: min(100% - (var(--gutter) * 2), var(--width-narrow)); }

.section { padding-block: var(--section-y); position: relative; }
.section--tint { background: linear-gradient(180deg, var(--c-ink), var(--c-navy-deep), var(--c-ink)); }

.stack > * + * { margin-top: var(--s-4); }
.stack-lg > * + * { margin-top: var(--s-6); }

.grid { display: grid; gap: var(--s-6); }
@media (min-width: 44rem) { .grid--2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 60rem) { .grid--3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 44rem) { .grid--4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 60rem) { .grid--4 { grid-template-columns: repeat(4, 1fr); } }

/* --- Type utilities ------------------------------------------------------- */

.eyebrow {
  font-family: var(--font-ui);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--s-3);
}

.lede { font-size: var(--t-lg); color: var(--fg); line-height: 1.6; }
.muted { color: var(--fg-muted); }
.faint { color: var(--fg-faint); font-size: var(--t-sm); }

/* Gold gradient lettering — the signature treatment of the site. */
.gilt {
  background: linear-gradient(178deg,
              var(--c-gold-bright) 0%,
              var(--c-gold) 46%,
              var(--c-gold-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
/* Fallback for engines without background-clip: text */
@supports not ((background-clip: text) or (-webkit-background-clip: text)) {
  .gilt { color: var(--c-gold); background: none; }
}

/* --- Accessibility helpers ------------------------------------------------ */

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

.skip-link {
  position: absolute; top: var(--s-3); left: var(--s-3);
  z-index: var(--z-skip);
  transform: translateY(-200%);
  background: var(--c-gold); color: var(--c-ink);
  padding: var(--s-3) var(--s-5);
  font-weight: 600; font-size: var(--t-sm);
  letter-spacing: var(--tracking-wide);
  text-decoration: none; border-radius: var(--radius);
  transition: transform var(--dur) var(--ease);
}
.skip-link:focus { transform: translateY(0); color: var(--c-ink); }

/* --- Spacing & alignment utilities ---------------------------------------
   These exist so no page needs an inline style attribute. The site's Content
   Security Policy deliberately omits 'unsafe-inline', which blocks style="".
   ------------------------------------------------------------------------- */

.mt-4 { margin-top: var(--s-4); }
.mt-6 { margin-top: var(--s-6); }
.mt-7 { margin-top: var(--s-7); }
.mt-8 { margin-top: var(--s-8); }
.mb-8 { margin-bottom: var(--s-8); }

.text-center   { text-align: center; }
.center-block  { margin-inline: auto; }

/* A centred section intro: eyebrow, heading and rule above a grid. */
.section-intro { text-align: center; margin-bottom: var(--s-8); }
.section-intro p { margin-inline: auto; }

/* A narrow lede that should not run the full reading measure. */
.lede--tight { max-width: 52ch; }

/* Full-viewport centred page, used by 404. */
.page-centre {
  min-height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
}

/* An empty-state row inside a table. */
.table-empty { text-align: center; padding: var(--s-7); }

/* A block that introduces a figure grid: no padding, extra space beneath. */
.block-intro { margin-bottom: var(--s-8); padding: 0; }
