/* ============================================================================
   Vantage — case study
   Swiss/editorial: one grid, generous air, hierarchy carried by type and space.

   Palette is measured, not chosen by eye. Every text tone below was checked
   against both grounds (#FAF9F7 page, #FFFFFF card) and clears WCAG AA for
   body copy; the two chart hues were validated for colour-vision deficiency
   (protan ΔE 19.0, normal ΔE 26.4) rather than assumed safe — a red/green
   pair was the first attempt and failed at ΔE 2.8.
   ========================================================================= */

:root {
  color-scheme: light;

  /* Ink — a warm near-black, so the page reads as paper rather than screen. */
  --ink:        #1A1714;  /* 16.96:1 */
  --ink-2:      #3D3833;  /* 11.02:1 */
  --muted:      #6B6259;  /*  5.68:1 */

  --paper:      #FAF9F7;
  --card:       #FFFFFF;
  --rule:       #E8E4DF;
  --rule-soft:  #F0EDE9;

  /* One accent, spent on emphasis and the cost side of every comparison. */
  --accent:     #B4491C;  /*  5.10:1 */
  --accent-sub: #FDF2EC;
  --blue:       #255C99;  /*  6.50:1 */
  --blue-sub:   #EDF3FA;

  --sans:  "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono:  "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Spacious scale — density dial at 2/10. */
  --s1: .5rem;  --s2: 1rem;   --s3: 1.5rem;  --s4: 2.5rem;
  --s5: 4rem;   --s6: 6rem;   --s7: 8rem;

  --measure: 68ch;
  --wide: 960px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.7;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
}

/* The browser surfaces you did not draw still belong to the design. */
::selection { background: #F6DCCB; color: var(--ink); }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------------------------------------------------------------- structure */

.wrap { width: min(100% - 2.5rem, var(--wide)); margin-inline: auto; }
.prose { max-width: var(--measure); }

section { padding-block: var(--s6); }
section + section { border-top: 1px solid var(--rule-soft); }

/* ---------------------------------------------------------------- masthead */

.masthead {
  background: color-mix(in oklab, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
/* Sticky only once it fits on one line. On a phone the nav wraps to three
   rows, and pinning ~150px of a 844px viewport to the top of a page whose
   whole job is reading costs more than the convenience returns. */
@media (min-width: 720px) {
  .masthead { position: sticky; top: 0; z-index: 20; }
}
.masthead__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3); min-height: 64px; flex-wrap: wrap;
}
.wordmark {
  font-family: var(--sans); font-weight: 700; font-size: .95rem;
  letter-spacing: -.01em; color: var(--ink); text-decoration: none;
  display: inline-flex; align-items: center; gap: .55rem;
}
.wordmark span {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); flex: none;
}
.masthead nav { display: flex; gap: var(--s3); flex-wrap: wrap; }
.masthead nav a {
  font-family: var(--sans); font-size: .875rem; font-weight: 500;
  color: var(--muted); text-decoration: none;
  padding-block: .35rem; border-bottom: 2px solid transparent;
  transition: color .2s ease, border-color .2s ease;
}
.masthead nav a:hover { color: var(--ink); }
.masthead nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* The one link that leaves the case study, so it does not wear the same
   clothes as the three that move within it — a section link underlines to
   say "you are here"; this one is an exit and says so by shape. */
.masthead nav a.live {
  color: var(--card); background: var(--ink);
  border: 1px solid var(--ink); border-bottom-color: var(--ink);
  border-radius: 999px; padding: .4rem .85rem;
  display: inline-flex; align-items: center; gap: .4rem;
  transition: background .2s ease, border-color .2s ease;
}
.masthead nav a.live:hover { background: var(--accent); border-color: var(--accent); color: var(--card); }
.masthead nav a.live svg { width: 13px; height: 13px; flex: none; }

/* -------------------------------------------------------------- typography */

h1, h2, h3, h4 {
  font-family: var(--sans);
  color: var(--ink);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -.025em;
  text-wrap: balance;
  margin: 0;
}
h1 { font-size: clamp(2.4rem, 1.4rem + 4vw, 4rem); }
h2 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.4rem); letter-spacing: -.02em; }
h3 { font-size: 1.2rem; letter-spacing: -.01em; line-height: 1.3; }
h4 { font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }

p { margin: 0 0 1.25em; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--ink); }

strong { font-weight: 600; color: var(--ink); }
em { font-style: italic; }

/* Generous above a heading, tight beneath it — the grouping rule of the page. */
.section-head { margin-bottom: var(--s4); max-width: var(--measure); }
.section-head h2 + p { margin-top: var(--s2); color: var(--muted); font-size: 1.2rem; }

.lede {
  font-size: clamp(1.2rem, 1.05rem + .6vw, 1.5rem);
  line-height: 1.55; color: var(--ink-2);
}

.tag {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .04em;
  color: var(--muted); background: var(--card);
  border: 1px solid var(--rule); border-radius: 3px;
  padding: .12em .45em; white-space: nowrap;
}

/* ------------------------------------------------------------------- hero */

.hero { padding-block: var(--s6) var(--s5); }
.hero h1 { max-width: 20ch; }
.hero .lede { margin-top: var(--s3); max-width: 60ch; }
.hero-meta {
  margin-top: var(--s4); padding-top: var(--s3);
  border-top: 1px solid var(--rule);
  display: flex; flex-wrap: wrap; gap: var(--s4) var(--s5);
  font-family: var(--sans); font-size: .875rem;
}
.hero-meta div { display: flex; flex-direction: column; gap: .2rem; }
.hero-meta dt, .hero-meta .k { color: var(--muted); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }
.hero-meta dd, .hero-meta .v { margin: 0; color: var(--ink); font-weight: 500; }

