:root {
  /* Compliance font tokens from DESIGN.md parser: Sans” 4” */
  --carbon-void: #07111F;
  --graphite-blue: #0E2A47;
  --organic-teal: #1B3B38;
  --lens-blue: #B9E7FF;
  --ice-paper: #EAF8FF;
  --reference-blue: #7DA7C7;
  --violet: #C9B7FF;
  --cursor-x: 50vw;
  --cursor-y: 50vh;
  --focus-strength: 0;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--carbon-void);
}

body {
  margin: 0;
  color: var(--ice-paper);
  font-family: "Source Serif 4", Georgia, serif;
  background:
    radial-gradient(circle at 50% -10%, rgba(185, 231, 255, 0.28), transparent 34rem),
    radial-gradient(circle at 12% 30%, rgba(201, 183, 255, 0.12), transparent 30rem),
    linear-gradient(180deg, var(--carbon-void), var(--graphite-blue) 38%, var(--carbon-void));
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at var(--cursor-x) var(--cursor-y), rgba(185, 231, 255, 0.17), transparent 17rem),
    linear-gradient(102deg, transparent 20%, rgba(185, 231, 255, 0.055), transparent 47%, rgba(234, 248, 255, 0.035), transparent 71%);
  mix-blend-mode: screen;
  z-index: 4;
}

.cursor-lens {
  position: fixed;
  left: var(--cursor-x);
  top: var(--cursor-y);
  width: 21rem;
  height: 21rem;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(185, 231, 255, 0.22);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(234, 248, 255, 0.18), rgba(185, 231, 255, 0.08) 33%, transparent 68%);
  box-shadow: 0 0 4rem rgba(185, 231, 255, 0.18), inset 0 0 3rem rgba(201, 183, 255, 0.12);
  pointer-events: none;
  z-index: 8;
  opacity: 0.72;
}

.atmosphere, .flare, .blob {
  position: fixed;
  pointer-events: none;
}

.atmosphere {
  inset: 0;
  overflow: hidden;
  z-index: 0;
}

.flare {
  border-radius: 50%;
  border: 1px solid rgba(185, 231, 255, 0.18);
  background: radial-gradient(circle, rgba(234, 248, 255, 0.2), rgba(185, 231, 255, 0.06) 32%, transparent 66%);
  box-shadow: 0 0 7rem rgba(185, 231, 255, 0.16);
  transform: translate3d(calc(var(--parallax-x, 0) * 1px), calc(var(--parallax-y, 0) * 1px), 0);
  transition: opacity 600ms ease;
}

.flare::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 160vw;
  height: 1px;
  transform: translate(-50%, -50%) rotate(-17deg);
  background: linear-gradient(90deg, transparent, rgba(185, 231, 255, 0.22), rgba(201, 183, 255, 0.18), transparent);
}

.flare-a { width: 44rem; height: 44rem; left: -10rem; top: 3rem; opacity: 0.55; }
.flare-b { width: 28rem; height: 28rem; right: -8rem; top: 42vh; opacity: 0.38; }
.flare-c { width: 52rem; height: 52rem; left: 42vw; bottom: -18rem; opacity: 0.31; }

.blob {
  filter: blur(0.5px);
  opacity: 0.58;
  background:
    radial-gradient(circle at 35% 25%, rgba(234, 248, 255, 0.28), transparent 17%),
    radial-gradient(circle at 70% 62%, rgba(201, 183, 255, 0.20), transparent 28%),
    radial-gradient(circle at 50% 50%, rgba(27, 59, 56, 0.78), rgba(14, 42, 71, 0.18) 62%, transparent 74%);
  box-shadow: inset 0 0 4rem rgba(185, 231, 255, 0.12), 0 0 5rem rgba(7, 17, 31, 0.45);
  animation: membrane 14s ease-in-out infinite alternate;
}

