/* ============================================================
   INFERNO — A Guided Descent with Virgil
   Doré-inspired dark engraving aesthetic
   ============================================================ */

:root {
  --bg: #1b1420;          /* Deep Plum */
  --bg-panel: #241b2c;
  --bg-panel-2: #2c2136;
  --ink: #ddd4c6;
  --ink-dim: #a39aac;
  --ink-faint: #7c7388;
  --gold: #c9a24b;
  --gold-dim: #8a7034;
  --ember: #d96b2f;
  --blood: #93301f;
  --line: #392e46;
  --accent: #c9a24b; /* overridden per location */
  --serif: "Iowan Old Style", "Palatino Nova", Palatino, "Book Antiqua", "Times New Roman", Georgia, serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* subtle vignette over everything */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 35%, transparent 55%, rgba(0,0,0,0.55) 100%);
  z-index: 5;
}

.hidden { display: none !important; }

button { font-family: var(--serif); cursor: pointer; }

/* ---------------- top bar ---------------- */

#topbar {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 1.1rem;
  background: linear-gradient(to bottom, rgba(27,20,32,0.97), rgba(27,20,32,0.88));
  border-bottom: 1px solid var(--line);
  z-index: 20;
}

.topbtn {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-dim);
  padding: 0.3rem 0.85rem;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  border-radius: 2px;
  transition: color .2s, border-color .2s;
}
.topbtn:hover { color: var(--gold); border-color: var(--gold-dim); }

#depth-indicator {
  flex: 1;
  text-align: center;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right { display: flex; align-items: center; gap: 0.8rem; }
#laurel-count { font-size: 0.9rem; color: var(--gold); white-space: nowrap; }

/* ---------------- screens ---------------- */

.screen {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  animation: screenfade .6s ease both;
}
@keyframes screenfade { from { opacity: 0; } to { opacity: 1; } }

/* ---------------- home ---------------- */

.home-inner {
  max-width: 760px;
  padding: 3.5rem 1.5rem 4rem;
  text-align: center;
}

#home-art svg { width: 100%; max-width: 640px; height: auto; display: block; margin: 0 auto 1.5rem; }

.home-kicker {
  font-size: 0.8rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.8rem;
}

/* language selector */
.lang-select {
  display: flex; align-items: center; justify-content: center; gap: 0.7rem;
  margin-bottom: 1.4rem;
}
.lang-sep { color: var(--ink-faint); font-size: 0.8rem; }
.lang-btn {
  background: none; border: none;
  color: var(--ink-faint);
  font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase;
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid transparent;
  transition: color .2s, border-color .2s;
}
.lang-btn:hover { color: var(--ink); }
.lang-btn.active { color: var(--gold); border-bottom-color: var(--gold-dim); }

.home-title {
  font-size: clamp(3rem, 9vw, 5.2rem);
  font-weight: 400;
  letter-spacing: 0.22em;
  color: var(--ink);
  text-shadow: 0 0 40px rgba(217,107,47,0.25);
  margin-bottom: 0.2rem;
}

.home-sub {
  font-size: 1.15rem;
  font-style: italic;
  color: var(--gold);
  margin-bottom: 2rem;
}

.home-lede {
  text-align: left;
  color: var(--ink-dim);
  margin: 0 auto 2.2rem;
  max-width: 620px;
}
.home-lede em { color: var(--ink); }

.home-buttons {
  display: flex; flex-wrap: wrap; gap: 0.9rem; justify-content: center;
  margin-bottom: 2.5rem;
}

.btn-primary {
  background: linear-gradient(to bottom, #3a2313, #2a180c);
  border: 1px solid var(--ember);
  color: #f0c795;
  font-size: 1.05rem;
  letter-spacing: 0.1em;
  padding: 0.75rem 1.9rem;
  border-radius: 2px;
  text-transform: uppercase;
  transition: box-shadow .25s, transform .15s;
  box-shadow: 0 0 18px rgba(217,107,47,0.15);
}
.btn-primary:hover { box-shadow: 0 0 30px rgba(217,107,47,0.4); transform: translateY(-1px); }

.btn-secondary {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-dim);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  padding: 0.75rem 1.4rem;
  border-radius: 2px;
  transition: color .2s, border-color .2s;
}
.btn-secondary:hover { color: var(--gold); border-color: var(--gold-dim); }

