:root {
  /* Typography compliance note: IBM Plex Sans* Sans** from Google Fonts for explanatory body copy and explanation panels. */
  --liquid-chrome: #D9E1E8;
  --deep-graphite: #1C2328;
  --aero-aqua: #62D7E8;
  --leaf-ion: #76C85F;
  --sky-glass: #B9F3FF;
  --nickel-blue: #7D93A6;
  --carbon-amber: #D7A84E;
  --chrome-shadow: #AEB8C2;
  --cool-field: #EEF6FA;
  --white-glint: #F8FBFF;
  --rail-width: clamp(250px, 23vw, 360px);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--deep-graphite);
  font-family: "IBM Plex Sans", sans-serif;
  background:
    radial-gradient(circle at 78% 8%, rgba(185, 243, 255, 0.78), transparent 30vw),
    radial-gradient(circle at 64% 76%, rgba(98, 215, 232, 0.26), transparent 34vw),
    linear-gradient(135deg, #EEF6FA 0%, #D9E1E8 46%, #7D93A6 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(115deg, rgba(248, 251, 255, 0.22) 0 1px, transparent 1px 84px),
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.62), transparent 9rem);
  mix-blend-mode: screen;
  z-index: 0;
}

.aero-shell { position: relative; z-index: 1; }

.lesson-rail {
  position: fixed;
  top: 2vh;
  left: 1.6vw;
  bottom: 2vh;
  width: var(--rail-width);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border: 1px solid rgba(248, 251, 255, 0.9);
  border-radius: 34px;
  background:
    linear-gradient(100deg, rgba(248,251,255,0.92), rgba(217,225,232,0.72) 38%, rgba(174,184,194,0.66) 51%, rgba(238,246,250,0.78)),
    rgba(185, 243, 255, 0.25);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.98),
    inset -18px 0 34px rgba(125, 147, 166, 0.22),
    0 20px 60px rgba(28, 35, 40, 0.22);
  backdrop-filter: blur(18px) saturate(140%);
  z-index: 5;
}

.rail-cap {
  min-height: 112px;
  padding: 1rem 1rem 1.2rem;
  border-radius: 26px;
  border: 1px solid rgba(248, 251, 255, 0.86);
  background: linear-gradient(160deg, rgba(185,243,255,0.78), rgba(238,246,250,0.24));
  box-shadow: inset 0 -16px 26px rgba(125,147,166,0.16);
}

.micro-label {
  display: block;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--nickel-blue);
}

.rail-cap strong {
  display: block;
  margin-top: 0.4rem;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2rem, 3vw, 3.35rem);
  line-height: 0.88;
  color: var(--deep-graphite);
}

.rail-tabs {
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
}

.rail-tab {
  position: relative;
  display: grid;
  grid-template-columns: 22px 36px 1fr 14px;
  align-items: center;
  gap: 0.45rem;
  min-height: 56px;
  padding: 0.62rem 0.76rem;
  text-decoration: none;
  color: var(--deep-graphite);
  border-radius: 999px;
  border: 1px solid rgba(248, 251, 255, 0.8);
  background: linear-gradient(90deg, rgba(248,251,255,0.74), rgba(217,225,232,0.54) 48%, rgba(174,184,194,0.35));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 9px 18px rgba(28,35,40,0.08);
  transition: transform 320ms ease, box-shadow 320ms ease, background 320ms ease;
}