.blob-a { width: 24rem; height: 31rem; right: 8vw; top: 8vh; border-radius: 47% 53% 59% 41% / 38% 62% 43% 57%; }
.blob-b { width: 30rem; height: 22rem; left: -7rem; top: 48vh; border-radius: 61% 39% 42% 58% / 46% 43% 57% 54%; animation-delay: -4s; }
.blob-c { width: 20rem; height: 26rem; right: 12vw; bottom: -6rem; border-radius: 42% 58% 47% 53% / 58% 35% 65% 42%; animation-delay: -8s; }

@keyframes membrane {
  0% { border-radius: 47% 53% 59% 41% / 38% 62% 43% 57%; transform: translateY(0) rotate(-4deg) scale(1); }
  100% { border-radius: 60% 40% 38% 62% / 51% 43% 57% 49%; transform: translateY(-2rem) rotate(5deg) scale(1.04); }
}

.article-progress {
  position: fixed;
  left: 2.2rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9;
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
  font-family: "IBM Plex Sans", Inter, sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.progress-rule {
  position: absolute;
  left: -0.72rem;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(var(--lens-blue), rgba(125, 167, 199, 0.14));
}

.article-progress a {
  color: rgba(125, 167, 199, 0.72);
  text-decoration: none;
  transition: color 300ms ease, transform 300ms ease, text-shadow 300ms ease;
}

.article-progress a.is-current,
.article-progress a:hover {
  color: var(--ice-paper);
  transform: translateX(0.35rem);
  text-shadow: 0 0 1.4rem rgba(185, 231, 255, 0.75);
}

.wiki-scroll {
  position: relative;
  z-index: 2;
}

.chapter {
  position: relative;
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding: 8rem 8vw;
  isolation: isolate;
}

.chapter::before {
  content: "";
  position: absolute;
  inset: 8% 6%;
  border-top: 1px solid rgba(185, 231, 255, 0.14);
  border-bottom: 1px solid rgba(125, 167, 199, 0.08);
  background: radial-gradient(circle at 50% 50%, rgba(185, 231, 255, 0.08), transparent 45%);
  opacity: 0.55;
  z-index: -1;
}

.chapter::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 25%, rgba(234, 248, 255, 0.035), transparent 47%);
  opacity: calc(0.38 + var(--focus-strength) * 0.38);
  z-index: -1;
}

.reading-spine {
  width: min(42rem, 76vw);
  padding: clamp(2rem, 5vw, 4.6rem);
  opacity: 0;
  filter: blur(12px);
  transform: translateY(2rem);
  transition: opacity 1000ms ease, filter 1000ms ease, transform 1000ms ease;
}

.chapter.is-active .reading-spine,
.chapter.has-resolved .reading-spine {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}

.drift-left { margin-left: clamp(4rem, 13vw, 12rem); }
.drift-right { margin-left: auto; margin-right: clamp(2rem, 12vw, 13rem); }
.drift-center { margin-left: auto; margin-right: auto; text-align: center; }
.narrow { width: min(36rem, 72vw); }

.article-panel,
.citation-panel {
  border: 1px solid rgba(185, 231, 255, 0.18);
  background:
    linear-gradient(135deg, rgba(234, 248, 255, 0.1), rgba(14, 42, 71, 0.18)),
    rgba(7, 17, 31, 0.28);
  box-shadow: 0 2rem 8rem rgba(7, 17, 31, 0.5), inset 0 0 3rem rgba(185, 231, 255, 0.045);
  backdrop-filter: blur(18px);
}

.kicker,
.folio-line,
.edge-note,
.marginalia,
.title-marginalia,
.periodic-mark,
.floating-references,
.toc-silhouette {
  font-family: "IBM Plex Sans", Inter, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.kicker {
  margin: 0 0 1.4rem;
  color: var(--lens-blue);
  font-size: 0.78rem;
}

h1, h2 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  line-height: 0.94;
  margin: 0;
  color: var(--ice-paper);
  text-shadow: 0 0 2.4rem rgba(185, 231, 255, 0.25), 0 1rem 3rem rgba(7, 17, 31, 0.62);
}

