:root {
  /* Typography compliance: Use IBM Plex Mono sparingly for tiny serial numbers; Interface and labels:** labels: labels* use uppercase micro-labels. */
  --charred-loam: #120D09;
  --burnt-orange: #C6531A;
  --ember-tangerine: #FF7A2F;
  --moss-shadow: #23351F;
  --verdigris-signal: #5F9C76;
  --bone-parchment: #E8D6BD;
  --oxidized-copper: #7B3E22;
  --core-glow: 0.38;
  --core-thickness: 2px;
  --active-node: 0;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--bone-parchment);
  background: var(--charred-loam);
  font-family: "Space Grotesk", Inter, sans-serif;
  overflow-x: hidden;
  transition: background 900ms ease;
}

body.chamber-0 { background: radial-gradient(circle at 50% 46%, rgba(198, 83, 26, 0.16), transparent 30%), #120D09; }
body.chamber-1 { background: radial-gradient(circle at 50% 52%, rgba(35, 53, 31, 0.38), transparent 38%), #120D09; }
body.chamber-2 { background: radial-gradient(circle at 50% 50%, rgba(95, 156, 118, 0.13), transparent 34%), linear-gradient(180deg, #120D09, #172011 52%, #120D09); }
body.chamber-3 { background: radial-gradient(circle at 50% 44%, rgba(255, 122, 47, 0.24), transparent 38%), #120D09; }
body.chamber-4 { background: radial-gradient(circle at 50% 50%, rgba(123, 62, 34, 0.22), transparent 40%), #120D09; }

.ambient-soil {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 18% 20%, rgba(123, 62, 34, 0.28), transparent 20%),
    radial-gradient(circle at 82% 76%, rgba(35, 53, 31, 0.38), transparent 26%),
    repeating-linear-gradient(90deg, rgba(232, 214, 189, 0.025) 0 1px, transparent 1px 98px),
    repeating-linear-gradient(0deg, rgba(232, 214, 189, 0.018) 0 1px, transparent 1px 88px);
  mix-blend-mode: screen;
  opacity: 0.72;
}

.ambient-soil::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(232, 214, 189, 0.16) 0.7px, transparent 0.7px);
  background-size: 19px 23px;
  opacity: 0.16;
}

.spore-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.spore {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ember-tangerine);
  opacity: 0.2;
  animation: driftSpore var(--duration) linear infinite;
  box-shadow: 0 0 12px rgba(255, 122, 47, 0.7);
}

@keyframes driftSpore {
  from { transform: translate3d(0, 110vh, 0) scale(0.4); }
  to { transform: translate3d(var(--sway), -12vh, 0) scale(1); }
}

.regeneration-core {
  position: fixed;
  left: 50%;
  top: 0;
  width: 1px;
  height: 100vh;
  transform: translateX(-50%);
  z-index: 3;
  pointer-events: none;
}

.core-glow {
  position: absolute;
  top: 8%;
  left: 50%;
  width: 96px;
  height: 84%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(255, 122, 47, calc(var(--core-glow) * 0.22)), transparent 62%);
  filter: blur(18px);
  opacity: var(--core-glow);
}

.core-line {
  position: absolute;
  left: 50%;
  top: 0;
  width: var(--core-thickness);
  height: 100%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, #7B3E22 10%, #C6531A 49%, #FF7A2F 52%, #7B3E22 90%, transparent);
  box-shadow: 0 0 calc(14px * var(--core-glow)) rgba(255, 122, 47, 0.9);
}

.core-line::before,
.core-line::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 44px;
  height: 1px;
  background: linear-gradient(90deg, #7B3E22, transparent);
  opacity: 0.7;
}

.core-line::before { top: 34%; transform: translateX(-100%); }
.core-line::after { top: 66%; transform: translateX(0) rotate(180deg); }

.core-node {
  position: absolute;
  left: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid var(--oxidized-copper);
  background: #120D09;
  box-shadow: 0 0 0 5px rgba(123, 62, 34, 0.12);
  transition: background 500ms ease, border-color 500ms ease, box-shadow 500ms ease;
}

.node-1 { top: 14%; }
.node-2 { top: 32%; }
.node-3 { top: 50%; }
.node-4 { top: 68%; }
.node-5 { top: 86%; }
body.chamber-0 .node-1,
body.chamber-1 .node-2,
body.chamber-2 .node-3,
body.chamber-3 .node-4,
body.chamber-4 .node-5 {
  background: var(--ember-tangerine);
  border-color: var(--ember-tangerine);
  box-shadow: 0 0 24px rgba(255, 122, 47, 0.95), 0 0 0 8px rgba(255, 122, 47, 0.1);
}

.magnetic-fragments {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.fragment {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  border: 1px solid var(--oxidized-copper);
  background: rgba(18, 13, 9, 0.8);
  box-shadow: 0 0 15px rgba(198, 83, 26, 0.26);
  transform: translate3d(var(--x), var(--y), 0) rotate(var(--r));
  transition: border-color 260ms ease, box-shadow 260ms ease;
}

.fragment.magnetized { border-color: var(--ember-tangerine); box-shadow: 0 0 22px rgba(255, 122, 47, 0.55); }
.sim { width: 30px; height: 22px; clip-path: polygon(0 0, 78% 0, 100% 28%, 100% 100%, 0 100%); }
.glass { width: 44px; height: 9px; border-radius: 50%; }
.pixel { width: 13px; height: 13px; background: rgba(95, 156, 118, 0.22); }
.pin { width: 4px; height: 46px; background: var(--oxidized-copper); }
.arc { width: 38px; height: 38px; border-radius: 50%; border-left-color: transparent; border-bottom-color: transparent; background: transparent; }
.copper { width: 26px; height: 8px; background: #7B3E22; }
.chip { width: 28px; height: 28px; background: linear-gradient(135deg, rgba(35, 53, 31, 0.9), rgba(18, 13, 9, 0.9)); }
.shard { width: 34px; height: 20px; clip-path: polygon(8% 0, 100% 22%, 64% 100%, 0 72%); }

.narrative { position: relative; z-index: 4; }

.chamber {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 8vh 7vw;
  position: relative;
  overflow: hidden;
}

.chamber::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 14%;
  width: min(74vw, 760px);
  height: min(74vw, 760px);
  transform: translateX(-50%);
  border: 1px solid rgba(123, 62, 34, 0.28);
  border-radius: 50%;
  opacity: 0.45;
}

.chamber-shell {
  position: relative;
  width: min(920px, 92vw);
  min-height: 58vh;
  display: grid;
  place-items: center;
  text-align: center;
  isolation: isolate;
}

h1, h2 {
  font-family: "Libre Baskerville", Georgia, serif;
  font-weight: 700;
  color: var(--bone-parchment);
  margin: 0;
  letter-spacing: -0.055em;
  line-height: 0.95;
}

h1 {
  font-size: clamp(3rem, 9vw, 8.4rem);
  text-shadow: 0 0 30px rgba(255, 122, 47, 0.28);
}

h2 { font-size: clamp(2.2rem, 6.6vw, 6.4rem); max-width: 820px; }

.chamber-kicker,
.specimen-label,
.specimen-card span,
.engine-caption span {
  font-family: "Space Grotesk", Inter, sans-serif;
  font-size: 0.74rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ember-tangerine);
}

.specimen-label {
  border: 1px solid rgba(123, 62, 34, 0.62);
  padding: 0.62rem 0.78rem;
  background: rgba(18, 13, 9, 0.74);
  box-shadow: inset 0 0 18px rgba(123, 62, 34, 0.14);
}

.label-top { position: absolute; top: 1rem; left: 8%; }
.label-bottom { position: absolute; bottom: 1rem; right: 8%; color: var(--verdigris-signal); }

.sigil-wrap { position: relative; display: grid; place-items: center; width: min(640px, 90vw); aspect-ratio: 1; }
.recycle-sigil { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 0 18px rgba(198, 83, 26, 0.35)); animation: sigilBreathe 7s ease-in-out infinite; }
.sigil-outer, .sigil-inner { fill: none; stroke: #7B3E22; stroke-width: 1.4; stroke-dasharray: 4 12; }
.sigil-arrow { fill: rgba(198, 83, 26, 0.13); stroke: #C6531A; stroke-width: 2; filter: url(#emberBlur); }
.leaf-trace { fill: none; stroke: #5F9C76; stroke-width: 2; stroke-linecap: round; stroke-dasharray: 18 10; animation: traceFlow 9s linear infinite; }
.pad { fill: #FF7A2F; opacity: 0.85; }

@keyframes sigilBreathe { 0%, 100% { transform: scale(0.985); opacity: 0.82; } 50% { transform: scale(1.02); opacity: 1; } }
@keyframes traceFlow { to { stroke-dashoffset: -140; } }

.opening-line,
.bloom-copy,
.loop-copy,
.engine-caption p {
  margin: 1.4rem auto 0;
  max-width: 560px;
  color: rgba(232, 214, 189, 0.74);
  font-size: clamp(1rem, 1.8vw, 1.28rem);
  line-height: 1.65;
}

.opening-line { font-family: "IBM Plex Mono", monospace; color: rgba(232, 214, 189, 0.66); }

.orbit-shell h2 { margin-top: 0.9rem; }
.specimen-ring { position: absolute; inset: 0; }
.specimen-card {
  position: absolute;
  width: min(280px, 38vw);
  padding: 1rem;
  border: 1px solid rgba(123, 62, 34, 0.7);
  background: rgba(18, 13, 9, 0.75);
  text-align: left;
  box-shadow: 0 0 38px rgba(18, 13, 9, 0.8), inset 0 0 20px rgba(123, 62, 34, 0.13);
}
.specimen-card::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 72px;
  height: 1px;
  background: linear-gradient(90deg, #7B3E22, transparent);
}
.card-left { left: 0; top: 23%; }
.card-left::after { right: -72px; }
.card-right { right: 0; top: 28%; }
.card-right::after { left: -72px; transform: rotate(180deg); }
.card-bottom { left: 50%; bottom: 1rem; transform: translateX(-50%); text-align: center; }
.card-bottom::after { left: 50%; top: -54px; width: 1px; height: 54px; background: linear-gradient(180deg, transparent, #7B3E22); }
.specimen-card p { margin: 0.55rem 0 0; line-height: 1.45; color: rgba(232, 214, 189, 0.72); }

.engine-shell { min-height: 72vh; }
.engine-shell h2 { max-width: 760px; }
.mycelium-map {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(820px, 96vw);
  height: auto;
  transform: translate(-50%, -50%);
  z-index: -1;
  opacity: 0.86;
}
.mycelium { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 26 14; animation: traceFlow 12s linear infinite; }
.mycelium.inactive { stroke: rgba(123, 62, 34, 0.62); }
.mycelium.active { stroke: #C6531A; filter: drop-shadow(0 0 8px rgba(255, 122, 47, 0.55)); }
.mycelium.delay { animation-delay: -3s; }
.leaf-nodes ellipse { fill: rgba(95, 156, 118, 0.28); stroke: #5F9C76; transform-origin: center; animation: leafPulse 4.5s ease-in-out infinite; }
.diodes circle { fill: #FF7A2F; animation: diodeBlink 1.8s steps(2, end) infinite; }
@keyframes leafPulse { 50% { fill: rgba(95, 156, 118, 0.54); transform: scale(1.08); } }
@keyframes diodeBlink { 50% { opacity: 0.22; } }

.engine-caption {
  align-self: end;
  justify-self: center;
  width: min(420px, 88vw);
  padding: 1rem 1.1rem;
  border: 1px solid rgba(123, 62, 34, 0.62);
  background: rgba(18, 13, 9, 0.74);
}

.bloom-shell h2 { text-shadow: 0 0 36px rgba(255, 122, 47, 0.35); }
.bloom-orb {
  position: absolute;
  width: min(520px, 75vw);
  aspect-ratio: 1;
  border-radius: 50%;
  z-index: -1;
  background: radial-gradient(circle, rgba(255, 122, 47, 0.18), transparent 58%);
  animation: sigilBreathe 8s ease-in-out infinite;
}
.petal, .port-stem { position: absolute; left: 50%; top: 50%; display: block; transform-origin: 0 0; }
.petal {
  width: 92px;
  height: 150px;
  border: 1px solid #5F9C76;
  background: linear-gradient(180deg, rgba(95, 156, 118, 0.34), rgba(198, 83, 26, 0.05));
  border-radius: 70% 18% 70% 18%;
  box-shadow: inset 0 0 22px rgba(95, 156, 118, 0.18), 0 0 20px rgba(255, 122, 47, 0.16);
}
.petal-one { transform: rotate(18deg) translate(24px, -178px); }
.petal-two { transform: rotate(104deg) translate(20px, -180px); }
.petal-three { transform: rotate(196deg) translate(22px, -176px); }
.petal-four { transform: rotate(286deg) translate(20px, -180px); }
.port-stem { width: 110px; height: 34px; transform: translate(-55px, 92px); border: 1px solid #7B3E22; background: rgba(18, 13, 9, 0.78); border-radius: 4px; }
.port-stem::before { content: ""; position: absolute; inset: 8px 18px; border-top: 1px solid #C6531A; border-bottom: 1px solid #C6531A; opacity: 0.7; }

.quiet-shell { min-height: 56vh; }
.final-mark { width: 180px; height: 180px; margin-bottom: 2rem; animation: orbitMark 14s linear infinite; }
.final-mark svg { width: 100%; height: 100%; stroke: #C6531A; fill: none; stroke-width: 3; filter: drop-shadow(0 0 16px rgba(255, 122, 47, 0.38)); }
@keyframes orbitMark { to { transform: rotate(360deg); } }

.chamber-shell > * { opacity: 0; transform: translateY(20px); transition: opacity 900ms ease, transform 900ms ease; }
.chamber.active .chamber-shell > * { opacity: 1; transform: translateY(0); }
.chamber.active .sigil-wrap, .chamber.active .bloom-orb { transform: none; }

@media (max-width: 780px) {
  .chamber { padding: 8vh 5vw; }
  .label-top, .label-bottom { position: static; margin: 0.75rem auto; }
  .specimen-card { position: relative; width: 100%; left: auto; right: auto; top: auto; bottom: auto; transform: none; margin: 0.75rem auto; }
  .specimen-card::after { display: none; }
  .specimen-ring { position: static; margin-top: 2rem; width: min(360px, 88vw); }
  .chamber-shell { min-height: 70vh; }
  .fragment { opacity: 0.65; }
}