.rail-tab::after {
  content: "";
  position: absolute;
  right: -1.1rem;
  top: 50%;
  width: 1.05rem;
  height: 1px;
  background: linear-gradient(90deg, rgba(125,147,166,0.08), var(--chapter, #62D7E8));
  opacity: 0;
  transition: opacity 260ms ease;
}

.rail-tab.active {
  transform: translateX(8px);
  background: linear-gradient(90deg, rgba(248,251,255,0.96), rgba(185,243,255,0.82), rgba(98,215,232,0.28));
  box-shadow: inset 0 1px 0 #F8FBFF, 0 0 22px rgba(98,215,232,0.46), 0 12px 26px rgba(28,35,40,0.14);
}

.rail-tab.active::after { opacity: 1; }

.tab-orb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(248,251,255,0.9);
  background: radial-gradient(circle at 35% 30%, #F8FBFF, #AEB8C2 55%, #7D93A6);
  box-shadow: inset -3px -4px 8px rgba(28,35,40,0.18);
}

.active .tab-orb {
  background: radial-gradient(circle at 34% 28%, #F8FBFF, var(--aero-aqua) 48%, #76C85F);
  box-shadow: 0 0 16px rgba(98,215,232,0.86), inset -3px -4px 8px rgba(28,35,40,0.16);
}

.tab-number {
  font-family: "Fraunces", serif;
  font-weight: 700;
  color: var(--nickel-blue);
}

.tab-name {
  font-family: "Fraunces", serif;
  font-weight: 650;
  font-size: 1.02rem;
}

.cursor {
  color: var(--carbon-amber);
  opacity: 0;
  animation: blink 980ms steps(2, start) infinite;
}
.active .cursor { opacity: 1; }

.instruction-panel {
  margin-top: auto;
  min-height: 136px;
  padding: 1rem;
  border-radius: 24px;
  border: 1px solid rgba(248,251,255,0.74);
  background: rgba(28,35,40,0.82);
  box-shadow: inset 0 0 0 1px rgba(98,215,232,0.18), inset 0 18px 28px rgba(185,243,255,0.05);
}

.instruction-panel p {
  margin: 0.7rem 0 0;
  color: var(--cool-field);
  font-family: "IBM Plex Sans", sans-serif;
  line-height: 1.48;
}

.rail-gauge {
  height: 12px;
  padding: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #AEB8C2, #EEF6FA, #AEB8C2);
  box-shadow: inset 0 1px 4px rgba(28,35,40,0.25);
}

.rail-gauge span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #62D7E8, #76C85F, #D7A84E);
  transition: width 420ms ease;
}

.experiment-chamber {
  margin-left: calc(var(--rail-width) + 4vw);
  min-height: 100vh;
}

.chapter {
  min-height: 100vh;
  padding: 4vh 4vw 4vh 3vw;
  display: grid;
  place-items: center;
  perspective: 1200px;
}

.aero-window {
  position: relative;
  width: min(100%, 1180px);
  min-height: 76vh;
  padding: clamp(1.5rem, 3vw, 3.4rem);
  overflow: hidden;
  border-radius: 46px;
  border: 1px solid rgba(248,251,255,0.92);
  background:
    linear-gradient(132deg, rgba(248,251,255,0.86), rgba(185,243,255,0.33) 34%, rgba(217,225,232,0.30) 58%, rgba(238,246,250,0.72)),
    radial-gradient(circle at 78% 26%, color-mix(in srgb, var(--chapter) 36%, transparent), transparent 28rem);
  box-shadow:
    inset 0 1px 0 #F8FBFF,
    inset 0 -28px 54px rgba(125,147,166,0.16),
    0 36px 90px rgba(28,35,40,0.18);
  transform: translateY(32px) rotateX(1deg);
  opacity: 0.72;
  transition: transform 780ms cubic-bezier(.2,.8,.2,1), opacity 780ms ease;
}

.chapter.active .aero-window {
  transform: translateY(0) rotateX(0deg);
  opacity: 1;
}

.aero-window::before,
.aero-window::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.aero-window::before {
  inset: 18px;
  border-radius: 34px;
  border: 1px solid rgba(248,251,255,0.64);
  box-shadow: inset 0 0 38px rgba(98,215,232,0.11);
}

.aero-window::after {
  top: 24px;
  right: 32px;
  width: 36%;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(248,251,255,0.92), transparent);
}

.lesson-copy {
  position: relative;
  z-index: 2;
  width: min(54rem, 66%);
}

.chapter-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  font-family: "Fraunces", serif;
  font-weight: 700;
  color: var(--deep-graphite);
  background: linear-gradient(90deg, rgba(248,251,255,0.78), color-mix(in srgb, var(--chapter) 28%, transparent));
  border: 1px solid rgba(248,251,255,0.82);
}

h1 {
  margin: 1.1rem 0 0.7rem;
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-size: clamp(4.2rem, 9vw, 9.8rem);
  line-height: 0.82;
  letter-spacing: -0.055em;
  color: var(--deep-graphite);
  text-shadow: 0 2px 0 rgba(248,251,255,0.8), 0 0 30px rgba(185,243,255,0.55);
}

.chapter.active h1 { animation: shimmer 1300ms ease 1; }

.lesson-copy p {
  max-width: 38rem;
  font-size: clamp(1.02rem, 1.5vw, 1.26rem);
  line-height: 1.66;
  color: rgba(28,35,40,0.82);
}

.artifact {
  position: absolute;
  z-index: 1;
  right: clamp(2rem, 6vw, 5rem);
  top: 50%;
  width: clamp(245px, 31vw, 455px);
  height: clamp(245px, 31vw, 455px);
  transform: translateY(-43%);
  border-radius: 42% 58% 50% 50% / 50% 44% 56% 50%;
  border: 1px solid rgba(248,251,255,0.9);
  background: radial-gradient(circle at 32% 24%, rgba(248,251,255,0.9), color-mix(in srgb, var(--accent) 58%, transparent) 26%, rgba(217,225,232,0.16) 62%, rgba(125,147,166,0.12));
  box-shadow: inset -24px -30px 52px rgba(28,35,40,0.08), 0 28px 54px rgba(28,35,40,0.15);
}

