/**
 * Dialogue System Styling
 * Styles for witness protection briefing dialogue entries
 */

/* Dialogue section should have FBI document styling */
#dialogueSection {
  /* Positioning root for in-section overlays (wake veils,
     stream staging) — without this their inset:0 anchors to
     the page and stacking gets unpredictable. */
  position: relative;
  background: #3A3238;
  padding: 2rem;
  font-family: 'Courier New', Courier, monospace;
  color: #5F5449;
  margin: 0;
  box-sizing: border-box;      /* QA P2-12 — padding inside the height */
  /* QA P2-12 (round 2) — the section wanted a full viewport of its
     own while sitting INSIDE the body's padding, so in-game the
     document was always taller than the window by exactly that
     padding (110px with the HUD panels up) and the page scrolled
     under every fixed layer. The section now concedes the body's
     vertical padding. */
  min-height: calc(var(--vh100, 100vh) - 4rem);
  /* Block text selection — the dialogue is click-to-advance,
     and drag-selection during a fast skip was catching text
     instead of firing the advance. Buttons/inputs re-enable
     selection where needed. */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Re-enable text selection on any input/textarea inside the
   dialogue view (e.g. the choice-input mini-games) so the player
   can still type. */
#dialogueSection input,
#dialogueSection textarea {
  user-select: text;
  -webkit-user-select: text;
}

/* ═══════════════════════════════════════════════════════
   Paper theme tints — chapter atmosphere carries into the
   reading area itself. The .file document is normally opaque
   cream (#EBE6D8) which hides the chapter atmosphere behind
   it; these classes shift the paper toward the theme so the
   mood reads inside the dialogue too.
   ═══════════════════════════════════════════════════════ */

/* Phil's daytime — warm ambient lamplight on aged paper.
   Slightly warmer cream + inner amber glow at top-centre + a
   soft coffee-ring stain in one corner. */
#dialogueSection .file.paper-phils {
  background:
    radial-gradient(ellipse 60% 40% at 50% 10%,
      rgba(230, 180, 115, 0.14) 0%,
      transparent 65%),
    radial-gradient(ellipse 4% 3% at 90% 96%,
      rgba(90, 55, 30, 0.15) 0%,
      transparent 75%),
    #EDE1C6;
  transition: background 1.5s ease;
}

/* Phil's late-night — same paper, dimmer, deeper warmth. */
#dialogueSection .file.paper-phils-late {
  background:
    radial-gradient(ellipse 60% 40% at 50% 15%,
      rgba(215, 165, 105, 0.20) 0%,
      transparent 65%),
    radial-gradient(ellipse 4% 3% at 90% 96%,
      rgba(70, 40, 20, 0.20) 0%,
      transparent 75%),
    #E4D6BC;
  transition: background 1.5s ease;
}

/* Phil's dead-zone — cool cast, the amber lamps are down. */
#dialogueSection .file.paper-phils-dead {
  background:
    radial-gradient(ellipse 60% 40% at 50% 12%,
      rgba(180, 165, 145, 0.10) 0%,
      transparent 65%),
    #E3DED0;
  transition: background 1.5s ease;
}

/* Bean There — cool cafe rejection. Slightly greyed paper +
   chalkboard hint on left edge + Florida-shaped brown stain
   bottom-right. Matches the section's cold-cafe atmosphere. */
#dialogueSection .file.paper-bean-there {
  background:
    linear-gradient(90deg,
      rgba(52, 72, 55, 0.25) 0%,
      rgba(52, 72, 55, 0.10) 1%,
      transparent 3%),
    radial-gradient(ellipse 7% 5% at 88% 92%,
      rgba(80, 45, 25, 0.28) 0%,
      transparent 78%),
    radial-gradient(ellipse 4% 3% at 82% 88%,
      rgba(80, 45, 25, 0.18) 0%,
      transparent 82%),
    #E5E0D2;
  transition: background 1.5s ease;
}

/* Dialogue Container */
#dialogueContainer {
  margin: 2rem 0;
  padding: 0 2rem;
}

/* Dialogue Entries */
/* z-index keeps these above the fixed-position pool overlays
   (Path A warm pools, Path B Valentina pools) which sit at z 2-6.
   Without this, full-viewport sweep gradients in those overlays
   paint above the semi-transparent dialogue entry backgrounds and
   tint the text. */
.dialogue-entry {
  display: flex;
  margin-bottom: 1rem;
  background: rgba(212,200,190,0.3);
  border-left: 3px solid #8E7F7F;
  padding: 1rem;
  border-radius: 0 8px 8px 0;
  position: relative;
  z-index: 10;
}

