/* ============================================================
   JACK THE RIPPER — Victorian Murder Mystery Theme
   Whitechapel, London 1888
   ============================================================ */
:root {
  --blood: #8b0000;
  --blood-lt: #cc1111;
  --blood-br: #3d0000;
  --gaslight: #c8960a;
  --gasdim: #7a5800;
  --parchment: #f0ddb0;
  --parch-dim: #b09060;
  --ink: #1a0e04;
  --black: #060300;

  --f-gothic: 'UnifrakturMaguntia', serif;
  --f-type: 'Special Elite', cursive;
  --f-fell: 'IM Fell English', serif;
  --f-cinzel: 'Cinzel', serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  scrollbar-width: none;
  -ms-overflow-style: none;
  height: 100%;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

body {
  background: var(--black);
  overflow-x: hidden;
  overflow-y: scroll;
}

/* ── Fixed 3D canvas ── */
#c {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

/* ── Scroll driver ── */
#scroller {
  height: 7000vh;
  position: relative;
  z-index: 1;
  pointer-events: none;
}

/* ════════════════════════════════════════════════
   LOADER
   ════════════════════════════════════════════════ */
#loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, #1c0c03 0%, #0a0400 50%, #000 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 1.4s ease, visibility 1.4s ease;
}

#loader.out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ── FOG LAYERS ── */
.fog {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.fog-1 {
  background: radial-gradient(ellipse 200% 55% at 15% 85%, rgba(200, 150, 10, 0.07) 0%, transparent 65%);
  animation: fogDrift1 20s ease-in-out infinite alternate;
}

.fog-2 {
  background: radial-gradient(ellipse 220% 45% at 85% 90%, rgba(180, 120, 8, 0.05) 0%, transparent 60%);
  animation: fogDrift2 26s ease-in-out infinite alternate;
}

.fog-3 {
  background: radial-gradient(ellipse 350% 35% at 50% 100%, rgba(100, 55, 15, 0.14) 0%, transparent 55%);
  animation: fogDrift3 15s ease-in-out infinite alternate;
}

@keyframes fogDrift1 {
  0% {
    transform: translateX(-10%) scaleY(1)
  }

  100% {
    transform: translateX(10%) scaleY(1.12)
  }
}

@keyframes fogDrift2 {
  0% {
    transform: translateX(12%) scaleY(1)
  }

  100% {
    transform: translateX(-12%) scaleY(0.88)
  }
}

@keyframes fogDrift3 {
  0% {
    transform: scaleX(1) translateY(0)
  }

  100% {
    transform: scaleX(1.18) translateY(-6px)
  }
}

/* ── BLOOD DRIPS ── */
.drips {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0;
  pointer-events: none;
  z-index: 2;
}

.drip {
  position: absolute;
  top: 0;
  width: 5px;
  border-radius: 0 0 60% 60%;
  background: linear-gradient(180deg, #6b0000 0%, var(--blood) 40%, var(--blood-lt) 75%, transparent 100%);
  box-shadow: 0 0 8px rgba(139, 0, 0, 0.8), 0 0 2px var(--blood-lt);
  opacity: 0;
  animation: dripFall 5s ease-in infinite;
}

@keyframes dripFall {
  0% {
    opacity: 0;
    transform: scaleY(0);
  }

  10% {
    opacity: 1;
    transform: scaleY(0.2);
  }

  55% {
    opacity: 1;
    transform: scaleY(1);
  }

  80% {
    opacity: 0.7;
    transform: scaleY(1) translateY(10px);
  }

  100% {
    opacity: 0;
    transform: scaleY(1) translateY(20px);
  }
}

/* ── CORNER ORNAMENTS ── */
.corner {
  position: absolute;
  width: 56px;
  height: 56px;
  pointer-events: none;
  z-index: 3;
}

.corner::before,
.corner::after {
  content: '';
  position: absolute;
  background: var(--gaslight);
  opacity: 0.3;
}

.corner::before {
  width: 100%;
  height: 1px;
  top: 0;
  left: 0;
}

.corner::after {
  width: 1px;
  height: 100%;
  top: 0;
  left: 0;
}

.corner-tl {
  top: 30px;
  left: 30px;
}

.corner-tr {
  top: 30px;
  right: 30px;
  transform: scaleX(-1);
}

.corner-bl {
  bottom: 30px;
  left: 30px;
  transform: scaleY(-1);
}

.corner-br {
  bottom: 30px;
  right: 30px;
  transform: scale(-1);
}

/* ── RULES ── */
.ld-rule {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(520px, 88vw);
  position: absolute;
  z-index: 4;
}

.top-rule {
  top: 46px;
}

.bot-rule {
  bottom: 46px;
}

.rule-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gaslight), transparent);
  opacity: 0.25;
}

