:root {
  /* Design compliance terms: Sans” (Google IntersectionObserver trigger changes */
  --burnt: #C55A1D;
  --sodium: #F28C38;
  --plum: #3A1F4D;
  --teal: #123C46;
  --cream: #F3D7A4;
  --ginkgo: #7D9B4E;
  --lilac: #B78CFF;
  --display: "Bricolage Grotesque", "IBM Plex Sans", sans-serif;
  --serif: "Instrument Serif", serif;
  --body: "IBM Plex Sans", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--plum);
  color: var(--cream);
  font-family: var(--body);
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -5;
  background:
    radial-gradient(circle at 18% 17%, rgba(183, 140, 255, 0.34), transparent 25%),
    radial-gradient(circle at 77% 18%, rgba(242, 140, 56, 0.46), transparent 28%),
    radial-gradient(circle at 42% 68%, rgba(18, 60, 70, 0.82), transparent 38%),
    linear-gradient(135deg, #3A1F4D 0%, #C55A1D 48%, #F28C38 100%);
}

.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom, rgba(243, 215, 164, 0.045) 0 1px, transparent 1px 5px);
  mix-blend-mode: overlay;
}

.sun-orb {
  position: absolute;
  left: 50%;
  top: 8vh;
  width: 44vw;
  height: 44vw;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 140, 56, 0.72), rgba(197, 90, 29, 0.28) 47%, transparent 70%);
  filter: blur(2px);
}

.drift {
  position: absolute;
  color: rgba(243, 215, 164, 0.28);
  font-size: 8rem;
  animation: drift 14s ease-in-out infinite alternate;
}

.drift-one { left: 6vw; top: 31vh; }
.drift-two { right: 11vw; top: 58vh; animation-delay: -5s; color: rgba(125, 155, 78, 0.28); }
.drift-three { left: 69vw; top: 12vh; animation-delay: -8s; color: rgba(183, 140, 255, 0.25); }

.ballot-route {
  position: absolute;
  top: 58vh;
  left: 0;
  width: 100%;
  height: 620vh;
  z-index: 1;
  pointer-events: none;
  overflow: visible;
}

#routePath {
  fill: none;
  stroke: var(--burnt);
  stroke-width: 26;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 18px rgba(242, 140, 56, 0.62));
}

.route-node {
  fill: var(--cream);
  stroke: var(--lilac);
  stroke-width: 8;
  transform-origin: center;
  animation: nodePulse 2.8s ease-in-out infinite;
}

.scene {
  position: relative;
  min-height: 100vh;
  padding: 9vh 8vw;
  isolation: isolate;
}

.hero-scene {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 112vh;
  overflow: hidden;
}

.municipal-stamp, .chapter-kicker, .tab, .archive-footer {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.municipal-stamp {
  color: var(--teal);
  background: rgba(243, 215, 164, 0.78);
  width: max-content;
  padding: 0.7rem 1rem;
  border: 2px solid var(--burnt);
  transform: rotate(-3deg);
  box-shadow: 11px 11px 0 rgba(58, 31, 77, 0.5);
}

.wordmark {
  margin: 2rem 0 0;
  font-family: var(--display);
  font-size: clamp(5.4rem, 18vw, 20rem);
  line-height: 0.77;
  letter-spacing: -0.09em;
  font-variation-settings: "wght" 800, "wdth" 92;
  color: var(--cream);
  text-shadow: 8px 0 0 rgba(183, 140, 255, 0.35), -7px 8px 0 rgba(18, 60, 70, 0.55), 0 0 38px rgba(242, 140, 56, 0.64);
}

.hero-copy {
  max-width: 38rem;
  margin: 2.1rem 0 0 7vw;
  color: var(--cream);
  font-size: clamp(1.15rem, 2vw, 1.65rem);
  line-height: 1.55;
  background: rgba(18, 60, 70, 0.68);
  padding: 1.3rem 1.6rem;
  border-radius: 36px 16px 44px 18px;
  border: 1px solid rgba(243, 215, 164, 0.4);
}

.cityline {
  position: absolute;
  left: -3vw;
  right: -3vw;
  bottom: -1rem;
  height: 31vh;
  color: var(--cream);
  animation: cityRise 3.8s ease-out both;
}

.cityline svg { width: 100%; height: 100%; overflow: visible; }
.cityline .line { fill: none; stroke: var(--cream); stroke-width: 8; stroke-linejoin: round; stroke-linecap: round; }
.cityline .plant { fill: none; stroke: var(--ginkgo); stroke-width: 7; stroke-linecap: round; }
.cityline .glow { fill: none; stroke: var(--lilac); stroke-width: 5; opacity: 0.78; }

.route-label {
  position: absolute;
  right: 11vw;
  bottom: 20vh;
  font-family: var(--serif);
  font-size: clamp(1.6rem, 4vw, 4.8rem);
  font-style: italic;
  color: var(--plum);
  background: var(--cream);
  padding: 0.2em 0.45em;
  border-radius: 50% 34% 47% 36%;
  transform: rotate(5deg);
}

.chapter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 37rem);
  gap: 4vw;
  align-items: center;
}

