/* The stack above the artist name was FOUR layers deep: .main-content's 4.5rem
   header clearance, then this column's 4rem, then .section-header's own 1rem
   top margin. That read as a large empty band under the nav and pushed the
   influence ledger — the page's actual differentiator — entirely below the fold
   on a laptop.

   The 4.5rem clearance in layout.css is LOCKED and hand-tuned; do not reclaim
   space there. Both other layers are page-scoped, so the trim comes from them:
   --space-xl here (the site-wide opening inset every other page container now
   uses), and the title's own margin is zeroed just below, which is what makes
   this page land level with the others despite the larger heading.

   Bottom padding drops to 0 and the head card's own bottom margin carries the
   gap down to the ledger band, so the two are not paid twice. */
.genres-main {
  padding: var(--space-xl) 2rem 0;
  max-width: 80rem;
  margin: 0 auto;
}

/* The shared .section-header carries a 1rem top margin for headings that follow
   body copy. The artist/writer name opens the column directly under the fixed
   header's clearance, so that margin is pure dead space here.

   Selected by the --large-text modifier, which only the page title uses, rather
   than :first-child: the trail <nav> renders before the title, so a
   first-child rule would never match. Mid-page headers ("Albums") are plain
   .section-header and keep their margin. */
.genres-main > .genre-section > .section-header--large-text {
  margin-top: 0;
}

/* The column below the full-bleed ledger. The band supplies its own generous
   vertical padding, so this side doesn't re-pay for it at the top. Bottom
   padding is restored here (the shared rule above zeroes it) because nothing
   below this column pays for the gap above the footer. */
.genres-main--lower {
  padding-top: 0;
  padding-bottom: 4rem;
}

/* ---------- Page head ----------
   Portrait and authored summary as ONE card, two columns inside it. The card is
   what the earlier version got wrong by putting the chrome on the summary alone:
   a box around the paragraph, with the photo loose on the page above it, framed
   the prose as a callout and left the two halves unrelated. Bounding both makes
   the head a single object, which is the thing that should stand out from the
   page — the portrait and the framing are one editorial unit.

   Geometry is the site's standard card (.dispatch-card): paper surface, hairline
   border, --radius-md, --shadow-card. Deliberately NOT a new card style, and
   deliberately not the sunk surface: --color-bg-card sits ON the page ground
   while --color-bg-subtle reads as recessed below it, and this block should
   read as raised.

   The portrait column is fixed so it is the same width on every artist page
   regardless of the source crop; the prose takes the rest. minmax(0, 1fr) on the
   prose half, not a bare 1fr: a long unbroken word (a hyphen-free band name in
   the copy) would otherwise set the column's floor to its own width and push the
   grid past the container.

   max-width is the prose measure (44rem) + the portrait column + the gap +
   padding, so the card doesn't run the full 80rem column while the paragraph
   inside it stops halfway. */
/* The .detail-actions row above carries a 44px tap-target floor (an
   accessibility minimum, not spacing — do not reclaim height there), so the
   air between the actions and this card comes off the card's top margin
   instead. */
.artist-head {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  gap: var(--space-lg);
  align-items: start;
  max-width: 68rem;
  margin: var(--space-md) 0 var(--space-xl);
  padding: var(--space-lg);
  background: var(--color-bg-card);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

/* One half missing: no empty column, and the portrait keeps its own width
   instead of stretching across the measure. */
.artist-head--solo {
  grid-template-columns: minmax(0, 1fr);
}

/* Source images vary in aspect ratio (Spotify gives square, landscape, and tall
   portrait crops). A fixed square frame + object-fit: cover gives every artist
   the same box; object-position keeps the top so faces aren't chopped. Not the
   old 18x12 letterbox, because the frame now stands in a column beside text
   where a wide short crop reads as a clipped strip.

   No shadow of its own: the card carries the elevation, and a shadowed image
   inside a shadowed box is the doubled-chrome problem one level down. The
   slightly tighter radius is the standard inner-corner treatment — matching
   --radius-md exactly would leave the image's corner fighting the card's.

   4:5 was too tall: at a 16rem column it forced a 320px floor under the card
   regardless of how short the summary was, so a three-line lede left a long
   empty gutter beside the photo and pushed the ledger off screen. 1:1 at a
   14rem column costs ~100px less, and the square reads as deliberate rather
   than cropped-to-fit when the copy runs shorter than the frame. */
.artist-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center top;
  display: block;
  margin: 0;
  border-radius: var(--radius-sm);
}

