/* Capstone explorer. Extends styles.css; inherits the palette and type scale
   from :root there. Field colours stay fixed, as on the index page. */

:root {
  /* Single-abstract points. Muted enough to read as background mass, dark
     enough to stay visible on white at 2px. */
  --sage-dot: #93a58c;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.mono-inline { font-family: var(--mono); font-size: .88em; }

/* Hero */

.page-hero { padding: clamp(2rem, 6vh, 4rem) 0 clamp(3rem, 9vh, 5.5rem); }
.eyebrow { color: var(--on-ink-mute); margin-bottom: 1.25rem; }
.page-hero h1 {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(2.6rem, 8vw, 5.6rem); line-height: 0.95;
  letter-spacing: -0.02em;
}
.lede {
  max-width: 42em; color: var(--on-ink-mute);
  font-size: clamp(.92rem, 1.5vw, 1.05rem); line-height: 1.75;
}

/* Standing caveat. Deliberately loud: this is a page about at-home health
   testing, and a cluster must not read as advice. */

.caveat-band { padding-bottom: 0; }
.caveat {
  border-left: 3px solid var(--coral);
  padding: 1.1rem 0 1.1rem 1.5rem;
  max-width: 54em;
}
.caveat-lead {
  font-family: var(--serif); font-size: clamp(1.1rem, 2.2vw, 1.45rem);
  line-height: 1.35; margin-bottom: .6rem;
}
.caveat p { font-size: .88rem; line-height: 1.7; color: var(--on-shell-mute); }
/* Sentence case: .mono uppercases, which is fine for a label and shouty for a
   full sentence. */
.caveat-aside {
  margin-top: .9rem; color: var(--on-shell); font-size: .72rem;
  text-transform: none; letter-spacing: .04em;
}

/* Controls */

.controls {
  display: flex; flex-wrap: wrap; gap: clamp(1rem, 3vw, 2.5rem);
  align-items: flex-end; margin-bottom: 1.75rem;
  padding-bottom: 1.5rem; border-bottom: 1px solid var(--hairline);
}
.control { display: flex; flex-direction: column; gap: .5rem; }
.control-label { color: var(--on-shell-mute); }

#analyte {
  font-family: var(--mono); font-size: .78rem; letter-spacing: .04em;
  padding: .55rem 2.2rem .55rem .7rem;
  border: 1px solid var(--on-shell); border-radius: 3px;
  background: transparent; color: var(--on-shell); cursor: pointer;
  appearance: none; min-width: 15rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2317201a' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center;
}
#analyte:focus-visible, .toggle-btn:focus-visible {
  outline: 2px solid var(--coral-deep); outline-offset: 2px;
}

.toggle { display: flex; gap: 0; }
.toggle-btn {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .12em;
  text-transform: uppercase; padding: .55rem .95rem;
  border: 1px solid var(--on-shell); background: transparent;
  color: var(--on-shell); cursor: pointer; transition: background-color .15s ease, color .15s ease;
}
.toggle .toggle-btn:first-child { border-radius: 3px 0 0 3px; }
.toggle .toggle-btn:last-child { border-radius: 0 3px 3px 0; border-left-width: 0; }
.toggle-btn:hover { background: rgba(23,32,26,.07); }
.toggle-btn.is-on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.control-null .toggle-btn { border-radius: 3px; }
.control-null .toggle-btn[aria-pressed="true"] {
  background: var(--coral-deep); border-color: var(--coral-deep); color: var(--shell);
}

/* Explorer layout */

.explorer {
  display: grid; grid-template-columns: minmax(0, 1fr) 17rem;
  gap: clamp(1.25rem, 3vw, 2.5rem); align-items: start;
}
.plot-head { margin-bottom: .75rem; }
.plot-head h3 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.15rem, 2.4vw, 1.6rem); letter-spacing: -.01em; line-height: 1.2;
}
.plot-sub { color: var(--on-shell-mute); margin-top: .3rem; text-transform: none; letter-spacing: .05em; }

.plot-frame {
  position: relative; background: #fff;
  border: 1px solid var(--hairline); border-radius: 4px;
}
#plot { width: 100%; height: auto; display: block; }

/* Points. Terms carried by a single abstract are drawn faintly and never
   labelled, so the long tail is visible without competing for attention. */
.pt { transition: opacity .2s ease; }
.pt-solo { fill: var(--sage-dot); opacity: .5; }
.pt-multi { fill: var(--ink); opacity: .82; }
.pt-null  { fill: var(--on-shell-mute); opacity: .45; }
.pt:hover, .pt.is-active { opacity: 1; }
.pt.is-active { stroke: var(--coral-deep); stroke-width: 2; }

.pt-label {
  font-family: var(--mono); font-size: 9.5px; fill: var(--on-shell);
  letter-spacing: .02em; pointer-events: none;
}
.pt-leader { stroke: var(--hairline); stroke-width: .8; }

