/* ═══════════════════════════════════════════════════════════════════════════
   page-feeds.css — /feeds (the register) and /feeds/<PAIR> (the band plate).
   Page layout only. Every value below consumes a token declared in style.css;
   nothing here redefines a token or restates a shared component.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── /feeds — the register ───────────────────────────────────────────────── */

/* head: the title block and the band-width rail share the major rule, so the
   right half of the measure carries an argument instead of empty paper */
.feeds-index .feeds-head {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(290px, 0.8fr);
  gap: clamp(1.75rem, 4vw, 3.5rem);
  align-items: start;
  border-bottom: 1px solid var(--rule-ink);
  padding-bottom: var(--s5);
  margin-bottom: var(--s5);
}
.feeds-index .feeds-head .page-head {
  border-bottom: none; padding-bottom: 0; margin-bottom: 0;
}

/* the rail is a `.figure-plate` (style.css) — it adds only the 2px top rule that
   marks it as a plate of its own and its internal rhythm; frame, ground, radius and
   the captioned foot all come from the shared component */
.band-rail {
  border-top: 2px solid var(--rule-2);
  padding: var(--s4) var(--s5) var(--s3);
  margin: 0;
}
.band-rail h4 { margin: 0 0 var(--s3); }
/* the whole field as one bar; segments are keyed to the rows beneath, and every
   count and share is printed there, so nothing lives in the bar alone */
.band-rail .rail-bar {
  display: flex; height: 10px; margin: 0 0 var(--s3);
  border: 1px solid var(--rule-2); border-radius: 2px;
  background: var(--paper-sunk); overflow: hidden;
}
.band-rail .rail-seg { display: block; height: 100%; border-right: 1px solid var(--paper-2); }
.band-rail .rail-seg:last-child { border-right: none; }
.band-rail .rail-key {
  display: inline-block; width: 8px; height: 8px; border-radius: 1px;
  margin-right: .45rem; vertical-align: 0;
}
/* one hue, stepped by weight — tightest band darkest, so the ramp reads as a scale */
.band-rail .rail-seg-0 { background: var(--accent-deep); }
.band-rail .rail-seg-1 { background: var(--accent); }
.band-rail .rail-seg-2 { background: var(--accent-bright); }
.band-rail .rail-seg-3 { background: var(--accent-bright); opacity: .72; }
.band-rail .rail-seg-4 { background: var(--accent-bright); opacity: .48; }
.band-rail .rail-seg-5 { background: var(--accent-bright); opacity: .28; }

.band-rail .rail-rows { margin: 0; }
.band-rail .rail-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(84px, auto);
  align-items: center; gap: var(--s3);
  padding: .3rem 0; border-top: 1px solid var(--rule);
}
.band-rail .rail-row:first-child { border-top: none; }
.band-rail dt {
  font-size: 0.84rem; font-weight: 600; color: var(--ink);
  font-variant-numeric: tabular-nums lining-nums; white-space: nowrap;
}
.band-rail .rail-unit { font-size: var(--fs-micro); font-weight: 600; letter-spacing: .1em; color: var(--ink-3); }
.band-rail .rail-pct { font-weight: 400; color: var(--ink-3); font-size: 0.78rem; margin-left: .2rem; }
.band-rail dd {
  margin: 0; display: flex; justify-content: flex-end;
  align-items: baseline; gap: .5rem;
  font-variant-numeric: tabular-nums lining-nums;
}
.band-rail dd b { font-size: 0.9rem; color: var(--ink); font-weight: 600; }
.band-rail .rail-share { font-size: 0.74rem; color: var(--ink-3); min-width: 2.4em; text-align: right; }
.band-rail figcaption { margin-top: var(--s3); max-width: none; }

/* the feeds head carries the page-head's full-ink rule for the whole grid, so the
   register's section head must not stack a second hairline under it */
.feeds-index .feeds-head + .sec-head { border-top: none; padding-top: 0; margin-top: 0; }

@media (max-width: 900px) {
  .feeds-index .feeds-head { grid-template-columns: 1fr; gap: var(--s5); }
  .band-rail { max-width: 520px; }
}

