/* DeathModal — appears over the play screen when a ruler dies. Inherits
   backdrop / container / title / close from modals.css. Layout pieces
   here are death-specific so visual iteration stays local. */

.death-modal {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.85rem;
  /* Fill the fullscreen modal body's height so the action buttons can be
     pushed to the bottom via margin-top: auto on .death-actions. The
     body is flex: 1 1 auto (see modals.css); this child stretches to
     match it. */
  flex: 1 1 auto;
  min-height: 0;
}

/* The 💀 on the modal title's first row — enlarged so it reads as the
   dominant visual of the death moment, above the "The King/Queen is
   dead" text line. inline-block so the larger glyph gets its own line
   box height (the title already breaks the rows with a <br>). */
.death-title-emoji {
  display: inline-block;
  font-size: 3rem;
  line-height: 1.1;
}

/* Opening prose lines: "Queen X died at..." / "She reigned for N years." /
   "She leaves behind N children." Three separate <p>s that should read as
   one tight stanza, so the reign + children lines are pulled up under the
   death line (countering the modal-body's 1rem inter-child gap). */
.death-message {
  margin: 0;
  line-height: 1.6;
  color: #4a3e30;
}
.death-reign,
.death-children {
  margin-top: -0.7rem;
}

/* ===== Context section (mirrors .end-context) =====
   Sits between the opening prose and the centered Legacy box. Reveals
   sequentially: the "earned +X Legacy" line first, then the badge tally
   appended below it — both PERSIST together (the death modal keeps both,
   unlike End-of-Dynasty which swaps the line for the tally). Fixed
   min-height reserves room so the score box below doesn't jump when the
   tally appears; margin-top: auto + the .death-bottom auto margin split
   the slack, centering this + the score block vertically. */
.death-context {
  /* Fixed height reserves room for the line + badge tally up front, so
     appending the tally in beat 2 fills into already-reserved space
     instead of pushing the score box down mid-animation. Content is
     top-aligned within the reserved block for the same reason.
     Sits just below the opening prose (small top gap) — only
     .death-bottom takes the auto margin now, so the context + tally
     cluster rides UP toward the center rather than being split down. */
  height: 8.5rem;
  margin: 0.5rem 0 0.25rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: 0.6rem;
}
.death-context-line {
  margin: 0;
  font-family: var(--font-family-2);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--font-color-1);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 280ms ease-out, transform 280ms ease-out;
}
.death-context-line.visible {
  opacity: 1;
  transform: translateY(0);
}

/* The signed delta inside the earned-Legacy line — green for a gain, red
   for a loss, so the earned/lost amount pops within the sentence. */
.death-legacy-amount-gain { color: var(--meter-up-color); }
.death-legacy-amount-loss { color: var(--meter-down-color); }

/* Centered Legacy score. No solid backing — the number + label float
   over the modal's parchment surface. */
.death-legacy {
  margin: 0 auto 1.5rem;
  padding: 0.5rem 1.25rem;
  text-align: center;
}

/* The big "X / Y" score row. X = cumulative Legacy (animated before →
   after), Y = cumulative ceiling. align-items: baseline so the smaller
   ceiling sits on the number's baseline. */
.death-legacy-score-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.15rem;
}
/* The cumulative Legacy number (X) — header-tier display flourish, same
   treatment as .end-legacy-number. */
.death-legacy-score-value {
  font-family: var(--font-family-1);
  font-size: 3.25rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  color: var(--font-color-1);
}
/* The "/ Y" cap — smaller, muted ceiling beside the score. */
.death-legacy-cap {
  font-family: var(--font-family-1);
  font-size: 1.5rem;
  line-height: 1;
  color: var(--font-color-2);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
/* "LEGACY" caption under the number. */
.death-legacy-label {
  font-family: var(--font-family-2);
  margin-top: 0.4rem;
  font-size: 0.7rem;
  color: var(--font-color-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Bottom cluster (explainer + buttons), pinned to the floor of the
   modal. margin-top: auto here absorbs the slack so the context + score
   block above settles toward the middle while this stays at the bottom —
   the same two-auto-margins split the End-of-Dynasty modal uses. */
.death-bottom {
  margin-top: auto;
}

/* Two-row meters explainer, just above the buttons inside .death-bottom.
   The two rows are pulled tight together so they read as one footnote
   couplet. */
.death-explainer-block {
  padding-bottom: 0.75rem;   /* space before the buttons */
}
.death-legacy-explainer {
  margin: 0;
  line-height: 1.5;
  color: #6a5a4a;
  font-size: 0.875rem;
}
.death-legacy-explainer-avg {
  margin-bottom: 0.1rem;
}

/* Heirless callout — the line ends, rendered in the heirless variant.
   Italicised and quiet to match the finality of the moment. */
.death-heirless {
  margin: 0;
  line-height: 1.6;
  color: #4a3e30;
  font-style: italic;
}

/* DeathModal is a fullscreen modal, so the button row follows the
   fullscreen rule: pair buttons side-by-side at 50%. The heirless
   variant has a single button — it stretches to fill the row width.
   .death-bottom (the wrapper) owns the floor-pinning margin-top: auto. */
.death-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;   /* lets the inline end-confirm prompt + Yes/No row stack */
  gap: 0.5rem;
  align-self: stretch;
}

.death-actions .button-primary,
.death-actions .button-secondary,
.death-actions .button-danger {
  flex: 1 1 0;
}

/* Inline end-the-line confirmation. When "End the line now" is tapped,
   the action row's contents are replaced with this prompt + Yes/No row.
   The parent .death-actions is flex-row, so we make these children span
   the full width (flex-basis: 100%) and stack: the prompt on its own
   line, the Yes/No buttons side-by-side beneath it. */
.death-end-confirm-prompt {
  flex: 1 0 100%;
  margin: 0;   /* parent .death-actions gap provides the separation */
  text-align: center;
  line-height: 1.5;
  color: #4a3e30;
  font-weight: 700;
}
.death-end-confirm-row {
  flex: 1 0 100%;
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
}
.death-end-confirm-row .button-secondary,
.death-end-confirm-row .button-danger {
  flex: 1 1 0;
}
