/* =========================================================
   SCROLL PARTY — yellow & black, never-ending
   ========================================================= */

:root {
  /* bubblegum-pink theme (var names kept as --yellow* for simplicity) */
  --yellow: #ff5fa6;        /* hot bubblegum pink */
  --yellow-deep: #ff2d8f;   /* deep magenta-pink */
  --black: #190a13;         /* deep plum-black so the glossy pinks pop */
  --ink: #0d050a;
  --paper: #fff0f6;
  --grid: rgba(255, 95, 166, 0.12);
  --font-display: "Archivo Black", system-ui, sans-serif;
  --font-mono: "Space Grotesk", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  background: var(--black);
  color: var(--yellow);
  font-family: var(--font-mono);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  /* subtle dotted party grid over the black — fixed to the viewport so the
     pattern can't "jump" at the infinite-loop reset (a source of seams) */
  background-image:
    radial-gradient(var(--grid) 1px, transparent 1px);
  background-size: 26px 26px;
  background-attachment: fixed;
}

/* kill stray horizontal scroll — never use overflow-x:hidden on body */
img, canvas, svg, video { max-width: 100%; display: block; }

/* ---------- the glossy candy-sphere field (Three.js) ---------- */
#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}

/* ---------- scroll content ---------- */
.wrapper { position: relative; z-index: 1; }
.content { position: relative; }

.panel {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.25rem, 5vw, 5rem);
  overflow: hidden;
  /* transparent so the candy field floats behind every panel */
  background: transparent;
}

/* parallaxed decorative glow — soft radial pools that fade to transparent well
   before the panel edges, so adjacent panels never form a hard horizontal seam.
   (No full-bleed or repeating fills here — those caused the visible boundary
   lines at every panel join.) */
.media {
  position: absolute;
  inset: -20% 0;          /* taller than panel so parallax never reveals an edge */
  z-index: 0;
  opacity: 0.6;
  pointer-events: none;
  will-change: transform;
}
.panel[data-bg="0"] .media {
  background:
    radial-gradient(42% 34% at 24% 34%, rgba(255,95,166,0.20), transparent 60%),
    radial-gradient(36% 30% at 82% 74%, rgba(255,45,143,0.16), transparent 60%);
}
.panel[data-bg="1"] .media {
  background:
    radial-gradient(40% 32% at 78% 30%, rgba(255,95,166,0.18), transparent 60%),
    radial-gradient(34% 28% at 22% 70%, rgba(255,45,143,0.14), transparent 60%);
}
.panel[data-bg="2"] .media {
  background:
    radial-gradient(42% 34% at 30% 64%, rgba(255,45,143,0.18), transparent 60%),
    radial-gradient(34% 28% at 72% 32%, rgba(255,95,166,0.14), transparent 60%);
}
.panel[data-bg="3"] .media {
  background:
    radial-gradient(46% 38% at 50% 50%, rgba(255,95,166,0.22), transparent 62%);
}

/* ---------- type ---------- */
.panel-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: min(92vw, 1100px);
  mix-blend-mode: normal;
}

.kicker {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  font-size: clamp(0.6rem, 1.6vw, 0.9rem);
  color: var(--yellow);
  opacity: 0.85;
  margin: 0 0 clamp(0.6rem, 2vw, 1.4rem);
  padding-left: 0.42em; /* offset the trailing letter-spacing for visual centering */
}

.title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3.4rem, 19vw, 16rem);
  line-height: 0.82;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--yellow);
  /* readable over the busy candy field */
  text-shadow:
    0 0 1px rgba(0,0,0,0.9),
    0 8px 40px rgba(0,0,0,0.85),
    0 2px 0 rgba(0,0,0,0.6);
  transform-origin: 50% 60%;
  will-change: transform;
}

/* when the 3D title takes over, hide the DOM title but keep its box so the
   kicker/sub stay spaced exactly where they were */
.title3d .title { visibility: hidden; }

.sub {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: clamp(0.9rem, 2vw, 1.2rem);
  line-height: 1.45;
  max-width: 36ch;
  margin: clamp(1rem, 3vw, 2rem) auto 0;
  color: #fff;
  text-shadow: 0 2px 16px rgba(0,0,0,0.9);
}

.big-index {
  position: absolute;
  right: clamp(0.6rem, 3vw, 3rem);
  bottom: clamp(0.4rem, 3vw, 2.5rem);
  z-index: 2;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 6rem);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 95, 166, 0.5);
  text-stroke: 1.5px rgba(255, 95, 166, 0.5);
  pointer-events: none;
}