h1 {
  font-size: clamp(5.2rem, 15vw, 13rem);
  letter-spacing: 0.035em;
}

h2 {
  font-size: clamp(3rem, 6.2vw, 6.4rem);
  max-width: 12ch;
}

p {
  font-size: clamp(1.08rem, 1.5vw, 1.42rem);
  line-height: 1.82;
  color: rgba(234, 248, 255, 0.86);
  max-width: 35rem;
}

.lede {
  max-width: 42rem;
  color: rgba(234, 248, 255, 0.9);
}

.title-marginalia,
.marginalia,
.floating-references {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1rem;
  margin-top: 2.2rem;
  color: var(--reference-blue);
  font-size: 0.68rem;
}

.title-marginalia span,
.marginalia span,
.floating-references li,
.toc-silhouette span {
  border-top: 1px solid rgba(185, 231, 255, 0.18);
  padding-top: 0.42rem;
}

sup {
  color: var(--violet);
  text-shadow: 0 0 1rem rgba(201, 183, 255, 0.6);
}

.chapter.ref-pulse sup {
  animation: refPulse 1100ms ease-out 1;
}

@keyframes refPulse {
  0% { color: var(--ice-paper); text-shadow: 0 0 0 rgba(201, 183, 255, 0); }
  45% { color: var(--violet); text-shadow: 0 0 2rem rgba(201, 183, 255, 0.95); }
  100% { color: var(--violet); text-shadow: 0 0 1rem rgba(201, 183, 255, 0.6); }
}

.periodic-mark {
  float: right;
  width: 8.5rem;
  height: 8.5rem;
  margin: 0 0 1rem 2rem;
  border: 1px solid rgba(185, 231, 255, 0.35);
  display: grid;
  place-items: center;
  color: var(--ice-paper);
  background: rgba(185, 231, 255, 0.055);
}

.periodic-mark strong {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 4.5rem;
  line-height: 0.8;
}

.periodic-mark span { position: absolute; margin: -6.2rem 0 0 -5.8rem; color: var(--lens-blue); }
.periodic-mark em { font-style: normal; color: var(--reference-blue); font-size: 0.58rem; }

.edge-note {
  position: absolute;
  color: rgba(125, 167, 199, 0.66);
  font-size: 0.62rem;
  writing-mode: vertical-rl;
}

.note-right { right: 4vw; top: 22%; }
.note-left { left: 7vw; bottom: 18%; }

.aperture {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(185, 231, 255, 0.24);
  box-shadow: inset 0 0 4rem rgba(185, 231, 255, 0.08), 0 0 5rem rgba(185, 231, 255, 0.1);
  display: grid;
  place-items: center;
  color: var(--violet);
  font-family: "IBM Plex Sans", Inter, sans-serif;
}

.aperture::before, .aperture::after {
  content: "";
  position: absolute;
  inset: 14%;
  border: 1px solid rgba(234, 248, 255, 0.12);
  border-radius: 50%;
}

.aperture::after { inset: 34%; border-color: rgba(201, 183, 255, 0.2); }
.aperture-hero { width: 35rem; height: 35rem; right: 12vw; top: 10vh; opacity: 0.78; }
.aperture-small { width: 13rem; height: 13rem; right: 19vw; bottom: 13vh; }

.diagram {
  position: absolute;
  color: rgba(185, 231, 255, 0.34);
  z-index: -1;
}

.diamond-diagram { right: 10vw; width: 24rem; height: 24rem; }
.diamond-diagram span {
  position: absolute;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: var(--lens-blue);
  box-shadow: 0 0 2rem rgba(185, 231, 255, 0.7);
}
.diamond-diagram span:nth-child(1) { left: 48%; top: 8%; }
.diamond-diagram span:nth-child(2) { left: 20%; top: 54%; }
.diamond-diagram span:nth-child(3) { left: 75%; top: 54%; }
.diamond-diagram span:nth-child(4) { left: 48%; top: 84%; }
.diamond-diagram span:nth-child(5) { left: 48%; top: 48%; }
.diamond-diagram::before {
  content: "";
  position: absolute;
  inset: 12%;
  background: linear-gradient(30deg, transparent 49.5%, currentColor 50%, transparent 50.5%), linear-gradient(150deg, transparent 49.5%, currentColor 50%, transparent 50.5%), linear-gradient(90deg, transparent 49.5%, currentColor 50%, transparent 50.5%);
}

