/* One Hundred People Like You
   Palette and type pairing from a healthcare-tuned design system.
   No SVG anywhere: the person glyphs in the array are built from two CSS
   shapes, which keeps a hundred of them cheap to paint and lets them inherit
   colour straight from the state class. */

:root {
  --primary: #0891B2;
  --primary-deep: #0E7490;
  --accent: #059669;
  --bg: #ECFEFF;
  --surface: #FFFFFF;
  --fg: #164E63;
  --fg-soft: #3F6E80;
  --muted: #E8F1F6;
  --border: #A5F3FC;
  --border-soft: #D6EEF5;
  --warn: #B45309;

  --person-yes: #0E7490;
  --person-no: #C3DFE8;

  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 48px;
  --space-6: 64px;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(22, 78, 99, .06), 0 8px 24px rgba(22, 78, 99, .06);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  padding: 0 var(--space-3) var(--space-6);
  background: var(--bg);
  color: var(--fg);
  font-family: "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

h1, h2, .compare-value, .answer-head, .step {
  font-family: Figtree, system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: -0.015em;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--fg);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 10;
}
.skip:focus { left: 0; }

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

.masthead {
  max-width: 780px;
  margin: 0 auto;
  padding: var(--space-6) 0 var(--space-5);
}

.eyebrow {
  margin: 0 0 var(--space-2);
  font-family: Figtree, sans-serif;
  font-weight: 600;
  font-size: .8rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--primary-deep);
}

.masthead h1 {
  margin: 0 0 var(--space-3);
  font-size: clamp(1.85rem, 4.6vw, 3rem);
  font-weight: 700;
  line-height: 1.14;
}

.lede {
  margin: 0;
  max-width: 62ch;
  font-size: 1.06rem;
  color: var(--fg-soft);
}

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

main { max-width: 780px; margin: 0 auto; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow);
}

.panel-plain { background: transparent; box-shadow: none; border-style: dashed; }

.panel-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-1);
}

.step {
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--surface);
  background: var(--primary-deep);
  padding: 4px 9px;
  border-radius: 999px;
}

.panel h2 { margin: 0; font-size: 1.28rem; font-weight: 600; }

.panel-note {
  margin: var(--space-2) 0 var(--space-3);
  color: var(--fg-soft);
  max-width: 64ch;
}
.panel-note.small { font-size: .92rem; }

/* ---------- form ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }

fieldset.field { border: 0; margin: 0; padding: 0; }

label, legend {
  font-family: Figtree, sans-serif;
  font-weight: 600;
  font-size: .93rem;
  color: var(--fg);
  padding: 0;
}

select, input[type="number"] {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  font: inherit;
  color: var(--fg);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .18s ease, box-shadow .18s ease;
}

select:hover, input[type="number"]:hover { border-color: var(--primary); }

select:focus-visible,
input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.hint { margin: 0; font-size: .85rem; color: var(--fg-soft); }

.checks { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 4px 8px;
  margin-left: -8px;
  border-radius: var(--radius-sm);
  font-weight: 400;
  cursor: pointer;
  transition: background-color .18s ease;
}
.check:hover { background: var(--muted); }
.check input { width: 20px; height: 20px; accent-color: var(--primary); cursor: pointer; flex: none; }

.slider-row { display: flex; align-items: center; gap: var(--space-2); }
.slider-row input[type="range"] { flex: 1; accent-color: var(--primary); min-height: 44px; cursor: pointer; }
.slider-row output {
  font-family: Figtree, sans-serif;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 4.2ch;
  text-align: right;
}

.readout {
  margin: var(--space-3) 0 0;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-soft);
  font-size: 1.02rem;
}
.readout strong { font-family: Figtree, sans-serif; font-size: 1.2rem; color: var(--primary-deep); }

/* ---------- result toggle ---------- */

.toggle { display: flex; gap: var(--space-1); margin-top: var(--space-2); }

