/* /demo. Editorial: serif throughout, set like a magazine feature. A large headline and a short
   account on the left, the glass with its annotations on the right, a ruled strip of context
   under it, then the full account in ruled columns. No cards. */
:root {
  --page-x: max(6vw, calc((100vw - 1640px) / 2));   /* one margin for the bar, the hero and the full account */
  --cup-x: calc(var(--page-x) + (100vw - 2 * var(--page-x)) * 0.665);   /* two thirds across the page, not the window */
  --cup-y: 47%; --cup-h: 90vh; --cup-w: 62vh;
}
body { font-family: var(--serif); font-size: 19px; line-height: 1.5; letter-spacing: 0; font-optical-sizing: auto; }

.bar { border-bottom-color: var(--hair); background: var(--deep); padding: 12px var(--page-x); gap: 14px; }
.bar .tagline { font-style: italic; color: var(--label2); font-size: 17px; }
.dateline { font-style: italic; color: var(--label2); font-size: 16px; }
.conn { font-family: var(--sans); }
.links { display: flex; gap: 22px; font-family: var(--sans); font-size: 13px; }
.links a { color: var(--label2); }
.links a:hover { color: var(--text); text-decoration: none; }

/* ---- hero: the words on the left, anchored at the top so they don't jump when the headline changes */
.hero-copy { position: absolute; left: var(--page-x); top: 21vh; z-index: 4; width: min(26vw, 500px); }
#site { font-style: italic; color: var(--label2); font-size: clamp(17px, 1.4vw, 21px); }
#verdict { margin-top: 12px; font-weight: 400; font-size: clamp(40px, 3.9vw, 78px); line-height: 1.02; letter-spacing: -0.025em; text-wrap: balance; transition: color 1.6s ease; }
#verdict.good { color: var(--accent); }
#sub { margin-top: 10px; min-height: 1.25em; font-style: italic; font-size: clamp(24px, 2.3vw, 40px); line-height: 1.2; letter-spacing: -0.01em; color: var(--label2); }
#standfirst { margin-top: 26px; max-width: 25em; color: var(--label2); font-size: clamp(17px, 1.35vw, 21px); line-height: 1.5; text-wrap: pretty; }
#proof { margin-top: 14px; color: var(--label2); font-size: clamp(17px, 1.35vw, 21px); line-height: 1.4; font-variant-numeric: lining-nums tabular-nums; text-wrap: pretty; }
#proof[data-state="retested"], #proof[data-state="bypass"] { color: var(--accent); }
#proof[data-state="out-of-range"] { color: var(--warn); }
#when { margin-top: 18px; font-family: var(--sans); color: var(--label3); font-size: 13px; }
/* what Clarity is for, in one sentence, ending on a live count: the page's argument, under the account of this cup */
#about { margin-top: 24px; max-width: 25em; font-style: italic; color: var(--label2); font-size: clamp(15px, 1.12vw, 17.5px); line-height: 1.45; text-wrap: balance; }
#about::before { content: ""; display: block; margin-bottom: 16px; border-top: 1px solid var(--hair); }
#about-tally { display: block; color: var(--text); }
#about:has(#about-tally:empty) { display: none; }       /* no pours yet: no tally, and no rule above nothing */

