:root {
  /* Typography compliance notes: eclectic voice; IBM Plex Mono** Mon* sparingly for ballot IDs. Interface labels and card headings: **Space Grotesk** Grotesk* for crisp civic indexing. */
  --frost: #EEF7F6;
  --mist: #BFD8E6;
  --ink: #132C38;
  --lavender: #D8D2F2;
  --moss: #8FB7A1;
  --amber: #D7B36A;
  --teal: #244E56;
  --charcoal: #07161B;
  --mx: 50vw;
  --my: 48vh;
  --pull-x: 0px;
  --pull-y: 0px;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--charcoal); }

body {
  margin: 0;
  min-height: 100%;
  color: var(--frost);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at var(--mx) var(--my), rgba(238, 247, 246, 0.20), transparent 18rem),
    radial-gradient(circle at 20% 15%, #D8D2F266, transparent 38%),
    radial-gradient(circle at 86% 28%, #8FB7A166, transparent 32%),
    linear-gradient(130deg, #07161B 0%, #132C38 48%, #244E56 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at var(--mx) var(--my), rgba(215, 179, 106, 0.13), transparent 26rem);
  mix-blend-mode: screen;
  z-index: 3;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  z-index: 20;
  background-image:
    repeating-radial-gradient(circle at 18% 22%, rgba(238,247,246,0.12) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(115deg, rgba(7,22,27,0.28) 0 1px, transparent 1px 5px);
  mix-blend-mode: overlay;
}

.lantern {
  position: fixed;
  left: var(--mx);
  top: var(--my);
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 4;
  background: radial-gradient(circle, rgba(238,247,246,0.18), rgba(191,216,230,0.08) 38%, transparent 70%);
  filter: blur(10px);
  transition: width 600ms ease, height 600ms ease;
}

.atmosphere { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }

.blob {
  position: absolute;
  border-radius: 39% 61% 70% 30% / 42% 45% 55% 58%;
  filter: blur(42px);
  opacity: 0.54;
  transform: translate3d(var(--pull-x), var(--pull-y), 0);
  animation: livingInk 22s ease-in-out infinite alternate;
}

.blob-lavender { width: 34rem; height: 27rem; left: -8rem; top: 6rem; background: #D8D2F2; animation-delay: -4s; }
.blob-teal { width: 39rem; height: 31rem; right: -12rem; top: 3rem; background: #244E56; opacity: 0.68; animation-delay: -10s; }
.blob-moss { width: 25rem; height: 28rem; left: 34vw; top: 54vh; background: #8FB7A1; opacity: 0.46; animation-delay: -7s; }
.blob-amber { width: 18rem; height: 16rem; right: 15vw; bottom: 8vh; background: #D7B36A; opacity: 0.30; animation-delay: -13s; }

@keyframes livingInk {
  0% { border-radius: 38% 62% 55% 45% / 44% 39% 61% 56%; transform: translate3d(calc(var(--pull-x) - 12px), calc(var(--pull-y) + 8px), 0) rotate(-3deg) scale(1); }
  100% { border-radius: 58% 42% 35% 65% / 57% 63% 37% 43%; transform: translate3d(calc(var(--pull-x) + 18px), calc(var(--pull-y) - 14px), 0) rotate(5deg) scale(1.08); }
}

.contour { position: absolute; border: 1px solid rgba(191,216,230,0.18); border-radius: 50%; }
.contour::before, .contour::after { content: ""; position: absolute; inset: 1.3rem; border: 1px solid rgba(238,247,246,0.12); border-radius: inherit; }
.contour::after { inset: 2.8rem; border-color: rgba(215,179,106,0.10); }
.contour-one { width: 27rem; height: 16rem; left: 4vw; bottom: 13vh; transform: rotate(-18deg); }
.contour-two { width: 35rem; height: 23rem; right: 2vw; top: 36vh; transform: rotate(21deg); }

.observatory { position: relative; z-index: 2; }
.scene { position: relative; min-height: 100vh; padding: clamp(1.4rem, 4vw, 4rem); }
.scene-opening { display: grid; grid-template-columns: repeat(12, 1fr); grid-template-rows: repeat(8, minmax(4rem, 1fr)); gap: 1rem; }

.scene-label, .micro, .card-index, .pane-chip span, .closing-tabs span {
  font-family: "Space Grotesk", Inter, system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: rgba(238,247,246,0.72);
}

.scene-label { position: absolute; top: 2rem; left: clamp(1.4rem, 4vw, 4rem); color: rgba(191,216,230,0.64); }

.glass-pane, .card {
  position: relative;
  border: 1px solid rgba(255,255,255,0.42);
  background:
    linear-gradient(145deg, rgba(238, 247, 246, 0.54), rgba(191, 216, 230, 0.17)),
    radial-gradient(circle at var(--local-x, 50%) var(--local-y, 50%), rgba(238,247,246,0.28), transparent 11rem);
  backdrop-filter: blur(22px) saturate(128%);
  -webkit-backdrop-filter: blur(22px) saturate(128%);
  box-shadow: 0 1.5rem 5rem rgba(7,22,27,0.27), inset 0 1px 0 rgba(255,255,255,0.34);
  color: var(--ink);
  overflow: hidden;
  transition: transform 500ms ease, border-color 500ms ease, background 500ms ease;
}

.glass-pane::before, .card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at var(--local-x, 50%) var(--local-y, 50%), rgba(255,255,255,0.58), transparent 8rem);
  opacity: 0;
  transition: opacity 450ms ease;
}

.glass-pane.is-lit::before, .card.is-lit::before { opacity: 1; }

.card { border-radius: 2rem; padding: clamp(1.1rem, 2vw, 2rem); }
.glass-pane { border-radius: 2.4rem; padding: clamp(1.5rem, 3vw, 3rem); }
.depth-front { z-index: 4; }
.depth-mid { z-index: 3; }
.depth-back { z-index: 1; opacity: 0.76; }

.title-block { grid-column: 2 / 7; grid-row: 4 / 8; align-self: end; min-height: 25rem; }
h1, h2 { font-family: Fraunces, Lora, Georgia, serif; font-weight: 500; letter-spacing: -0.055em; line-height: 0.9; margin: 0; }
h1 { font-size: clamp(4.8rem, 13vw, 13rem); color: var(--frost); text-shadow: 0 2rem 6rem rgba(7,22,27,0.45); mix-blend-mode: screen; }
h2 { font-size: clamp(2.4rem, 6vw, 6rem); }
h3 { margin: 0.8rem 0 0.8rem; font-family: "Space Grotesk", Inter, system-ui, sans-serif; font-size: clamp(1.25rem, 2vw, 2rem); color: var(--ink); }
p { font-family: Newsreader, Lora, Georgia, serif; font-size: clamp(1rem, 1.4vw, 1.35rem); line-height: 1.55; margin: 1rem 0 0; }
small, .tile-small p { font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }

.title-block p { color: rgba(238,247,246,0.86); max-width: 35rem; }
.pressed-seal { position: absolute; right: 2rem; bottom: 1.8rem; width: 5rem; height: 5rem; border-radius: 50%; display: grid; place-items: center; color: rgba(215,179,106,0.82); border: 1px solid rgba(215,179,106,0.45); font-family: Fraunces, serif; font-size: 2.5rem; box-shadow: inset 0 0 1.5rem rgba(215,179,106,0.12); animation: sealBloom 8s ease-in-out infinite; }
@keyframes sealBloom { 0%,100% { opacity: 0.45; filter: blur(0.4px); } 50% { opacity: 0.92; filter: blur(0); } }

.constitution { grid-column: 7 / 12; grid-row: 2 / 6; }
.pane-note { grid-column: 1 / 4; grid-row: 2 / 4; }
.pane-chip { grid-column: 9 / 11; grid-row: 7 / 8; display: flex; justify-content: space-between; align-items: center; border-radius: 999px; }
.pane-chip b { font-family: "IBM Plex Mono", monospace; color: var(--amber); }
.pane-glossary { grid-column: 4 / 7; grid-row: 1 / 3; }

.annotation { display: block; margin-top: 1.25rem; color: rgba(19,44,56,0.44); opacity: 0; transform: translateY(0.5rem); transition: opacity 450ms ease, transform 450ms ease; }
.is-lit .annotation, .card:hover .annotation, .glass-pane:hover .annotation { opacity: 1; transform: translateY(0); }
.revision-lines { margin-top: 1.6rem; display: grid; gap: 0.45rem; }
.revision-lines i { height: 1px; width: 100%; background: linear-gradient(90deg, rgba(19,44,56,0.38), transparent); }

.atlas { padding-top: 10vh; }
.chapter-heading { width: min(55rem, 88vw); margin: 0 0 7vh 7vw; color: var(--frost); background: rgba(19,44,56,0.22); }
.chapter-heading h2 { color: var(--frost); }
.card-grid { display: grid; grid-template-columns: repeat(12, 1fr); grid-auto-rows: minmax(9rem, auto); gap: clamp(1rem, 2vw, 1.6rem); width: min(118rem, 94vw); margin: 0 auto; }
.tile { min-height: 18rem; }
.tile-tall { grid-column: span 4; grid-row: span 2; }
.tile-wide { grid-column: span 5; }
.tile-faint { grid-column: span 3; opacity: 0.66; }
.tile-small { grid-column: span 3; min-height: 12rem; background: rgba(216,210,242,0.24); }
.tile-wide.second { grid-column: 2 / span 6; background: rgba(238,247,246,0.47); }
.quiet { grid-column: span 4; transform: translateY(-3rem); }
.seal-ring { width: 8rem; height: 8rem; border-radius: 50%; border: 1px solid rgba(215,179,106,0.55); margin-top: 1.5rem; box-shadow: inset 0 0 0 1.1rem rgba(215,179,106,0.06), inset 0 0 2rem rgba(215,179,106,0.13); }

.memory { min-height: 72vh; display: grid; place-items: center; padding-bottom: 10vh; }
.memory-panel { width: min(70rem, 92vw); color: var(--frost); background: linear-gradient(145deg, rgba(19,44,56,0.40), rgba(238,247,246,0.20)); }
.memory-panel h2 { color: var(--frost); }
.memory-panel p { max-width: 52rem; color: rgba(238,247,246,0.82); }
.closing-tabs { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 2rem; }
.closing-tabs span { padding: 0.65rem 0.9rem; border: 1px solid rgba(255,255,255,0.28); border-radius: 999px; background: rgba(238,247,246,0.10); }

.card.in-view, .glass-pane.in-view { animation: floatIn 900ms ease both; }
@keyframes floatIn { from { opacity: 0; transform: translateY(2rem) scale(0.985); } to { opacity: inherit; transform: translateY(0) scale(1); } }

@media (max-width: 900px) {
  .scene-opening, .card-grid { display: block; }
  .scene-opening > *, .card-grid > * { margin: 1rem 0; }
  .title-block { min-height: auto; margin-top: 18vh; }
  h1 { font-size: clamp(4rem, 18vw, 8rem); }
  .quiet { transform: none; }
  .lantern { width: 18rem; height: 18rem; }
}
