/*
 * comp-newborn — the newborn's conditions as a reel (chapter 4). The middle
 * card faces the reader; its neighbours turn away to the sides (transforms
 * set per frame in comp-newborn.js). Newborn = var(--cat-emph).
 */
.rl {
  --rl-card: min(460px, 38vw);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  color: var(--ink);
}
.rl:not(.in-reel) { height: 660px; }

/* the top bar: the kicker on the left, the counter and the arrows on the right, over a rule */
.rl-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid rgba(var(--ink-rgb), .18); }
.rl-kick { margin: 0; min-width: 0; font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--cat-emph); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rl-kick span { font-weight: 400; color: var(--muted); }
.rl-ctl { display: flex; align-items: center; gap: 10px; flex: none; }
.rl-ctl { gap: 8px; }
.rl-count { min-width: 8ch; text-align: center; font-family: var(--font-mono); font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.rl-btn {
  width: 36px; height: 36px; padding: 0;
  font-family: var(--font-mono); font-size: 15px; color: var(--ink);
  background: none; border: 1px solid rgba(var(--ink-rgb), .35); border-radius: 0;
  cursor: pointer; transition: color .15s, background .15s, border-color .15s, opacity .15s;
}
.rl-btn:hover:not(:disabled) { color: var(--bg); background: var(--ink); border-color: var(--ink); }
.rl-btn:disabled { opacity: .3; cursor: default; }

/* ---- the track: cards placed around the middle, in 3D ------------------------ */
.rl-track { position: relative; min-height: 0; perspective: 1400px; perspective-origin: 50% 45%; }
.rl-card {
  position: absolute; left: 50%; top: 50%;
  box-sizing: border-box;
  width: var(--rl-card);
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px 20px 20px;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-top: 3px solid rgba(var(--ink-rgb), .2);
  border-radius: 0;
  box-shadow: 0 18px 50px rgba(var(--ink-rgb), .08);
  backface-visibility: hidden;
  will-change: transform, opacity;
  cursor: pointer;
}
.rl-card.on { cursor: default; border-top-color: var(--cat-emph); }
.rl-art { flex: none; }
.rl-art .vw-art-box { width: 100%; max-width: 100% !important; height: auto; max-height: 36svh; aspect-ratio: 1000 / 720; margin: 0 auto; }
.rl-art .vw-art-box > .vw-art, .rl-art .vw-art-stack { width: 100%; height: 100%; object-fit: contain; }
/* In a 3D-moved card, Chrome drops the 300 weight of the mono font at this
   size; the labels use the normal weight here, a little larger. */
.rl-art .vw-ov-label { font-size: 30px; font-weight: 400; }
/* on a phone the callouts on the drawing shrink below reading size; the card says the same in words */
@container (width < 600px) { .rl-art .vw-overlay { display: none; } }

.rl-text { opacity: var(--t, 1); }
.rl-card:not(.on) .rl-text { pointer-events: none; }
.rl-k { margin: 0 0 6px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--cat-emph); }
.rl-name { margin: 0 0 6px; font-family: var(--font-display); font-size: clamp(22px, 2vw, 28px); font-weight: 500; line-height: 1.15; letter-spacing: -.01em; }
.rl-code { font-family: var(--font-mono); font-size: 12px; font-weight: 400; letter-spacing: .04em; color: var(--muted); vertical-align: 3px; }
.rl-desc { margin: 0; font-family: var(--font-display); font-size: 17px; line-height: 1.4; }
.rl-stats { display: grid; grid-template-columns: repeat(3, minmax(0, auto)); justify-content: space-between; gap: 8px 14px; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--hairline); }
.rl-stats dt { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.rl-stats dd { margin: 3px 0 0; font-family: var(--font-mono); font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---- the card's text: the name (ICD-10 code behind a click), the frequency, a line, two figures ---- */
.rl-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.rl-icd { flex: none; font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; color: var(--label-ink, var(--muted)); }
.rl-icd summary { list-style: none; cursor: pointer; padding: 3px 7px; border: 1px solid rgba(var(--ink-rgb), .25); }
.rl-icd summary::-webkit-details-marker { display: none; }
.rl-icd summary::after { content: " +"; }
.rl-icd[open] summary::after { content: " −"; }
.rl-icd[open] { display: flex; align-items: baseline; gap: 6px; }
.rl-icd span { color: var(--ink); font-size: 12px; }
.rl-hero { margin: 4px 0 10px; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.rl-hero b { font-family: var(--font-display); font-size: clamp(30px, 2.8vw, 38px); font-weight: 500; line-height: 1; letter-spacing: -.02em; color: var(--cat-emph); }
.rl-hero span { font-family: var(--font-mono); font-size: 12px; color: var(--label-ink, var(--muted)); }
.rl-card .rl-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); justify-content: stretch; }

/* ---- the navigation: the nine babies, most common to rarest ---------------- */
.rl-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }
.rl-end { flex: none; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--label-ink, var(--muted)); }
.rl-thumbs { display: flex; gap: 6px; }
.rl-th {
  position: relative; display: grid; justify-items: center; gap: 2px;
  width: 58px; padding: 2px 0 8px; background: none; border: 0; cursor: pointer;
  opacity: .42; transition: opacity .2s;
}
.rl-th img { display: block; width: 100%; height: auto; aspect-ratio: 1000 / 720; object-fit: contain; }
.rl-th::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: 0; height: 2px; background: var(--cat-emph); transform: scaleX(0); transition: transform .25s; }
.rl-th-n { font-family: var(--font-mono); font-size: 10px; color: var(--cat-emph); white-space: nowrap; visibility: hidden; }
.rl-th:hover { opacity: .75; }
.rl-th.on { opacity: 1; }
.rl-th.on::after { transform: scaleX(1); }
.rl-th.on .rl-th-n { visibility: visible; }
.rl-th:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }

@media (width < 900px) {
  .rl { --rl-card: min(80vw, 340px); }
  .rl-kick span { display: none; }
  .rl-card { padding: 14px 14px 16px; gap: 10px; }
  .rl-art .vw-art-box { max-height: 28svh; }
  .rl-name { font-size: 22px; }
  .rl-desc { font-size: 15.5px; }
  .rl-stats dd { font-size: 13.5px; }
  .rl-stats dt { font-size: 11px; }
  .rl-nav { gap: 6px; margin-top: 12px; }
  .rl-end { display: none; }
  .rl-thumbs { gap: 2px; }
  .rl-th { width: 33px; }
  .rl-hero b { font-size: 28px; }
}
@container (width <= 600px) {
  .rl:not(.in-reel) { --rl-card: min(80cqw, 340px); height: 640px; }
}
