/* =====================================================================================
 * READING RHYTHM — the typography of a long paid reading.
 *
 * This sheet gives the prose air. It never hides it: there is no max-height, no overflow
 * clip, no collapsed state and no accordion anywhere below. Every rule here either spaces
 * the text out or places a picture beside it.
 *
 * MOBILE FIRST. Under 640px the floated card does not float — it becomes a small centred
 * plate ABOVE its paragraph, so the text column is never squeezed on a phone.
 * ===================================================================================== */

.rhy-anchor,
.rhy-toc,
.dsr-body .rhy-seam {
  --rhy-line: #2a2a38;
  --rhy-panel: #171722;
  --rhy-muted: #9a9ab0;
  --rhy-faint: #6f6f86;
  --rhy-brass: #d8b26a;
  --rhy-blue: #7fa8dd;
  --rhy-red: #e0656b;
  --rhy-green: #6fcf97;
}

/* --------------------------------------------------------------- the lead -- */
/* Each paragraph opens with a short bold lead naming what it is about. The generator emits
   it as **bold**, ava_dossier_clean() turns that into <strong>, and this is where it earns
   its keep: a first-child <strong> becomes a quiet brass signpost. */
.dsr-body p > strong:first-child {
  color: var(--rhy-brass, #d8b26a);
  font-weight: 640;
  letter-spacing: .005em;
}

/* Air between paragraphs. Rhythm is mostly this: whitespace and shorter blocks. */
.dsr-body p { margin: 0 0 1.05em; }
.dsr-body p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------- the seam -- */
.dsr-body .rhy-seam {
  border: 0;
  height: 1px;
  margin: 26px auto;
  max-width: 62%;
  background: linear-gradient(90deg, transparent, var(--rhy-line, #2a2a38) 22%, var(--rhy-line, #2a2a38) 78%, transparent);
  position: relative;
  overflow: visible;
}
.dsr-body .rhy-seam::after {
  content: "✦";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 0 10px;
  background: #101019;
  color: var(--rhy-brass, #d8b26a);
  font-size: 10px;
  line-height: 1;
  opacity: .55;
}

/* -------------------------------------------------------- the floated card -- */
/* Mobile default: NO float. A small centred plate that sits above the paragraph it belongs
   to and leaves the text column its full width. */
.rhy-mini {
  display: block;
  margin: 4px auto 18px;
  max-width: 190px;
}
.rhy-mini .arcui-card { margin: 0; }
.rhy-mini .arcui-card__img { width: 100%; height: auto; }

@media (min-width: 641px) {
  .rhy-mini {
    float: right;
    width: 176px;
    max-width: 38%;
    margin: 2px 0 14px 24px;
    shape-outside: margin-box;
  }
  /* the float must not bleed past the end of the section */
  .dsr-body::after { content: ""; display: block; clear: both; }
}

/* ------------------------------------------------------------- the anchor -- */
.rhy-anchor {
  clear: both;
  margin: 22px 0 4px;
  padding-top: 18px;
  border-top: 1px solid var(--rhy-line, #2a2a38);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.rhy-anchor .arcui-rail { margin: 0; }

/* ------------------------------------------------------------ chakra bars -- */
.rhy-bars {
  margin: 0;
  padding: 14px 14px 10px;
  border: 1px solid var(--rhy-line, #2a2a38);
  border-radius: 16px;
  background: var(--rhy-panel, #171722);
}
.rhy-bars__cap {
  font-size: 11.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--rhy-faint, #6f6f86);
  margin: 0 0 12px;
}
.rhy-bars__row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 7px 0;
  border-top: 1px solid rgba(255, 255, 255, .04);
}
.rhy-bars__row:first-of-type { border-top: 0; }
.rhy-bars__row.is-total {
  margin-top: 4px;
  border-top: 1px solid var(--rhy-line, #2a2a38);
  opacity: .85;
}
.rhy-bars__name {
  font-size: 12.5px;
  color: var(--rhy-muted, #9a9ab0);
  line-height: 1.35;
}
.rhy-bars__track {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.rhy-bars__cell {
  position: relative;
  display: block;
  height: 20px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .05);
  overflow: hidden;
}
.rhy-bars__fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 6px;
  background: rgba(216, 178, 106, .42);
  transition: width .35s cubic-bezier(.16, 1, .3, 1);
}
.rhy-bars__cell.is-heavy .rhy-bars__fill { background: rgba(224, 101, 107, .58); }
.rhy-bars__cell.is-light .rhy-bars__fill { background: rgba(111, 207, 151, .42); }
.rhy-bars__cell.is-heavy { box-shadow: inset 0 0 0 1px rgba(224, 101, 107, .55); }
.rhy-bars__v {
  position: relative;
  z-index: 1;
  display: block;
  text-align: right;
  padding-right: 7px;
  font: 600 11.5px/20px ui-monospace, "SF Mono", Menlo, monospace;
  color: #ececf4;
  font-variant-numeric: tabular-nums;
}
.rhy-bars__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--rhy-faint, #6f6f86);
}
.rhy-lg { display: inline-flex; align-items: center; gap: 5px; }
.rhy-lg::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .12);
}
.rhy-lg.is-heavy::before { background: rgba(224, 101, 107, .7); }
.rhy-lg.is-light::before { background: rgba(111, 207, 151, .6); }
.rhy-lg.is-cols::before { display: none; }

@media (min-width: 560px) {
  .rhy-bars__row { grid-template-columns: 1fr 240px; align-items: center; gap: 12px; }
  .rhy-bars__name { font-size: 13px; }
}

/* --------------------------------------------------------- pythag. square -- */
.rhy-sq {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--rhy-line, #2a2a38);
  border-radius: 16px;
  background: var(--rhy-panel, #171722);
}
.rhy-sq__cap {
  font-size: 11.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--rhy-faint, #6f6f86);
  margin: 0 0 12px;
}
.rhy-sq__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.rhy-sq__cell {
  padding: 10px 8px;
  border-radius: 12px;
  border: 1px solid var(--rhy-line, #2a2a38);
  background: rgba(255, 255, 255, .03);
  text-align: center;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}
.rhy-sq__d {
  font: 700 17px/1.1 ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--rhy-brass, #d8b26a);
  letter-spacing: .06em;
}
.rhy-sq__l { font-size: 10.5px; color: var(--rhy-faint, #6f6f86); line-height: 1.3; }
.rhy-sq__cell.is-empty { border-style: dashed; border-color: rgba(224, 101, 107, .45); }
.rhy-sq__cell.is-empty .rhy-sq__d { color: var(--rhy-red, #e0656b); }
.rhy-sq__foot { margin-top: 11px; font-size: 12.5px; color: var(--rhy-muted, #9a9ab0); }
.rhy-sq__foot b { color: #ececf4; }

/* -------------------------------------------------------------- transits --- */
.rhy-tr {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--rhy-line, #2a2a38);
  border-radius: 16px;
  background: var(--rhy-panel, #171722);
}
.rhy-tr__cap {
  font-size: 11.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--rhy-faint, #6f6f86);
  margin: 0 0 10px;
}
.rhy-tr__grid { display: flex; flex-direction: column; }
.rhy-tr__row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 46px;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, .05);
  font-size: 13px;
}
.rhy-tr__row:first-child { border-top: 0; }
.rhy-tr__p { color: var(--rhy-blue, #7fa8dd); font-weight: 600; }
.rhy-tr__a { color: var(--rhy-muted, #9a9ab0); }
.rhy-tr__n { color: #ececf4; }
.rhy-tr__o {
  text-align: right;
  color: var(--rhy-faint, #6f6f86);
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
}

/* ------------------------------------------------------------------ TOC ---- */
.rhy-toc {
  margin: 26px 0 34px;
  padding: 18px 18px 14px;
  border: 1px solid var(--rhy-line, #2a2a38);
  border-radius: 18px;
  background: var(--rhy-panel, #171722);
}
.rhy-toc__h {
  font-size: 11.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--rhy-brass, #d8b26a);
  font-weight: 700;
  margin-bottom: 12px;
}
.rhy-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
}
.rhy-toc__item { margin: 0; }
.rhy-toc__link {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 4px 10px;
  align-items: baseline;
  padding: 9px 8px;
  border-radius: 10px;
  text-decoration: none;
  color: #ececf4;
  transition: background .18s ease, transform .18s cubic-bezier(.16, 1, .3, 1);
}
.rhy-toc__link:hover,
.rhy-toc__link:focus-visible {
  background: rgba(255, 255, 255, .05);
  transform: translateX(2px);
}
.rhy-toc__n {
  font: 600 11px/1.5 ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--rhy-faint, #6f6f86);
  font-variant-numeric: tabular-nums;
}
.rhy-toc__t { font-size: 14.5px; font-weight: 600; }
.rhy-toc__v {
  grid-column: 2;
  font: 500 11.5px/1.4 ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--rhy-brass, #d8b26a);
  opacity: .82;
}
.rhy-toc__v.is-shadow { color: var(--rhy-red, #e0656b); opacity: 1; }
.rhy-toc__v.is-none { display: none; }
.rhy-toc__note {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, .05);
  font-size: 11.5px;
  color: var(--rhy-faint, #6f6f86);
  line-height: 1.45;
}

@media (min-width: 720px) {
  .rhy-toc__list { grid-template-columns: 1fr 1fr; gap: 2px 14px; }
  .rhy-toc__link { grid-template-columns: 26px 1fr auto; }
  .rhy-toc__v { grid-column: 3; text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  .rhy-bars__fill,
  .rhy-toc__link { transition: none; }
}