.chapter::before {
  content: "";
  position: absolute;
  inset: 5vh 4vw;
  z-index: -1;
  border-radius: 36% 64% 42% 58% / 42% 31% 69% 58%;
  background: rgba(18, 60, 70, 0.34);
  border: 1px solid rgba(243, 215, 164, 0.16);
  transform: rotate(var(--tilt, -2deg));
}

.queue-scene { --tilt: -4deg; }
.booth-scene { --tilt: 3deg; background: linear-gradient(155deg, rgba(18, 60, 70, 0.38), transparent 58%); }
.mark-scene { --tilt: -1deg; }
.count-scene { --tilt: 4deg; }
.record-scene { --tilt: -3deg; min-height: 110vh; }

.chapter-kicker {
  grid-column: 1 / -1;
  color: var(--sodium);
  align-self: end;
  margin-bottom: -6vh;
}

h2 {
  font-family: var(--display);
  font-size: clamp(5.2rem, 16vw, 18rem);
  line-height: 0.78;
  letter-spacing: -0.08em;
  margin: 0;
  color: var(--cream);
  font-variation-settings: "wght" var(--weight, 560), "wdth" 88;
  text-shadow: 6px 5px 0 rgba(197, 90, 29, 0.6), -5px 0 0 rgba(183, 140, 255, 0.24);
  transition: font-variation-settings 0.8s ease, transform 0.8s ease;
}

.chapter.is-visible h2 {
  --weight: 800;
  transform: translateX(1.6vw) scale(1.02);
}

.notice-panel {
  position: relative;
  z-index: 2;
  color: var(--teal);
  background: rgba(243, 215, 164, 0.93);
  border: 3px solid var(--burnt);
  box-shadow: 18px 18px 0 rgba(58, 31, 77, 0.62), inset 0 0 35px rgba(242, 140, 56, 0.17);
  padding: clamp(1.4rem, 3vw, 2.6rem);
  border-radius: 42px 18px 58px 20px;
  font-size: clamp(1rem, 1.45vw, 1.25rem);
  line-height: 1.72;
  transform: translateY(5rem) rotate(2deg);
  opacity: 0.35;
  transition: transform 0.9s ease, opacity 0.9s ease;
}

.chapter.is-visible .notice-panel {
  transform: translateY(0) rotate(0deg);
  opacity: 1;
}

.tab {
  position: absolute;
  top: -1.1rem;
  left: 1.4rem;
  display: inline-block;
  padding: 0.42rem 0.8rem;
  color: var(--cream);
  background: var(--burnt);
  border-radius: 8px 8px 0 0;
  font-size: 0.74rem;
}

.annotation {
  font-family: var(--serif);
  font-size: 1.38em;
  color: var(--plum);
}

.glossary-token, .transit-node, .field-label summary, .specimen, .route-node {
  cursor: pointer;
  transition: transform 0.25s ease, filter 0.25s ease, background 0.25s ease;
}

.glossary-token {
  display: inline-block;
  color: var(--cream);
  background: var(--plum);
  padding: 0.1em 0.35em;
  border-radius: 0.3em;
}

.glossary-token:hover, .transit-node:hover, .field-label summary:hover, .specimen:hover {
  transform: scale(1.08);
  filter: drop-shadow(0 0 14px rgba(242, 140, 56, 0.7));
}

.specimen {
  position: absolute;
  left: 12vw;
  bottom: 12vh;
  width: 10rem;
  height: 10rem;
  border: 3px solid var(--ginkgo);
  border-radius: 60% 40% 56% 44%;
  display: grid;
  place-items: center;
  color: var(--ginkgo);
  font-size: 6rem;
  background: rgba(243, 215, 164, 0.08);
}

.poster {
  position: absolute;
  right: 8vw;
  top: 14vh;
  padding: 1rem 1.2rem;
  color: var(--cream);
  border: 2px solid var(--cream);
  background: rgba(197, 90, 29, 0.7);
  font-family: var(--display);
  font-size: 1.7rem;
  line-height: 0.9;
  transform: rotate(7deg);
}

.poster em { font-family: var(--serif); font-size: 1rem; }

.booth-illustration {
  position: relative;
  z-index: 2;
  min-height: 48vh;
  border-radius: 46% 54% 38% 62%;
  border: 4px solid var(--cream);
  background: linear-gradient(180deg, rgba(197, 90, 29, 0.75), rgba(58, 31, 77, 0.78));
  box-shadow: 0 0 70px rgba(242, 140, 56, 0.36);
  overflow: hidden;
}

