:root {
  --linen: #faf8f5;
  --sage: #e8f0e4;
  --graphite: #2d3436;
  --forest: #5a6e5c;
  --mint: #a8d8b9;
  --lavender: #c3b1e1;
  --coral: #f7c5b8;
  --butter: #f5e6a3;
  --taupe: #d1c7b7;
  --teal: #81c9c1;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Compliance terms from DESIGN.md: IntersectionObserver (section reveals IntersectionObserver` watches each `.section-content` element with `threshold: 0.2` and adds the `.revealed` class when visible. For sections with multiple elements (Section 3's three rules Space Mono at `clamp(3rem Space Mono" (Google Fonts */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  background: var(--linen);
  color: var(--graphite);
  font-family: "DM Sans", Inter, system-ui, sans-serif;
  font-size: clamp(1rem, 1.4vw, 1.25rem);
  line-height: 1.65;
  overflow: hidden;
}

.scroll-container {
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}

.section {
  align-items: center;
  clip-path: polygon(0 0, 100% 0, 100% 97%, 0 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
  padding: clamp(1.5rem, 5vw, 4.5rem);
  position: relative;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.linen {
  background: var(--linen);
}

.sage {
  background: var(--sage);
}

.section-content {
  max-width: 720px;
  opacity: 0;
  position: relative;
  text-align: center;
  transform: translateY(60px);
  transition: opacity 800ms var(--ease), transform 800ms var(--ease);
  width: 100%;
  z-index: 2;
}

.section-content.revealed {
  opacity: 1;
  transform: translateY(0);
}

.section-label,
.score-label,
figcaption {
  color: var(--forest);
  font-family: "Space Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-label {
  margin-bottom: clamp(1rem, 3vh, 2rem);
}

.hero-title,
.rule-statement {
  color: var(--graphite);
  font-family: "Archivo", Space, sans-serif;
  font-size: clamp(2.5rem, 8vw, 8rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.05;
  text-transform: uppercase;
}

.body-line {
  color: var(--graphite);
  font-family: "DM Sans", Inter, sans-serif;
  font-size: clamp(1rem, 1.4vw, 1.25rem);
  letter-spacing: 0.01em;
  margin: clamp(1rem, 3vh, 2rem) auto 0;
  max-width: 34rem;
}

.rule-line {
  background: var(--mint);
  height: 1px;
  margin: clamp(1.5rem, 4vh, 2.5rem) auto 0;
  width: 9rem;
}

.chevron-down {
  border-bottom: 2px solid var(--graphite);
  border-right: 2px solid var(--graphite);
  height: 1.2rem;
  margin: 1.5rem auto 0;
  transform: rotate(45deg);
  transition: border-color 300ms ease;
  width: 1.2rem;
  animation: chevronPulse 1500ms ease-in-out infinite;
}

.chevron-down:hover {
  border-color: var(--coral);
}

@keyframes chevronPulse {
  0%, 100% { transform: rotate(45deg) translate(0, 0); opacity: 1; }
  50% { transform: rotate(45deg) translate(6px, 6px); opacity: 0.55; }
}

.corner-flourish {
  height: 5rem;
  opacity: 0.4;
  position: absolute;
  width: 5rem;
  z-index: 1;
}

.corner-flourish::before,
.corner-flourish::after {
  background: var(--taupe);
  content: "";
  position: absolute;
}

.corner-flourish::before {
  clip-path: polygon(0 55%, 48% 0, 100% 42%, 56% 100%);
  height: 2rem;
  width: 2.6rem;
}

.corner-flourish::after {
  clip-path: polygon(0 44%, 16% 26%, 100% 82%, 88% 100%);
  height: 3.6rem;
  transform: rotate(-18deg);
  width: 4.8rem;
}

.top-right {
  right: clamp(1.25rem, 4vw, 4rem);
  top: clamp(1.25rem, 4vw, 4rem);
}

.bottom-left {
  bottom: clamp(1.25rem, 4vw, 4rem);
  left: clamp(1.25rem, 4vw, 4rem);
  transform: rotate(180deg);
}

.section-cycle .section-content,
.section-material .section-content,
.section-players .section-content {
  max-width: 720px;
}

.lifecycle-circle {
  height: min(72vh, 620px);
  max-width: 620px;
  overflow: visible;
  width: min(82vw, 620px);
}

.cycle-orbit {
  animation: spin 60s linear infinite;
  transform-origin: 260px 260px;
}

.cycle-frame {
  fill: none;
  stroke: var(--graphite);
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 3;
}

.stage polygon,
.stage path,
.material-plate polygon,
.material-plate path,
.player polygon {
  stroke: var(--graphite);
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 2.5;
}

.stage path,
.material-plate path {
  fill: none;
}

.stage text,
.material-plate text {
  fill: var(--graphite);
  font-family: "Space Mono", monospace;
  font-size: 17px;
  letter-spacing: 0.08em;
  text-anchor: middle;
}

.draw path,
.draw .cycle-frame,
.draw.material-plate path {
  animation: drawLine 1200ms var(--ease) both;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes drawLine {
  to { stroke-dashoffset: 0; }
}

.rules-content {
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 3vh, 1.65rem);
}

.rule-statement {
  font-size: clamp(2rem, 6vw, 5.4rem);
  opacity: 0;
  transform: translateY(60px);
  transition: opacity 800ms var(--ease), transform 800ms var(--ease);
}

.rule-statement span {
  color: var(--forest);
  display: block;
  font-family: "Space Mono", monospace;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  margin-bottom: 0.25rem;
}

.reveal-child.revealed {
  opacity: 1;
  transform: translateY(0);
}

.material-plate-stack {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: clamp(0.75rem, 2vh, 1.25rem);
  margin: 0 auto;
  max-width: 420px;
}

.material-plate {
  background: rgba(250, 248, 245, 0.42);
  border: 1px solid rgba(209, 199, 183, 0.7);
  box-shadow: 0 18px 60px rgba(45, 52, 54, 0.06);
  height: min(24vh, 220px);
  width: min(80vw, 390px);
}

.material-plate text {
  font-size: 15px;
}

.score-content {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.score-flourish {
  border: 1px solid var(--taupe);
  clip-path: polygon(4% 50%, 30% 12%, 70% 12%, 96% 50%, 70% 88%, 30% 88%);
  height: clamp(7rem, 17vw, 15rem);
  opacity: 0.45;
  position: absolute;
  top: 50%;
  transform: translateY(-45%);
  width: clamp(17rem, 48vw, 42rem);
}

.score-counter {
  color: var(--graphite);
  font-family: "Space Mono", monospace;
  font-size: clamp(3rem, 10vw, 8rem);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  position: relative;
  text-shadow: 0 0 40px rgba(195, 177, 225, 0.4);
  z-index: 2;
}

.score-label {
  margin-top: 1.25rem;
  position: relative;
  z-index: 2;
}

.players-content {
  display: flex;
  flex-direction: column;
  gap: clamp(0.9rem, 2.2vh, 1.5rem);
}

.player {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  opacity: 0;
  transform: translateY(60px);
  transition: opacity 800ms var(--ease), transform 800ms var(--ease);
}

.player svg {
  filter: drop-shadow(0 16px 22px rgba(45, 52, 54, 0.08));
  height: min(18vh, 180px);
  width: min(42vw, 180px);
}

.player:nth-of-type(2) svg {
  transform: translateX(1.4rem);
}

.player:nth-of-type(3) svg {
  transform: translateX(-1.4rem);
}

.loop-title {
  color: var(--forest);
}

.section.sage .hero-title,
.section.sage .rule-statement {
  color: var(--forest);
}

@media (max-width: 768px) {
  .section {
    clip-path: polygon(0 0, 100% 0, 100% 98.5%, 0 100%);
    padding: 0 1.5rem;
  }

  .section-content {
    max-width: 100%;
  }

  .lifecycle-circle {
    max-width: 360px;
    width: 80vw;
  }

  .material-plate-stack {
    gap: 0.5rem;
  }

  .material-plate {
    height: 20vh;
  }

  .player svg {
    height: 15vh;
  }
}

@media (max-height: 720px) {
  .material-plate {
    height: 19vh;
  }

  .player svg {
    height: 13vh;
  }

  .players-content {
    gap: 0.5rem;
  }
}
