:root {
  --ink: #1a1410;
  --walnut: #2a1c14;
  --pumpkin: #f4a64b;
  --wax-pale: #ffd9a3;
  --cinnabar: #d65a3a;
  --indigo: #3d4f6b;
  --brass: #8a6a3a;
  --cream: #c8b89a;

  --candle-warmth: 1;
  --background-tint: 0;

  --hero-wght: 700;
  --hero-wdth: 100;
  --elastic: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--ink);
  color: var(--cream);
  font-family: "Fraunces", Georgia, serif;
  font-variation-settings: "SOFT" 50, "WONK" 1, "opsz" 32;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  height: 100vh;
  overflow-y: scroll;
  filter: hue-rotate(calc(var(--background-tint) * 1deg));
  transition: filter 0.6s ease;
}

::-webkit-scrollbar { width: 0; display: none; }

/* ---------- Candle scroll indicator ---------- */
#candle-rail {
  position: fixed;
  right: 24px; top: 0;
  width: 40px; height: 100vh;
  z-index: 50;
  pointer-events: none;
}
#candle-svg { width: 40px; height: 100vh; display: block; filter: drop-shadow(0 0 18px rgba(244,166,75,0.35)); }
#flame-grp { transform-origin: 20px 56px; transform-box: view-box; }
#flame {
  transform-origin: 20px 56px; transform-box: view-box;
  animation: flame-dance 2.4s ease-in-out infinite, flicker 2.4s ease-in-out infinite;
}
@keyframes flame-dance {
  0%   { d: path("M20,18 C28,30 30,42 20,52 C10,42 12,30 20,18 Z"); }
  33%  { d: path("M20,12 C30,28 28,44 20,52 C13,44 11,26 20,12 Z"); }
  66%  { d: path("M21,20 C26,32 32,40 20,52 C9,42 14,32 19,20 Z"); }
  100% { d: path("M20,18 C28,30 30,42 20,52 C10,42 12,30 20,18 Z"); }
}
@keyframes flicker {
  0%,100% { opacity: 1; }
  45% { opacity: 0.78; }
  70% { opacity: 0.92; }
}
#wax-pool { transition: d 0.25s linear; }

/* ---------- Floors ---------- */
main { display: block; }
.floor {
  position: relative;
  min-height: 100vh;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6vh 9vw 6vh 6vw;
  overflow: hidden;
}
.floor-scroll {
  align-items: flex-start;
  overflow-y: auto;
  scroll-snap-align: start;
}

.flicker {
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(60% 50% at 38% 42%, rgba(244,166,75,0.16), transparent 70%);
  mix-blend-mode: screen;
  opacity: 0.9;
}
#b1 .flicker { animation: drift1 7s ease-in-out infinite alternate; }
#b2 .flicker { animation: drift2 7.6s ease-in-out infinite alternate; }
#b3 .flicker { animation: drift3 6.4s ease-in-out infinite alternate; }
#b4 .flicker { animation: drift1 8.1s ease-in-out infinite alternate; }
#b5 .flicker { animation: drift2 7.2s ease-in-out infinite alternate; }
#b6 .flicker { animation: drift3 6.9s ease-in-out infinite alternate; }
#b7 .flicker { animation: drift1 7.8s ease-in-out infinite alternate; }
@keyframes drift1 { from { transform: translate(-4%,-2%) scale(1); opacity:.85;} to { transform: translate(5%,4%) scale(1.12); opacity:1;} }
@keyframes drift2 { from { transform: translate(6%,3%) scale(1.05); opacity:.88;} to { transform: translate(-5%,-3%) scale(1); opacity:1;} }
@keyframes drift3 { from { transform: translate(-2%,5%) scale(1); opacity:.85;} to { transform: translate(4%,-4%) scale(1.1); opacity:.98;} }

/* ---------- Floor labels ---------- */
.floor-label {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 1.4rem;
  opacity: 0.85;
}

