/* modals components: EventModal (+OptionPreviewCard), EndTenureBook, Ledger, Codex.
 * Authored paper theme (theme.css): panel #F4EFE6 / 1px ink border, ink text, walnut-umber links. */

/* RichTextLabel stand-in: wrapped rich text with codex links. */
.rtl { color: var(--ink); font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }

/* EventModal min 960x440, centered horizontally on any screen aspect ratio. */
.event-modal {
  left: calc((var(--stage-w, 1920px) - 960px) / 2) !important;
  top: calc((var(--stage-h, 1080px) - 620px) / 2) !important;
  width: 960px;
}
.event-modal-panel { min-height: 440px; width: 960px; padding: 16px 20px; box-shadow: 0 6px 22px rgba(30, 28, 26, 0.35); }
.event-modal-column { gap: 10px; }
.event-modal-title { font-family: var(--font-title); font-weight: 700; white-space: pre-wrap; line-height: 1.5; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.event-stamp { font-family: var(--font-ui); font-size: 13px; font-weight: 700; letter-spacing: 1px; margin-right: 4px; }
.event-meta-tag { margin-left: auto; font-family: var(--font-mono); font-size: 12px; font-weight: 400; color: var(--muted); letter-spacing: 0.5px; }

/* Two-column archival hero: historical photo print on left, narrative + perspectives on right */
.event-modal-hero {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 10px 0 6px;
  border-top: 1px solid rgba(30, 28, 26, 0.28);
  border-bottom: 1px solid rgba(30, 28, 26, 0.18);
}
.event-photo-card {
  margin: 0;
  flex: 0 0 330px;
  width: 330px;
  background: #FAF6EE;
  border: 1px solid rgba(30, 28, 26, 0.65);
  padding: 7px 7px 8px;
  box-shadow: 2px 3px 10px rgba(30, 28, 26, 0.18);
  transition: width 0.2s ease, flex-basis 0.2s ease;
}
.event-photo-card.event-photo-expanded {
  flex: 0 0 480px;
  width: 480px;
}
.event-photo-card.event-photo-missing {
  display: none;
}
.event-photo-mat {
  position: relative;
  width: 100%;
  height: 210px;
  background: #1E1C1A;
  border: 1px solid #1E1C1A;
  overflow: hidden;
  cursor: zoom-in;
}
.event-photo-card.event-photo-expanded .event-photo-mat {
  height: 320px;
  cursor: zoom-out;
}
.event-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  display: block;
  filter: sepia(0.12) contrast(1.04);
  transition: filter 0.2s ease;
}
.event-photo-card.event-photo-expanded .event-photo-img {
  object-fit: contain;
  background: #141312;
  filter: none;
}
.event-photo-badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: rgba(20, 19, 18, 0.76);
  color: #F4EFE6;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  letter-spacing: 0.6px;
  border: 1px solid rgba(244, 239, 230, 0.35);
  pointer-events: none;
}
.event-photo-caption {
  margin-top: 6px;
  font-family: var(--font-title);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink);
}
.event-photo-credit {
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.3;
  color: var(--muted);
}

.event-modal-narrative-col {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.event-modal-body { font-size: 15px; line-height: 1.62; padding: 0; }
.event-perspectives {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  padding: 7px 10px;
  background: rgba(232, 223, 209, 0.55);
  border-left: 3px solid var(--amber);
  font-size: 12.5px;
  line-height: 1.48;
}
.event-perspective-item { color: #3D3833; }
.event-perspective-label { font-weight: 700; color: var(--ink); margin-right: 4px; }
.event-modal-cards { gap: 7px; }
button.btn.event-option { width: 100%; text-align: left; padding: 9px 12px; font-size: 14.5px; white-space: pre-wrap; }
button.btn.event-option:hover:not(:disabled) { background: var(--paper-2); }

/* OptionPreviewCard: compact 3-layer preview under the options. */
.option-preview-card { border: 1px dashed var(--ink); background: rgba(232, 223, 209, 0.6); padding: 6px 10px; font-size: 13px; }
.option-preview-card .preview-line { display: flex; gap: 10px; line-height: 1.55; }
.option-preview-card .preview-key { flex: 0 0 auto; font-weight: 700; color: var(--ink); }
.option-preview-card .preview-val { flex: 1 1 auto; color: #524B44; }

/* Ledger / Codex overlays, centered horizontally. */
.ledger-overlay, .codex-overlay {
  left: calc((var(--stage-w, 1920px) - 920px) / 2) !important;
  padding: 14px 18px; box-shadow: 0 4px 16px rgba(30, 28, 26, 0.3); overflow: hidden;
}
.ledger-body { font-size: 14px; line-height: 1.8; }
.codex-body { width: 640px; font-size: 14px; }
.codex-term-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; width: 640px; }
button.btn.codex-term-btn { padding: 3px 10px; font-size: 12.5px !important; }
.codex-entry { margin-top: 14px; padding-top: 10px; border-top: 1px solid rgba(30, 28, 26, 0.3); width: 640px; }
.codex-entry-title { font-family: var(--font-title); font-weight: 700; margin-bottom: 6px; }
.codex-entry-def { line-height: 1.6; }

/* EndTenureBook: page text left, 8-dimension radar right. */
.end-book {
  left: calc((var(--stage-w, 1920px) - 920px) / 2) !important;
  top: calc((var(--stage-h, 1080px) - 560px) / 2) !important;
  padding: 18px 22px; cursor: pointer; box-shadow: 0 8px 26px rgba(30, 28, 26, 0.4); user-select: none;
}
.end-book-left { position: absolute; left: 22px; top: 18px; width: 520px; bottom: 44px; }
.end-book-ending { color: var(--muted); margin-bottom: 10px; white-space: pre-wrap; }
.end-book-page { font-family: var(--font-title); font-size: 18px; line-height: 1.8; }
.end-book-right { position: absolute; right: 22px; top: 14px; width: 300px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.end-book-dims { font-size: 13px; line-height: 1.45; align-self: stretch; padding-left: 40px; }
.end-book-footer { position: absolute; left: 22px; bottom: 14px; color: var(--muted); font-size: 13px; }
.end-book-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
button.btn.end-book-succ-btn { font-weight: 700; padding: 8px 14px; font-size: 13.5px !important; }
button.btn.end-book-new-btn { padding: 8px 14px; font-size: 13.5px !important; }
