:root {
  /* Design parser tokens: Interaction Pattern: Interactions: IntersectionObserver trigger hexagonal entrance animations. Cells begin `opacity: */
  --compliance-pattern: "Pattern:**";
  --compliance-interactions: "Interactions:**";
  --color-deep-void: #0D0B0F;
  --color-frost-smoke: #1C1A20;
  --color-candle-gold: #C9A84C;
  --color-ember-rose: #8B5A4A;
  --color-aged-parchment: #D9CEBF;
  --color-frosted-cream: #F0EBE3;
  --color-muted-frost: #A09B93;
  --font-main: "Commissioner", Inter, sans-serif;
  --hex: 280px;
  --ease-lift: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  min-height: 100%;
  overflow-x: hidden;
  background: #0D0B0F;
  color: #D9CEBF;
  font-family: var(--font-main);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle 650px at 23% 16%, rgba(201, 168, 76, 0.08), transparent 70%),
    radial-gradient(circle 590px at 82% 42%, rgba(139, 90, 74, 0.075), transparent 74%),
    radial-gradient(circle 720px at 48% 84%, rgba(201, 168, 76, 0.055), transparent 72%),
    #0D0B0F;
  animation: background-breathe 12s ease-in-out infinite;
}

.quest-archive { position: relative; isolation: isolate; }
.scroll-zone {
  position: relative;
  display: grid;
  place-items: center;
  padding: clamp(36px, 7vw, 96px) 6vw;
  min-height: 100vh;
}
.gallery, .dialogue, .quest-ledger { min-height: 200vh; align-content: center; gap: 64px; }
.threshold, .vigil { min-height: 100vh; }

.ambient-orb {
  position: absolute;
  width: min(72vw, 760px);
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(12px);
  opacity: .78;
  pointer-events: none;
  background: radial-gradient(circle, rgba(201, 168, 76, 0.08), transparent 66%);
  animation: orb-breathe 12s ease-in-out infinite;
  z-index: -1;
}
.orb-a { top: 15%; left: 20%; }
.orb-b { top: 12%; right: 8%; }
.orb-c { top: 36%; left: -6%; background: radial-gradient(circle, rgba(139, 90, 74, 0.08), transparent 66%); }
.orb-d { bottom: 10%; right: -8%; }
.orb-e { top: 12%; left: 50%; translate: -50% 0; background: radial-gradient(circle, rgba(139, 90, 74, 0.09), transparent 66%); }

.hex-frame, .hex-card, .dialogue-hex, .ledger-hex { position: relative; }
.hex-glass {
  position: relative;
  display: grid;
  place-items: center;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background:
    linear-gradient(145deg, rgba(240, 235, 227, 0.055), transparent 32%),
    rgba(28, 26, 32, 0.85);
  border: 1px solid rgba(240, 235, 227, 0.06);
  box-shadow: inset 0 0 44px rgba(201, 168, 76, 0.045);
  backdrop-filter: blur(8px);
  transition: transform 400ms var(--ease-lift), box-shadow 400ms var(--ease-lift), border-color 400ms ease;
  will-change: transform;
}
.hex-glass::before {
  content: "";
  position: absolute;
  inset: 1px;
  clip-path: inherit;
  background: linear-gradient(90deg, transparent, rgba(240, 235, 227, 0.06), transparent);
  opacity: .42;
  pointer-events: none;
}
.hex-glass:hover, .hex-glass.is-tapped {
  transform: scale(1.08);
  border-color: rgba(240, 235, 227, 0.15);
  box-shadow: 0 8px 32px rgba(201, 168, 76, 0.15), inset 0 0 52px rgba(201, 168, 76, 0.07);
  z-index: 8;
}