.home-howto {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg-panel);
  padding: 1.1rem 1.4rem;
  text-align: left;
  max-width: 620px;
  margin: 0 auto 1.6rem;
}
.home-howto h3 {
  font-size: 0.82rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gold); font-weight: 400; margin-bottom: 0.4rem;
}
.home-howto p { color: var(--ink-dim); font-size: 0.95rem; }

.home-credit { font-size: 0.8rem; color: var(--ink-faint); font-style: italic; }

.linklike {
  background: none; border: none;
  color: var(--ink-faint); font-size: 0.8rem; font-style: italic;
  text-decoration: underline; text-underline-offset: 3px;
  padding: 0.2rem;
}
.linklike:hover { color: var(--blood); }

/* ---------------- map ---------------- */

.map-inner {
  max-width: 860px;
  width: 100%;
  padding: 4.5rem 1.5rem 3rem;
  text-align: center;
}
.map-title {
  font-size: 2rem; font-weight: 400; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink);
}
.map-sub { color: var(--ink-dim); margin: 0.5rem auto 1.5rem; max-width: 560px; font-size: 0.95rem; }

#map-svg-holder svg { width: 100%; height: auto; max-width: 780px; }

.map-ring { cursor: pointer; }
.map-ring .ring-band { transition: opacity .2s; opacity: 0.85; }
.map-ring:hover .ring-band { opacity: 1; }
.map-ring:hover .ring-label { fill: #ffffff; }
.map-ring .ring-label { transition: fill .2s; }

.map-legend {
  display: flex; gap: 1.6rem; justify-content: center;
  color: var(--ink-dim); font-size: 0.85rem;
  margin: 1rem 0 1.4rem;
}
.legend-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 0.35rem; vertical-align: middle;
}
.dot-visited { background: var(--gold); }
.dot-here { background: var(--ember); box-shadow: 0 0 8px var(--ember); }

/* ---------------- location ---------------- */

.loc-inner {
  max-width: 780px;
  width: 100%;
  padding: 3.6rem 1.25rem 3rem;
}

#loc-art { margin-bottom: 1.2rem; }
#loc-art svg { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 3px; }

.loc-head { text-align: center; margin-bottom: 1.4rem; }

.loc-kicker {
  font-size: 0.78rem; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 0.35rem;
}
.loc-title {
  font-size: clamp(1.7rem, 5vw, 2.5rem);
  font-weight: 400; letter-spacing: 0.1em; color: var(--ink);
}
.loc-subtitle { font-style: italic; color: var(--ink-dim); margin-top: 0.3rem; }

/* step tabs */
.loc-steps {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem;
  margin-bottom: 1.6rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0.5rem 0;
}
.step-tab {
  background: none; border: none;
  color: var(--ink-faint);
  font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border-radius: 2px;
  transition: color .2s, background .2s;
}
.step-tab:hover { color: var(--ink); }
.step-tab.active { color: var(--accent); background: rgba(255,255,255,0.04); }
.step-tab.done::after { content: " ·"; color: var(--gold); }

/* body content blocks */
.loc-body { animation: stepfade .45s ease both; }
@keyframes stepfade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.prose p { margin-bottom: 1.05rem; color: var(--ink); }
.prose p.narr { color: var(--ink-dim); }

.blockcard {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  padding: 1.2rem 1.4rem;
  margin-bottom: 1.1rem;
}
.blockcard h3 {
  font-size: 0.8rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--accent); font-weight: 400; margin-bottom: 0.55rem;
}
.blockcard p { color: var(--ink); margin-bottom: 0.7rem; }
.blockcard p:last-child { margin-bottom: 0; }
.blockcard .em { color: var(--gold); font-style: italic; }

/* contrapasso card */
.contrapasso-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem;
}
@media (max-width: 620px) { .contrapasso-grid { grid-template-columns: 1fr; } }