/* Solo portrait (no summary): the grid is one full-measure column, so cap the
   image at its normal column width rather than letting it blow up. */
.artist-head--solo .artist-image {
  max-width: 14rem;
}

/* Solo lede — every writer page, and an artist with no photo. Without the
   portrait column the prose would run the card's full width, well past a
   readable line length, so cap it at its old measure. */
.artist-head--solo .influence-summary {
  max-width: 44rem;
}

.playlist-embed {
  max-width: 600px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.start-here-playlist {
  text-align: center;
  margin: 3rem 0;
}

.playlist-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  margin-bottom: 1rem;
}

.playlist-description {
  max-width: 600px;
  margin: 1rem auto 0;
  font-size: 1rem;
  line-height: 1.6;
}

.artist-network-section {
  margin-top: 3rem;
  margin-bottom: 2rem;
  text-align: center;
}

.artist-network-section h3 {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  margin-bottom: 1.5rem;
}

.artist-network-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
}

.connection-avatar {
  width: 6rem;
  height: 6rem;
  border-radius: var(--radius-round);
  overflow: hidden;
  margin: 0 auto 0.5rem;
}

.connection-avatar img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-round);
}

.connection-name {
  font-size: 1rem;
  font-weight: 500;
  margin-top: 0.25rem;
}

.artist-description {
  max-width: 40rem;
  margin: 3rem auto;
  padding: 0 1rem;
  font-size: 1.1rem;
  line-height: 1.75;
  color: var(--color-gray-text);
  text-align: left;
  font-variant-numeric: lining-nums;
}

.artist-description p {
  margin-bottom: 1.25rem;
}

/* Elegant blockquote styling */
.artist-description blockquote {
  margin: 2rem 0;
  padding: 1rem 1.5rem;
  border-left: 4px solid var(--color-border);
  background-color: var(--color-bg-subtle);
  font-style: italic;
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-heading-muted);
}

/* Optional: classier links inside blockquotes */
.artist-description blockquote a {
  text-decoration: none;
  color: var(--color-dark-gray);
  font-weight: var(--font-weight-semibold);
  border-bottom: 1px dotted var(--color-subtle-text);
}

/* --- Exploration breadcrumb trail (browser-side, see static/js/trail.js) --- */
.artist-trail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 var(--space-md);
  padding-top: var(--space-md);
  font-family: var(--font-content);
  font-size: var(--font-size-sm);
  color: var(--color-subtle-text);
}

/* The nav ships in the HTML empty and hidden (trail.js fills it once it knows
   the stored trail), so `display: flex` above must not override the `hidden`
   attribute — otherwise a first visit renders an empty flex box and its spacing
   as a blank gap above the title. */
.artist-trail[hidden] {
  display: none;
}

.artist-trail-link {
  color: var(--color-subtle-text);
  text-decoration: none;
}

.artist-trail-link:hover {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.artist-trail-sep {
  color: var(--color-light-gray);
}

.artist-trail-current {
  color: var(--color-heading);
  font-weight: var(--font-weight-semibold);
}

/* ---------- Responsive ---------- */

@media (max-width: 54rem) { /* --bp-phone */
  /* The shorter mobile header means the 4rem top padding leaves a large gap
     above the artist image — pull the content up. */
  .genres-main {
    padding: var(--space-xl) 1rem var(--space-xl);
  }

  .genres-main--lower {
    padding-top: 0;
  }

  /* One column: portrait first, then the lede. A 16rem column beside prose is
     ~40% of a phone's width, which leaves the paragraph setting at four or five
     words a line.

     Padding drops a step. --space-xl inside a card on a ~360px screen spends
     18% of the width on gutters, and the card already sits inside the column's
     own 1rem padding, so the copy measure gets squeezed twice. */
  .artist-head {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-lg);
    padding: var(--space-lg);
  }

  /* A full-width 4:5 portrait would eat most of a phone screen before the reader
     reaches a word of copy, so the frame goes landscape here. This is the one
     place the aspect ratio changes: the desktop column is portrait because it
     stands beside text, the phone banner is not because it stands above it.

     Full width rather than the desktop cap — inside a card, a 20rem image on a
     wider phone would leave a ragged strip of surface beside it, where the same
     image loose on the page read fine. */
  .artist-head .artist-image,
  .artist-head--solo .artist-image {
    max-width: 100%;
    aspect-ratio: 3 / 2;
  }
}

