/* ==========================================================================
   Reset, elements, layout primitives
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6.5rem;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background: var(--obsidian);
  color: var(--text-on-dark);
  font-family: var(--font-ui);
  font-size: var(--step-0);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* The sticky mobile action bar sits over the page; reserve its height. */
@media (max-width: 768px) {
  body { padding-bottom: calc(var(--mobile-bar-h) + env(safe-area-inset-bottom, 0px)); }
}

img, picture, svg, video, canvas { display: block; max-width: 100%; }
img, video { height: auto; }

input, button, textarea, select { font: inherit; color: inherit; }

button { background: none; border: 0; cursor: pointer; }

ul, ol { padding: 0; list-style: none; }

a { color: inherit; text-decoration: none; }

:target { scroll-margin-top: 7rem; }

/* ---- headings ---------------------------------------------------------- */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: -.02em;
  text-wrap: balance;
}

h1 { font-size: var(--step-5); }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-2); line-height: var(--lh-snug); }
h4 { font-size: var(--step-1); line-height: var(--lh-snug); }

h1 em, h2 em, h3 em {
  font-style: italic;
  color: var(--gold);
}

p { text-wrap: pretty; }

strong { font-weight: 600; color: var(--paper); }

/* ---- focus ------------------------------------------------------------- */

:focus { outline: none; }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -100px;
  z-index: var(--z-toast);
  padding: var(--sp-3) var(--sp-5);
  background: var(--gold);
  color: var(--obsidian);
  font-weight: 600;
  font-size: var(--step--1);
  border-radius: var(--r-md);
  transition: top var(--t-base) var(--ease-out);
}

.skip-link:focus { top: var(--sp-4); }

/* ---- selection --------------------------------------------------------- */

::selection { background: var(--gold); color: var(--obsidian); }

/* ---- scrollbar --------------------------------------------------------- */

@supports selector(::-webkit-scrollbar) {
  ::-webkit-scrollbar { width: 11px; height: 11px; }
  ::-webkit-scrollbar-track { background: var(--obsidian); }
  ::-webkit-scrollbar-thumb {
    background: var(--graphite);
    border: 3px solid var(--obsidian);
    border-radius: var(--r-pill);
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--gold-deep); }
}

/* ==========================================================================
   Layout primitives
   ========================================================================== */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.shell--narrow { max-width: var(--shell-narrow); }

.section {
  position: relative;
  padding-block: var(--section-y);
  isolation: isolate;
}

/* Alternating obsidian / ivory rhythm. */
.section--dark { background: var(--obsidian); }
.section--deep { background: var(--obsidian-soft); }

.section--light {
  background: var(--ivory);
  color: var(--text-on-light);
}

.section--light h1, .section--light h2,
.section--light h3, .section--light h4 { color: var(--text-on-light); }

.section--light .lede,
.section--light p { color: var(--muted-on-light); }

.section--light strong { color: var(--text-on-light); }

/* Hairline ledger grid behind dark sections. */
.section--grid::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, var(--gold) 1px, transparent 1px),
    linear-gradient(to bottom, var(--gold) 1px, transparent 1px);
  background-size: 76px 76px;
  opacity: .04;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 20%, transparent 78%);
  pointer-events: none;
}

.section--grain::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: url("/assets/img/grain.png");
  opacity: .22;
  mix-blend-mode: overlay;
  pointer-events: none;
}

.stack > * + * { margin-top: var(--sp-5); }
.stack-sm > * + * { margin-top: var(--sp-3); }
.stack-lg > * + * { margin-top: var(--sp-7); }

.grid { display: grid; gap: var(--sp-6); }

@media (min-width: 720px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1100px) {
  .grid--4 { grid-template-columns: repeat(4, 1fr); }
}

/* Below-fold sections can skip layout until scrolled near. */
.defer-render {
  content-visibility: auto;
  contain-intrinsic-size: auto 720px;
}

/* ---- shared type helpers ---------------------------------------------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--font-ui);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: var(--sp-4);
}

.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  flex: none;
  background: var(--gold);
}

.eyebrow--center { justify-content: center; }

.lede {
  font-size: var(--step-1);
  line-height: 1.62;
  color: var(--muted-on-dark);
  max-width: var(--measure);
}

.prose { max-width: var(--measure); }
.prose > * + * { margin-top: var(--sp-5); }
.prose h2 { margin-top: var(--sp-8); }
.prose h3 { margin-top: var(--sp-7); }

.prose ul { display: grid; gap: var(--sp-3); }

.prose ul li {
  position: relative;
  padding-left: var(--sp-5);
}

.prose ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .72em;
  width: 8px;
  height: 1px;
  background: var(--gold);
}

.prose a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color var(--t-micro) var(--ease-out);
}

.prose a:hover { color: var(--gold-lit); }

.text-center { text-align: center; }

.section-head {
  max-width: 720px;
  margin-bottom: var(--sp-8);
}

.section-head > h2 + .lede,
.section-head > h1 + .lede { margin-top: var(--sp-5); }

.section-head--center {
  margin-inline: auto;
  text-align: center;
}

.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;
}
