@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=EB+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&display=swap');
:root {
  --bg: #0e1014;
  --bg-soft: #151820;
  --panel: #181c24;
  --text: #e9ecef;
  --muted: #9aa3ad;
  --line: rgba(233, 236, 239, .12);
  --accent: #d8b26a;
  --accent-soft: rgba(216, 178, 106, .14);
  --max: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: 'DM Sans', system-ui, sans-serif; line-height: 1.6; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
.container { width: min(var(--max), calc(100% - 40px)); margin-inline: auto; }
.narrow { width: min(840px, calc(100% - 40px)); }

.site-header { position: sticky; top: 0; z-index: 20; background: rgba(14, 16, 20, .88); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.nav-wrap { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--accent); color: var(--accent); font-family: 'Libre Baskerville', serif; }
.brand strong, .brand small { display: block; letter-spacing: .16em; }
.brand strong { font-size: .82rem; }
.brand small { color: var(--muted); font-size: .56rem; margin-top: 2px; }
.site-nav { display: flex; gap: 26px; align-items: center; }
.site-nav a { color: var(--muted); font-size: .92rem; padding: 26px 0 23px; border-bottom: 2px solid transparent; }
.site-nav a:hover, .site-nav a.active { color: var(--text); border-bottom-color: var(--accent); }
.nav-toggle { display: none; background: transparent; color: var(--text); border: 1px solid var(--line); padding: 8px 12px; }

.hero { position: relative; min-height: 78vh; display: grid; align-items: end; overflow: hidden; background: radial-gradient(circle at 78% 20%, rgba(216,178,106,.11), transparent 28%), linear-gradient(135deg, #0d0f13 0%, #181b22 55%, #101216 100%); }
.hero::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(14,16,20,.98) 0%, rgba(14,16,20,.8) 43%, rgba(14,16,20,.2) 100%); }
.hero::after { content: ''; position: absolute; width: 540px; height: 540px; border: 1px solid rgba(216,178,106,.16); border-radius: 50%; right: -180px; top: 80px; box-shadow: 0 0 0 70px rgba(216,178,106,.03), 0 0 0 140px rgba(216,178,106,.018); }
.hero-content { position: relative; z-index: 1; padding-block: 110px 110px; max-width: 820px; }
.eyebrow { margin: 0 0 14px; color: var(--accent); font-size: .72rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; }
h1, h2, h3 { font-family: 'Libre Baskerville', Georgia, serif; line-height: 1.16; font-weight: 700; }
h1 { font-size: clamp(2.8rem, 7vw, 6.2rem); margin: 0 0 24px; }
h2 { font-size: clamp(2rem, 4vw, 3.2rem); margin: 0 0 18px; }
h3 { font-size: 1.4rem; margin: 0 0 10px; }
em { color: var(--accent); }
.hero-lead { max-width: 650px; color: #c8cdd3; font-size: 1.08rem; margin-bottom: 28px; }
.button { display: inline-flex; align-items: center; justify-content: center; padding: 13px 18px; font-weight: 700; border: 1px solid var(--accent); }
.button-primary { background: var(--accent); color: #121212; }
.button-primary:hover { filter: brightness(1.05); }

.section { padding: 92px 0; }
.section-alt { background: var(--bg-soft); }
.two-col { display: grid; grid-template-columns: .85fr 1.15fr; gap: 70px; align-items: start; }
.prose { color: #c0c6cd; font-family: 'Libre Baskerville', Georgia, serif; }
.prose p { margin: 0 0 1.2em; }
.prose.large { font-size: 1.12rem; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.text-link { display: inline-block; color: var(--accent); font-weight: 700; }
.feature-card, .info-card, .character-card, .episode-block { border: 1px solid var(--line); background: var(--panel); }
.feature-card { padding: 32px; }
.feature-card p { color: var(--muted); max-width: 720px; margin: 0 0 22px; }
.card-kicker { margin: 0 0 9px; color: var(--accent); font-size: .68rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.mini-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.info-card { padding: 26px; transition: transform .15s ease, border-color .15s ease; }
.info-card:hover { transform: translateY(-3px); border-color: rgba(216,178,106,.45); }
.info-card p { margin: 0; color: var(--muted); }

.page-hero { padding: 92px 0 74px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(216,178,106,.04), transparent); }
.page-hero h1 { font-size: clamp(2.5rem, 6vw, 4.8rem); margin-bottom: 16px; }
.page-hero p:last-child { max-width: 720px; color: var(--muted); font-size: 1.05rem; }
.episode-block { padding: 30px; }
.episode-block + .episode-block { margin-top: 18px; }
.episode-number { color: var(--accent); font-size: .72rem; font-weight: 700; letter-spacing: .18em; }
.episode-meta { padding: 8px 0 20px; }
.episode-meta p { color: var(--muted); max-width: 670px; }
.chapter-list { border-top: 1px solid var(--line); }
.chapter-list a { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 18px 0; border-bottom: 1px solid var(--line); color: #d9dde1; }
.chapter-list a:hover { color: var(--accent); }
.chapter-list-large a { padding: 24px 0; }
.chapter-list small { display: block; color: var(--muted); font-size: .65rem; letter-spacing: .12em; margin-bottom: 4px; }
.chapter-list strong { font-family: 'Libre Baskerville', serif; font-size: 1.18rem; font-weight: 700; }

.character-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.character-card { overflow: hidden; }
.character-portrait { aspect-ratio: 4 / 5; display: grid; place-items: center; font-family: 'Libre Baskerville', serif; font-size: 5rem; color: rgba(255,255,255,.3); background: linear-gradient(135deg, #252a33, #13161b); }
.portrait-bruce { background: radial-gradient(circle at 65% 22%, rgba(216,178,106,.28), transparent 24%), linear-gradient(135deg, #26313a, #111318); }
.portrait-ale { background: radial-gradient(circle at 40% 25%, rgba(145,117,160,.28), transparent 22%), linear-gradient(135deg, #302833, #121316); }
.portrait-zivon { background: radial-gradient(circle at 55% 22%, rgba(130,150,170,.2), transparent 25%), linear-gradient(135deg, #2b3037, #121416); }
.portrait-monse { background: radial-gradient(circle at 65% 23%, rgba(174,106,202,.24), transparent 25%), linear-gradient(135deg, #2d2833, #141419); }
.portrait-danna { background: radial-gradient(circle at 40% 18%, rgba(75,193,155,.18), transparent 24%), linear-gradient(135deg, #22302f, #111516); }
.portrait-nate { background: radial-gradient(circle at 55% 22%, rgba(170,176,188,.18), transparent 24%), linear-gradient(135deg, #2c2e33, #121315); }
.character-card-body { padding: 22px; }
.character-card-body h2 { font-size: 1.5rem; margin-bottom: 10px; }
.character-card-body p:not(.card-kicker) { color: var(--muted); margin: 0 0 16px; }

.profile { display: grid; grid-template-columns: 320px 1fr; gap: 54px; align-items: start; }
.profile-portrait { aspect-ratio: 4 / 5; display: grid; place-items: center; font: 700 7rem 'Libre Baskerville', serif; color: rgba(255,255,255,.32); border: 1px solid var(--line); }
.profile h1 { font-size: clamp(2.6rem, 5vw, 4.5rem); }
.profile-lead { color: #c0c6cd; font-size: 1.08rem; max-width: 650px; }
.profile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 32px 0 44px; }
.profile-grid div { border-top: 1px solid var(--line); padding-top: 12px; }
.profile-grid small { display: block; color: var(--muted); font-size: .62rem; letter-spacing: .11em; margin-bottom: 6px; }
.profile-grid strong { display: block; font-size: .9rem; }
.profile-text h2 { font-size: 1.7rem; color: var(--text); margin-top: 34px; }

.chapter { padding-top: 74px; padding-bottom: 90px; }
.chapter-header { text-align: center; max-width: 720px; margin: 0 auto 68px; }
.chapter-header h1 { font-size: clamp(2.8rem, 6vw, 5rem); }
.chapter-subtitle { color: var(--muted); }
.chapter-text { font-size: 1.09rem; line-height: 2; }
.chapter-text p { margin: 0 0 1.55em; }
.chapter-nav { display: flex; justify-content: space-between; gap: 18px; margin-top: 64px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--accent); }
.empty-state { padding: 70px 30px; text-align: center; border: 1px dashed var(--line); color: var(--muted); }
.empty-state span { display: inline-grid; place-items: center; width: 54px; height: 54px; border: 1px solid var(--accent); color: var(--accent); font-weight: 700; margin-bottom: 16px; }
.empty-state h2 { color: var(--text); font-size: 1.8rem; }
.error-message { padding: 22px; border: 1px solid rgba(220,100,100,.3); color: #e3b7b7; }

.site-footer { border-top: 1px solid var(--line); padding: 30px 0; color: var(--muted); }
.footer-wrap { display: flex; justify-content: space-between; gap: 24px; align-items: end; }
.footer-wrap p { margin: 3px 0 0; }

@media (max-width: 900px) {
  .site-nav { display: none; position: absolute; left: 20px; right: 20px; top: 74px; flex-direction: column; align-items: stretch; gap: 0; background: var(--panel); border: 1px solid var(--line); padding: 8px 16px; }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 11px 0; border-bottom: 1px solid var(--line); }
  .site-nav a:last-child { border-bottom: 0; }
  .nav-toggle { display: block; }
  .two-col, .profile { grid-template-columns: 1fr; gap: 34px; }
  .mini-grid, .character-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-portrait { max-width: 280px; }
  .profile-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .container, .narrow { width: min(100% - 28px, var(--max)); }
  .hero { min-height: 70vh; }
  .hero-content { padding-block: 84px 76px; }
  .section { padding: 68px 0; }
  .mini-grid, .character-grid { grid-template-columns: 1fr; }
  .section-heading, .footer-wrap { align-items: start; flex-direction: column; }
  .feature-card, .info-card, .episode-block { padding: 22px; }
  .chapter { padding-top: 50px; }
  .chapter-text { font-size: 1rem; line-height: 1.9; }
  .chapter-nav { flex-wrap: wrap; }
}

/* --- Experimental chapter experience --- */
.immersive-reading { background: #090b0f; }
.reading-background { position: fixed; inset: 0; z-index: -2; overflow: hidden; background: #090b0f; }
.reading-background-layer { position: absolute; inset: -2%; background-position: center; background-size: cover; background-repeat: no-repeat; opacity: 0; transform: scale(1.025); filter: saturate(.75) contrast(1.02); transition: opacity 1.5s ease, filter 1.7s ease, transform 8s ease; }
.reading-background-layer.is-visible { opacity: 1; transform: scale(1); }
.reading-background-vignette { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(7,9,12,.84) 0%, rgba(7,9,12,.64) 50%, rgba(7,9,12,.82) 100%), linear-gradient(180deg, rgba(7,9,12,.68) 0%, rgba(7,9,12,.2) 28%, rgba(7,9,12,.68) 100%); }
.reading-background-grain { position: absolute; inset: 0; opacity: .08; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E"); pointer-events: none; }
.reading-page .site-header { background: rgba(9,11,15,.46); }
.reading-status { margin-left: auto; margin-right: 20px; color: rgba(233,236,239,.75); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.status-divider { color: rgba(216,178,106,.65); padding: 0 7px; }

.start-experience { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 28px; background: rgba(5,7,10,.74); backdrop-filter: blur(14px); transition: opacity .5s ease, visibility .5s ease; }
.start-experience.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.start-card { width: min(580px, 100%); padding: 46px; border: 1px solid rgba(233,236,239,.14); background: rgba(18,22,29,.92); box-shadow: 0 30px 90px rgba(0,0,0,.44); text-align: center; }
.start-card h1 { margin-bottom: 14px; }
.start-card p:not(.eyebrow) { color: #aeb6bf; margin: 0 auto 26px; max-width: 470px; }
.start-youtube-link { display: block; margin-top: 18px; font-size: .8rem; }

.music-widget { position: fixed; left: 24px; bottom: 24px; z-index: 30; display: flex; align-items: center; gap: 10px; }
.music-control {
  position: static;
  z-index: auto;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: min(420px, calc(100vw - 180px));
  padding: 12px 14px;
  color: var(--text);
  background: rgba(12,15,20,.72);
  border: 1px solid rgba(233,236,239,.14);
  backdrop-filter: blur(14px);
  cursor: pointer;
  text-align: left;
  transition: border-color .2s ease, transform .2s ease, background .2s ease;
}
.music-control:hover {
  border-color: rgba(216,178,106,.46);
  transform: translateY(-2px);
  background: rgba(12,15,20,.86);
  
}
.music-icon { color: var(--accent); font: 700 1.35rem/1 'Libre Baskerville', serif; }
.volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  color: var(--muted);
  background: rgba(12,15,20,.72);
  border: 1px solid rgba(233,236,239,.14);
  backdrop-filter: blur(14px);
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.volume-control input {
  width: 90px;
  accent-color: var(--accent);
}
.music-control-copy { min-width: 0; }
.music-control-copy strong, .music-control-copy small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-control-copy strong { font-size: .82rem; }
.music-control-copy small { margin-top: 2px; color: var(--muted); font-size: .64rem; text-transform: uppercase; letter-spacing: .1em; }
.music-bars { display: inline-flex; align-items: center; gap: 2px; height: 18px; margin-left: auto; }
.music-bars i { display: block; width: 2px; height: 8px; background: var(--accent); opacity: .8; animation: musicbar .85s ease-in-out infinite alternate; }
.music-bars i:nth-child(2) { height: 14px; animation-delay: -.42s; }
.music-bars i:nth-child(3) { height: 11px; animation-delay: -.15s; }
.music-bars i:nth-child(4) { height: 6px; animation-delay: -.62s; }
.music-control.is-paused .music-bars i { animation-play-state: paused; opacity: .35; }
@keyframes musicbar { from { transform: scaleY(.55); } to { transform: scaleY(1.2); } }

.chapter-intro { min-height: 92vh; display: grid; place-items: center; text-align: center; }
.chapter-intro .narrow { display: grid; justify-items: center; }
.chapter-intro h1 { font-size: clamp(3.2rem, 8vw, 7rem); margin-bottom: 12px; text-shadow: 0 10px 40px rgba(0,0,0,.28); }
.chapter-subtitle { color: rgba(233,236,239,.74); }
.scroll-cue { margin-top: 66px; color: rgba(233,236,239,.56); font-size: .65rem; text-transform: uppercase; letter-spacing: .18em; }
.scroll-cue i { display: block; width: 1px; height: 56px; margin: 14px auto 0; background: linear-gradient(rgba(216,178,106,.8), transparent); }

.story-section { position: relative; min-height: 100vh; padding: 15vh 0 18vh; }
.story-content { position: relative; }
.section-marker { position: sticky; top: 105px; width: fit-content; margin-left: auto; margin-bottom: 36px; color: rgba(233,236,239,.45); font-size: .63rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.section-marker span { padding-left: 12px; border-left: 1px solid rgba(216,178,106,.7); }
.story-section .chapter-text { font-family: 'EB Garamond', serif; font-size: clamp(1.18rem, 1.5vw, 1.35rem); line-height: 1.8; text-align: justify; hyphens: auto; color: rgba(244,246,248,.93); text-shadow: 0 2px 14px rgba(0,0,0,.34);
}.story-section .chapter-text p { margin-bottom: 1.35em; }
.story-section .chapter-text em { color: #f0d7a4; }
.prescription-card { display: grid; gap: 6px; width: min(430px, 100%); margin: 32px auto 40px; padding: 22px 24px; color: #17181a; background: linear-gradient(135deg, #f4f0e9, #d7d3cb); border-left: 4px solid #d2a96a; box-shadow: 0 22px 55px rgba(0,0,0,.3); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; line-height: 1.45; text-shadow: none; }
.prescription-card strong { letter-spacing: .08em; }
.prescription-card span:first-of-type { margin-top: 5px; font-weight: 700; }
.section-end { height: 28vh; min-height: 180px; margin-top: 7vh; }
.section-end::before { content: '·  ·  ·'; display: block; padding-top: 10vh; color: rgba(233,236,239,.28); text-align: center; letter-spacing: .48em; }
.section-end-final { height: 15vh; min-height: 100px; }
.immersive-chapter-nav { padding-top: 28px; padding-bottom: 100px; position: relative; }
.immersive-footer { position: relative; background: rgba(8,10,13,.88); }
.youtube-audio-host { position: fixed; width: 320px; height: 180px; right: -340px; bottom: 12px; overflow: hidden; opacity: .01; pointer-events: none; z-index: -1; }
.youtube-audio-host > div { width: 320px; height: 180px; }
.youtube-audio-host iframe { width: 320px !important; height: 180px !important; border: 0; }

@media (max-width: 900px) {
  .reading-status { display: none; }
  .music-widget { left: 14px; bottom: 14px; max-width: calc(100% - 28px); }
  .music-control { max-width: none; }
  .volume-control input { width: 70px; }
  .story-section { padding-top: 12vh; }
  .section-marker { top: 86px; }
  .start-card { padding: 34px 24px; }
}


/* --- General city background --- */
body.city-background {
  position: relative;
  isolation: isolate;
  background: #0e1014;
}

body.city-background::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: url("/img/backgrounds/eidolon-city.jpg");
  background-position: center 36%;
  background-size: cover;
  background-repeat: no-repeat;
  transform: scale(1.02);
}

body.city-background::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(7,10,14,.42) 0%, rgba(7,10,14,.62) 55%, rgba(7,10,14,.82) 100%);
  pointer-events: none;
}

.city-background .hero {
  background: transparent;
}

.city-background .page-hero {
  background: linear-gradient(180deg, rgba(7,10,14,.20), rgba(7,10,14,.08));
}

.city-background .section {
  background: rgba(8,11,15,.34);
}

.city-background .section-alt {
  background: rgba(12,15,20,.62);
}

.city-background .site-footer {
  background: rgba(8,10,13,.72);
}

/* --- Character profiles --- */
.character-profile {
  padding: 78px 0 100px;
}

.character-profile-header {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 54px;
  align-items: center;
  padding-bottom: 64px;
  border-bottom: 1px solid var(--line);
}

.character-profile-image {
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  font: 700 7rem 'Libre Baskerville', serif;
  color: rgba(255,255,255,.30);
  background-size: cover;
  background-position: center;
}

.character-profile-intro h1 {
  max-width: 850px;
  margin-bottom: 18px;
}

.character-profile-body {
  padding-top: 8px;
}

.character-section {
  width: min(820px, 100%);
  margin: 0 auto;
  padding: 54px 0;
  border-bottom: 1px solid var(--line);
}

.character-section h2 {
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  margin-bottom: 22px;
}

.character-section p,
.character-section li {
  color: #c0c6cd;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.18rem;
  line-height: 1.8;
}

.character-section p {
  margin: 0 0 1.2em;
}

.character-section ul {
  margin: 0;
  padding-left: 1.3em;
}

.character-data {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 0;
}

.character-data > div {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.character-data dt {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.character-data dd {
  margin: 0;
  color: var(--text);
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.15rem;
}

.character-relations {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.character-relations a {
  padding: 9px 12px;
  border: 1px solid var(--line);
  color: #d9dde1;
  background: rgba(24,28,36,.60);
  transition: border-color .15s ease, color .15s ease;
}

.character-relations a:hover {
  color: var(--accent);
  border-color: rgba(216,178,106,.45);
}

@media (max-width: 900px) {
  .character-profile-header {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .character-profile-image {
    max-width: 280px;
  }

  .character-data {
    grid-template-columns: 1fr;
  }
}