/* Four columns don't need the 1400px bleed the 12-column register uses: the
   frame keeps its scroll pane, sticky first column and "more below" gradient,
   but stays inside the text block so the figures sit near their labels. */
.feeds-index .table-frame { --bleed: 100%; }

/* The ± translation next to a PPM width is metadata, not a second figure — but it
   carries information, so it sits at the H3 floor for --ink-4 (0.72rem) rather than
   the 0.62rem the shared in-cell pill uses for decoration. */
.feeds-index td .pill {
  white-space: nowrap; font-size: 0.72rem; color: var(--ink-3);
  letter-spacing: 0; min-width: 4.4em; text-align: right;
}

.feeds-index .fine { margin-top: var(--s3); max-width: var(--measure); }
/* a directional CTA must never break before its arrow */
.feeds-index .fine a, .feed-detail .fine a { white-space: nowrap; }
/* the page should not end on 180px of empty paper */
.feeds-index .call, .feed-detail .call { margin-bottom: 0; }

/* ── /feeds/<PAIR> — the chart is the hero ───────────────────────────────── */

/* the page head is deliberately short so the plate clears the fold */
.feed-detail .page-head { padding-bottom: var(--s3); margin-bottom: var(--s5); }
.feed-detail .page-head .dek { max-width: 66ch; }

.feed-detail .chart-plate { margin: 0 0 var(--s5); padding-top: var(--s4); }
.feed-detail .chart-plate .bandview-wrap { margin: 0; }

/* feedchart.js retires the server-rendered fallback with `svg.hidden = true`,
   which silently does nothing: `hidden` is an HTMLElement property and an SVG
   root is not an HTMLElement, so no attribute is ever set and both charts
   painted, stacked (see CSS-REQUESTS.md #1). The uPlot host is inserted as the
   SVG's previous sibling only while the interactive chart is alive — and is
   removed again on failure — so its presence is the honest signal that the
   fallback is redundant. With JS off there is no host and the SVG stands. */
.feed-detail .uplot-host + svg.bandview { display: none; }
/* the zoom group IS an HTMLElement, so `hidden` sticks — but the shared
   `.bv-group { display: inline-flex }` out-specifies the UA `[hidden]` rule and
   left three dead controls on screen once uPlot took over the y-axis. */
.feed-detail .bv-group[hidden] { display: none !important; }

/* controls: a labelled toolbar rather than eleven loose buttons */
.feed-detail .bv-controls {
  display: flex; align-items: center; gap: var(--s3) var(--s5);
  flex-wrap: wrap; margin: 0 0 var(--s3);
  padding-bottom: var(--s3); border-bottom: 1px solid var(--rule);
}
.feed-detail .bv-group { align-items: center; gap: 3px; }
.feed-detail .bv-label {
  font-size: var(--fs-micro); font-weight: 700; letter-spacing: .13em;
  text-transform: uppercase; color: var(--ink-4);
  margin-right: .45rem; white-space: nowrap;
}
/* In dark mode `html.dark button` (0,1,2) out-specifies `.bv-btn` (0,1,0), so every
   control in the band toolbar rendered as a filled gold button and the active state
   became invisible — the toolbar lied about which range and view were on screen.
   Re-stating the control's own surface at (0,2,0) restores it. See CSS-REQUESTS.md #2. */
.feed-detail .bv-btn {
  min-height: 30px;
  background: var(--paper-2); color: var(--ink-3);
  border: 1px solid var(--rule-2);
}
.feed-detail .bv-btn:hover { background: var(--paper-3); color: var(--ink); }
.feed-detail .bv-btn.is-active {
  background: var(--ink); color: var(--paper-2); border-color: var(--ink); font-weight: 600;
}
html.dark .feed-detail .bv-btn.is-active {
  background: var(--accent); color: #14130f; border-color: var(--accent);
}

.feed-detail .uplot-host { margin-top: var(--s2); }

/* the legend reads as a caption line, and every swatch matches the ramp the
   chart actually draws with (§1.4) */