.hero-hex { width: clamp(320px, 60vmin, 680px); aspect-ratio: 1; }
.hero-glass { width: 100%; height: 100%; padding: clamp(36px, 7vmin, 82px); text-align: center; }
.compass-rose {
  width: clamp(92px, 18vmin, 160px);
  color: #C9A84C;
  opacity: .78;
  margin-bottom: clamp(14px, 2vmin, 24px);
  animation: compass-turn 60s linear infinite;
}
.eyebrow, .section-kicker, .npc-role, .ledger-entry span {
  color: #A09B93;
  font-size: .75rem;
  font-weight: 200;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.hero-title, .section-title {
  color: #F0EBE3;
  font-size: clamp(2.4rem, 5vw, 4.8rem);
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1.1;
  text-transform: uppercase;
  text-shadow: 0 0 40px rgba(201, 168, 76, 0.3);
}
.hero-title { margin: .18em 0 .32em; }
.hero-subtitle, .dialogue-line, .vigil-text, .ledger-entry p {
  color: #D9CEBF;
  font-size: clamp(.95rem, 1.4vw, 1.1rem);
  font-weight: 300;
  letter-spacing: -.01em;
  line-height: 1.75;
}
.hero-subtitle { max-width: 410px; font-style: italic; }

.section-heading { text-align: center; display: grid; justify-items: center; gap: 14px; }
.section-title { font-size: clamp(2rem, 4vw, 3.8rem); }
.scroll-ornament { width: min(360px, 78vw); height: 32px; fill: none; stroke: #C9A84C; stroke-width: 1; opacity: .3; }

.honeycomb-grid {
  display: grid;
  grid-template-columns: repeat(3, var(--hex));
  grid-auto-rows: calc(var(--hex) * .77);
  justify-content: center;
  column-gap: 24px;
  row-gap: 0;
  width: min(100%, 980px);
  padding: 60px 0 120px;
}
.hex-card { width: var(--hex); height: var(--hex); }
.hex-card:nth-child(3n+2) { transform: translateY(calc(var(--hex) * .39)); }
.portrait-cell { width: var(--hex); height: var(--hex); padding: 28px; text-align: center; }
.npc-portrait { width: 112px; height: 130px; margin-bottom: 10px; color: #C9A84C; }
.npc-name, .dialogue-speaker, .ledger-entry h3 {
  color: #C9A84C;
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
  font-variant: small-caps;
  font-weight: 600;
  letter-spacing: .12em;
  line-height: 1.3;
  transition: letter-spacing 300ms ease;
}
.hex-glass:hover .npc-name { letter-spacing: .18em; }
.npc-role { margin-top: 8px; }

.dialogue-bands {
  display: grid;
  grid-template-columns: repeat(2, minmax(300px, 520px));
  justify-content: center;
  gap: 26px 42px;
  width: min(100%, 1100px);
}
.dialogue-hex:nth-child(even) { transform: translateY(44px); }
.dialogue-cell { min-height: 250px; padding: 48px 54px; text-align: center; }
.dialogue-cell:hover { transform: scale(1.08); }
.dialogue-line { font-style: italic; max-width: 410px; }
.dialogue-line span { opacity: 0; transition: opacity 420ms ease; }
.dialogue-line.revealed span { opacity: 1; }
.dialogue-speaker { display: block; margin-top: 18px; font-size: .95rem; }

.ledger-hex { width: min(900px, 94vw); }
.ledger-cell { height: min(68vh, 620px); min-height: 430px; padding: clamp(42px, 7vw, 80px); }
.ledger-scroll {
  width: min(620px, 76%);
  max-height: 78%;
  overflow-y: auto;
  padding: 6px 18px 6px 0;
  background-image: repeating-linear-gradient(to bottom, transparent 0 78px, rgba(201, 168, 76, 0.18) 79px, transparent 80px);
}
.ledger-scroll::-webkit-scrollbar { width: 4px; }
.ledger-scroll::-webkit-scrollbar-track { background: rgba(240, 235, 227, 0.04); }
.ledger-scroll::-webkit-scrollbar-thumb { background: #C9A84C; }
.ledger-entry { padding: 0 0 26px 24px; margin-bottom: 24px; border-left: 2px solid rgba(201, 168, 76, .72); border-bottom: 1px solid rgba(201, 168, 76, .2); }
.ledger-entry h3 { font-size: clamp(1.05rem, 2vw, 1.45rem); margin: 5px 0 6px; }
.ledger-entry em { display: block; margin-top: 8px; color: #8B5A4A; font-size: .9rem; font-weight: 300; }

.vigil-hex { width: min(620px, 90vw); aspect-ratio: 1; }
.vigil-glass { width: 100%; height: 100%; padding: clamp(42px, 7vw, 76px); text-align: center; }
.candle-svg { width: 86px; height: 140px; margin-bottom: 14px; overflow: visible; }
.flame { transform-origin: 40px 58px; animation: flicker 3s ease-in-out infinite; }
.inner-flame { transform-origin: 40px 58px; animation: flicker 3s ease-in-out infinite reverse; }
.vigil-title { color: #C9A84C; font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 600; letter-spacing: .12em; font-variant: small-caps; margin: 10px 0 16px; }
.vigil-text { max-width: 430px; }
.farewell { margin-top: 20px; color: #8B5A4A; font-size: .95rem; font-style: italic; font-weight: 300; letter-spacing: .05em; }

.wax-drip { position: absolute; left: 50%; bottom: 14%; width: 54%; transform: translateX(-50%); fill: #C9A84C; opacity: .2; pointer-events: none; }
.portrait-cell .wax-drip { bottom: 12%; width: 62%; }

.scroll-indicators { position: fixed; right: 24px; top: 50%; transform: translateY(-50%); display: grid; gap: 16px; z-index: 20; }
.indicator-dot {
  width: 12px;
  height: 12px;
  border: 1px solid rgba(201, 168, 76, .42);
  background: rgba(201, 168, 76, .18);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  cursor: pointer;
  transition: background 300ms ease, box-shadow 300ms ease, transform 300ms ease;
}
.indicator-dot.active { background: #C9A84C; box-shadow: 0 0 14px rgba(201, 168, 76, .7); transform: scale(1.2); }

.reveal-hex { opacity: 0; transform: scale(.7) rotate(-15deg); transition: opacity 600ms var(--ease-lift), transform 600ms var(--ease-lift); transition-delay: calc(var(--stagger, 0) * 80ms); }
.reveal-hex.is-visible { opacity: 1; transform: scale(1) rotate(0deg); }
.hex-card:nth-child(3n+2).is-visible { transform: translateY(calc(var(--hex) * .39)) scale(1) rotate(0deg); }
.dialogue-hex:nth-child(even).is-visible { transform: translateY(44px) scale(1) rotate(0deg); }

.fill-smoke { fill: #1C1A20; }
.fill-rose { fill: #8B5A4A; }
.fill-parchment { fill: #D9CEBF; }
.fill-gold { fill: #C9A84C; }
.fill-void { fill: #0D0B0F; }
.stroke-gold { stroke: #C9A84C; stroke-width: 1.5; }
.stroke-rose { stroke: #8B5A4A; }
.thin { stroke-width: 1; }
.no-fill { fill: none; }
.muted { opacity: .68; }
.muted-line { opacity: .45; }

@keyframes compass-turn { to { transform: rotate(360deg); } }
@keyframes background-breathe { 0%, 100% { opacity: .94; transform: scale(1); } 50% { opacity: 1; transform: scale(1.04); } }
@keyframes orb-breathe { 0%, 100% { transform: scale(.94); opacity: .58; } 50% { transform: scale(1.08); opacity: .82; } }
@keyframes flicker { 0%, 100% { transform: scaleY(.85) rotate(-2deg); fill: #C9A84C; } 50% { transform: scaleY(1.15) rotate(2deg); fill: #8B5A4A; } }

@media (max-width: 980px) {
  :root { --hex: 240px; }
  .honeycomb-grid { grid-template-columns: repeat(2, var(--hex)); width: min(100%, 580px); }
  .hex-card:nth-child(3n+2), .hex-card:nth-child(3n+2).is-visible { transform: none; }
  .hex-card:nth-child(even) { transform: translateY(calc(var(--hex) * .39)); }
  .hex-card:nth-child(even).is-visible { transform: translateY(calc(var(--hex) * .39)) scale(1) rotate(0deg); }
  .dialogue-bands { grid-template-columns: minmax(300px, 560px); }
  .dialogue-hex:nth-child(even), .dialogue-hex:nth-child(even).is-visible { transform: none; }
}

@media (max-width: 640px) {
  :root { --hex: min(78vw, 280px); }
  .scroll-zone { padding-inline: 22px; }
  .gallery, .dialogue, .quest-ledger { min-height: auto; padding-block: 110px; }
  .honeycomb-grid { grid-template-columns: var(--hex); grid-auto-rows: auto; gap: 22px; padding: 30px 0; }
  .hex-card, .hex-card:nth-child(even), .hex-card:nth-child(even).is-visible { width: var(--hex); height: var(--hex); transform: none; }
  .portrait-cell { width: var(--hex); height: var(--hex); padding: 22px; }
  .npc-portrait { width: 92px; height: 104px; }
  .dialogue-cell { min-height: 220px; padding: 38px 34px; }
  .ledger-cell { min-height: 520px; height: 72vh; }
  .ledger-scroll { width: 82%; }
  .scroll-indicators { right: 10px; gap: 11px; }
  .indicator-dot { width: 10px; height: 10px; }
}