.toggle-btn {
  flex: 1;
  min-height: 52px;
  padding: 12px 18px;
  font: 600 1rem/1 Figtree, sans-serif;
  color: var(--fg);
  background: var(--muted);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
.toggle-btn:hover { border-color: var(--primary); }
.toggle-btn.is-active { background: var(--primary-deep); border-color: var(--primary-deep); color: #fff; }

/* ---------- answer ---------- */

.panel-answer { border-color: var(--border); }

.answer-head {
  margin: 0 0 var(--space-3);
  font-size: clamp(1.2rem, 2.7vw, 1.6rem);
  font-weight: 700;
  line-height: 1.32;
}
.answer-head .num { color: var(--primary-deep); }

.answer-body {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
}

.array-wrap { margin-bottom: 0; }

.array {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: clamp(5px, 1.5vw, 9px);
  max-width: 420px;
}

/* Each person: a head and a torso, no SVG. */
.p { position: relative; aspect-ratio: 3 / 4; }
.p::before, .p::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%); background: currentColor; }
.p::before { top: 0; width: 46%; aspect-ratio: 1; border-radius: 50%; }
.p::after { bottom: 0; width: 82%; height: 58%; border-radius: 42% 42% 26% 26%; }
.p-yes { color: var(--person-yes); }
.p-no  { color: var(--person-no); }

.caption { margin: var(--space-2) 0 0; font-size: .92rem; color: var(--fg-soft); max-width: 56ch; }

.legend { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-2); font-size: .92rem; }
.legend-item { display: flex; align-items: center; gap: 9px; }
.swatch { width: 15px; height: 20px; position: relative; flex: none; }
.swatch::before, .swatch::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%); background: currentColor; }
.swatch::before { top: 0; width: 46%; aspect-ratio: 1; border-radius: 50%; }
.swatch::after { bottom: 0; width: 82%; height: 58%; border-radius: 42% 42% 26% 26%; }

.answer-side { display: flex; flex-direction: column; gap: var(--space-3); }

.compare {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--muted);
  border-radius: var(--radius-sm);
}
.compare-cell { text-align: center; min-width: 0; }
.compare-label { margin: 0; font-size: .8rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--fg-soft); }
.compare-value { margin: 4px 0; font-size: clamp(1.5rem, 5vw, 2.1rem); font-weight: 700; color: var(--primary-deep); font-variant-numeric: tabular-nums; }
.compare-sub { margin: 0; font-size: .84rem; color: var(--fg-soft); }
.compare-arrow { width: 26px; height: 2px; background: var(--border); position: relative; }
.compare-arrow::after {
  content: ""; position: absolute; right: -1px; top: -3px;
  border-left: 8px solid var(--border);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}

.band {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-left: 3px solid var(--warn);
  background: #FFFBEB;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .95rem;
}


/* Inside the narrow side column the three-across comparison is too tight,
   so it stacks and the connector turns to point downward. */
.answer-side .compare { grid-template-columns: 1fr; gap: var(--space-2); }
.answer-side .compare-arrow { justify-self: center; transform: rotate(90deg); }
.answer-side .compare-cell { text-align: left; }
.answer-side .compare-value { font-size: 2rem; margin: 2px 0; }
.answer-side .compare-sub { max-width: 30ch; }

/* ---------- model transparency ---------- */

.metrics { width: 100%; border-collapse: collapse; margin: var(--space-2) 0 var(--space-3); font-size: .95rem; }
.metrics caption { text-align: left; color: var(--fg-soft); font-size: .88rem; padding-bottom: var(--space-2); }
.metrics th, .metrics td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.metrics th { font-weight: 600; white-space: nowrap; }
.metrics td:last-child { color: var(--fg-soft); font-size: .89rem; }

.rel-legend { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-bottom: var(--space-2); font-size: .88rem; color: var(--fg-soft); }
.rel-key { display: flex; align-items: center; gap: 8px; }
.rel-chip { width: 22px; height: 9px; border-radius: 999px; flex: none; }

.reliability { display: flex; flex-direction: column; gap: 7px; }
.rel-row { display: grid; grid-template-columns: 5.5ch 1fr 5.5ch; align-items: center; gap: var(--space-2); font-size: .84rem; font-variant-numeric: tabular-nums; }
.rel-bars { display: flex; flex-direction: column; gap: 3px; }
.rel-bar { height: 9px; border-radius: 999px; min-width: 2px; }
.rel-pred { background: var(--border); }
.rel-obs { background: var(--primary); }

.limits { margin: var(--space-2) 0 0; padding-left: 1.15em; color: var(--fg-soft); }
.limits li { margin-bottom: var(--space-1); max-width: 66ch; }

.foot { max-width: 780px; margin: var(--space-4) auto 0; font-size: .86rem; color: var(--fg-soft); }
.foot p { margin: 0; max-width: 68ch; }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .answer-body { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .grid { grid-template-columns: 1fr; }
  .panel { padding: var(--space-3); }
  .compare { grid-template-columns: 1fr; gap: var(--space-3); }
  .compare-arrow { justify-self: center; transform: rotate(90deg); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
