/* Research hero: the spine chart. Every paper is a square, oldest first by default; a toggle
   reflows them into six bands read top to bottom, atlas to sacrum, each one handing off to the
   explorer below through research:filter. Replaces the old .waffle rules in research.html's
   inline <style> (dead now, see report). Classes are prefixed rh- to stay clear of research.js. */

.rh-chart { margin: 0; justify-self: end; width: min(100%, 27rem); }

.rh-chart__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 0.9rem; }
.rh-stat { margin: 0; display: flex; align-items: baseline; gap: 0.4rem; }
.rh-stat__n { font-family: var(--display); font-weight: 700; font-size: clamp(1.5rem, 2.6vw, 1.9rem); color: var(--ink); line-height: 1; font-variant-numeric: tabular-nums; }
.rh-stat__l { font-family: var(--label); font-weight: 600; font-size: 0.86rem; color: var(--muted); }

.rh-modes { position: relative; display: inline-flex; padding: 3px; background: var(--mist); border-radius: calc(var(--r-btn) + 3px); flex: none; }
.rh-modes__ind { position: absolute; top: 3px; left: 3px; bottom: 3px; width: var(--iw, 50%); border-radius: var(--r-btn); background: var(--ink); box-shadow: 0 1px 2px rgba(10, 13, 18, 0.25); transform: translateX(var(--ix, 0)); transition: transform 0.45s cubic-bezier(0.32, 0.72, 0, 1); }
.rh-mode { position: relative; z-index: 1; border: 0; background: none; padding: 0.4rem 0.75rem; font-family: var(--label); font-weight: 600; font-size: 0.82rem; color: var(--ink-2); cursor: pointer; border-radius: var(--r-btn); transition: color 0.3s; }
.rh-mode[aria-pressed="true"] { color: #fff; }
.rh-mode:not([aria-pressed="true"]):hover { color: var(--accent); }

/* both views share one grid cell (a CSS stack), so the taller one sets the height and the
   figcaption below never overlaps either; opacity and tabindex (in JS) do the rest of the work */
.rh-chart__body { display: grid; }
.rh-grid, .rh-bands {
  grid-area: 1 / 1;
  opacity: 0; translate: 0 6px; pointer-events: none;
  transition: opacity 0.32s cubic-bezier(0.32, 0.72, 0, 1), translate 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}
.rh-grid.is-active, .rh-bands.is-active { opacity: 1; translate: 0; pointer-events: auto; }
/* only the view showing takes up room; the other fades out on top of it (pass 1) */
.rh-chart__body { position: relative; overflow: hidden; }
.rh-grid:not(.is-active), .rh-bands:not(.is-active) { position: absolute; top: 0; left: 0; right: 0; }

.rh-grid { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 3px; align-content: start; }

.rh-sq { aspect-ratio: 1; border-radius: 2px; background: var(--lightbox); cursor: pointer; padding: 0; border: 0; opacity: 0; transform: scale(0.4); filter: blur(5px); transition: opacity 0.4s cubic-bezier(0.28, 0.11, 0.32, 1), transform 0.5s var(--ease-spring), filter 0.4s cubic-bezier(0.28, 0.11, 0.32, 1), background 0.15s, box-shadow 0.15s; }
.rh-view--in .rh-sq { opacity: 1; transform: none; filter: blur(0); }
.rh-sq.is-led { background: var(--accent); }
.rh-sq.is-ed { background: #fff; box-shadow: inset 0 0 0 1.5px var(--accent); }
.rh-sq:hover, .rh-sq.is-on { background: var(--ink); box-shadow: none; transform: scale(1.5); position: relative; z-index: 2; }
.rh-chart.is-dim .rh-sq:not(.is-led) { opacity: 0.22; }
.rh-chart.is-dim .rh-sq.is-led { transform: scale(1.06); }

.rh-bands { display: flex; flex-direction: column; gap: 0.7rem; padding-left: 0.9rem; border-left: 2px solid var(--line); }
.rh-band { position: relative; }
.rh-band::before { content: ''; position: absolute; left: -0.99rem; top: 0.35rem; width: 8px; height: 8px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); transition: background 0.3s, border-color 0.3s, transform 0.35s var(--ease-spring); }
.rh-band.is-hot::before { background: var(--accent); border-color: var(--accent); transform: scale(1.3); }
.rh-band__label { display: flex; align-items: baseline; gap: 0.4rem; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; text-align: left; font-family: var(--label); }
.rh-band__name { font-weight: 600; font-size: 0.92rem; color: var(--ink); transition: color 0.2s; }
.rh-band__n { font-weight: 500; font-size: 0.8rem; color: var(--muted); }
.rh-band__go { opacity: 0; margin-left: -0.1rem; color: var(--accent); transition: opacity 0.2s, transform 0.2s; transform: translateX(-3px); }
.rh-band__label:hover .rh-band__name, .rh-band__label:focus-visible .rh-band__name { color: var(--accent); }
.rh-band__label:hover .rh-band__go, .rh-band__label:focus-visible .rh-band__go { opacity: 1; transform: none; }
.rh-band__squares { margin-top: 0.3rem; display: flex; flex-wrap: wrap; gap: 2px; }
.rh-band__squares .rh-sq { width: 9px; height: 9px; aspect-ratio: auto; border-radius: 1.5px; }
.rh-band__squares .rh-sq:hover, .rh-band__squares .rh-sq.is-on { transform: scale(1.7); }
.rh-bands.is-dim .rh-band:not(.is-hot) .rh-sq:not(.is-led) { opacity: 0.16; }
.rh-bands.is-dim .rh-band:not(.is-hot) .rh-sq.is-led { opacity: 0.55; }
.rh-band--general { margin-top: 0.15rem; padding-top: 0.65rem; border-top: 1px solid var(--line); }
.rh-band--general::before { display: none; }

.rh-chart__foot { margin-top: 1rem; display: grid; gap: 0.6rem; }
.rh-key { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; }
.rh-key__i { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0; border: 0; background: none; font-family: var(--label); font-weight: 600; font-size: 0.9rem; color: var(--muted); }
button.rh-key__i { cursor: pointer; color: var(--ink); }
button.rh-key__i:hover { color: var(--accent); }
.rh-key__i b { font-weight: 600; color: var(--accent); }
.rh-key__i i { width: 11px; height: 11px; border-radius: 2px; background: var(--lightbox); }
.rh-key__i i.is-led { background: var(--accent); }
.rh-key__i i.is-ed { background: #fff; box-shadow: inset 0 0 0 1.5px var(--accent); }
.rh-read { min-height: 2.8em; font-size: 0.92rem; line-height: 1.45; color: var(--ink-2); }
.rh-read b { font-family: var(--label); font-weight: 600; color: var(--accent); margin-right: 0.4rem; }

@media (max-width: 960px) {
  .rh-chart { justify-self: start; width: min(100%, 30rem); }
}
@media (max-width: 600px) {
  .rh-chart__head { flex-wrap: wrap; }
  .rh-band__squares .rh-sq { width: 8px; height: 8px; }
}

/* pass 1 (whole page): the headline and the chart meet in the middle, not at the bottom edge */
.page-hero .rhero__grid { align-items: center; }