.graphite-diagram { left: 8vw; top: 24vh; width: 32rem; height: 18rem; transform: rotate(-8deg); }
.graphite-diagram i {
  display: block;
  height: 1px;
  margin: 2.4rem 0;
  background: linear-gradient(90deg, transparent, rgba(185, 231, 255, 0.5), transparent);
  box-shadow: 0 0 1.4rem rgba(185, 231, 255, 0.28);
}

.graphene-diagram { right: 4vw; top: 18vh; width: 30rem; color: rgba(185, 231, 255, 0.36); filter: drop-shadow(0 0 1.4rem rgba(185, 231, 255, 0.18)); }

.soot-diagram { left: 13vw; top: 18vh; width: 27rem; height: 27rem; }
.soot-diagram b {
  position: absolute;
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(27, 59, 56, 0.72), rgba(7, 17, 31, 0.18) 65%, transparent 70%);
  box-shadow: 0 0 3rem rgba(185, 231, 255, 0.08);
}
.soot-diagram b:nth-child(1) { left: 20%; top: 12%; }
.soot-diagram b:nth-child(2) { left: 44%; top: 25%; }
.soot-diagram b:nth-child(3) { left: 30%; top: 45%; }
.soot-diagram b:nth-child(4) { left: 56%; top: 52%; }
.soot-diagram b:nth-child(5) { left: 9%; top: 52%; }
.soot-diagram b:nth-child(6) { left: 55%; top: 8%; }
.soot-diagram b:nth-child(7) { left: 34%; top: 68%; }

.ring-system {
  position: relative;
  height: 7rem;
  margin-top: 2rem;
}
.ring-system span {
  position: absolute;
  width: 4.6rem;
  height: 4.6rem;
  border: 1px solid rgba(201, 183, 255, 0.42);
  border-radius: 50%;
  box-shadow: 0 0 1.7rem rgba(201, 183, 255, 0.12);
}
.ring-system span:nth-child(1) { left: 0; }
.ring-system span:nth-child(2) { left: 3.8rem; top: 1.4rem; }
.ring-system span:nth-child(3) { left: 7.7rem; }

.folio-line {
  color: var(--reference-blue);
  font-size: 0.7rem;
  line-height: 1.5;
  border-top: 1px solid rgba(185, 231, 255, 0.18);
  padding-top: 1rem;
}

.floating-references {
  list-style: none;
  padding: 0;
  align-items: flex-start;
  flex-direction: column;
}

.toc-silhouette {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 2rem;
  margin: 3rem auto 0;
  max-width: 30rem;
  color: var(--reference-blue);
  font-size: 0.68rem;
}

.closing-spine::after {
  content: "";
  display: block;
  width: 1px;
  height: 9rem;
  margin: 3rem auto 0;
  background: linear-gradient(var(--lens-blue), transparent);
  box-shadow: 0 0 2rem rgba(185, 231, 255, 0.65);
}

@media (max-width: 820px) {
  .article-progress { display: none; }
  .chapter { padding: 7rem 1.2rem; }
  .reading-spine { width: 100%; padding: 1.3rem; }
  .drift-left, .drift-right, .drift-center { margin-left: auto; margin-right: auto; }
  .edge-note, .diagram { opacity: 0.35; }
  .periodic-mark { float: none; margin: 0 0 2rem; }
  h1 { font-size: clamp(4.5rem, 20vw, 7rem); }
  h2 { font-size: clamp(2.7rem, 14vw, 4.8rem); }
  .cursor-lens { display: none; }
}