.feed-detail .bv-legend {
  display: flex; align-items: center; gap: .35rem; flex-wrap: wrap;
  margin: var(--s3) 0 0; font-size: 0.76rem; color: var(--ink-3);
}
.feed-detail .mk-swatch {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent-deep); margin-right: 2px; flex: none;
}
.feed-detail .mk-swatch.mk-median { border-radius: 1px; width: 14px; height: 3px; background: var(--accent); }
.feed-detail .mk-swatch.mk-band { border-radius: 1px; width: 14px; height: 9px; background: var(--accent-bright); opacity: .38; }

.feed-detail .chart-plate figcaption { margin-top: var(--s4); }

/* an inline key inside a figcaption must not take the tracked-uppercase "Figure"
   label treatment the shared rule gives every <b> in a caption */
.feed-detail figcaption .cap-key {
  font-style: normal; font-weight: 600; color: var(--ink);
  white-space: nowrap;
}

/* summary: the lead figure and the profile share one row — the page's central
   claim beside the evidence for it */
.feed-detail .feed-summary {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
  gap: var(--s5); align-items: start; margin: 0 0 var(--s5);
}
/* the shared record caps itself at 560px between 761 and 1040px for the landing
   masthead; here it is a full grid column at every width */
.feed-detail .feed-record { max-width: none; height: 100%; }
.feed-detail .feed-record .record-head h2 { font-size: 1.02rem; }
.feed-detail .feed-record .record-figure { font-size: clamp(2.4rem, 4.4vw, 3.2rem); }
.feed-detail .feed-record .record-figure .of { white-space: normal; }
.feed-detail .feed-record .rank-scale { flex-wrap: wrap; }
.feed-detail .feed-record .record-rows { grid-template-columns: repeat(3, 1fr); }
.feed-detail .feed-record .record-row dd { font-size: 1.2rem; }
.feed-detail .feed-record .record-row dd .of { font-size: .7rem; }
.feed-detail .feed-record .record-foot span { max-width: 46ch; }

@media (max-width: 1000px) {
  .feed-detail .feed-summary { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .feed-detail .feed-record .record-rows { grid-template-columns: 1fr 1fr; }
  /* same treatment as the profile scale: the reading takes its own centred row
     rather than colliding with the two ends of the bar */
  .feed-detail .feed-record .rank-scale .rank-pct {
    order: 3; flex-basis: 100%; text-align: center; margin-top: .2rem;
  }
}

/* the explainer is the best teaching artifact on the site — it gets a plate and a
   readable summary, not a 0.7rem tracked line behind a default triangle */
.feed-detail details.explainer {
  border: 1px solid var(--rule); border-left: 3px solid var(--accent);
  border-radius: var(--radius); background: var(--paper-2);
  padding: 0; margin: var(--s5) 0 0; color: var(--ink-2);
}
.feed-detail details.explainer summary {
  display: flex; align-items: center; gap: .6rem;
  list-style: none; cursor: pointer;
  padding: var(--s3) var(--s5); min-height: 44px;
  font-family: var(--font-display); font-size: 1.02rem; font-weight: 600;
  color: var(--ink); letter-spacing: -0.005em;
}
.feed-detail details.explainer summary::-webkit-details-marker { display: none; }
.feed-detail details.explainer summary::before {
  content: "+"; flex: none;
  width: 20px; height: 20px; line-height: 18px; text-align: center;
  border: 1px solid var(--rule-2); border-radius: 2px;
  font-family: var(--font-text); font-size: .9rem; font-weight: 600; color: var(--accent);
}
.feed-detail details[open].explainer summary::before { content: "−"; }
.feed-detail details.explainer summary::after {
  content: "the band, the quartiles, and what our line means";
  font-family: var(--font-text); font-size: 0.8rem; font-weight: 400;
  color: var(--ink-3); letter-spacing: 0;
}
.feed-detail details.explainer summary:hover { background: var(--paper-3); }
.feed-detail details[open].explainer summary { border-bottom: 1px solid var(--rule); }
.feed-detail details.explainer ul {
  margin: 0; padding: var(--s4) var(--s5) var(--s4) 2.4rem;
  max-width: 78ch; font-size: 0.92rem; line-height: 1.62;
}
.feed-detail details.explainer li { margin: 0 0 .55rem; }
.feed-detail details.explainer li:last-child { margin-bottom: 0; }

/* the rounds register shares the page's column instead of bleeding wider than
   the hero plate above it */
.feed-detail .table-frame { --bleed: 100%; }

/* ── agreement profile (Figure 2) ────────────────────────────────────────── */
.feed-detail .profile-plate { margin: 0; padding-bottom: var(--s3); height: 100%; }
.feed-detail .profile-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s4); margin-bottom: var(--s3);
}
.feed-detail .profile-head h4 { margin: 0; }
.feed-detail .profile-max {
  font-size: var(--fs-micro); font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}
