/* FynSig — the whole site's styling.
   Colours and type follow the FynSig deck; see CLAUDE.md for the two
   deliberate divergences (--eyebrow, and the dark theme, which the deck has no equivalent of). */

@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-700-latin.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Open Sans";
  src: url("../fonts/opensans-var-latin.woff2") format("woff2-variations");
  font-weight: 300 800; /* one variable file covers body 400 and semibold 600 */
  font-style: normal;
  font-display: swap;
}

/* ------------------------------------------------------------------ tokens */

:root {
  /* Deck palette, sampled from the pitch deck. */
  --ink: #1f4650;
  --body: #33403c;
  --green: #6e9b6e;   /* brand green: chart series, rules, large text */
  --eyebrow: #557c55; /* darkened for small text: 4.64:1 on --page */
  --card: #dce8de;
  --page: #fbfcfb;
  --axis: #8a9a92;
  --accent: #9b2c2c;

  /* Pipeline stages, dark to light. */
  --stage-1: #1f4650;
  --stage-2: #2e5f6b;
  --stage-3: #3e7a63;
  --stage-4: #55865a;
  --on-stage: #dce8de;

  --ours: #2e5f6b;    /* links, buttons, focus rings */

  --rule: color-mix(in srgb, var(--axis) 35%, transparent);
  --shadow: 0 1px 2px rgb(31 70 80 / 6%), 0 6px 20px rgb(31 70 80 / 6%);

  --head: "Montserrat", "Open Sans", system-ui, sans-serif;
  --text: "Open Sans", system-ui, sans-serif;

  --s1: 0.5rem;
  --s2: 0.875rem;
  --s3: 1.5rem;
  --s4: 2.5rem;
  --s5: 4rem;
  --s6: 6rem;

  --r-card: 12px;
  --r-pill: 999px;
  --measure: 62ch;
  --wrap: 68rem;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* The deck only ever appears on white, so this theme is new work, not sampled.
       Every pair below is checked at >= 4.5:1 for text and >= 3:1 for marks. */
    --ink: #dce8de;
    --body: #b8c7c0;
    --green: #8fba8a;
    --eyebrow: #8fba8a;
    --card: #1a2b2e;
    --page: #0f1b1f;
    --axis: #6b7f79;
    --accent: #e06b6b;

    --stage-1: #16323a;
    --stage-2: #24505c;
    --stage-3: #2f6650;
    --stage-4: #406b48;
    --on-stage: #dce8de;

    --ours: #5fa3b5;

    --rule: color-mix(in srgb, var(--axis) 40%, transparent);
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 6px 20px rgb(0 0 0 / 25%);

    color-scheme: dark;
  }
}

/* ------------------------------------------------------------------- reset */

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

body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, fieldset { margin: 0; }
fieldset { border: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  background: var(--page);
  color: var(--body);
  font-family: var(--text);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; height: auto; }

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

:focus-visible {
  outline: 3px solid var(--ours);
  outline-offset: 3px;
  border-radius: 3px;
}

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

h1, h2, h3, .stat-n {
  font-family: var(--head);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.15;
  text-wrap: balance;
}

h1 { font-size: clamp(2.1rem, 1.45rem + 2.9vw, 3.4rem); letter-spacing: -0.015em; }
h2 { font-size: clamp(1.55rem, 1.25rem + 1.35vw, 2.2rem); letter-spacing: -0.01em; }
h3 { font-size: clamp(1.05rem, 1rem + 0.25vw, 1.2rem); }

p { text-wrap: pretty; }
p + p { margin-top: var(--s2); }

.eyebrow {
  font-family: var(--head);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--eyebrow);
  margin-bottom: var(--s1);
}

.lede {
  font-size: clamp(1.08rem, 1rem + 0.45vw, 1.3rem);
  line-height: 1.55;
  max-width: var(--measure);
}

/* ------------------------------------------------------------------ layout */

.wrap { width: min(100% - 2rem, var(--wrap)); margin-inline: auto; }
@media (min-width: 40rem) { .wrap { width: min(100% - 4rem, var(--wrap)); } }

/* Top-level sections are the page's chapters and carry the rules between them. A chapter can
   hold several parts (nested sections), which are spaced apart but not ruled off. */
main > section { padding-block: var(--s5); }
main > section + section { border-top: 1px solid var(--rule); }
.part + .part { margin-top: var(--s6); }

.head { max-width: var(--measure); margin-bottom: var(--s4); }
.head p { margin-top: var(--s2); }

.skip {
  position: absolute;
  left: -9999px;
  background: var(--ink);
  color: var(--page);
  padding: var(--s1) var(--s3);
  border-radius: 0 0 var(--r-card) 0;
  z-index: 10;
}
.skip:focus { left: 0; top: 0; }

/* ------------------------------------------------------------------ header */