.ribbon {
  position: absolute;
  left: 8%;
  right: 8%;
  height: 54px;
  border-radius: 999px;
  border: 1px solid rgba(248,251,255,0.72);
  background: linear-gradient(90deg, transparent, rgba(98,215,232,0.42), rgba(248,251,255,0.78), transparent);
  filter: blur(0.2px);
  animation: floatRibbon 6s ease-in-out infinite;
}
.ribbon-one { top: 30%; transform: rotate(-14deg); }
.ribbon-two { top: 54%; transform: rotate(13deg); animation-delay: -2s; }

.carbon-dot, .bubble, .carbon-bead, .calm-orb {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 24%, #F8FBFF, #62D7E8 48%, #1C2328);
  box-shadow: 0 0 14px rgba(98,215,232,0.72);
  animation: rise 7s ease-in-out infinite;
}
.d1 { left: 18%; top: 24%; } .d2 { left: 55%; top: 34%; animation-delay: -1.7s; }
.d3 { left: 34%; top: 66%; animation-delay: -3.4s; } .d4 { left: 74%; top: 58%; animation-delay: -4.8s; }

.leaf-blade {
  position: absolute;
  inset: 18% 18% 16% 18%;
  border-radius: 8% 80% 8% 80%;
  transform: rotate(-28deg);
  background: linear-gradient(145deg, rgba(248,251,255,0.82), rgba(118,200,95,0.78) 44%, rgba(98,215,232,0.36));
  box-shadow: inset -18px -22px 34px rgba(28,35,40,0.12), 0 0 34px rgba(118,200,95,0.35);
}
.leaf-blade i, .leaf-blade b, .leaf-blade em {
  position: absolute;
  display: block;
  height: 2px;
  background: rgba(248,251,255,0.76);
  transform-origin: left center;
}
.leaf-blade i { left: 14%; top: 52%; width: 76%; transform: rotate(3deg); }
.leaf-blade b { left: 35%; top: 50%; width: 42%; transform: rotate(-32deg); }
.leaf-blade em { left: 42%; top: 58%; width: 36%; transform: rotate(32deg); }
.bubble { background: radial-gradient(circle at 35% 26%, #F8FBFF, #B9F3FF 54%, #76C85F); }
.b1 { left: 24%; top: 18%; } .b2 { left: 70%; top: 28%; animation-delay: -2s; }
.b3 { left: 54%; top: 68%; animation-delay: -4s; } .b4 { left: 28%; top: 76%; animation-delay: -5s; }

.soil-artifact { border-radius: 36px; overflow: hidden; }
.soil-layer { position: absolute; left: 10%; right: 10%; border-radius: 999px; border: 1px solid rgba(248,251,255,0.58); }
.l1 { top: 24%; height: 24%; background: rgba(215,168,78,0.30); }
.l2 { top: 45%; height: 22%; background: rgba(125,147,166,0.28); }
.l3 { top: 64%; height: 18%; background: rgba(28,35,40,0.22); }
.carbon-bead { background: radial-gradient(circle at 30% 24%, #F8FBFF, #D7A84E 52%, #1C2328); box-shadow: 0 0 18px rgba(215,168,78,0.9); }
.s1 { left: 22%; top: 48%; } .s2 { left: 52%; top: 36%; animation-delay: -2.1s; }
.s3 { left: 68%; top: 67%; animation-delay: -3.7s; } .s4 { left: 34%; top: 72%; animation-delay: -5.4s; }

.lens-ring {
  position: absolute;
  inset: 13%;
  border-radius: 50%;
  border: 14px solid rgba(217,225,232,0.6);
  box-shadow: inset 0 0 32px rgba(28,35,40,0.22), 0 0 26px rgba(248,251,255,0.6);
}
.graphite-flake {
  position: absolute;
  left: 28%; top: 28%; right: 28%; bottom: 28%;
  transform-style: preserve-3d;
  animation: rotateFlake 8s linear infinite;
}
.graphite-flake span {
  position: absolute;
  inset: 0;
  clip-path: polygon(50% 0, 98% 28%, 92% 76%, 50% 100%, 8% 76%, 2% 28%);
  background: linear-gradient(145deg, #7D93A6, #1C2328 58%, #D9E1E8);
  box-shadow: inset 0 0 18px rgba(248,251,255,0.22);
}
.graphite-flake span:nth-child(2) { transform: translateZ(-18px) translate(14px, 14px); opacity: 0.72; }
.graphite-flake span:nth-child(3) { transform: translateZ(-36px) translate(28px, 28px); opacity: 0.45; }

.group-artifact .node {
  position: absolute;
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  font-family: "Fraunces", serif;
  font-weight: 700;
  background: radial-gradient(circle at 35% 28%, #F8FBFF, rgba(185,243,255,0.75), rgba(98,215,232,0.35));
  border: 1px solid rgba(248,251,255,0.85);
  box-shadow: 0 0 24px rgba(98,215,232,0.35);
  animation: orbitPulse 4.8s ease-in-out infinite;
}
.n1 { left: 16%; top: 20%; } .n2 { right: 14%; top: 24%; animation-delay: -1.2s; }
.n3 { left: 22%; bottom: 17%; animation-delay: -2.4s; } .n4 { right: 16%; bottom: 20%; animation-delay: -3.6s; }
.group-artifact .center { left: 50%; top: 50%; transform: translate(-50%, -50%); width: 116px; height: 116px; font-size: 3rem; color: #1C2328; }

.water-band {
  position: absolute;
  left: 7%; right: 7%; top: 42%; height: 96px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(98,215,232,0.18), rgba(185,243,255,0.82), rgba(215,168,78,0.24));
  box-shadow: inset 0 0 24px rgba(248,251,255,0.8);
  animation: breathe 5.5s ease-in-out infinite;
}
.chrome-handle {
  position: absolute;
  left: 25%; right: 25%; top: 35%; height: 22px;
  border-radius: 999px;
  background: linear-gradient(90deg, #F8FBFF, #AEB8C2, #EEF6FA);
  box-shadow: 0 12px 20px rgba(28,35,40,0.18);
}
.o1 { left: 20%; top: 30%; } .o2 { left: 62%; top: 50%; animation-delay: -2s; } .o3 { left: 44%; top: 70%; animation-delay: -4s; }

.wave-map {
  position: absolute;
  z-index: 2;
  left: 4%;
  right: 4%;
  bottom: 7%;
  width: 92%;
  height: 24%;
  overflow: visible;
}
.wave-path, .branch-path {
  fill: none;
  stroke: var(--chapter);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 24 18;
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--chapter) 70%, transparent));
  animation: dashFlow 2.8s linear infinite;
}
.branch-path { stroke-width: 3; opacity: 0.7; animation-duration: 3.4s; }
.wave-rider { fill: var(--carbon-amber); filter: drop-shadow(0 0 12px rgba(215,168,78,0.95)); }
.amber .wave-rider { fill: #62D7E8; }
.graphite .wave-path { stroke: #1C2328; }

@keyframes blink { 50% { opacity: 0; } }
@keyframes dashFlow { to { stroke-dashoffset: -84; } }
@keyframes floatRibbon { 50% { translate: 0 -24px; opacity: 0.72; } }
@keyframes rise { 50% { translate: 0 -22px; scale: 1.14; } }
@keyframes rotateFlake { to { transform: rotateY(360deg) rotateX(16deg); } }
@keyframes orbitPulse { 50% { scale: 1.08; box-shadow: 0 0 34px rgba(118,200,95,0.38); } }
@keyframes breathe { 50% { transform: scaleX(1.08); filter: saturate(140%); } }
@keyframes shimmer {
  0% { text-shadow: 0 2px 0 rgba(248,251,255,0.6), -20px 0 34px rgba(98,215,232,0); }
  45% { text-shadow: 0 2px 0 #F8FBFF, 24px 0 42px rgba(98,215,232,0.86); }
  100% { text-shadow: 0 2px 0 rgba(248,251,255,0.8), 0 0 30px rgba(185,243,255,0.55); }
}

@media (max-width: 900px) {
  :root { --rail-width: 100%; }
  .lesson-rail {
    position: sticky;
    top: 0;
    left: 0;
    bottom: auto;
    width: 100%;
    border-radius: 0 0 28px 28px;
    max-height: none;
  }
  .rail-cap, .instruction-panel { display: none; }
  .rail-tabs { flex-direction: row; overflow-x: auto; padding-bottom: 0.25rem; }
  .rail-tab { min-width: 145px; }
  .experiment-chamber { margin-left: 0; }
  .chapter { padding: 3vh 1rem; }
  .aero-window { min-height: 82vh; }
  .lesson-copy { width: 100%; }
  .artifact { opacity: 0.55; right: -3rem; top: 56%; }
  h1 { font-size: clamp(3.4rem, 18vw, 6.2rem); }
}