.dialogue-entry:nth-child(even) {
  background: rgba(212,200,190,0.2);
  border-left: 3px solid #5F5449;
}

/* Narration Entries - no background */
.narration-entry {
  background: none !important;
  border-left: none !important;
  padding: 0;
  border-radius: 0;
  position: relative;
  z-index: 10;
}

/* Dialogue Portrait */
.dialogue-portrait {
  /* 120x110, not 120x80. Every face on file is a headshot — shot
     portrait or square — and a landscape letterbox threw away the
     forehead and the chin of all of them. This is near enough to
     square that the crop keeps a head and shoulders. Text
     portraits are two or three stacked lines and sit fine in the
     taller card; narration never draws one at all.
     150 since 2026-10-03: the faces on file are portrait-shaped (2:3,
     4:5) and the near-square 110 still took the forehead off some of
     them — the author picked the taller card from a side-by-side. */
  min-width: 120px;
  max-width: 120px;
  height: 150px;
  background: #D4C8BE;
  border: 2px solid #8E7F7F;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.7rem;
  font-weight: bold;
  color: #3A3238;
  margin-right: 1rem;
  white-space: pre-line;
  line-height: 1.2;
  overflow: hidden;
}

/* Photo variant — image overlays the text fallback. If the image file is
   missing, onerror removes the img + this class, revealing the text box. */
.dialogue-portrait--photo {
  padding: 0;
  background: #3A3238;
  position: relative;
}
.dialogue-portrait--photo img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* Match the dossier case-file photo treatment */
  filter: grayscale(42%) sepia(30%) contrast(1.08) brightness(0.96);
}

/* Dialogue Content */
.dialogue-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.dialogue-speaker {
  font-weight: bold;
  color: #3A3238;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  letter-spacing: 1px;
}

.dialogue-text {
  color: #5F5449;
  line-height: 1.6;
  font-size: 0.95rem;
}

/* Continue Button */
.continue-button {
  background: #4a7c59;
  color: #EBE6D8;
  border: none;
  padding: 1rem 2rem;
  font-family: 'Courier New', Courier, monospace;
  font-weight: bold;
  font-size: 1rem;
  cursor: pointer;
  margin: 2rem auto;
  display: block;
  border-radius: 4px;
  transition: background-color 0.3s ease;
  letter-spacing: 1px;
}

.continue-button:hover {
  background: #5c8f6b;
}

.continue-button:active {
  background: #3e6b4d;
}

/* **word** emphasis inside typed dialogue lines — the red ribbon
   on a two-color typewriter. Applied by typewriterEffect after the
   line finishes typing. */
.dlg-emph {
  font-weight: bold;
  color: #8B0000;
}
/* ── No text selection on the papers or scene dialogue ─────────
   The story is a document, not a copy-paste surface: stray
   drag-highlights broke the noir spell (and made long-press skip
   feel glitchy). Applies to the paper, overlay dialogue, dream
   popup and transition cards. */
#dialogueSection,
#overlayDialogue,
#sleepDreamPopup,
#chapterTransitionPopup {
  -webkit-user-select: none;
  user-select: none;
}

/* P2-12 — with the HUD panels on, the body's vertical padding is
   60px + 50px, not 2rem + 2rem; the sheet concedes that instead. */
body.panel-active #dialogueSection {
  min-height: calc(var(--vh100, 100vh) - 110px);
}

/* ── READING TEXT (2026-10-03) ─────────────────────────────────────────
   The author picked it from a side-by-side of the same page: a column of
   about seventy characters instead of the whole sheet (~105, the eye lost
   its way back to the next line), set ragged-right instead of justified
   (a monospace face can't squeeze, so justify opened holes between the
   words), in Courier Prime — the same typewriter, drawn for screens —
   instead of the thin Courier New. Speaker cards stay full width. */
#dialogueContainer .narration-entry {
  max-width: 70ch;
  margin-left: auto;
  margin-right: auto;
}
#dialogueContainer .dialogue-content { max-width: 70ch; }
/* !important: the narration line is written with an inline style
   (dialogue-system.js — Courier New, justify, .95rem), and an inline
   style beats any stylesheet rule that isn't !important. */
#dialogueContainer .dialogue-text,
#dialogueContainer .narration-text {
  text-align: left !important;
  font-family: 'Courier Prime', 'Courier New', Courier, monospace !important;
  font-size: 1.02rem !important;
}