.rule-deco {
  font-size: .75rem;
  color: var(--gaslight);
  opacity: 0.4;
}

/* ── INNER LAYOUT ── */
.ld-inner {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
  padding: 0 24px;
  max-width: 680px;
  width: 100%;
}

/* ── CASE STAMP ── */
.case-stamp {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transform: rotate(-1.2deg);
  margin-top: -30px;
  margin-bottom: 0;
}

.stamp-text {
  font-family: var(--f-cinzel);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .4em;
  color: var(--blood-lt);
}

.stamp-no {
  font-family: var(--f-type);
  font-size: .58rem;
  color: rgba(200, 80, 80, 0.5);
  letter-spacing: .12em;
}

/* ── DAGGER SVG ORNAMENT ── */
.ld-ornament-top {
  width: min(320px, 80vw);
  opacity: 0.7;
}

.dagger-svg {
  width: 100%;
  height: auto;
}

/* ── GOTHIC TITLE ── */
.ld-title-main {
  font-family: var(--f-gothic);
  font-size: clamp(2.8rem, 7vw, 5rem);
  color: var(--parchment);
  letter-spacing: .03em;
  line-height: 1;
  margin: -6px 0;
  text-shadow:
    0 0 40px rgba(200, 150, 10, 0.5),
    0 0 80px rgba(200, 150, 10, 0.18),
    0 2px 6px rgba(0, 0, 0, 1);
  animation: titleFlicker 9s ease-in-out infinite;
}

@keyframes titleFlicker {

  0%,
  89%,
  91%,
  93%,
  100% {
    opacity: 1;
  }

  90% {
    opacity: 0.65;
  }

  92% {
    opacity: 1;
  }
}

/* ── LOCATION ── */
.ld-location {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  justify-content: center;
  margin-top: -4px;
}

.loc-line {
  flex: 1;
  max-width: 90px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gasdim));
  opacity: 0.45;
}

.ld-location .loc-line:last-child {
  background: linear-gradient(270deg, transparent, var(--gasdim));
}

.loc-text {
  font-family: var(--f-cinzel);
  font-size: .75rem;
  letter-spacing: .28em;
  color: var(--gasdim);
  white-space: nowrap;
}

/* ── QUOTE (single line) ── */
.ld-quote {
  font-family: var(--f-fell);
  font-style: italic;
  font-size: 1rem;
  color: rgba(195, 170, 120, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: .03em;
}

/* ── PROGRESS SECTION ── */
.ld-case-progress {
  width: min(460px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.case-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.case-msg {
  font-family: var(--f-type);
  font-size: .78rem;
  color: rgba(190, 160, 100, 0.75);
  letter-spacing: .14em;
  animation: caseMsgPulse 2s ease-in-out infinite;
}

@keyframes caseMsgPulse {

  0%,
  100% {
    opacity: 0.75;
  }

  50% {
    opacity: 1;
  }
}

.ld-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(139, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}

.ld-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blood-br), var(--blood), #e01010);
  box-shadow: 0 0 12px var(--blood), 0 0 24px rgba(139, 0, 0, 0.35);
  transition: width .5s ease;
  position: relative;
}

.ld-fill::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 0;
  width: 3px;
  height: 100%;
  background: rgba(255, 120, 120, 0.9);
  box-shadow: 0 0 8px rgba(255, 80, 80, 0.8);
}

.case-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: -2px;
}

.case-dept {
  font-family: var(--f-type);
  font-size: .58rem;
  color: rgba(160, 130, 80, 0.35);
  letter-spacing: .08em;
}

.ld-pct {
  font-family: var(--f-cinzel);
  font-size: 1rem;
  font-weight: 700;
  color: rgba(180, 40, 40, 0.85);
  text-shadow: 0 0 10px rgba(139, 0, 0, 0.5);
}

