/* ═══════════════════════════════════════════════
   Story-beat popup — aged parchment scroll w/ Tessel
   ═══════════════════════════════════════════════ */

/* Fonts loaded in index.html */

.story-backdrop {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, #1a0e06 0%, #0f0803 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
  opacity: 0;
  transition: opacity 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.story-backdrop--visible {
  opacity: 1;
}

/* Belt-and-suspenders: hide the underlying app while a story beat is open */
body.story-open > #app {
  visibility: hidden;
}

.story-scroll {
  position: relative;
  width: 100%;
  max-width: 620px;
  padding: 38px 44px 32px 44px;
  background: linear-gradient(180deg, #f6ead0 0%, #ecdcb5 100%);
  border-radius: 6px;
  box-shadow:
    0 2px 0 rgba(42, 24, 16, 0.08),
    0 30px 60px -20px rgba(42, 24, 16, 0.45),
    0 10px 30px -10px rgba(42, 24, 16, 0.25),
    inset 0 0 0 1px rgba(138, 100, 32, 0.35),
    inset 0 0 80px rgba(138, 100, 32, 0.18);
  font-family: 'Crimson Pro', Georgia, serif;
  color: #2a1810;
  transform: translateY(12px) scale(0.96);
  opacity: 0;
  transition:
    transform 260ms cubic-bezier(0.22, 0.61, 0.36, 1),
    opacity 260ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.story-backdrop--visible .story-scroll {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Gold corner flourishes (CSS-drawn) */
.story-corner {
  position: absolute;
  width: 32px;
  height: 32px;
  pointer-events: none;
  border: 0 solid #8a6420;
}

.story-corner::before {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  background: radial-gradient(circle at 0% 0%, #b8893a 0%, #8a6420 60%, transparent 70%);
  opacity: 0.85;
}

.story-corner--tl { top: 8px; left: 8px; border-top-width: 1.2px; border-left-width: 1.2px; }
.story-corner--tr { top: 8px; right: 8px; border-top-width: 1.2px; border-right-width: 1.2px; transform: scaleX(-1); }
.story-corner--bl { bottom: 8px; left: 8px; border-bottom-width: 1.2px; border-left-width: 1.2px; transform: scaleY(-1); }
.story-corner--br { bottom: 8px; right: 8px; border-bottom-width: 1.2px; border-right-width: 1.2px; transform: scale(-1, -1); }

.story-corner--tl::before { top: -2px; left: -2px; }
.story-corner--tr::before { top: -2px; left: -2px; }
.story-corner--bl::before { top: -2px; left: -2px; }
.story-corner--br::before { top: -2px; left: -2px; }

/* Tessel sits in the top-left, overlapping the scroll edge */
.story-tessel {
  position: absolute;
  left: -34px;
  top: -28px;
  filter: drop-shadow(0 8px 14px rgba(42, 24, 16, 0.25));
  pointer-events: none;
}

.story-content {
  padding-left: 110px;
}

.story-chapter {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8a6420;
  margin-bottom: 10px;
}

.story-speaker {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 700;
  font-size: 26px;
  line-height: 1;
  color: #2a1810;
  margin-bottom: 10px;
  letter-spacing: 0.01em;
}

.story-dialogue {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 20px;
  line-height: 1.55;
  color: #3a2614;
  font-style: italic;
  text-wrap: pretty;
}

.story-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 8px 0;
  color: #b8893a;
}

.story-divider hr {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #b8893a 20%, #b8893a 80%, transparent);
  border: 0;
  margin: 0;
}

.story-divider span {
  font-size: 12px;
  letter-spacing: 0.2em;
}

.story-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  gap: 16px;
  flex-wrap: wrap;
}

.story-hint {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 13px;
  color: #8a6420;
  font-style: italic;
  flex: 1;
  min-width: 0;
}

.story-hint:empty { display: none; }

.story-continue {
  font-family: 'IM Fell English SC', 'Cormorant Garamond', serif;
  font-size: 14px;
  letter-spacing: 0.12em;
  padding: 10px 22px;
  background: linear-gradient(180deg, #e6c078 0%, #b8893a 100%);
  color: #2a1810;
  border: 1px solid #8a6420;
  border-radius: 3px;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 2px 0 rgba(42, 24, 16, 0.2);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.story-continue:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 4px 0 rgba(42, 24, 16, 0.25);
}

.story-continue:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 2px rgba(42, 24, 16, 0.2),
    0 1px 0 rgba(42, 24, 16, 0.2);
}

.story-continue:focus-visible {
  outline: 2px solid #d9ab4c;
  outline-offset: 3px;
}

/* Mobile — Tessel sits above the content, not overlapping */
@media (max-width: 560px) {
  .story-scroll {
    padding: 28px 22px 24px 22px;
  }
  .story-tessel {
    position: static;
    display: flex;
    justify-content: center;
    margin: -12px 0 4px 0;
  }
  .story-tessel svg {
    width: 120px !important;
    height: 120px !important;
  }
  .story-content {
    padding-left: 0;
  }
  .story-speaker {
    font-size: 22px;
  }
  .story-dialogue {
    font-size: 17px;
  }
  .story-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .story-continue {
    width: 100%;
  }
}
