/* ==========================================================================
   GATE CAPITAL — V3 REFINED
   01 · FOUNDATIONS — Reset, typography primitives, layout stages
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* header + rail must not cover the target of an anchor jump */
  scroll-padding-top: calc(var(--header-h) + var(--rail-h) + var(--s-6));
  /* `clip`, not `hidden`: the atmospheric fields deliberately bleed past the
     right edge, and `hidden` would turn that bleed into a scrollable area. */
  overflow-x: clip;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  letter-spacing: var(--tr-normal);
  font-weight: var(--fw-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1, "liga" 1;
  overflow-x: clip;
  transition: background-color var(--dur-3) var(--ease-out),
              color var(--dur-3) var(--ease-out);
}
body.is-locked { overflow-y: hidden; }  /* keep overflow-x: clip */

img, svg, video { display: block; max-width: 100%; }
[hidden] { display: none !important; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}
button { background: none; border: 0; padding: 0; cursor: pointer; }

a { color: var(--c-text-link); text-decoration: none; }

/* Focus — one visible, consistent ring across every interactive element */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

::selection { background: var(--c-accent); color: #fff; }

/* --------------------------------------------------------------------------
   TYPOGRAPHY PRIMITIVES
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: var(--fw-bold); }
p { margin: 0; }

.display-1, .display-2, .display-3 {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);   /* V3 is Outfit SemiBold, not ExtraBold */
  line-height: var(--lh-display);
  letter-spacing: var(--tr-display);
  text-wrap: balance;
}
.display-1 { font-size: var(--t-d1); }
.display-2 { font-size: var(--t-d2); }
.display-3 { font-size: var(--t-d3); line-height: var(--lh-tight); }

.heading-1 { font-size: var(--t-h1); font-weight: var(--fw-semibold); line-height: 1.15; letter-spacing: var(--tr-tight); }
.heading-2 { font-size: var(--t-h2); font-weight: var(--fw-semibold); line-height: 1.27; letter-spacing: var(--tr-tight); }
.heading-3 { font-size: var(--t-h3); font-weight: var(--fw-semibold); line-height: var(--lh-snug); }
.heading-4 { font-size: var(--t-h4); font-weight: var(--fw-semibold); line-height: var(--lh-snug); }

.lead {
  font-size: clamp(1rem, 0.94rem + 0.28vw, 1.125rem);   /* V3 lead: 18px */
  line-height: 1.5;
  color: var(--c-text-secondary);
  text-wrap: pretty;
}
.body    { font-size: var(--t-body); line-height: 1.5;  color: var(--c-text-secondary); text-wrap: pretty; }
.body-sm { font-size: var(--t-sm);   line-height: 1.5;  color: var(--c-text-secondary); text-wrap: pretty; }
.caption { font-size: var(--t-xs);   line-height: var(--lh-snug); color: var(--c-text-muted); }
.micro   { font-size: var(--t-2xs);  line-height: var(--lh-snug); color: var(--c-text-muted); }

.measure         { max-width: var(--stage-reading); }
.measure-wide    { max-width: 78ch; }

/* Eyebrow — the "• Label" section marker that runs through all of V3.
   V3 spec: Outfit SemiBold 16/20, #111, sentence case, literal bullet. */
.eyebrow {
  display: inline-flex;
  align-items: baseline;
  gap: var(--s-2);
  font-size: var(--t-eyebrow);
  font-weight: var(--fw-semibold);
  line-height: 1.25;
  letter-spacing: var(--tr-normal);
  color: var(--c-text);
}
.eyebrow::before { content: "\2022"; flex: none; }
.eyebrow--verify { color: var(--c-verify); }
.eyebrow--on-dark { color: rgba(255,255,255,0.86); }

/* Caps badge — the one genuinely uppercase label in V3 (e.g. "PLAN") */
.caps {
  font-size: var(--t-3xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tr-caps);
  text-transform: uppercase;
}

/* Ledger figures — tabular, tight, used for all financial evidence */
.figure-xl, .figure-lg, .figure-md {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);   /* V3 stat figures are SemiBold */
  letter-spacing: -0.03em;           /* V3: -1.44px at 48px */
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "kern" 1;
  color: var(--c-text);
}
.figure-xl { font-size: var(--t-fig-xl); }
.figure-lg { font-size: var(--t-fig-lg); }
.figure-md { font-size: var(--t-fig-md); letter-spacing: var(--tr-tight); }

.mono {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0;
  font-variant-ligatures: none;
}

.text-muted   { color: var(--c-text-muted); }
.text-faint   { color: var(--c-text-faint); }
.text-verify  { color: var(--c-verify); }
.text-accent  { color: var(--c-accent-text); }

/* --------------------------------------------------------------------------
   LAYOUT STAGES
   Four widths, used deliberately to vary the page's rhythm.
   -------------------------------------------------------------------------- */