/* ------------------------------------------------------------------ pull */

.pull {
  margin: var(--s4) 0; padding-left: var(--s3);
  border-left: 2px solid var(--accent);
  max-width: 58ch;
}
.pull p {
  font-size: clamp(1.25rem, 1.1rem + .7vw, 1.6rem);
  line-height: 1.45; color: var(--ink); font-style: italic;
}
.pull cite {
  display: block; margin-top: .8rem; font-style: normal;
  font-family: var(--sans); font-size: .85rem; color: var(--muted);
}

.statement {
  background: var(--card); border: 1px solid var(--rule);
  border-radius: 6px; padding: var(--s4);
  max-width: var(--measure);
}
.statement p { font-size: 1.2rem; line-height: 1.6; }
.statement p:first-child { margin-top: 0; }

/* ------------------------------------------------------------------ lists */

/* The term column is fixed and the definition gets everything left, capped at
   a readable measure. Constraining the whole list to the prose measure and
   *then* spending 15rem of it on the term left definitions at 40ch — below
   the comfortable range, and worst on the longest entries. */
.facts { list-style: none; margin: 0; padding: 0; }
.facts > div {
  display: grid; grid-template-columns: minmax(0, 1fr);
  gap: .3rem; padding-block: var(--s3);
  border-top: 1px solid var(--rule);
}
.facts > div:last-child { border-bottom: 1px solid var(--rule); }
.facts dt, .facts .term {
  font-family: var(--sans); font-weight: 700; color: var(--ink); font-size: 1.05rem;
  line-height: 1.35; text-wrap: balance;
}
.facts dd, .facts .def { margin: 0; color: var(--ink-2); max-width: 64ch; }
@media (min-width: 800px) {
  .facts > div { grid-template-columns: 14rem minmax(0, 1fr); gap: var(--s4); align-items: start; }
}

/* ------------------------------------------------------------------ table */

.table-scroll { overflow-x: auto; margin-block: var(--s3); }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
caption {
  text-align: left; color: var(--muted); font-family: var(--sans);
  font-size: .85rem; padding-bottom: var(--s2);
}
th, td { text-align: left; vertical-align: top; padding: .85rem 1.1rem .85rem 0; }
thead th {
  font-family: var(--sans); font-size: .75rem; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--rule);
  padding-bottom: .6rem;
}
tbody tr { border-bottom: 1px solid var(--rule-soft); }
tbody th { font-family: var(--sans); font-weight: 600; color: var(--ink); }
td .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.delta { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 500; }
.delta--up { color: var(--blue); }
.delta--down { color: var(--accent); }

/* ------------------------------------------------------------------ chart */

.figure { margin: var(--s4) 0 0; }
.figure figcaption {
  font-family: var(--sans); font-size: .85rem; color: var(--muted);
  margin-top: var(--s2); max-width: 60ch;
}
.chart-legend {
  display: flex; flex-wrap: wrap; gap: var(--s3);
  font-family: var(--sans); font-size: .85rem; margin-bottom: var(--s2);
}
.chart-legend span { display: inline-flex; align-items: center; gap: .5rem; color: var(--ink-2); }
.swatch { width: 22px; height: 0; border-top-width: 2.5px; flex: none; }
.swatch--now { border-top: 2.5px solid var(--accent); }
.swatch--next { border-top: 2.5px dashed var(--blue); }
.chart { width: 100%; height: auto; display: block; overflow: visible; }

/* ------------------------------------------------------------------ panels */

.panels { display: grid; gap: var(--s2); margin-top: var(--s3); }
@media (min-width: 640px) { .panels { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .panels { grid-template-columns: repeat(3, 1fr); } }
.panel {
  background: var(--card); border: 1px solid var(--rule);
  border-radius: 6px; padding: var(--s3);
  display: flex; flex-direction: column; gap: .5rem;
}
.panel__n {
  font-family: var(--mono); font-size: .75rem; color: var(--muted);
  display: flex; align-items: center; justify-content: space-between;
}
.panel__score { font-weight: 700; }
.panel--now .panel__score { color: var(--accent); }
.panel--next .panel__score { color: var(--blue); }
.panel h3 { font-size: 1rem; }
.panel p { font-size: .95rem; color: var(--muted); margin: 0; }

/* ------------------------------------------------------------------- misc */

.two-col { display: grid; gap: var(--s4); }
@media (min-width: 900px) { .two-col { grid-template-columns: 1fr 1fr; gap: var(--s5); } }

.note {
  font-size: .95rem; color: var(--muted);
  border-left: 2px solid var(--rule); padding-left: var(--s2);
  max-width: 60ch;
}

.pager {
  display: flex; justify-content: space-between; gap: var(--s3);
  flex-wrap: wrap; padding-block: var(--s5);
  border-top: 1px solid var(--rule);
}
.pager a {
  font-family: var(--sans); font-weight: 600; text-decoration: none;
  color: var(--ink); display: flex; flex-direction: column; gap: .15rem;
}
.pager a span { font-size: .78rem; color: var(--muted); font-weight: 500; letter-spacing: .06em; text-transform: uppercase; }
.pager a:hover { color: var(--accent); }

footer.site {
  border-top: 1px solid var(--rule); padding-block: var(--s4);
  font-family: var(--sans); font-size: .82rem; color: var(--muted);
}

.skip {
  position: absolute; left: -9999px;
  background: var(--ink); color: var(--paper);
  padding: .7rem 1rem; border-radius: 0 0 4px 0; z-index: 50;
  font-family: var(--sans); font-size: .875rem;
}
.skip:focus { left: 0; top: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