/* entrance (.live): the copy rises line by line, the cup fades up, then the notes (base.css) */
.hero-copy > *, .cup-wrap, .context { opacity: 0; }
.live .hero-copy > * { opacity: 1; animation: rise 1.7s var(--lux) backwards; }
.live .hero-copy > :nth-child(2) { animation-delay: 140ms; }
.live .hero-copy > :nth-child(3) { animation-delay: 260ms; }
.live .hero-copy > :nth-child(4) { animation-delay: 400ms; }
.live .hero-copy > :nth-child(5) { animation-delay: 520ms; }
.live .hero-copy > :nth-child(6) { animation-delay: 640ms; }
.ready .cup-wrap { opacity: 1; animation: fade 2.4s ease backwards; animation-delay: 200ms; }
.live .context { opacity: 1; animation: fade 1.8s ease backwards; animation-delay: 2000ms; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes fade { from { opacity: 0; } }

/* ---- annotations on the plate. The dotted rule under a value says there is more to read. */
.tag { max-width: 290px; cursor: pointer; }
.tag .head { display: flex; flex-direction: column; align-items: inherit; }
.tag .lab { font-style: italic; color: var(--label2); font-size: clamp(15px, 1.15vw, 18px); line-height: 1.2; white-space: nowrap; }
.tag .val { font-size: clamp(30px, 2.7vw, 44px); line-height: 1.12; letter-spacing: -0.015em; white-space: nowrap; font-variant-numeric: lining-nums; border-bottom: 1px dotted var(--label3); padding-bottom: 2px; transition: color 1.6s ease, border-color 0.4s ease; }
.tag.minor .val { font-size: clamp(21px, 1.8vw, 29px); }
.tag .flag { margin-top: 4px; font-style: italic; font-size: clamp(15px, 1.1vw, 17px); line-height: 1.25; white-space: nowrap; }
.tag.warn .val, .tag.warn .flag { color: var(--warn); }
.tag.good .val, .tag.good .flag { color: var(--accent); }
/* once a pour has been retested, the Retest note says the glass can be compared (with a mouse; it follows the pointer).
   The hint is no wider than the value above it, so it never moves the note. */
@media (hover: hover) and (pointer: fine) {
  .stage:has(.cup-wrap.can-compare) .tag[data-id="retest"] .head::after {
    content: "move across the glass to compare"; width: 0; min-width: 100%; margin-top: 6px;
    font-style: italic; font-size: clamp(14px, 1.05vw, 16px); line-height: 1.25; color: var(--label2); white-space: normal; text-wrap: balance;
  }
}
.tag:hover .val, .tag:focus-visible .val, .tag.pinned .val { border-bottom-color: transparent; }
.tag .txt { display: block; width: 214px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--hair); white-space: normal; text-align: left; color: var(--label2); font-size: 16px; line-height: 1.42; }
.tag[data-grow="up"] .txt { margin: 0 0 10px; padding: 0 0 10px; border-top: 0; border-bottom: 1px solid var(--hair); }
/* a plate fades in behind an open note; the note's own text doesn't move */
.tag::before {
  content: ""; position: absolute; inset: -14px -18px; z-index: -1; pointer-events: none;
  background: var(--deep); box-shadow: 0 0 0 1px rgba(247, 240, 240, 0.2), 0 24px 44px -20px rgba(0, 0, 0, 0.85);
  opacity: 0; transition: opacity 0.4s ease;
}
.tag:hover::before, .tag:focus-visible::before, .tag.pinned::before { opacity: 1; }
.tag:focus-visible::before { box-shadow: 0 0 0 2px var(--accent), 0 24px 44px -20px rgba(0, 0, 0, 0.85); }

/* ---- context: a ruled strip under the plate, for what surrounds this cup */
.context {
  position: absolute; left: var(--page-x); right: var(--page-x); bottom: 22px; z-index: 5;
  display: flex; align-items: flex-start; gap: 28px; padding-top: 14px; border-top: 1px solid var(--hair);
}
.cx-row { flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; }
.cx { position: relative; margin: 0; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; display: grid; gap: 1px; align-content: start; min-width: 0; }
.cx .lab { font-style: italic; color: var(--label2); font-size: 15px; line-height: 1.25; }
.cx .val { font-size: 19px; line-height: 1.25; text-wrap: balance; }
.cx.warn .val { color: var(--warn); }
.cx.alert .val { color: var(--alert); }
.cx .pop {
  position: absolute; left: -18px; bottom: calc(100% + 16px); width: 300px; padding: 14px 18px 16px;
  background: var(--deep); box-shadow: 0 0 0 1px rgba(247, 240, 240, 0.2), 0 24px 44px -20px rgba(0, 0, 0, 0.85);
  color: var(--label2); font-size: 16px; line-height: 1.42; white-space: normal;
  opacity: 0; transform: translateY(6px); pointer-events: none; transition: opacity 0.4s ease, transform 0.6s var(--lux);
}
.cx:last-child .pop { left: auto; right: -18px; }
.cx:hover .pop, .cx:focus-visible .pop, .cx.pinned .pop { opacity: 1; transform: none; }
.cx:focus-visible { outline: none; }
.cx:focus-visible .val { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 5px; }
.cx-more { flex: none; align-self: center; display: inline-flex; align-items: center; gap: 6px; font-family: var(--sans); font-size: 13px; color: var(--label2); }
.cx-more:hover { color: var(--text); text-decoration: none; }
.cx-more svg { width: 16px; height: 16px; animation: nudge 3.2s ease-in-out infinite; }