/* dialogue */
.dialogue { margin-bottom: 1rem; }
.dline {
  margin-bottom: 1rem;
  animation: stepfade .4s ease both;
}
.dline .speaker {
  display: block;
  font-size: 0.75rem; letter-spacing: 0.24em; text-transform: uppercase;
  margin-bottom: 0.15rem;
}
.dline.sp-virgil .speaker { color: var(--gold); }
.dline.sp-dante .speaker { color: #b8c4cc; }
.dline.sp-narr .speaker { display: none; }
.dline.sp-other .speaker { color: var(--accent); }
.dline .dtext { color: var(--ink); }
.dline.sp-narr .dtext { color: var(--ink-dim); font-style: italic; }
.dline.sp-other .dtext { border-left: 2px solid var(--accent); padding-left: 0.9rem; }
.dline.sp-virgil .dtext { border-left: 2px solid var(--gold-dim); padding-left: 0.9rem; }

.dialogue-controls { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.2rem; }

.ask-btn {
  background: var(--bg-panel-2);
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  font-size: 0.92rem;
  font-style: italic;
  padding: 0.55rem 1.1rem;
  border-radius: 2px;
  transition: background .2s;
}
.ask-btn:hover { background: #2a2117; }
.ask-btn:disabled { opacity: 0.35; cursor: default; }

/* verse */
.verse-card {
  background: linear-gradient(to bottom, var(--bg-panel-2), var(--bg-panel));
  border: 1px solid var(--gold-dim);
  border-radius: 3px;
  padding: 1.6rem 1.6rem 1.3rem;
  text-align: center;
  margin-bottom: 1.1rem;
  box-shadow: 0 0 30px rgba(201,162,75,0.06);
}
.verse-it { font-size: 1.22rem; font-style: italic; color: #e9dfc6; line-height: 1.75; margin-bottom: 1rem; }
.verse-en { color: var(--ink-dim); line-height: 1.7; margin-bottom: 0.9rem; }
.verse-ref { font-size: 0.8rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); }
.verse-note { font-size: 0.92rem; color: var(--ink-dim); font-style: italic; margin-top: 0.9rem; }

/* lesson */
.lesson-list { list-style: none; margin-bottom: 1rem; }
.lesson-list li {
  position: relative;
  padding: 0.65rem 0 0.65rem 1.7rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.lesson-list li::before {
  content: "✦";
  position: absolute; left: 0.2rem; top: 0.65rem;
  color: var(--accent); font-size: 0.85rem;
}
.funfact {
  background: var(--bg-panel);
  border: 1px dashed var(--gold-dim);
  border-radius: 3px;
  padding: 1rem 1.3rem;
  margin-top: 1.1rem;
}
.funfact h4 {
  font-size: 0.75rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--gold); font-weight: 400; margin-bottom: 0.35rem;
}
.funfact p { color: var(--ink-dim); font-size: 0.97rem; }

/* quiz */
.quiz-progress { font-size: 0.8rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 0.8rem; text-align: center; }
.quiz-q { font-size: 1.15rem; color: var(--ink); margin-bottom: 1.1rem; text-align: center; }
.quiz-opts { display: flex; flex-direction: column; gap: 0.6rem; max-width: 560px; margin: 0 auto 1rem; }
.quiz-opt {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  color: var(--ink);
  text-align: left;
  padding: 0.75rem 1.1rem;
  font-size: 1rem;
  border-radius: 3px;
  transition: border-color .2s, background .2s;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--accent); background: var(--bg-panel-2); }
.quiz-opt:disabled { cursor: default; }
.quiz-opt.correct { border-color: #5d8a4a; background: #17200f; color: #cde3b8; }
.quiz-opt.wrong { border-color: var(--blood); background: #200f0c; color: #dfa79b; opacity: 0.9; }

.quiz-feedback {
  max-width: 560px; margin: 0 auto 1.2rem;
  padding: 0.9rem 1.2rem;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: var(--bg-panel-2);
  animation: stepfade .35s ease both;
}
.quiz-feedback .fb-head {
  font-size: 0.75rem; letter-spacing: 0.22em; text-transform: uppercase; margin-bottom: 0.3rem;
}
.quiz-feedback.good .fb-head { color: #8fbb72; }
.quiz-feedback.bad .fb-head { color: #c96a52; }
.quiz-feedback p { color: var(--ink-dim); font-size: 0.97rem; }

.quiz-result { text-align: center; padding: 1rem 0; }
.quiz-result .big { font-size: 2.6rem; margin-bottom: 0.5rem; }
.quiz-result h3 { font-weight: 400; letter-spacing: 0.12em; color: var(--gold); margin-bottom: 0.6rem; }
.quiz-result p { color: var(--ink-dim); max-width: 520px; margin: 0 auto 1.2rem; }

/* footer nav */
.loc-footer {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  margin-top: 2rem; padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}
.nav-btn {
  background: none; border: 1px solid var(--line);
  color: var(--ink-dim); padding: 0.6rem 1.2rem;
  font-size: 0.92rem; letter-spacing: 0.06em; border-radius: 2px;
  transition: color .2s, border-color .2s;
}
.nav-btn:hover { color: var(--gold); border-color: var(--gold-dim); }
.nav-btn.descend {
  border-color: var(--ember); color: #f0c795;
  background: linear-gradient(to bottom, #33200f, #241407);
  box-shadow: 0 0 14px rgba(217,107,47,0.15);
}
.nav-btn.descend:hover { box-shadow: 0 0 26px rgba(217,107,47,0.4); }

.step-next-wrap { text-align: center; margin-top: 1.6rem; }
.step-next {
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.6rem 1.6rem;
  font-size: 0.9rem; letter-spacing: 0.14em; text-transform: uppercase;
  border-radius: 2px;
  transition: background .2s, color .2s;
}
.step-next:hover { background: var(--accent); color: #14100a; }

/* descent transition overlay */
#descent-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: #0b0713;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 1rem;
  text-align: center; padding: 2rem;
  animation: screenfade .4s ease both;
}
#descent-overlay .d-quote { font-style: italic; font-size: 1.25rem; color: var(--ink); max-width: 560px; }
#descent-overlay .d-depth { font-size: 0.8rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ember); }

/* ---------------- end screen ---------------- */

.end-inner { max-width: 720px; padding: 4.5rem 1.5rem 3rem; text-align: center; }
#end-art svg { width: 100%; max-width: 640px; height: auto; margin: 0 auto 1.5rem; display: block; }

/* ---------------- SVG scene animations ---------------- */

.flicker { animation: flicker 2.6s ease-in-out infinite; transform-origin: center bottom; transform-box: fill-box; }
.flicker2 { animation: flicker 3.4s ease-in-out infinite 0.7s; transform-origin: center bottom; transform-box: fill-box; }
@keyframes flicker {
  0%,100% { opacity: 0.85; transform: scaleY(1); }
  40% { opacity: 1; transform: scaleY(1.06); }
  70% { opacity: 0.75; transform: scaleY(0.96); }
}

.drift { animation: drift 9s ease-in-out infinite alternate; }
.drift2 { animation: drift 13s ease-in-out infinite alternate-reverse; }
@keyframes drift { from { transform: translateX(-14px); } to { transform: translateX(14px); } }

.rainfall { animation: rainfall 1.1s linear infinite; }
@keyframes rainfall { from { transform: translateY(-24px); } to { transform: translateY(24px); } }

.snowfall { animation: snowfall 7s linear infinite; }
.snowfall2 { animation: snowfall 11s linear infinite 2s; }
@keyframes snowfall { from { transform: translateY(-30px); } to { transform: translateY(170px); } }

.twinkle { animation: twinkle 3s ease-in-out infinite; }
.twinkle2 { animation: twinkle 4.4s ease-in-out infinite 1.2s; }
@keyframes twinkle { 0%,100% { opacity: 0.35; } 50% { opacity: 1; } }

.swirl { animation: swirlmove 7s ease-in-out infinite alternate; }
@keyframes swirlmove { from { transform: translate(-10px, 4px); } to { transform: translate(12px, -6px); } }

.bob { animation: bob 5s ease-in-out infinite alternate; }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  .flicker, .flicker2, .drift, .drift2, .rainfall, .snowfall, .snowfall2, .twinkle, .twinkle2, .swirl, .bob { animation: none; }
}

/* small screens */
@media (max-width: 560px) {
  body { font-size: 16px; }
  #depth-indicator { display: none; }
  .loc-footer { flex-direction: column; }
  .loc-footer .nav-btn { width: 100%; }
}
