/* story.css
   The text-only narration layer: a darkened scene, a god portrait sliding in
   from the side, and a parchment panel that reveals the words. Also the Sea Day
   wake scene and the ending screens. */

.narration-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  cursor: pointer;
}
.narration-layer.hidden { display: none; }
.narration-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(800px 600px at 50% 25%, rgba(40, 56, 120, 0.32), rgba(6, 8, 15, 0.8));
  backdrop-filter: blur(1px);
}

/* Parallax scenery behind the panels (Feature 5). Background images so a
   missing SVG simply leaves the gradient, never a broken element. */
.narration-layer .parallax-layer[data-scene="far"] { background-image: url('../assets/images/scenery/mountains.svg'); opacity: 0.45; }
.narration-layer .parallax-layer[data-scene="mid"] { background-image: url('../assets/images/scenery/aurora.svg'); opacity: 0.4; }
.narration-layer .parallax-layer[data-scene="near"] { background-image: url('../assets/images/scenery/clouds.svg'); opacity: 0.32; }
/* Faint parchment grain on story panels. */
.narration-panel::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 10px;
  pointer-events: none;
  opacity: 0.06;
  background-image: radial-gradient(rgba(90, 60, 20, 0.7) 1px, transparent 1px);
  background-size: 6px 6px;
}
.narration-portrait {
  position: absolute;
  bottom: 26vh;
  max-height: 52vh;
  max-width: 60vw;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.6));
  animation: portrait-in 0.45s ease-out;
  z-index: 1;
}
.narration-portrait.side-left { left: 4vw; }
.narration-portrait.side-right { right: 4vw; }
.narration-portrait.wink { animation: portrait-in 0.45s ease-out, wink 0.7s ease-in-out 0.5s; }
@keyframes portrait-in { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes wink { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-3deg) scale(1.03); } }

.narration-panel {
  position: relative;
  z-index: 2;
  width: min(680px, 92vw);
  margin-bottom: calc(24px + env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(243, 230, 196, 0.97), rgba(226, 207, 156, 0.97));
  color: #2c2208;
  border: 2px solid var(--gold);
  border-radius: 14px;
  padding: 18px 20px 14px;
  box-shadow: var(--shadow), inset 0 0 40px rgba(150, 120, 50, 0.25);
}
.narration-panel::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(139, 26, 26, 0.35);
  border-radius: 10px;
  pointer-events: none;
}
.narration-speaker {
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--rune-red);
  font-size: 18px;
  margin-bottom: 6px;
  min-height: 18px;
}
.narration-text { font-size: 18px; line-height: 1.5; min-height: 3em; }
.narration-advance {
  text-align: right;
  font-size: 12px;
  color: #7a6326;
  margin-top: 8px;
  letter-spacing: 1px;
}
.narration-panel.whisper { font-style: italic; opacity: 0.92; }
.narration-panel.whisper .narration-text { color: #5a4a16; }

/* Sea Day wake scene */
.wake-scene { text-align: center; }
.wake-sky {
  height: 220px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #1b2a66 0%, #7a4ea0 55%, #f5a623 80%, #ffd98a 100%);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.wake-sky::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -40px;
  width: 60%;
  height: 120px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at top, rgba(255, 224, 138, 0.8), rgba(255, 224, 138, 0));
  animation: shimmer 2.4s ease-in-out infinite;
}
@keyframes shimmer { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
.wake-caption { margin: 14px 0; color: #cdd6ef; }
.wake-target {
  background: linear-gradient(180deg, rgba(255,224,138,0.9), rgba(245,166,35,0.85));
  color: #3a2300;
  border: 2px solid var(--gold);
  border-radius: 14px;
  padding: 16px;
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
  width: 100%;
}

/* Endings */
.ending-screen {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  text-align: center;
  box-shadow: var(--shadow);
}
.ending-title { font-family: var(--font-head); font-size: 34px; color: var(--gold-bright); text-shadow: 0 2px 20px rgba(0,0,0,0.7); padding: 24px; }
.ending-saga, .ending-legend {
  background: linear-gradient(180deg, #06080f, #0a2e2e 60%, #0a0e2e);
  position: relative;
  overflow: hidden;
}
.ending-saga::before, .ending-legend::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px 200px at 30% 20%, rgba(58, 210, 159, 0.5), transparent),
    radial-gradient(600px 200px at 70% 30%, rgba(155, 107, 214, 0.5), transparent);
  animation: aurora 6s ease-in-out infinite;
}
@keyframes aurora { 0%, 100% { transform: translateY(0); opacity: 0.7; } 50% { transform: translateY(10px); opacity: 1; } }
.ending-warrior { background: linear-gradient(135deg, #2a1414, #0a0e2e); }
.ending-trickster { background: linear-gradient(135deg, #14331f, #0a0e2e); }
.ending-legend .ending-title { color: var(--gold-bright); text-shadow: 0 0 24px rgba(255, 224, 138, 0.8); }