/* ---------- Seams ---------- */
.seam {
  position: relative;
  display: flex; align-items: center;
  height: 0;
  background: var(--ink);
}
.seam .rule { flex: 1; height: 1px; background: var(--brass); opacity: 0.65; }
.seam .rivet {
  width: 6px; height: 6px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--wax-pale), var(--brass) 70%);
  box-shadow: 0 0 6px rgba(138,106,58,0.5);
  flex: 0 0 6px;
  margin: 0 4px;
}

/* knurled brass bezel utility */
.knurl {
  border: 1px solid var(--brass);
  background-image: repeating-linear-gradient(6deg, rgba(138,106,58,0.7) 0 1px, rgba(0,0,0,0.5) 1px 2px);
  background-blend-mode: overlay;
}

.humanist-italic {
  font-style: italic;
  font-variation-settings: "SOFT" 80, "WONK" 0, "opsz" 18;
  color: var(--cream);
  opacity: 0.82;
  font-size: 1.05rem;
  margin-top: 1.2rem;
}

/* ---------- B1 ---------- */
#b1 { background: linear-gradient(160deg, #241710 0%, #1a1410 60%, #14100c 100%); }
.b1-bg {
  position: absolute; inset: 0;
  z-index: 0;
}
.b1-bg img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0.30;
  filter: url(#duotone-amber-indigo);
  animation: huedrift 18s ease-in-out infinite alternate;
}
@keyframes huedrift { from { filter: url(#duotone-amber-indigo) hue-rotate(0deg);} to { filter: url(#duotone-amber-indigo) hue-rotate(8deg);} }
.corner-candle {
  position: absolute; left: 4vw; bottom: 0;
  width: 70px; height: 220px; z-index: 1;
}
.corner-flame { transform-origin: 40px 70px; transform-box: view-box; animation: flame-dance 2.4s ease-in-out infinite, flicker 2.4s ease-in-out infinite; }
.b1-inner { position: relative; z-index: 2; max-width: 1100px; width: 100%; text-align: center; }
#hero-domain {
  font-family: "Recursive", monospace;
  font-variation-settings: "MONO" 0, "CASL" 0.4, "wght" var(--hero-wght), "slnt" 0;
  font-stretch: calc(var(--hero-wdth) * 1%);
  font-size: clamp(3.5rem, 11vw, 9rem);
  letter-spacing: -0.01em;
  line-height: 0.95;
  color: var(--pumpkin);
  text-shadow: 0 0 40px rgba(244,166,75,0.25);
  transition: font-variation-settings 0.2s ease, font-stretch 0.2s ease;
}
.b1-sub {
  margin-top: 1.6rem;
  font-style: italic;
  color: var(--cream);
  opacity: 0.78;
  font-size: clamp(1rem, 2vw, 1.3rem);
}
.descend, .ascend {
  display: inline-block;
  margin-top: 2.6rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--wax-pale);
  text-decoration: none;
  padding: 0.7rem 1.4rem;
  border: 1px solid var(--brass);
  background-image: repeating-linear-gradient(6deg, rgba(138,106,58,0.5) 0 1px, rgba(0,0,0,0.4) 1px 2px);
  transition: transform 0.5s var(--elastic), letter-spacing 0.5s var(--elastic), color 0.4s ease;
}
.descend:hover, .ascend:hover { transform: scale(1.12); letter-spacing: 0.3em; color: var(--pumpkin); }
.chev { display: inline-block; margin-left: 0.5em; transition: transform 0.5s var(--elastic); }
.descend:hover .chev { transform: translateY(6px) scale(1.4); }
.ascend:hover .chev { transform: translateY(-6px) scale(1.4); }

/* ---------- B2 ---------- */
#b2 { background: linear-gradient(110deg, #1a1410 0%, #221a12 100%); }
.b2-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 4vw;
  width: 100%; max-width: 1200px;
  align-items: center;
  position: relative; z-index: 2;
}
.b2-meter {
  border: 1px solid var(--brass);
  background-image: repeating-linear-gradient(6deg, rgba(138,106,58,0.5) 0 1px, rgba(0,0,0,0.4) 1px 2px);
  padding: 8px; aspect-ratio: 4/5;
  overflow: hidden;
}
.b2-meter img { width: 100%; height: 100%; object-fit: cover; filter: url(#duotone-amber-indigo); }
.breathing-block {
  font-family: "Roboto Flex", sans-serif;
  font-size: clamp(2rem, 6.5vw, 5rem);
  line-height: 1.05;
  color: var(--pumpkin);
  margin-top: 0.6rem;
  display: flex; flex-wrap: wrap;
}
.breathing-block .digit {
  display: inline-block;
  font-variation-settings: "wght" 400, "wdth" 90, "opsz" 60;
  animation: breathe-digit 4s ease-in-out infinite;
}
@keyframes breathe-digit {
  0%,100% { font-variation-settings: "wght" 350, "wdth" 78, "opsz" 40; }
  50% { font-variation-settings: "wght" 760, "wdth" 122, "opsz" 90; }
}

/* ---------- B3 ---------- */
#b3 { background: linear-gradient(120deg, #1a1410 0%, #1f1812 100%); }
.b3-inner { width: 100%; max-width: 1300px; position: relative; z-index: 2; }
.rack-frame {
  margin-top: 1.6rem;
  border: 1px solid var(--brass);
  background-image: repeating-linear-gradient(6deg, rgba(138,106,58,0.45) 0 1px, rgba(0,0,0,0.4) 1px 2px);
  padding: 1.4rem 1.2rem 1.8rem;
}
.wax-rack {
  display: flex;
  gap: 1.6rem;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  padding-bottom: 0.4rem;
}
.wax-rack::-webkit-scrollbar { display: none; }
.wax-card {
  flex: 0 0 clamp(220px, 26vw, 340px);
  scroll-snap-align: center;
  background: var(--walnut);
  border: 1px solid rgba(138,106,58,0.5);
  padding: 0.8rem;
}
.wax-photo { aspect-ratio: 4/3; overflow: hidden; border: 1px solid rgba(138,106,58,0.4); }
.wax-photo img { width: 100%; height: 100%; object-fit: cover; filter: url(#duotone-amber-indigo); transition: transform 0.6s ease; }
.wax-card:hover .wax-photo img { transform: scale(1.05); }
.wax-caption {
  margin-top: 0.7rem;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--cream);
  opacity: 0.85;
}
.rack-track {
  position: relative;
  height: 30px;
  margin-top: 1.2rem;
  background: linear-gradient(var(--brass), #6a4f2a);
  border-radius: 2px;
  opacity: 0.85;
}
.rack-scrubber {
  position: absolute; top: -4px; left: 0;
  width: 24px; height: 38px;
  transition: transform 0.3s var(--elastic);
}
.rack-scrubber svg { width: 24px; height: 38px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }

/* ---------- B4 ---------- */
#b4 { background: #14100c; }
.b4-bg { position: absolute; inset: 0; z-index: 0; }
.b4-bg img { width: 100%; height: 100%; object-fit: cover; filter: url(#duotone-amber-indigo); opacity: 0.34; }
.b4-inner { position: relative; z-index: 2; max-width: 720px; width: 100%; }
.broadcast-notes { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.bnote {
  font-family: "Roboto Flex", sans-serif;
  font-size: clamp(1.1rem, 2.3vw, 1.6rem);
  line-height: 1.5;
  color: var(--cream);
  font-variation-settings: "wght" 380, "wdth" 75, "opsz" 30;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 1.1s ease, transform 1.1s ease, font-variation-settings 1.4s ease;
}
.bnote.lit {
  opacity: 0.92;
  transform: translateY(0);
  font-variation-settings: "wght" 460, "wdth" 100, "opsz" 30;
}
.bnote:first-child { color: var(--pumpkin); font-family: "JetBrains Mono", monospace; font-size: 0.82rem; letter-spacing: 0.14em; text-transform: uppercase; }

/* ---------- B5 ---------- */
#b5 { background: linear-gradient(135deg, #1a1410 0%, #241a12 100%); }
.b5-inner { width: 100%; max-width: 1000px; text-align: center; position: relative; z-index: 2; }
.knob-panel {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
  gap: clamp(2rem, 6vw, 5rem);
  flex-wrap: wrap;
}
.knob-cell { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.knob {
  width: clamp(96px, 14vw, 150px);
  height: clamp(96px, 14vw, 150px);
  border-radius: 50%;
  cursor: grab;
  position: relative;
  border: 2px solid var(--brass);
  background:
    repeating-conic-gradient(from 0deg, rgba(138,106,58,0.85) 0deg 4deg, rgba(20,16,12,0.9) 4deg 8deg),
    radial-gradient(circle at 38% 32%, #c8b89a 0%, #8a6a3a 38%, #2a1c14 75%, #14100c 100%);
  box-shadow: inset 0 4px 10px rgba(0,0,0,0.6), inset 0 -3px 8px rgba(255,217,163,0.15), 0 6px 16px rgba(0,0,0,0.5);
  transition: transform 0.45s var(--elastic);
}
.knob:active { cursor: grabbing; }
.knob-pointer {
  position: absolute;
  top: 8%; left: 50%;
  width: 4px; height: 28%;
  background: var(--pumpkin);
  transform: translateX(-50%);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(244,166,75,0.7);
}
.knob-name {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
}
.b5-hint { text-align: center; }

/* ---------- B6 ---------- */
#b6 { background: linear-gradient(180deg, #1a1410 0%, #18120e 100%); }
.b6-inner {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  position: relative; z-index: 2;
  padding: 8vh 0 12vh;
}
.manifesto {
  width: 56ch;
  max-width: 100%;
  margin-left: 0;
  transform: translateX(-4%);
}
.manifesto p {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.0625rem;
  line-height: 1.78;
  color: var(--cream);
  font-variation-settings: "SOFT" 50, "WONK" 1, "opsz" 28;
  margin: 1.4rem 0;
}
.manifesto p:first-child::first-letter {
  font-size: 3.2rem;
  float: left;
  line-height: 0.8;
  padding: 0.1em 0.12em 0 0;
  color: var(--pumpkin);
}
.wax-drip {
  display: block;
  height: 50px;
  margin: 0.4rem 0 1.6rem;
}
.wax-drip svg { width: 40px; height: 50px; display: block; transform-origin: top center; }
.wax-drip.dripped svg { animation: wax-fall 1.3s var(--elastic) forwards; }
@keyframes wax-fall {
  0% { transform: translateY(-30px) scaleY(1.3) scaleX(0.7); }
  60% { transform: translateY(0) scaleY(0.7) scaleX(1.3); }
  80% { transform: translateY(0) scaleY(1.08) scaleX(0.95); }
  100% { transform: translateY(0) scaleY(1) scaleX(1); }
}

/* ---------- B7 ---------- */
#b7 { background: radial-gradient(60% 60% at 50% 70%, #221a12 0%, #14100c 70%, #100c08 100%); }
.b7-smoke { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: 60px; height: 50vh; z-index: 1; }
.b7-smoke svg { width: 60px; height: 100%; }
.smoke-path { stroke-dasharray: 4 8; animation: smoke-rise 6s linear infinite; }
@keyframes smoke-rise { from { stroke-dashoffset: 0; opacity: 0.5; } to { stroke-dashoffset: -48; opacity: 0.2; } }
.b7-inner { position: relative; z-index: 2; text-align: center; max-width: 900px; }
#signoff-domain {
  font-family: "Recursive", monospace;
  font-variation-settings: "MONO" 0, "CASL" 0.2, "wght" 320, "slnt" 0;
  font-stretch: 75%;
  font-size: clamp(2.6rem, 8vw, 6rem);
  color: var(--pumpkin);
  opacity: 0.55;
  letter-spacing: 0.02em;
}
.b7-sub { margin-top: 1.4rem; font-style: italic; color: var(--cream); opacity: 0.6; font-size: clamp(1rem, 2vw, 1.25rem); }

@media (max-width: 720px) {
  .b2-grid { grid-template-columns: 1fr; }
  .b2-meter { aspect-ratio: 16/9; max-height: 30vh; }
  .manifesto { transform: none; }
  #candle-rail { right: 6px; width: 24px; }
  #candle-svg { width: 24px; }
}