/* ── BOTTOM ORNAMENT ── */
.ld-ornament {
  font-size: .7rem;
  color: rgba(200, 150, 10, 0.25);
  letter-spacing: .6em;
  margin-top: 2px;
}

/* ════════════════════════════════════════════════
   CSS3D RENDERER LAYER
   ════════════════════════════════════════════════ */
#css3d-layer {
  position: fixed;
  inset: 0;
  z-index: 2;           /* above WebGL canvas, below loader */
  pointer-events: none; /* scroll passes through */
  overflow: hidden;
}

#css3d-layer > div {    /* the CSS3DRenderer's internal div */
  pointer-events: none !important;
}

/* ════════════════════════════════════════════════
   STORY PANELS  (CSS3DObject contents)
   ════════════════════════════════════════════════ */
.story-panel {
  width: 680px;
  padding: 20px;
  background: transparent;
  border: none;
  position: relative;
  /* Force GPU layer for performance */
  transform: translateZ(0);
  will-change: transform;
}

/* Top ornamental rule */
.story-panel::before {
  content: '✦ ─────────────────────── ✦';
  display: block;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(200, 150, 10, 0.50);
  letter-spacing: 0.05em;
  margin-bottom: 18px;
  font-family: 'Special Elite', cursive;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
}

/* Panel label / chapter stamp */
.panel-stamp {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.panel-stamp-badge {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  color: var(--blood-lt);
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(139, 0, 0, 0.5);
  padding: 4px 12px;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
}

.panel-stamp-date {
  font-family: 'Special Elite', cursive;
  font-size: 0.82rem;
  color: rgba(210, 180, 130, 0.85);
  letter-spacing: 0.1em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
}

/* Panel headline */
.panel-headline {
  font-family: 'UnifrakturMaguntia', serif;
  font-size: 2.5rem;
  color: var(--parchment);
  line-height: 1.05;
  letter-spacing: 0.02em;
  text-shadow:
    0 0 20px rgba(200, 150, 10, 0.5),
    0 2px 5px rgba(0, 0, 0, 0.95),
    0 0 10px rgba(0, 0, 0, 0.9);
  margin-bottom: 12px;
}

/* Divider */
.panel-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 16px;
}

.panel-divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200, 150, 10, 0.45), transparent);
}

.panel-divider-ornament {
  font-size: 0.8rem;
  color: rgba(200, 150, 10, 0.6);
  font-family: 'Special Elite', cursive;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
}

/* Body copy */
.panel-body {
  font-family: 'IM Fell English', serif;
  font-size: 1.12rem;
  line-height: 1.78;
  color: rgba(230, 210, 160, 0.95);
  letter-spacing: 0.01em;
  text-align: justify;
  hyphens: auto;
  text-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.95), 
    0 0 8px rgba(0, 0, 0, 0.9);
}

.panel-body em {
  font-style: italic;
  color: rgba(255, 230, 180, 1);
}

.panel-body strong {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(220, 170, 40, 1);
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
}

/* Witness / victim record rows */
.panel-record {
  border-left: 2px solid rgba(139, 0, 0, 0.75);
  padding: 6px 0 6px 14px;
  margin: 10px 0;
  background: rgba(0, 0, 0, 0.4);
}

.panel-record-name {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: rgba(240, 80, 80, 0.95);
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
}

.panel-record-detail {
  font-family: 'Special Elite', cursive;
  font-size: 0.92rem;
  color: rgba(210, 185, 130, 0.85);
  line-height: 1.5;
  margin-top: 2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
}

/* Pull quote */
.panel-pullquote {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 1.35rem;
  color: rgba(220, 195, 140, 0.9);
  text-align: center;
  margin: 18px 0 6px;
  padding: 0 20px;
  line-height: 1.5;
  text-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.95), 
    0 0 8px rgba(0, 0, 0, 0.9);
}

/* Footer byline */
.panel-byline {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.panel-byline-source {
  font-family: 'Special Elite', cursive;
  font-size: 0.78rem;
  color: rgba(180, 150, 100, 0.7);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
}

.panel-byline-page {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  color: rgba(180, 150, 100, 0.5);
  letter-spacing: 0.15em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
}

/* Active state without glow */
.story-panel.active {
  /* Simple solid state, no animation/filter drop-shadows */
}

/* ════════════════════════════════════════════════
   MOBILE VIEW WARNING OVERLAY
   ════════════════════════════════════════════════ */
#mobile-warning {
  display: none;
}