/* ---------- HUD ---------- */
.hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: clamp(0.6rem, 3vw, 2rem);
  padding: clamp(0.7rem, 2.4vw, 1.2rem) clamp(0.9rem, 3vw, 2rem);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(0.6rem, 1.5vw, 0.82rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--black);
  background: linear-gradient(90deg, var(--yellow), var(--yellow-deep));
  border-bottom: 3px solid var(--black);
  mix-blend-mode: normal;
}
.hud-brand { white-space: nowrap; }
.hud-meter {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: auto;
  min-width: 0;
}
.hud-label { opacity: 0.75; }
.hud-bar {
  position: relative;
  width: clamp(60px, 22vw, 180px);
  height: 10px;
  background: rgba(10,10,10,0.25);
  border: 2px solid var(--black);
  overflow: hidden;
}
.hud-bar > i {
  position: absolute;
  inset: 0;
  width: 0%;
  background: var(--black);
  transform-origin: left;
}
.hud-count { white-space: nowrap; }

/* ---------- side scrolling marquee hint ---------- */
.scroll-hint {
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 25;
  width: 100%;
  display: flex;
  gap: 0;
  white-space: nowrap;
  overflow: hidden;
  padding: 0.45rem 0;
  background: var(--black);
  border-top: 2px solid var(--yellow);
  color: var(--yellow);
  font-family: var(--font-display);
  font-size: clamp(0.7rem, 1.8vw, 1rem);
  letter-spacing: 0.06em;
  pointer-events: none;
}
.scroll-hint span {
  display: inline-block;
  padding-right: 1ch;
  animation: marquee 14s linear infinite;
}
@keyframes marquee {
  to { transform: translateX(-100%); }
}

/* ---------- confetti ---------- */
.confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  overflow: hidden;
}
.confetti {
  position: absolute;
  top: -8vh;
  width: 10px;
  height: 16px;
  background: var(--yellow);
  opacity: 0.9;
  will-change: transform;
}
.confetti.alt { background: #fff; }
.confetti.dark { background: #1a1a1a; border: 1px solid var(--yellow); }
.confetti.round { border-radius: 50%; height: 10px; }

/* ---------- the little cog-cranking guy ---------- */
.cranker {
  position: fixed;
  left: 12px;
  bottom: 40px;
  width: clamp(82px, 22vw, 118px);
  z-index: 26;
  pointer-events: none;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
}
.cranker svg { display: block; width: 100%; height: auto; overflow: visible; }

/* rotation meter — how many times the guy has cranked the cog */
.rotmeter {
  position: fixed;
  left: 14px;
  bottom: 148px;
  z-index: 26;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--yellow);
  background: rgba(25, 10, 19, 0.7);
  border: 2px solid var(--yellow);
  border-radius: 999px;
  pointer-events: none;
}
.rotmeter .rot-cog { font-size: 0.9rem; }
.rotmeter .rot-lbl { opacity: 0.7; }
#sp-rot { font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }

/* ---------- glassy sheen (reads as candy-on-glass) ---------- */
.glass {
  position: fixed;
  inset: 0;
  z-index: 19;
  pointer-events: none;
  background:
    linear-gradient(115deg, rgba(255,255,255,0.06) 0%, transparent 22%, transparent 78%, rgba(255,255,255,0.04) 100%);
  mix-blend-mode: screen;
}

/* ---------- tilt-to-roll prompt (mobile) ---------- */
.tilt-btn {
  position: fixed;
  left: 50%;
  bottom: 54px;
  transform: translateX(-50%);
  z-index: 31;
  padding: 0.7rem 1.2rem;
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: var(--black);
  background: linear-gradient(90deg, var(--yellow), var(--yellow-deep));
  border: 3px solid var(--black);
  border-radius: 999px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.4);
  cursor: pointer;
  animation: tiltpulse 1.4s ease-in-out infinite;
}
@keyframes tiltpulse { 50% { transform: translateX(-50%) scale(1.06); } }

/* ---------- grain / vignette ---------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 28;
  pointer-events: none;
  background:
    radial-gradient(120% 120% at 50% 50%, transparent 55%, rgba(0,0,0,0.55) 100%);
  mix-blend-mode: multiply;
}

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  .scroll-hint span { animation: none; }
}