.plot-empty {
  font-family: var(--mono); font-size: 11px; fill: var(--on-shell-mute);
  text-anchor: middle;
}

.tooltip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--ink); color: var(--on-ink);
  border-radius: 3px; padding: .5rem .65rem; max-width: 15rem;
  font-size: .72rem; line-height: 1.5;
  transform: translate(-50%, calc(-100% - 10px));
  box-shadow: 0 6px 18px rgba(13,16,14,.22);
}
.tooltip strong { font-family: var(--mono); font-size: .74rem; letter-spacing: .02em; }
.tooltip span { display: block; color: var(--on-ink-mute); font-size: .66rem; margin-top: .2rem; }

figcaption.mono {
  margin-top: .7rem; font-size: .6rem; line-height: 1.8;
  color: var(--on-shell-mute); text-transform: none; letter-spacing: .05em;
}

/* Facts panel */

.facts { display: flex; flex-direction: column; gap: 1.5rem; }
.fact-block h4 {
  font-size: .62rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--on-shell-mute); padding-bottom: .5rem;
  border-bottom: 1px solid var(--hairline); margin-bottom: .7rem;
}
.facts dl { display: grid; grid-template-columns: auto 1fr; gap: .38rem .8rem; }
.facts dt {
  font-family: var(--mono); font-size: .58rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--on-shell-mute); padding-top: .12rem;
}
.facts dd { font-size: .78rem; line-height: 1.5; }
.facts dd.note {
  grid-column: 1 / -1; font-size: .72rem; line-height: 1.6;
  color: var(--on-shell-mute); border-left: 2px solid var(--hairline);
  padding-left: .65rem; margin-top: .1rem;
}
.facts .flag { color: var(--coral-deep); }
.tag {
  display: inline-block; font-family: var(--mono); font-size: .55rem;
  letter-spacing: .1em; text-transform: uppercase;
  border: 1px solid var(--hairline); border-radius: 2px; padding: .1rem .35rem;
}

/* Rankings */

.readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: clamp(1.5rem, 4vw, 3rem); margin-top: clamp(2rem, 5vh, 3rem);
  padding-top: clamp(1.5rem, 4vh, 2.25rem); border-top: 1px solid var(--hairline);
}
.readout-col h4 {
  font-size: .62rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--on-shell-mute); margin-bottom: .5rem;
}
.readout-note {
  font-size: .74rem; line-height: 1.6; color: var(--on-shell-mute);
  max-width: 30em; margin-bottom: .9rem;
}
.rank { width: 100%; border-collapse: collapse; }
.rank td {
  padding: .34rem 0; border-bottom: 1px solid var(--hairline);
  font-size: .78rem; vertical-align: baseline;
}
.rank td.term { width: 100%; padding-right: .8rem; }
.rank td.num {
  font-family: var(--mono); font-size: .68rem; text-align: right;
  color: var(--on-shell-mute); white-space: nowrap; padding-left: .6rem;
}
.rank tr.is-capped td.num { color: var(--coral-deep); }
.rank-foot { font-size: .68rem; color: var(--on-shell-mute); margin-top: .6rem; line-height: 1.6; }

/* Reading */

.reading {
  margin-top: clamp(2rem, 5vh, 3rem); padding-top: clamp(1.5rem, 4vh, 2.25rem);
  border-top: 1px solid var(--hairline); max-width: 46em;
}
.reading h4 {
  font-size: .62rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--on-shell-mute); margin-bottom: .7rem;
}
.reading p { font-size: .88rem; line-height: 1.75; margin-bottom: .8rem; }
.reading p:last-child { margin-bottom: 0; }
.reading .verdict {
  font-family: var(--serif); font-size: clamp(1.05rem, 2vw, 1.3rem);
  line-height: 1.4; margin-bottom: .8rem;
}
.reading .flag { color: var(--coral-deep); }

/* Method */

.method-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: clamp(1.5rem, 4vw, 2.75rem);
}
.method-grid article { border-top: 1px solid var(--hairline); padding-top: 1rem; }
.method-grid h4 {
  font-family: var(--serif); font-weight: 400; font-size: 1.05rem;
  line-height: 1.3; margin-bottom: .6rem;
}
.method-grid p {
  font-size: .82rem; line-height: 1.7; color: var(--on-shell-mute);
  margin-bottom: .7rem;
}
.method-grid p:last-child { margin-bottom: 0; }

/* Responsive */

@media (max-width: 62rem) {
  .explorer { grid-template-columns: 1fr; }
  .facts { flex-direction: row; flex-wrap: wrap; gap: 1.75rem; }
  .fact-block { flex: 1 1 16rem; }
}
@media (max-width: 40rem) {
  .controls { gap: 1.1rem; }
  .control { width: 100%; }
  #analyte { width: 100%; min-width: 0; }
  .facts { flex-direction: column; }
}