/* ---------- Influence readout (SEO Phase 2) ----------
   The always-visible, crawlable structured list of curated connections. Built
   from DB rows by core.services.seo.influence_readout — replaces the old
   display:none fallback list. All values come from the design tokens. */

/* The summary is the page's editorial lede — the one piece of authored voice
   above the data. It carries NO chrome of its own: no surface, border, shadow or
   rule. .artist-head is the card, and every mark repeated here would be a second
   frame drawn just inside the first. It used to hold all four at once, which is
   why it read as a warning box rather than an opening paragraph.

   What sets it apart from body copy is type alone: the content serif, muted ink,
   and a HALF step up at --font-size-lede. It was a full step (--font-size-lg,
   1.25rem) with relaxed leading, and at that size it stopped reading as a lede
   and just read as oversized body copy. The separation here should stay subtle;
   the serif and the muted ink are doing most of the work.

   No max-width: the grid column is the measure now (the solo variant sets one,
   since there is no portrait column to constrain it). Setting one here would let
   the prose stop short inside its own column, which was half the original
   problem. */
.influence-summary {
  margin: 0;
  text-align: left;
  color: var(--color-heading-muted);
  font-family: var(--font-content);
  font-size: var(--font-size-lede);
  line-height: var(--line-height-body);
  text-wrap: pretty;
}

/* |linebreaks gives one <p> per paragraph, so space them but leave no trailing
   gap inside the card. */
.influence-summary p {
  margin: 0 0 var(--space-md);
}

.influence-summary p:last-child {
  margin-bottom: 0;
}

/* The lede is sized up so it reads as a lede BESIDE the portrait. Stacked on a
   phone there is nothing to out-rank, and every extra fraction of a rem costs a
   line on a narrow measure, so it drops to plain body size.

   This sits after the base rule rather than up in the responsive section
   because the two have equal specificity — in the block above it loses on
   source order and never applies. */
@media (max-width: 54rem) { /* --bp-phone */
  .influence-summary {
    font-size: var(--font-size-base);
  }
}

.influence-readout {
  margin: var(--space-lg) 0;
}

/* Heading + a quiet "N connections · M cited" confidence line. */
.influence-readout-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-xs) var(--space-md);
}

.influence-readout-meta {
  margin: 0;
  font-size: var(--font-size-sm);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-subtle-text);
}

.influence-readout-cited {
  color: var(--color-accent);
}

.influence-readout-dot {
  margin: 0 var(--space-xxs);
  color: var(--color-light-gray);
}

/* Each connection-type group: a label, then a wrapping field of chips. */
.influence-readout-groups {
  margin-top: var(--space-md);
}

.influence-readout-group {
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-divider);
}

.influence-readout-group:last-child {
  border-bottom: 0;
}

.influence-readout-term {
  margin: 0 0 var(--space-sm);
  font-family: var(--font-ui);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-heading-muted);
}

.influence-chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

/* === "SHOW ALL" DISCLOSURE (long connection groups) ===
   A CSS-only toggle: the checkbox is visually hidden, its label is the button,
   and the sibling list is clipped. Every chip stays in the DOM at every state,
   which is the point — this list is the page's crawlable connection content.

   The collapsed height is a max-height rather than an nth-child cutoff because
   chips are name-width and wrap unpredictably: clamping the box keeps the
   collapsed state a consistent size whether the names are "U2" or "Tom Petty
   and the Heartbreakers". The value shows roughly four rows. */
.influence-chips--clamped {
  max-height: 9.5rem;
  overflow: hidden;
  /* Fade the clipped edge so it reads as "more below" rather than a hard cut. */
  mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
}

.influence-more-toggle:checked ~ .influence-chips--clamped {
  max-height: none;
  overflow: visible;
  mask-image: none;
  -webkit-mask-image: none;
}

.influence-more-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
  margin-top: var(--space-sm);
  /* Comfortable thumb target; this is a primary control on phones. */
  min-height: 44px;
  font-family: var(--font-ui);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-accent);
  cursor: pointer;
}