/* ---- the full account: same margins as the hero */
.sheet { border-top: 1px solid rgba(247, 240, 240, 0.3); }
.page { padding: 60px var(--page-x) 72px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.section-head h2, .page h2 { font-weight: 400; font-size: 40px; line-height: 1.1; letter-spacing: -0.015em; }
.section-head p { font-style: italic; color: var(--label2); }
.cols { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 48px; row-gap: 32px; }
.col-7 { grid-column: span 7; }
.col-5 { grid-column: span 5; }
.ruled { margin-top: 52px; padding-top: 44px; border-top: 1px solid var(--hair); }
.page h3 { font-weight: 400; font-style: italic; font-size: 21px; color: var(--label2); margin: 0 0 10px; }
figcaption { margin-top: 14px; font-style: italic; color: var(--label2); font-size: 16px; line-height: 1.4; max-width: 46em; }
.wide { margin-inline: 0; }

/* the plate: before and after, drawn from the readings */
.plate { margin: 0; position: relative; }
/* the two glasses in 3D sit in one canvas over the flat cups, which stay (unseen) to hold the layout */
.plate3d { position: absolute; left: 0; right: 0; z-index: 1; pointer-events: none; }
.plate3d canvas { display: block; width: 100%; height: 100%; }
.plate.has-3d .pair .cup { visibility: hidden; max-width: 210px; }
.plate.has-3d .pair .arrow { margin-bottom: 110px; }
.plate.has-3d .pair-labels { margin-top: 26px; }
.pair { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 18px; padding: 8px 6px 0; }
.pair .cup { width: 100%; max-width: 150px; height: auto; margin-inline: auto; }
.pair .arrow { width: 54px; height: 12px; margin-bottom: 64px; }
.pair .arrow path { stroke: var(--neutral); stroke-width: 1.2; fill: none; }
.pair-labels { display: grid; grid-template-columns: 1fr 54px 1fr; gap: 18px; margin-top: 12px; padding: 0 6px; text-align: center; }
.pair.single, .pair-labels.single { grid-template-columns: 1fr; justify-items: start; text-align: left; }
.pair.single .cup { margin-inline: 0; }
.pair-labels b { display: block; font-weight: 400; font-size: 19px; }
.pair-labels span { font-style: italic; color: var(--label2); font-size: 15px; }

.lede { font-size: 28px; line-height: 1.3; letter-spacing: -0.01em; text-wrap: balance; }
.lede + p { margin-top: 14px; color: var(--label2); max-width: 36em; text-wrap: pretty; }
#figures { margin-top: 26px; max-width: 40em; }
.sample-note { margin-top: 10px; font-family: var(--sans); font-size: 13px; color: var(--warn); }

table { width: 100%; border-collapse: collapse; font-variant-numeric: lining-nums tabular-nums; }
th, td { padding: 9px 0; text-align: left; vertical-align: baseline; border-bottom: 1px solid var(--hair); }
thead th { font-weight: 400; font-style: italic; color: var(--label2); font-size: 16px; }
td.n, th.n { text-align: right; padding-left: 18px; }
.figures td.n { font-size: 26px; line-height: 1.1; width: 6.5ch; }
.figures td.n.word { font-size: 18px; width: auto; white-space: nowrap; }   /* "High dissolved solids" stays on one line */
.figures td.warn { color: var(--warn); }
.figures tr:last-child td { border-bottom: 0; }
.unit { color: var(--label3); font-size: 15px; }
.status-ok { color: var(--accent); }
.status-soon { color: var(--warn); }
.status-now { color: var(--alert); }
.note-warn { color: var(--warn); font-style: italic; }
.note-odd { color: var(--alert); font-style: italic; }
.sim { font-style: italic; color: var(--label3); }

/* the tally: what the pours in the chart add up to, set as figures over it */
.tally { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 48px; margin: 0 0 34px; padding: 0; list-style: none; }
.tally li { padding-top: 14px; border-top: 1px solid var(--hair); }
.tally b { display: block; font-weight: 400; font-size: 60px; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: lining-nums; }
.tally b small { font-size: 0.42em; letter-spacing: 0; color: var(--label2); }
.tally span { display: block; margin-top: 8px; max-width: 17em; font-style: italic; color: var(--label2); font-size: 17px; line-height: 1.35; }
.tally .good b { color: var(--accent); }

/* the history chart */
.chart-key { display: flex; gap: 22px; font-style: italic; color: var(--label2); font-size: 16px; }
.chart-key span { display: inline-flex; align-items: center; gap: 8px; }
.chart-key i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.k-before { box-shadow: inset 0 0 0 1.5px #A9ACB3; }
.k-after { background: var(--accent); }
#history svg { display: block; width: 100%; height: auto; overflow: visible; }
#history text { font-family: var(--sans); font-size: 12.5px; fill: var(--label2); font-variant-numeric: tabular-nums; }
#history .now text { fill: var(--text); }
#history .grid { stroke: var(--hair); stroke-width: 1; }
#history .limit { stroke: var(--label3); stroke-width: 1; stroke-dasharray: 2 5; }
#history .limit-label { font-family: var(--serif); font-style: italic; font-size: 14.5px; fill: var(--label2); }
#history .stem { stroke: #A9ACB3; stroke-opacity: 0.55; stroke-width: 1.25; }
#history .before { fill: var(--deep); stroke: #A9ACB3; stroke-width: 1.5; }
#history .after { fill: var(--accent); stroke: var(--deep); stroke-width: 2; }
#history .value { font-family: var(--serif); font-size: 16px; fill: var(--text); font-variant-numeric: lining-nums; }
#history .hit { fill: transparent; }
#history .col.hot .before, #history .col.hot .after { stroke: var(--text); }
.tip { position: fixed; z-index: 40; pointer-events: none; padding: 8px 12px; background: var(--deep); box-shadow: 0 0 0 1px rgba(247, 240, 240, 0.2), 0 16px 30px -14px rgba(0, 0, 0, 0.85); font-size: 15px; line-height: 1.35; white-space: nowrap; font-variant-numeric: lining-nums; }
.tip i { color: var(--label2); }

.about { margin-top: 6px; font-style: italic; color: var(--label2); }
.pull { font-style: italic; font-size: 30px; line-height: 1.28; letter-spacing: -0.01em; margin: 18px 0 26px; text-wrap: balance; }
#report ul, #report ol { margin: 0 0 22px; padding-left: 22px; display: grid; gap: 8px; max-width: 38em; }
#report li::marker { color: var(--accent); }
#report .sample-note { margin: 14px 0 0; }
/* the report: who wrote it, its verdict, the checks behind it, what each agent found, the draft notice */
#report .by { margin: 14px 0 0; max-width: 46em; font-family: var(--sans); font-size: 13px; line-height: 1.45; color: var(--label3); }
.rep-verdict { margin: -8px 0 26px; font-size: 21px; color: var(--label2); }
.rep-verdict b { font-weight: 400; color: var(--text); }
.rep-verdict.sev-0 b { color: var(--accent); }
.rep-verdict.sev-2 b { color: var(--warn); }
#report h3 { margin-top: 30px; }
.checks { max-width: 44em; }
.checks th { width: 7.5em; padding-right: 18px; font-weight: 400; font-style: italic; color: var(--label2); white-space: nowrap; vertical-align: baseline; }
.checks td { color: var(--label2); font-size: 17px; line-height: 1.45; }
.checks tr.warn td { color: var(--text); }
.checks tr:last-child th, .checks tr:last-child td { border-bottom: 0; }
.agents { margin: 0; max-width: 44em; display: grid; gap: 14px; }
.agents dt { font-style: italic; color: var(--label2); font-size: 16px; }
.agents dd { margin: 2px 0 0; font-size: 17px; line-height: 1.45; }
.notice { margin: 0; max-width: 40em; padding-left: 18px; border-left: 1px solid var(--accent); font-style: italic; font-size: 18px; line-height: 1.5; color: var(--text); }
.notice + .by { margin-top: 10px; }
/* the investigator at work, and afterwards the trail each agent left */
.swarm { margin: 16px 0 6px; padding: 14px 0 6px; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); max-width: 44em; }
.swarm .by { margin: 0 0 10px; color: var(--label2); }
.swarm ul { margin: 0 !important; padding: 0 !important; list-style: none; display: grid; gap: 0 !important; }
.swarm li { display: grid; grid-template-columns: 11.5em minmax(0, 1fr); gap: 16px; padding: 7px 0; font-size: 17px; transition: opacity 0.5s ease; }
.swarm li b { font-weight: 400; }
.swarm li span { font: 13px/1.5 var(--sans); color: var(--label2); padding-top: 3px; }
.swarm li.waiting { opacity: 0.4; }
.swarm li.asked span, .swarm li.working span { color: var(--accent); }
.swarm li.working span::after, .swarm li.asked span::after { content: " …"; }
.agents dt small { display: block; margin-top: 1px; font: normal 13px/1.4 var(--sans); color: var(--label3); }
.agents .trail { margin-top: 5px; font: 13px/1.4 var(--sans); color: var(--label3); }
.agents .untraced { color: var(--warn); font-style: italic; }
#report .by.checked { margin: 0 0 14px; color: var(--label2); }
.quiet { color: var(--label2); }

#filters + #nearby { margin-top: 36px; }
#filters td, #nearby td { font-size: 17px; }
.life { position: relative; height: 3px; margin-top: 9px; background: var(--fill); }
.life span { position: absolute; inset: 0 auto 0 0; background: var(--c, var(--accent)); }
.life.status-soon { --c: var(--warn); }
.life.status-now { --c: var(--alert); }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent); font: italic 16px var(--serif); cursor: pointer; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }


.check { display: inline-flex; align-items: center; gap: 8px; font-style: italic; color: var(--label2); font-size: 16px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }
.ledger td { font-size: 17px; padding: 8px 0; }
.ledger td.site { font-size: 18px; }
.ledger td.t { font-family: var(--sans); font-size: 13px; color: var(--label2); white-space: nowrap; padding-right: 18px; }

.colophon { text-align: center; padding-bottom: 8px; }
.colophon .mark { font-size: 44px; line-height: 1; letter-spacing: -0.02em; }
.colophon .tagline { margin-top: 8px; font-style: italic; font-size: 22px; color: var(--label2); }
.colophon .fine { margin: 26px auto 0; max-width: 44em; color: var(--label2); font-size: 15px; line-height: 1.5; text-wrap: pretty; }
.colophon .fine a { margin: 0 12px; font-family: var(--sans); font-size: 13px; color: var(--label2); }
.colophon .fine a:hover { color: var(--text); text-decoration: none; }

@media (max-width: 1000px) {
  /* twelve columns with 48px gaps are wider than a phone: collapse to one column */
  .cols { grid-template-columns: minmax(0, 1fr); column-gap: 0; }
  .col-7, .col-5 { grid-column: 1 / -1; }
  .hide-s { display: none; }
}
/* below 1180px the hero stops being a pinned plate: words, glass, then the notes in a grid */
@media (max-width: 1180px) {
  :root { --cup-x: 50%; --cup-y: 36vh; --cup-h: 72vh; --cup-w: min(100vw, 62vh); --page-x: clamp(16px, 5vw, 56px); }
  .glow { display: none; }
  .bar { position: static; }
  .dateline { display: none; }
  .hero { position: relative; height: auto; overflow: visible; }
  #hero-inner, .stage { position: relative; }
  .hero-copy { position: static; width: auto; max-width: 34em; padding: 20px var(--page-x) 0; }
  .cup-wrap { position: relative; left: 0; top: 0; margin-inline: auto; max-width: 100%; }
  .leaders { display: none; }
  .tags { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; padding: 0 var(--page-x) 8px; max-width: 46em; margin-inline: auto; }
  .tag, .tag[data-side], .tag[data-grow] { position: static; transform: none; width: 100%; max-width: none; flex-direction: column; align-items: flex-start; text-align: left; padding: 12px 0; border-top: 1px solid var(--hair); }
  .tag::before { display: none; }
  .tag .val { border-bottom: 0; }
  .tag .txt, .tag[data-grow="up"] .txt { width: auto; margin: 6px 0 0; padding: 0; border: 0; }
  .context { position: static; display: block; margin: 0 auto 24px; padding-inline: var(--page-x); max-width: 46em; border-top: 0; }
  .cx-row { grid-template-columns: 1fr 1fr; gap: 14px 24px; padding-top: 14px; border-top: 1px solid var(--hair); }
  .cx .pop, .cx:last-child .pop { position: static; width: auto; padding: 4px 0 0; background: none; box-shadow: none; display: none; opacity: 1; transform: none; font-size: 15px; }
  .cx:hover .pop, .cx:focus-visible .pop, .cx.pinned .pop { display: block; }
  .cx-more { display: none; }
  .page { padding: 36px var(--page-x) 56px; }
  .section-head { flex-wrap: wrap; gap: 4px 24px; }
}
/* Short presentation screens: the tally under the hero gives way; the cup, palette and editorial
   hierarchy stay the same. */