.site-head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-head > .wrap {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 4.25rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--head);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
  margin-inline-end: auto;
}
.brand img { width: 2rem; height: auto; }
@media (prefers-color-scheme: dark) {
  /* The emblem's teal end goes muddy on a dark page; lift it rather than reship the art. */
  .brand img, .lockup img { filter: brightness(1.4) saturate(1.05); }
}

.nav { display: flex; align-items: center; gap: clamp(0.75rem, 2.5vw, 1.6rem); }
.nav a {
  color: var(--body);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] {
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--green);
}

/* Phones: brand, nav and button must share one row. Tighter gaps and a smaller button fit it
   down to a 320px screen; wrapping put the button alone on a second row. */
@media (max-width: 30rem) {
  .site-head > .wrap { flex-wrap: nowrap; gap: var(--s2); min-height: 3.75rem; }
  .brand { font-size: 1.05rem; gap: 0.45rem; }
  .brand img { width: 1.75rem; }
  .nav { gap: 0.75rem; }
  .nav a { font-size: 0.9rem; }
  .site-head .btn { font-size: 0.85rem; padding: 0.5rem 0.85rem; white-space: nowrap; }
}
/* Below 360px there is no room for the wordmark too; the emblem stays, and the name stays
   readable to screen readers (the emblem's alt is empty, so the span is the link's name). */
@media (max-width: 22.4rem) {
  .brand span {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--head);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.6rem 1.15rem;
  border-radius: var(--r-pill);
  background: var(--ours);
  color: var(--page);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s ease, transform 0.15s ease;
}
.btn:hover { background: var(--ink); color: var(--page); transform: translateY(-1px); }

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

.hero { padding-block: clamp(var(--s4), 8vw, var(--s6)); }
.hero h1 { margin-bottom: var(--s3); }
.hero .lede { margin-bottom: var(--s4); }
/* About: two lede paragraphs in one block, closer together than a lede and its CTA. */
.hero .about .lede { margin-bottom: var(--s2); }
.cta { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }

.lockup { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s4); }
.lockup img { width: clamp(3.5rem, 9vw, 5.5rem); }
.lockup .name {
  font-family: var(--head);
  font-weight: 700;
  font-size: clamp(1.3rem, 1rem + 1.4vw, 2rem);
  color: var(--green);
  letter-spacing: -0.01em;
}

/* ------------------------------------------------------------------- cards */

.grid { display: grid; gap: var(--s3); }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr)); }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr)); }

.card {
  background: var(--card);
  border-radius: var(--r-card);
  padding: var(--s3);
}
.card h3 { margin-bottom: var(--s1); }
.card p { font-size: 0.95rem; }

.stat { text-align: center; }
.stat-n {
  display: block;
  font-size: clamp(1.7rem, 1.3rem + 1.8vw, 2.5rem);
  line-height: 1.05;
  margin-bottom: var(--s1);
}
.stat p { font-size: 0.9rem; line-height: 1.45; }

/* ---------------------------------------------------------------- pipeline */

.pipeline {
  display: grid;
  gap: 0.4rem;
  grid-template-columns: 1fr;
  margin-bottom: var(--s3);
  list-style: none;
  padding: 0;
}
@media (min-width: 52rem) {
  .pipeline { grid-template-columns: repeat(4, 1fr); }
  /* Flat left edge, pointed right edge — the poster's arrow, in CSS. */
  .pipeline li + li {
    clip-path: polygon(0 0, calc(100% - 1.15rem) 0, 100% 50%, calc(100% - 1.15rem) 100%, 0 100%);
    padding-inline-start: 1.8rem;
  }
}
.pipeline li {
  background: var(--stage);
  color: var(--on-stage);
  padding: var(--s3);
  border-radius: 8px;
  min-height: 7.5rem;
}
.pipeline li:first-child { border-radius: 8px; }
.pipeline li:nth-child(1) { --stage: var(--stage-1); }
.pipeline li:nth-child(2) { --stage: var(--stage-2); }
.pipeline li:nth-child(3) { --stage: var(--stage-3); }
.pipeline li:nth-child(4) { --stage: var(--stage-4); }
.pipeline b {
  display: block;
  font-family: var(--head);
  font-weight: 700;
  color: #fff;
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}
.pipeline span { font-size: 0.9rem; line-height: 1.45; display: block; }

/* --------------------------------------------- model switcher (no JS at all)

   The radios must stay siblings of .stack so `:checked ~ .stack` can reach the frames,
   so they are taken out of flow with position:absolute rather than wrapped in a row. */

.viewer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 0.35rem;
  background: var(--card);
  border-radius: var(--r-card);
  padding: var(--s3);
}

.viewer > input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.viewer > label {
  font-family: var(--head);
  font-weight: 700;
  font-size: 0.76rem;
  text-align: center;
  padding: 0.4rem 0.7rem;
  border-radius: var(--r-pill);
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--axis) 40%, transparent);
  transition: background 0.15s ease, color 0.15s ease;
}
.viewer > label:hover { background: color-mix(in srgb, var(--page) 55%, transparent); }