.influence-more-label:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Swap the label's two spans on state. */
.influence-more-label-hide,
.influence-more-toggle:checked ~ .influence-more-label .influence-more-label-show {
  display: none;
}

.influence-more-toggle:checked ~ .influence-more-label .influence-more-label-hide {
  display: inline;
}

/* The checkbox is sr-only, so its focus ring would be invisible. Move the
   keyboard-focus treatment onto the label the user actually sees. */
.influence-more-toggle:focus-visible ~ .influence-more-label {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-sm);
}

/* The chip: a pill that holds the subject name and, if present, a cite marker.
   Sourced chips read as the "confidence" signal — a left accent rail. */
.influence-chip {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--color-light-gray);
  border-radius: var(--radius-pill);
  background: var(--color-bg-card);
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.influence-chip:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-card);
}

.influence-chip-link {
  padding: var(--space-xxs) var(--space-md);
  font-size: var(--font-size-base);
  line-height: 1.4;
  color: var(--color-heading);
  text-decoration: none;
  white-space: nowrap;
}

.influence-chip:hover .influence-chip-link {
  color: var(--color-accent);
}

/* The source marker(s) inside a sourced chip: a small, set-off cite tag. */
.influence-chip-cites {
  display: inline-flex;
  align-items: center;
  border-left: 1px solid var(--color-light-gray);
  background: var(--color-bg-subtle);
}

.influence-chip-cite {
  padding: var(--space-xxs) var(--space-sm);
  font-size: var(--font-size-xs);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-subtle-text);
  text-decoration: none;
  white-space: nowrap;
}

.influence-chip-cite:hover {
  color: var(--color-accent);
}

/* Genres are descriptive, not navigable — quiet chips with no border/hover. */
.influence-chip--genre {
  border-color: transparent;
  background: var(--color-bg-subtle);
}

.influence-chip--genre:hover {
  border-color: transparent;
  box-shadow: none;
}

.influence-chip--genre .influence-chip-link {
  color: var(--color-heading-muted);
  cursor: default;
}

@media (max-width: 40rem) { /* non-canonical, fold onto --bp-phone (54rem) */
  .influence-chip-link {
    padding: var(--space-xxs) var(--space-sm);
  }
}

/* === RELATED ESSAYS (artist/writer → essay cross-links) ===
   Editorial row list: quiet, newspaper-style rows that echo the influence
   table above. Serif title that takes the accent color on hover; a small-caps
   muted meta line (By Author · Date). */
.related-essays {
  margin-top: var(--space-2xl);
}

.related-essays-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--color-divider);
}

.related-essays-item {
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-divider);
}

.related-essays-link {
  display: inline-block;
  text-decoration: none;
}

.related-essays-title {
  font-family: var(--font-heading);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  line-height: 1.25;
  color: var(--color-heading);
  transition: color var(--transition-fast);
}

.related-essays-link:hover .related-essays-title,
.related-essays-link:focus-visible .related-essays-title {
  color: var(--color-accent);
}

.related-essays-meta {
  margin: var(--space-xs) 0 0;
  font-size: var(--font-size-sm);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-subtle-text);
}

.related-essays-sep {
  margin: 0 var(--space-xs);
  color: var(--color-light-gray);
}

.related-essays-date {
  white-space: nowrap;
}

/* === READ NEXT — "More in {genre}" artist rail ===
   Onward path at the bottom of an artist page (not a track list). A compact
   responsive grid of genre-mates that echoes the influence chips above. */
.read-next--artists {
  margin-top: var(--space-2xl);
}

.read-next-artist-grid {
  list-style: none;
  margin: var(--space-md) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
  gap: var(--space-md);
}

.read-next-artist-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  text-decoration: none;
  text-align: center;
}

.read-next-artist-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-round);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast);
}

.read-next-artist-link:hover .read-next-artist-image,
.read-next-artist-link:focus-visible .read-next-artist-image {
  box-shadow: var(--shadow-card-hover);
}

.read-next-artist-name {
  font-family: var(--font-heading);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  line-height: 1.25;
  color: var(--color-heading);
  transition: color var(--transition-fast);
}

.read-next-artist-link:hover .read-next-artist-name,
.read-next-artist-link:focus-visible .read-next-artist-name {
  color: var(--color-accent);
}