.stage {
  width: 100%;
  max-width: var(--stage-max);
  margin-inline: auto;
  padding-inline: var(--page-gutter);
}
.stage--wide    { max-width: var(--stage-wide); }
.stage--narrow  { max-width: var(--stage-narrow); }
.stage--reading { max-width: calc(var(--stage-reading) + var(--page-gutter) * 2); }
.stage--flush   { padding-inline: 0; }

.section { position: relative; padding-block: var(--sec-pad-normal); }
.section--tight { padding-block: var(--sec-pad-tight); }
.section--loose { padding-block: var(--sec-pad-loose); }
.section--alt   { background: var(--c-bg-alt); }

/* Evidence sections — V2 restraint applied inside V3.
   Quieter ground, hairline structure, no atmosphere, reduced type contrast. */
.section--evidence {
  background: var(--c-bg-alt);
  border-block: 1px solid var(--c-rule);
}
.section--evidence .display-2 { font-size: var(--t-d3); letter-spacing: var(--tr-tight); }

.rule { height: 1px; border: 0; margin: 0; background: var(--c-rule); }

/* 12-column grid */
.grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr));
  gap: var(--grid-gutter);
}
.col-3  { grid-column: span 3; }
.col-4  { grid-column: span 4; }
.col-5  { grid-column: span 5; }
.col-6  { grid-column: span 6; }
.col-7  { grid-column: span 7; }
.col-8  { grid-column: span 8; }
.col-12 { grid-column: span 12; }

.stack     { display: flex; flex-direction: column; }
.stack-2   { gap: var(--s-2); }
.stack-3   { gap: var(--s-3); }
.stack-4   { gap: var(--s-4); }
.stack-5   { gap: var(--s-5); }
.stack-6   { gap: var(--s-6); }
.stack-8   { gap: var(--s-8); }
.stack-10  { gap: var(--s-10); }
.stack-12  { gap: var(--s-12); }
.row       { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--tight   { gap: var(--s-2); }

/* Section header — one consistent construction everywhere */
.sec-head { display: flex; flex-direction: column; gap: var(--s-4); }
.sec-head--center { align-items: center; text-align: center; }
.sec-head--center .lead { max-width: 62ch; }
.sec-head--split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(var(--s-8), 5vw, var(--s-24));
  align-items: end;
}

/* --------------------------------------------------------------------------
   ATMOSPHERE
   The violet / pink / blue fields behind expressive sections.
   Rules: max one field per section, never behind a data table,
   never with a hard edge, always below content.
   -------------------------------------------------------------------------- */
.atmos { position: relative; isolation: isolate; }
.atmos > * { position: relative; z-index: 1; }
.atmos::before {
  content: "";
  position: absolute;
  z-index: 0;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(90px);
  opacity: var(--atm-opacity);
}
.atmos--hero::before {
  inset: -14% 8% auto -12%;
  height: 118%;
  background:
    radial-gradient(46% 52% at 32% 42%, var(--atm-violet) 0%, transparent 72%),
    radial-gradient(40% 44% at 62% 62%, var(--atm-pink) 0%, transparent 70%),
    radial-gradient(36% 40% at 12% 74%, var(--atm-blue) 0%, transparent 72%);
}
.atmos--left::before {
  inset: 4% auto -18% -22%;
  width: 62%; height: 88%;
  background: radial-gradient(50% 50% at 50% 50%, var(--atm-violet) 0%, transparent 72%),
              radial-gradient(40% 40% at 66% 70%, var(--atm-pink) 0%, transparent 72%);
}
.atmos--right::before {
  inset: -8% -18% auto auto;
  width: 58%; height: 90%;
  background: radial-gradient(50% 50% at 50% 50%, var(--atm-blue) 0%, transparent 74%),
              radial-gradient(42% 42% at 34% 66%, var(--atm-violet) 0%, transparent 74%);
}
.atmos--center::before {
  inset: -6% 12% auto 12%;
  height: 84%;
  background: radial-gradient(46% 50% at 50% 46%, var(--atm-pink) 0%, transparent 74%),
              radial-gradient(40% 44% at 24% 60%, var(--atm-violet) 0%, transparent 74%);
}

/* Scroll-reveal — entrance only, never gates content.
   Content is fully readable with JS disabled. */
.reveal { opacity: 0; transform: translateY(14px); }
.reveal.is-in {
  opacity: 1; transform: none;
  transition: opacity var(--dur-4) var(--ease-out),
              transform var(--dur-4) var(--ease-out);
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}
.no-js .reveal { opacity: 1; transform: none; }

/* Visually hidden but readable by assistive tech.
   `contain: strict` keeps it from contributing to any ancestor's scroll
   area even when its containing block sits outside a scroll container. */
.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 link */
.skip-link {
  position: absolute; top: var(--s-3); left: var(--s-3);
  z-index: 200;
  padding: var(--s-3) var(--s-5);
  background: var(--c-btn-primary-bg);
  color: var(--c-btn-primary-text);
  border-radius: var(--r-pill);
  font-size: var(--t-sm); font-weight: var(--fw-semibold);
  transform: translateY(-160%);
  transition: transform var(--dur-2) var(--ease-out);
}
.skip-link:focus-visible { transform: none; }