@media (min-width: 1181px) and (max-height: 800px) {
  .hero-copy { top: 18vh; }
  #standfirst { margin-top: 18px; }
  #about { display: none; }
}
}
/* small laptop windows: the notes' explanations are set narrower, so an open one stays clear of the headline column */
@media (min-width: 1181px) and (max-width: 1320px) {
  .tag .txt { width: 176px; }
}
/* tablets and small windows: the words on the left, the glass with its notes under it on the right */
@media (min-width: 761px) and (max-width: 1180px) {
  :root { --cup-h: 54vh; --cup-w: min(46vw, 40vh); }
  #hero-inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .hero-copy { padding-top: 7vh; }
  .stage { grid-column: 2; }
  .tags { max-width: none; padding-left: 0; }
  .context { grid-column: 1 / -1; max-width: none; margin: 4px 0 24px; }   /* no auto margins: as a grid item it would shrink and centre */
}
@media (max-width: 640px) {
  :root { --cup-y: 30vh; --cup-h: 60vh; }
  .bar .tagline { display: none; }
  .section-head h2, .page h2 { font-size: 30px; }
  .lede { font-size: 22px; }
  .pull { font-size: 23px; }
  .figures td.n.word { font-size: 16px; }   /* so the verdict still fits on one line beside the label */
  .tally { gap: 18px; margin-bottom: 26px; }
  .tally b { font-size: 40px; }
  .tally span { font-size: 15px; }
  #history { overflow-x: auto; }
  #history svg { min-width: 880px; }
}

.prototype-help { margin-top: 14px; font: 13px/1.5 var(--sans); color: var(--label2); }
.prototype-help a { color: var(--accent); }