/* ============================================================
   THE INFLUENCE LEDGER
   The artist page's full-bleed dark band. Replaced the D3 force graph and the
   chip list: the force layout crowded and clipped on well-connected artists
   (The Beatles carries 73 edges) and never showed WHY two artists were linked.
   A ledger cannot overlap by construction and puts the citation on every row.

   Full-bleed from inside a centred column. Unlike the homepage — where the band
   is a sibling of the column — this section sits inside .genres-main, so it
   escapes with the margin/padding pair below rather than a template change.
   `100vw` is deliberately NOT used: it counts the scrollbar and overflows the
   page by its width. Doubling a 50% negative margin against 50% padding stays
   exactly as wide as the content box's parent, scrollbar included.
   ============================================================ */
/* No bleed trickery: the section is a SIBLING of .genres-main (see
   artist_detail.html), so it is full-width structurally at every viewport.
   Negative margins can't reach the viewport edge from inside a centred column,
   and 100vw over-shoots by the scrollbar's width. */
.ledger {
  background: var(--palette-ink);
  color: var(--text-light);
  padding: var(--space-2xl) 0;
}

/* The .section-bar that opens the band carries a shared 3.5rem TOP margin, for
   separating one section from the last on the paper ground. Here it stacks on
   the band's own --space-2xl padding, so ~104px of black sat above the rule and
   the band opened with a void. The band's padding is the separation now, so the
   bar's own top margin is dead space — zero it, keeping the bottom margin that
   sets the rule off from the headline. */
.ledger .section-bar {
  margin-top: 0;
}

.ledger-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ---------- Lede: headline + the citation credential ---------- */
.ledger-lede {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18rem;
  gap: var(--space-2xl);
  align-items: start;
  margin-bottom: var(--space-xl);
}

.ledger-headline {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-bold-heading);
  font-size: clamp(1.6rem, 3.2vw, 2.5rem);
  line-height: 1.06;
  letter-spacing: -0.015em;
  color: var(--text-light);
  margin: 0 0 var(--space-sm);
}

.ledger-deck {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.55;
  margin: 0;
  max-width: 34rem;
}

.ledger-stat {
  border-left: 1px solid var(--palette-neutral-700);
  padding-left: var(--space-xl);
}

.ledger-stat-figure {
  font-family: var(--font-heading);
  font-size: 3rem;
  font-weight: var(--font-weight-bold);
  line-height: 1;
  color: var(--text-light);
  margin: 0;
}

.ledger-stat-label {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--text-muted);
  margin: var(--space-xs) 0 0;
}

.ledger-stat-note {
  font-family: var(--font-content);
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin: var(--space-md) 0 0;
}

/* The all-cited case has no second number to carry the accent, so the statement
   itself takes it — same treatment as the homepage band's complete note. */
.ledger-stat-note--complete {
  font-style: normal;
  color: var(--color-accent-on-dark);
}

.ledger-stat-note-figure {
  font-family: var(--font-heading);
  font-style: normal;
  font-size: 1.5rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-accent-on-dark);
}

/* ---------- The spine ----------
   Influences flow in from the left, descendants out to the right, the subject
   between them. `auto` on the middle track lets the medallion size itself. */
.ledger-spine {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
}

.ledger-subject {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 var(--space-xs);
  align-self: stretch;
}

.ledger-subject-rule {
  width: 1px;
  height: var(--space-lg);
  background: var(--palette-neutral-700);
  flex: none;
}

.ledger-subject-rule--long {
  flex: 1;
  height: auto;
  min-height: var(--space-3xl);
}

.ledger-subject-medallion {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 6rem;
  height: 6rem;
  padding: var(--space-xs);
  border-radius: var(--radius-round);
  border: 2px solid var(--color-accent-on-dark);
  background: var(--palette-neutral-800);
  font-family: var(--font-heading);
  font-size: 0.8rem;
  line-height: 1.15;
  text-align: center;
  color: var(--color-accent-on-dark);
  flex: none;
  /* A long name must not blow the circle out. */
  overflow: hidden;
}

/* ---------- Sides ---------- */
.ledger-side--in {
  padding-right: var(--space-xl);
  text-align: right;
}

.ledger-side--out {
  padding-left: var(--space-xl);
}

.ledger-side-label {
  font-family: var(--font-ui);
  font-size: 0.66rem;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps-wide);
  color: var(--text-muted);
  margin: 0 0 var(--space-xxs);
}