.booth-top { height: 3rem; background: var(--teal); border-bottom: 4px solid var(--cream); }
.booth-curtain { position: absolute; inset: 3rem 18% 0; background: repeating-linear-gradient(90deg, rgba(243, 215, 164, 0.19) 0 14px, rgba(58, 31, 77, 0.15) 14px 28px); }
.shadow-voter { position: absolute; left: 44%; top: 35%; width: 13%; height: 38%; background: rgba(18, 60, 70, 0.68); border-radius: 50% 50% 20% 20%; filter: blur(1px); }
.ivy { position: absolute; width: 7rem; height: 16rem; border-left: 4px solid var(--ginkgo); border-radius: 50%; }
.ivy::before, .ivy::after { content: ""; position: absolute; width: 2rem; height: 3rem; border-radius: 50% 0 50% 50%; background: var(--ginkgo); }
.ivy-left { left: 7%; top: 18%; transform: rotate(-16deg); }
.ivy-right { right: 9%; top: 13%; transform: rotate(18deg) scaleX(-1); }
.ivy::before { left: -1.2rem; top: 3rem; transform: rotate(35deg); }
.ivy::after { left: 0.7rem; top: 8rem; transform: rotate(-26deg); }

blockquote {
  position: absolute;
  right: 9vw;
  bottom: 7vh;
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(5rem, 12vw, 15rem);
  color: rgba(183, 140, 255, 0.58);
}

.ballot-garden {
  position: relative;
  min-height: 56vh;
  z-index: 2;
}

.ballot-slip {
  position: absolute;
  width: 18rem;
  height: 24rem;
  padding: 3rem 2rem;
  background: var(--cream);
  border: 3px solid var(--burnt);
  box-shadow: 16px 16px 0 rgba(18, 60, 70, 0.52);
  transition: transform 0.25s ease;
}

.ballot-slip:hover { transform: scale(1.08) rotate(-3deg); }
.slip-one { left: 4vw; top: 3vh; transform: rotate(-10deg); }
.slip-two { left: 19vw; top: 15vh; transform: rotate(8deg); }
.ballot-slip span { display: block; height: 1.25rem; margin: 1.1rem 0; background: linear-gradient(90deg, var(--plum), transparent); border-radius: 999px; }

.botanical-line { position: absolute; border: solid var(--ginkgo); border-width: 0 0 0 4px; border-radius: 50%; }
.vine-one { left: 13vw; top: 23vh; width: 12rem; height: 22rem; transform: rotate(-31deg); }
.vine-two { left: 31vw; top: 6vh; width: 9rem; height: 25rem; transform: rotate(26deg); }
.botanical-line::before, .botanical-line::after { content: ""; position: absolute; width: 2.1rem; height: 3rem; background: var(--ginkgo); border-radius: 80% 0 80% 50%; }
.botanical-line::before { top: 5rem; left: -1.3rem; }
.botanical-line::after { top: 12rem; left: 0.5rem; transform: rotate(78deg); }

.transit-row { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.3rem; }
.transit-node { display: inline-block; color: var(--cream); background: var(--teal); border: 2px solid var(--lilac); border-radius: 999px; padding: 0.55rem 0.9rem; }

.folded { clip-path: polygon(0 0, 88% 0, 100% 14%, 100% 100%, 0 100%); }

.count-board {
  position: absolute;
  left: 10vw;
  bottom: 11vh;
  display: grid;
  gap: 0.6rem;
  transform: rotate(-7deg);
}

.count-board div {
  color: var(--sodium);
  border: 3px solid var(--sodium);
  padding: 0.3rem 0.8rem;
  font-family: var(--display);
  font-size: clamp(1.5rem, 4vw, 4.5rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  background: rgba(58, 31, 77, 0.52);
}

.field-label {
  margin-top: 1.2rem;
  color: var(--cream);
  background: var(--plum);
  padding: 1rem;
  border-radius: 20px 8px 28px 8px;
}

.field-label summary {
  display: inline-block;
  font-family: var(--display);
  color: var(--sodium);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.archive-footer {
  position: absolute;
  left: 8vw;
  right: 8vw;
  bottom: 8vh;
  color: var(--cream);
  background: rgba(18, 60, 70, 0.72);
  border: 2px solid var(--cream);
  padding: 1rem;
  text-align: center;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) rotate(-6deg); }
  to { transform: translate3d(3vw, -4vh, 0) rotate(9deg); }
}

@keyframes cityRise {
  from { transform: translateY(45%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes nodePulse {
  0%, 100% { transform: scale(1); opacity: 0.88; }
  50% { transform: scale(1.18); opacity: 1; }
}

@media (max-width: 780px) {
  .scene { padding: 8vh 6vw; }
  .chapter { grid-template-columns: 1fr; align-content: center; }
  .chapter-kicker { margin-bottom: 0; }
  .ballot-route { width: 160%; left: -46%; }
  .poster, .specimen, blockquote { opacity: 0.42; }
  .hero-copy { margin-left: 0; }
  .route-label { right: 5vw; bottom: 25vh; }
  .ballot-slip { width: 13rem; height: 18rem; }
  .slip-two { left: 31vw; }
}
