/* ==========================================================================
   Base — reset, typography rhythm, landmarks, focus, containers, utilities.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
[hidden] { display: none !important; }

html {
  color-scheme: light;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font-ui);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  color: var(--ink);
  background: var(--bg-page);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--selection); }

img, svg, video, picture { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }

/* ------------------------------------------------------------ headings --- */
h1, h2, h3, h4 {
  font-weight: 620;
  line-height: var(--leading-heading);
  color: var(--ink-strong);
  letter-spacing: -0.015em;
  text-wrap: balance;
}
h1 { font-size: var(--text-h1); }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); }
h4 { font-size: var(--text-h4); }

p { text-wrap: pretty; }

a {
  color: var(--link);
  text-decoration: none;
  text-underline-offset: 3px;
}
a:hover { text-decoration: underline; }

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.86em;
}

/* --------------------------------------------------------------- focus --- */
:focus { outline: none; }
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--r-ctl);
  position: relative;
  z-index: 1;
}
.on-night :focus-visible { box-shadow: var(--focus-ring-night); }

.skip-link {
  position: absolute;
  left: 16px;
  top: -64px;
  z-index: calc(var(--z-nav) + 1);
  padding: 12px 18px;
  border-radius: var(--r-ctl);
  background: var(--bg-raise);
  color: var(--ink-strong);
  font-weight: 600;
  box-shadow: var(--e-2);
  transition: top var(--t-fast) var(--ease);
}
.skip-link:focus-visible { top: 16px; text-decoration: none; }

/* ---------------------------------------------------------- containers --- */
.container { width: min(var(--w-content), 100% - 48px); margin-inline: auto; }
.container-wide { width: min(var(--w-wide), 100% - 48px); margin-inline: auto; }
.container-text { width: min(var(--w-text), 100% - 48px); margin-inline: auto; }
@media (max-width: 640px) {
  .container, .container-wide, .container-text { width: calc(100% - 40px); }
}

.section { padding-block: var(--section-y); }
.section-tight { padding-block: calc(var(--section-y) * 0.62); }

/* ------------------------------------------------------- section header --- */
.section-head { max-width: 720px; margin-bottom: var(--s-7); }
.section-head.center { margin-inline: auto; text-align: center; }
.overline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-micro);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--cobalt);
  margin-bottom: var(--s-4);
}
.overline::before {
  content: "";
  width: 20px;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
  opacity: 0.7;
}
.section-head .lede,
.lede {
  font-size: var(--text-body-lg);
  color: var(--ink-soft);
  margin-top: var(--s-4);
  max-width: 62ch;
}
.section-head.center .lede { margin-inline: auto; }
h2 .em, h1 .em { color: var(--cobalt); }

/* editorial display (hero, closing, auth) */
.display {
  font-family: var(--font-display);
  font-weight: 540;
  letter-spacing: -0.01em;
  line-height: var(--leading-tight);
  text-wrap: balance;
}

/* ------------------------------------------------------------- utility --- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.text-soft { color: var(--ink-soft); }
.text-small { font-size: var(--text-small); }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }

/* --------------------------------------------------------- night bands --- */
.on-night {
  background: var(--night);
  color: var(--night-ink);
}
.on-night h2, .on-night h3, .on-night h4 { color: #FFFFFF; }
.on-night .lede, .on-night .text-soft { color: var(--night-soft); }
.on-night a { color: #A9C4F8; }

/* ------------------------------------------------------ reveal on scroll -- */
.reveal { opacity: 0; transform: translateY(14px); }
.reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease);
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* --------------------------------------------------------- scrollbars ---- */
.scroll-x { overflow-x: auto; scrollbar-width: thin; }
.scroll-x:focus-visible { box-shadow: var(--focus-ring); }