@media (max-width: 1024px) {
  #mobile-warning {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 100000; /* Above all other layers, including loader */
    background: radial-gradient(ellipse 80% 60% at 50% 40%, #1c0c03 0%, #0a0400 50%, #000 100%);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--parchment);
    text-align: center;
    padding: 30px;
  }

  body {
    overflow: hidden !important;
    height: 100% !important;
  }

  .warning-inner {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    max-width: 480px;
    width: 100%;
    animation: fadeInWarning 1s ease-out;
  }

  .warning-stamp {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transform: rotate(-1.5deg);
    margin-bottom: 5px;
  }

  .warning-title {
    font-family: var(--f-gothic);
    font-size: clamp(2.2rem, 6vw, 3.8rem);
    color: var(--parchment);
    letter-spacing: .03em;
    line-height: 1.1;
    text-shadow:
      0 0 30px rgba(200, 150, 10, 0.4),
      0 2px 6px rgba(0, 0, 0, 1);
  }

  .warning-desc {
    font-family: var(--f-fell);
    font-style: italic;
    font-size: 1.15rem;
    line-height: 1.7;
    color: rgba(195, 170, 120, 0.8);
    margin: 10px 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
  }

  .warning-icon {
    margin-top: 15px;
    color: var(--gaslight);
    opacity: 0.7;
    animation: warningIconPulse 2.5s ease-in-out infinite;
  }

  .desktop-svg {
    width: 72px;
    height: 72px;
    filter: drop-shadow(0 0 10px rgba(200, 150, 10, 0.3));
  }
}

@keyframes fadeInWarning {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes warningIconPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.6;
    filter: drop-shadow(0 0 5px rgba(200, 150, 10, 0.2));
  }
  50% {
    transform: scale(1.08);
    opacity: 0.95;
    filter: drop-shadow(0 0 15px rgba(200, 150, 10, 0.6));
  }
}

/* ════════════════════════════════════════════════
   ARCHIVE ABOUT OVERLAY (SEO & USER INFO)
   ════════════════════════════════════════════════ */
.archive-about-overlay {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  max-width: 380px;
  font-family: var(--f-fell);
  color: var(--parchment);
}

.about-toggle-btn {
  background: rgba(6, 3, 0, 0.85);
  border: 1px solid rgba(200, 150, 10, 0.4);
  color: var(--parch-dim);
  padding: 8px 16px;
  font-family: var(--f-cinzel);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.about-toggle-btn:hover {
  color: var(--parchment);
  border-color: var(--gaslight);
  box-shadow: 0 0 10px rgba(200, 150, 10, 0.2);
}

.about-toggle-btn .btn-deco {
  font-size: 0.6rem;
  color: var(--gaslight);
  opacity: 0.6;
}

.archive-about-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.3s ease;
  background: rgba(26, 14, 4, 0.95);
  border: 1px solid rgba(200, 150, 10, 0.3);
  border-top: none;
  padding: 0 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.archive-about-overlay.open .archive-about-content {
  max-height: 500px;
  padding: 18px;
}

.archive-about-content h3 {
  font-family: var(--f-cinzel);
  font-size: 0.9rem;
  color: var(--gaslight);
  margin-bottom: 10px;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(200, 150, 10, 0.2);
  padding-bottom: 6px;
}

.archive-about-content p {
  font-size: 0.9rem;
  line-height: 1.5;
  color: rgba(240, 221, 176, 0.8);
  margin-bottom: 12px;
  text-align: justify;
}

.archive-about-content strong {
  color: var(--parchment);
}

.archive-tech-specs {
  display: flex;
  justify-content: space-between;
  font-family: var(--f-type);
  font-size: 0.68rem;
  color: rgba(200, 150, 10, 0.4);
  margin-top: 14px;
  border-top: 1px dashed rgba(200, 150, 10, 0.15);
  padding-top: 10px;
}

@media (max-width: 1024px) {
  .archive-about-overlay {
    display: none;
  }
}