.viewer > input:checked + label {
  background: var(--ours);
  color: var(--page);
  border-color: var(--ours);
}
.viewer > input:focus-visible + label { outline: 3px solid var(--ours); outline-offset: 3px; }

.stack {
  flex: 1 0 100%;
  display: grid;
  justify-items: center;
  margin-top: var(--s3);
}
.stack img {
  grid-area: 1 / 1;
  /* The frames are tall portraits. Size by height and let width follow, so the card hugs the
     image instead of letterboxing it. */
  height: clamp(17rem, 27vw, 24rem);
  width: auto;
  max-width: 100%;
  border-radius: 8px;
  /* Casual-save deterrent only: no right-click "Save image", no drag-out, no iOS long-press
     menu. The files are still one devtools click away; nothing shown in a browser is private. */
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  opacity: 0;
  /* Microscopy: show the sensor's pixels, never a smoothed guess at them. */
  image-rendering: pixelated;
  transition: opacity 0.18s ease;
}

/* One rule per position, shared by every viewer on the page. */
.viewer > input:nth-of-type(1):checked ~ .stack img:nth-child(1),
.viewer > input:nth-of-type(2):checked ~ .stack img:nth-child(2),
.viewer > input:nth-of-type(3):checked ~ .stack img:nth-child(3),
.viewer > input:nth-of-type(4):checked ~ .stack img:nth-child(4),
.viewer > input:nth-of-type(5):checked ~ .stack img:nth-child(5) { opacity: 1; }

.viewer figcaption {
  flex: 1 0 100%;
  font-size: 0.85rem;
  text-align: center;
  margin-top: var(--s2);
  color: color-mix(in srgb, var(--body) 80%, var(--card));
}

/* ------------------------------------------------------------------ charts */

.figure {
  background: var(--card);
  border-radius: var(--r-card);
  padding: var(--s3);
  overflow: hidden;
}
.figure h3 { margin-bottom: var(--s1); }
.figure figcaption { font-size: 0.85rem; margin-top: var(--s2); }
.chart { min-height: 6rem; }
.chart svg { max-width: 100%; height: auto; }
/* Faceted specs keep their authored width, so centre them rather than pinning them left. */
.figure.is-fixed .chart { display: flex; justify-content: center; }
.chart .vega-embed { width: 100%; }

/* A morph slider: Vega renders the range input into #mask-switch, the page supplies the end
   labels. Vega nests the binding in one label - <span class=vega-bind-name>, the input, then a
   <span> with the live value. Both spans are hidden (an empty name still prints the signal's). */
.morph {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  margin-bottom: var(--s3);
  font: 700 0.85rem/1.3 var(--head);
  color: var(--ink);
}
.morph > div { flex: 1; max-width: 260px; }
.morph .vega-bind, .morph .vega-bind label { display: flex; align-items: center; width: 100%; }
.morph .vega-bind-name, .morph .vega-bind label > span { display: none; }
.morph input[type="range"] { width: 100%; accent-color: var(--ink); cursor: ew-resize; }
/* Phones: one word per line in the end labels hands their width to the slider, and a taller
   input gives a thumb something to catch. */
@media (max-width: 40rem) {
  .morph { gap: var(--s1); }
  .morph > span { width: min-content; }
  .morph > span:first-child { text-align: end; }
  .morph > div { max-width: none; }
  .morph input[type="range"] { height: 2.25rem; }
}

/* ----------------------------------------------------------------- contact */

.contact {
  display: grid;
  gap: var(--s4);
  grid-template-columns: 1fr;
  align-items: center;
  background: var(--card);
  border-radius: var(--r-card);
  padding: clamp(var(--s3), 5vw, var(--s5));
}
@media (min-width: 48rem) { .contact { grid-template-columns: 1fr auto; } }
.contact .lede { margin-block: var(--s2) var(--s3); }
.contact .qr {
  width: 9.5rem;
  background: #fff;
  padding: 0.6rem;
  border-radius: 10px;
}
.contact .qr img { width: 100%; }
.contact .qr figcaption { font-size: 0.78rem; text-align: center; color: #33403c; margin-top: 0.35rem; }

/* ------------------------------------------------------------------ footer */

.site-foot {
  border-top: 1px solid var(--rule);
  padding-block: var(--s4);
  font-size: 0.9rem;
}
.site-foot > .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  justify-content: space-between;
  align-items: center;
}
.site-foot a { color: var(--body); }

/* ------------------------------------------------------------------- print */

@media print {
  .site-head, .cta, .skip { display: none; }
  body { background: #fff; color: #000; }
  main > section { padding-block: 1.5rem; }
  .part, .hero, #contact { break-inside: avoid; }
  /* :checked still applies when printing, so the selected frame prints and the rest stay hidden. */
}