.feed-detail .profile-frame { border-bottom: 1px solid var(--rule-2); }
.feed-detail .profile-svg { display: block; width: 100%; height: 96px; }
.feed-detail .profile-fill { fill: var(--accent-bright); opacity: .3; stroke: none; }
.feed-detail .profile-line { fill: none; stroke: var(--accent); stroke-width: 1.2; stroke-linejoin: round; }
.feed-detail .profile-plate .fig-base { stroke: var(--rule-2); }
.feed-detail .profile-scale {
  display: flex; justify-content: space-between; gap: var(--s3);
  margin-top: .4rem;
  font-size: 0.7rem; color: var(--ink-4); font-variant-numeric: tabular-nums;
}
.feed-detail .profile-scale .profile-med {
  color: var(--accent-deep); font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; font-size: 0.68rem;
}

.feed-detail .sec-head { margin-top: var(--s7); }
.feed-detail .fine { max-width: var(--measure); }

@media (max-width: 760px) {
  .feeds-index .table-frame,
  .feed-detail .table-frame { --bleed: calc(100vw - 2.2rem); }
  .feed-detail details.explainer summary { flex-wrap: wrap; }
  .feed-detail details.explainer summary::after { flex-basis: 100%; padding-left: 1.6rem; }
  .feed-detail details.explainer ul { padding-left: 1.9rem; padding-right: var(--s4); }
  .feed-detail .profile-svg { height: 72px; }
  /* the three-up scale line collides at 390 — the median reading takes its own row */
  .feed-detail .profile-scale { flex-wrap: wrap; }
  .feed-detail .profile-scale .profile-med {
    order: 3; flex-basis: 100%; text-align: center; margin-top: .2rem;
  }
  /* the control row scrolls as one strip instead of stacking three rows of
     buttons above the chart */
  .feed-detail .bv-controls {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    gap: var(--s4); padding-bottom: var(--s3);
    -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent);
    mask-image: linear-gradient(90deg, #000 90%, transparent);
  }
  .feed-detail .bv-controls::-webkit-scrollbar { display: none; }
  .feed-detail .bv-group { flex: none; }
  .feed-detail .chart-plate { padding-left: var(--s3); padding-right: var(--s3); }
}

/* At 390px the one-strip toolbar pushed the VIEW and ZOOM groups off the right edge
   behind a fade — a control a reader cannot see is a control they do not have. Below
   480px the groups wrap onto their own lines instead: every button stays on screen and
   nothing has to be discovered by swiping. */
@media (max-width: 480px) {
  .feed-detail .bv-controls {
    flex-wrap: wrap; overflow-x: visible;
    gap: var(--s3) var(--s4);
    -webkit-mask-image: none; mask-image: none;
  }
  .feed-detail .bv-group { flex: 0 1 auto; flex-wrap: wrap; }
  .feed-detail .bv-label { margin-right: .3rem; }
}

/* the band-position reading under the feed record is `.meter-pct`, now shared in
   style.css beside `.rank-pct` — §2.9 reserves .rank-pct for a field position, and
   this is a distance, stated countably in the unit printed at both ends. Two pages
   need it (this one and the lesson rail), so one definition serves both. */
