/* ==========================================================================
   Core — reset, editorial primitives, utilities
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 20px);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
body.no-scroll { overflow: hidden; }

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-snug);
  color: var(--ink-900);
  text-wrap: balance;
}
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
figure { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 0; }
::selection { background: rgba(41,171,226,.24); color: var(--ink-900); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide { max-width: var(--container-wide); }
.container--text { max-width: var(--container-text); }

.section { padding-block: var(--section-y); position: relative; }
.section--tight { padding-block: var(--section-y-tight); }
.section--paper { background: var(--paper); }
.section--soft { background: var(--bg-alt); }
.section--tint { background: linear-gradient(180deg, var(--cyan-050), var(--paper) 72%); }
.section--deep { background: var(--deep); color: rgba(255,255,255,.76); }
.section--deep h1, .section--deep h2, .section--deep h3 { color: #fff; }
/* hairline rhythm: sections can be separated by a rule instead of a background */
.section--ruled { border-top: 1px solid var(--line); }

.grid { display: grid; gap: var(--s-8); }
.grid--2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 1000px) { .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 640px) { .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0,1fr); } }

.stack > * + * { margin-top: var(--s-4); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: center; }

/* ---------- Editorial section head: numbered label + rule ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--focal-ink);
  font-variant-numeric: tabular-nums;
}
.eyebrow::before {
  content: "";
  width: 34px; height: 1px;
  background: currentColor; opacity: .5;
}
.eyebrow--plain::before { display: none; }
.section--deep .eyebrow, .reach .eyebrow { color: var(--cyan); }

.section-head { max-width: 52rem; }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head--center .eyebrow { justify-content: center; }
.section-title {
  font-size: var(--fs-h2);
  letter-spacing: var(--ls-tight);
  line-height: var(--lh-tight);
  margin-top: var(--s-5);
}
.section-lede {
  margin-top: var(--s-5);
  font-size: var(--fs-md);
  line-height: var(--lh-loose);
  color: var(--text-muted);
  max-width: 44rem;
}
.section-head--center .section-lede { margin-inline: auto; }

.display { font-size: var(--fs-display); line-height: var(--lh-display); letter-spacing: var(--ls-display); font-weight: 600; }
.lede { font-size: var(--fs-lg); line-height: 1.55; color: var(--text-muted); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.numeric { font-variant-numeric: tabular-nums; letter-spacing: -0.03em; font-weight: 600; line-height: 1; }

/* label used for metadata rows */
.meta-label {
  font-size: var(--fs-label); letter-spacing: var(--ls-label);
  text-transform: uppercase; color: var(--text-soft); font-weight: 600;
}

/* ---------- Rules ---------- */
.rule { height: 1px; background: var(--line); }
.rule--invert { background: var(--line-invert); }

/* ---------- Links ---------- */
.link { position: relative; display: inline-flex; align-items: center; gap: var(--s-2); font-weight: 500; color: var(--focal-ink); }
.link::after {
  content: ""; position: absolute; left: 0; bottom: -2px; width: 100%; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: right;
  transition: transform var(--t-base) var(--ease-out);
}
.link:hover::after { transform: scaleX(1); transform-origin: left; }
.link svg { transition: transform var(--t-base) var(--ease-out); }
.link:hover svg { transform: translateX(4px); }

.u-link {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px; background-repeat: no-repeat; background-position: 0 100%;
  transition: background-size var(--t-base) var(--ease-out);
  padding-bottom: 2px;
}
.u-link:hover { background-size: 100% 1px; }

/* ---------- Decorative ---------- */
.mark-dots {
  --dot: 4px;
  width: calc(var(--dot) * 6); height: calc(var(--dot) * 4);
  background-image: radial-gradient(circle, var(--cyan) 1.2px, transparent 1.3px);
  background-size: var(--dot) var(--dot);
  opacity: .45; pointer-events: none;
}
/* fine measurement grid — echoes the VI hex field, reads as technical */
.grid-field {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(41,171,226,.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(41,171,226,.10) 1px, transparent 1px);
  background-size: 56px 56px;
}
.sr-only {
  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; border: 0;
}
.skip {
  position: absolute; left: -9999px; top: 0; z-index: var(--z-toast);
  background: var(--ink-900); color: #fff; padding: var(--s-3) var(--s-5);
}
.skip:focus { left: 0; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--paper-2); }
::-webkit-scrollbar-thumb { background: var(--ink-200); border: 3px solid var(--paper-2); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-300); }

/* index-numbered section marker, used across pages */
.index-mark {
  display: flex; align-items: baseline; gap: var(--s-4);
  font-family: var(--font-mono); font-size: var(--fs-label);
  letter-spacing: .16em; color: var(--text-soft);
  padding-bottom: var(--s-4); border-bottom: 1px solid var(--line);
  margin-bottom: var(--s-10);
}
.index-mark b { color: var(--cyan-700); font-weight: 600; }