.ledger-side-count {
  font-family: var(--font-ui);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--palette-neutral-650);
  margin: 0 0 var(--space-md);
}

/* ---------- Rows ---------- */
.ledger-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ledger-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--palette-neutral-800);
}

.ledger-row:last-child {
  border-bottom: none;
}

/* The connector: a short accent rule pointing at the spine. It sits on the
   spine side of the row, so the two columns mirror each other. */
.ledger-side--in .ledger-row {
  flex-direction: row-reverse;
}

.ledger-row-rule {
  width: 1.375rem;
  height: 1px;
  background: var(--color-accent);
  flex: none;
}

.ledger-row-name {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  line-height: 1.2;
  color: var(--text-light);
  text-decoration: none;
}

.ledger-row-name:hover,
.ledger-row-name:focus-visible {
  color: var(--color-accent-on-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* The citation. Its title/aria carry the source's own description (a real
   headline, e.g. "How the Fab 4 Influenced Queen") so the evidence is one
   hover away without widening every row. */
.ledger-row-cite {
  font-family: var(--font-ui);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--palette-neutral-600);
  border: 1px solid var(--palette-neutral-700);
  border-radius: var(--radius-pill);
  padding: 0.125rem 0.5rem;
  text-decoration: none;
  white-space: nowrap;
  flex: none;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.ledger-row-cite:hover,
.ledger-row-cite:focus-visible {
  color: var(--color-accent-on-dark);
  border-color: var(--color-accent-on-dark);
}

/* ---------- "Show all" disclosure ----------
   CSS-only, exactly like the chip list it replaced: the checkbox is visually
   hidden and clamps the sibling list's height. EVERY ROW STAYS IN THE DOM —
   this block is the page's crawlable connection content. Do not reimplement
   this by slicing in the template or injecting with JS. */
.ledger-rows--clamped {
  max-height: 26rem;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, #000 78%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent 100%);
}

.ledger-more-toggle:checked ~ .ledger-rows--clamped {
  max-height: none;
  overflow: visible;
  mask-image: none;
  -webkit-mask-image: none;
}

.ledger-more-label {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: var(--space-xs);
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--color-accent-on-dark);
  cursor: pointer;
}

.ledger-more-label:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ledger-more-label-hide,
.ledger-more-toggle:checked ~ .ledger-more-label .ledger-more-label-show {
  display: none;
}

.ledger-more-toggle:checked ~ .ledger-more-label .ledger-more-label-hide {
  display: inline;
}

/* The checkbox is sr-only, so move its keyboard-focus ring to the visible label. */
.ledger-more-toggle:focus-visible ~ .ledger-more-label {
  outline: var(--focus-ring-width) solid var(--color-accent-on-dark);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-sm);
}

/* ---------- Minor relation types, below the spine ---------- */
.ledger-other {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--palette-neutral-700);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--space-xl);
}

/* ---------- Responsive ---------- */
@media (max-width: 54rem) { /* --bp-phone */
  .ledger {
    padding: var(--space-xl) 0;
  }

  .ledger-inner {
    padding: 0 1rem;
  }

  .ledger-lede {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

  .ledger-stat {
    border-left: none;
    border-top: 1px solid var(--palette-neutral-700);
    padding-left: 0;
    padding-top: var(--space-lg);
  }

  .ledger-stat-figure {
    font-size: 2.5rem;
  }

  /* The spine collapses: one column, no medallion. A centre column with two
     stacked lists either side reads as nothing at all on a phone, and the
     subject's name is already the page's h1 a few hundred pixels up. */
  .ledger-spine {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .ledger-subject {
    display: none;
  }

  /* Both sides read left-to-right; the mirrored connector would be confusing
     without a spine to point at. */
  .ledger-side--in,
  .ledger-side--out {
    padding: 0;
    text-align: left;
  }

  .ledger-side--in .ledger-row {
    flex-direction: row;
  }

  /* Shorter than the desktop 26rem, and shorter than the 20rem this was: the
     disclosure threshold is 8 rows, so at 20rem (~7.5 rows) a newly-clamped
     9-row side hid a row and a half and the control barely disclosed anything.
     18rem shows ~6.8 rows, which keeps the side to about a third of a phone
     screen and gives "Show all" something to do. */
  .ledger-rows--clamped {
    max-height: 18rem;
  }
}
