/* =========================================================
   Tip our SuperSTARS - Peter Piper Pizza fundraiser night
   Arcade-cabinet theme: deep indigo, token gold, marquee bulbs.
   Mobile only (target ~360-430px). One column, centered hero.
   ========================================================= */

:root {
  color-scheme: dark;
  --bg:        #171043;
  --bg-2:      #241a5c;
  --ink:       #fef6e7;
  --ink-soft:  rgba(254, 246, 231, 0.82);
  --ink-faint: rgba(254, 246, 231, 0.55);
  --coin:      #ffc63d;
  --coin-lite: #ffdd80;
  --coin-deep: #f59e0b;
  --pop:       #ff5d8f;
  --mint:      #37e0b0;
  --brown:     #b45309;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(130% 80% at 50% 0%, #2a1f66 0%, #171043 58%, #110b32 100%) no-repeat,
    var(--bg);
  color: var(--ink);
  font-family: "Fredoka", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; }

.wrap {
  max-width: 460px;
  margin-inline: auto;
  padding: 22px 18px calc(112px + env(safe-area-inset-bottom));
}

/* ---------- marquee bulbs ---------- */
.bulbs {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
  margin-bottom: 18px;
}
.bulbs span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--coin);
  box-shadow: 0 0 9px var(--coin), 0 0 2px #fff inset;
  animation: blink 1.7s ease-in-out infinite;
}
.bulbs span:nth-child(2n)  { animation-delay: 0.28s; }
.bulbs span:nth-child(3n)  { animation-delay: 0.55s; }
.bulbs span:nth-child(4n)  { animation-delay: 0.82s; }

/* ---------- hero ---------- */
.hero { text-align: center; }

.hero-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 12px;
  margin: 2px 0 12px;
}
.hero-logo {
  flex: none;
  height: clamp(60px, 18vw, 82px);
  width: auto;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45))
    drop-shadow(0 0 7px rgba(255, 255, 255, 0.3));
}

.marquee {
  font-family: "Press Start 2P", "Fredoka", monospace;
  font-size: clamp(0.9rem, 4.6vw, 1.2rem);
  line-height: 1.7;
  letter-spacing: 0.5px;
  margin: 0;
  text-align: left;
  color: var(--ink);
  text-shadow: 0 0 14px rgba(255, 198, 61, 0.55), 0 3px 0 var(--brown);
}

.tagline {
  max-width: 33ch;
  margin: 0 auto 22px;
  font-size: 1.02rem;
  color: var(--ink-soft);
}

/* ---------- jar component ---------- */
.jar {
  position: relative;
  width: var(--jw);
  height: var(--jh);
}
.jar--hero { --jw: 150px; --jh: 190px; --glass-top: 11px; }
.jar--mini { --jw: 64px;  --jh: 82px;  --glass-top: 6px; }

.jar__lid {
  position: absolute;
  top: 0;
  left: -4px;
  width: calc(100% + 8px);
  height: 13px;
  background: linear-gradient(180deg, var(--coin-lite), var(--coin-deep));
  border-radius: 5px 5px 3px 3px;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2);
  z-index: 3;
}
.jar--mini .jar__lid { height: 7px; }

.jar__glass {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: var(--glass-top);
  border: 3px solid rgba(255, 214, 107, 0.5);
  border-radius: 6px 6px 22px 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
  overflow: hidden;
}
.jar--mini .jar__glass {
  border-width: 2px;
  border-radius: 5px 5px 14px 14px;
}

.jar__liquid {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: linear-gradient(180deg, var(--coin-lite) 0%, var(--coin) 55%, var(--coin-deep) 100%);
  will-change: height;
}

/* Two overlapping wave surfaces per jar: a crisp front swell and a taller,
   translucent back swell drifting the other way. The interference between them
   reads as real rolling liquid (after chrisgannon/vjNNew) rather than one
   scrolling ripple. Motion is handed to GSAP via .jars-live; the CSS animation
   below is only the no-JS / reduced-motion fallback. */
.jar__wave,
.jar__wave2 {
  position: absolute;
  left: -12%;
  right: -12%;
  background-repeat: repeat-x;
  background-position: 0 0;
  pointer-events: none;
  transform-origin: 50% 100%;
}
.jar__wave {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='28' viewBox='0 0 120 28' preserveAspectRatio='none'%3E%3Cpath d='M0,14 q15,-13 30,0 t30,0 t30,0 t30,0 V28 H0 Z' fill='%23ffdd80'/%3E%3C/svg%3E");
}
.jar__wave2 {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='28' viewBox='0 0 120 28' preserveAspectRatio='none'%3E%3Cpath d='M0,14 q15,-13 30,0 t30,0 t30,0 t30,0 V28 H0 Z' fill='%23ffe9ad'/%3E%3C/svg%3E");
}

.jar--hero .jar__wave  { top: -18px; height: 26px; background-size: 120px 26px; }
.jar--hero .jar__wave2 { top: -25px; height: 34px; background-size: 172px 34px; opacity: 0.5; }
.jar--mini .jar__wave  { top: -10px; height: 15px; background-size: 60px 15px; }
.jar--mini .jar__wave2 { top: -15px; height: 21px; background-size: 88px 21px; opacity: 0.45; }

/* fallback drift (no GSAP): front only, slow */
.jar--hero .jar__wave { animation: slosh 9s linear infinite; }
.jar--mini .jar__wave { animation: slosh-mini 11s linear infinite; }
.roster__grid .mini:nth-child(2n) .jar__wave     { animation-duration: 14s; }
.roster__grid .mini:nth-child(3n) .jar__wave     { animation-duration: 12s; }
.roster__grid .mini:nth-child(3n + 1) .jar__wave { animation-direction: reverse; }
.roster__grid .mini:nth-child(5n) .jar__wave     { animation-delay: -4s; }

/* When GSAP is driving the jars it owns the surface motion. */
.jars-live .jar__wave,
.jars-live .jar__wave2 { animation: none !important; will-change: transform, background-position; }
.jars-live .jar__liquid { transform-origin: 50% 100%; }

.jar__shine {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 9px;
  bottom: 26px;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0));
}

.hero-jar {
  position: relative;
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.coin-stage {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
/* Super Mario Bros coin: gold disc, bright rim, hollow inner ring. The JS
   flips it on its vertical axis (scaleX) so it reads as a spinning coin. */
.coin {
  position: absolute;
  left: calc(50% - 10px);
  top: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 36%,
    #fff6d0 0%, var(--coin-lite) 26%, var(--coin) 60%, var(--coin-deep) 100%);
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 246, 214, 0.5),
    inset 0 0 0 3px rgba(221, 143, 24, 0.75),
    0 1px 4px rgba(0, 0, 0, 0.4);
  will-change: transform;
}
.coin::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 2px solid rgba(160, 98, 10, 0.55);
  box-shadow: inset 0 0 5px rgba(255, 246, 200, 0.75);
}
.spark {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  pointer-events: none;
}

/* ---------- readout ---------- */
.readout { margin: 4px 0 2px; }
.readout__amount {
  display: block;
  font-family: "Press Start 2P", "Fredoka", monospace;
  font-size: clamp(1.35rem, 6.6vw, 1.8rem);
  letter-spacing: 1px;
  color: var(--coin);
  text-shadow: 0 0 16px rgba(255, 198, 61, 0.5);
}
.readout__goal {
  display: block;
  margin-top: 9px;
  font-size: 0.95rem;
  color: var(--ink-faint);
}

.live {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 10px 0 20px;
  font-size: 0.8rem;
  letter-spacing: 0.4px;
  color: var(--ink-faint);
}
.live__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 8px var(--mint);
  animation: ping 1.9s ease-out infinite;
}
.live.is-stale .live__dot {
  background: var(--coin-deep);
  box-shadow: 0 0 8px var(--coin-deep);
}

/* ---------- primary button ---------- */
.btn {
  display: block;
  width: 100%;
  padding: 15px 20px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--coin-lite), var(--coin-deep));
  color: #3b2400;
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  font-size: 1.08rem;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 6px 0 var(--brown), 0 12px 22px rgba(0, 0, 0, 0.38);
}
.btn:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 var(--brown), 0 6px 12px rgba(0, 0, 0, 0.38);
}

/* ---------- prose ---------- */
.prose {
  max-width: 42ch;
  margin: 28px auto;
  color: var(--ink-soft);
  font-size: 1.02rem;
}
.prose p + p { margin-top: 0.9em; }

/* ---------- section heading ---------- */
.section-h {
  font-family: "Press Start 2P", "Fredoka", monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  letter-spacing: 1px;
  text-align: center;
  color: var(--ink);
  text-shadow: 0 0 10px rgba(255, 198, 61, 0.4);
  margin: 32px 0 14px;
}

/* ---------- fees callout ---------- */
.callout {
  margin: 24px 0;
  padding: 16px;
  border: 2px solid rgba(255, 198, 61, 0.35);
  border-left: 6px solid var(--coin);
  border-radius: 12px;
  background: rgba(255, 198, 61, 0.07);
  font-size: 0.96rem;
  color: var(--ink-soft);
}
.callout__h {
  margin: 0 0 8px;
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--coin);
}
.callout p + p { margin-top: 0.7em; }
.callout strong { color: var(--ink); font-weight: 600; }
.callout em { font-style: normal; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Zeffy embed ---------- */
.tip-section { margin-top: 8px; }
.tip-embed {
  background: #fff;
  border-radius: 16px;
  padding: 6px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.tip-embed iframe { max-width: 100%; border-radius: 12px; }

/* ---------- roster ---------- */
.roster__sub {
  margin: 0 0 18px;
  text-align: center;
  font-size: 0.92rem;
  color: var(--ink-faint);
}
.roster__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px 10px;
}
.mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.mini__name {
  margin: 9px 0 0;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
}
.mini__tag {
  margin: 2px 0 0;
  font-size: 0.74rem;
  color: var(--ink-faint);
}
.mini__amt {
  display: block;
  margin: 5px 0 0;
  font-family: "Press Start 2P", monospace;
  font-size: 0.7rem;
  color: var(--coin);
  text-shadow: 0 0 8px rgba(255, 198, 61, 0.45);
}

/* ---------- debug panel (?debug=1) ---------- */
.debug-panel { display: none; }
.is-debug .debug-panel {
  display: block;
  margin: 30px 0 10px;
}
.debug-panel__hint {
  margin: 0 0 10px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--ink-faint);
}
.debug-panel__hint a { color: var(--coin); }
.debug-panel pre {
  margin: 0;
  padding: 14px;
  border: 1px solid rgba(255, 214, 107, 0.3);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}

/* ---------- footer ---------- */
.footer {
  margin: 34px 0 6px;
  text-align: center;
  font-size: 1rem;
  color: var(--ink-soft);
}
.footer-logo {
  display: block;
  width: 172px;
  max-width: 60%;
  height: auto;
  margin: 6px auto 16px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45))
    drop-shadow(0 0 10px rgba(255, 255, 255, 0.22));
}

/* ---------- sticky CTA ---------- */
.sticky-cta {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  max-width: 436px;
  margin-inline: auto;
  padding: 14px 18px;
  border-radius: 14px;
  background: linear-gradient(180deg, #ff7aa8, var(--pop));
  color: #fff;
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
  font-size: 1.04rem;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 6px 0 #b3244f, 0 12px 24px rgba(0, 0, 0, 0.42);
  transform: translateY(150%);
  transition: transform 0.36s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 50;
}
.sticky-cta.is-visible { transform: translateY(0); }
.sticky-cta:active { transform: translateY(3px); }

/* ---------- focus ---------- */
a:focus-visible {
  outline: 3px solid var(--mint);
  outline-offset: 3px;
  border-radius: 8px;
}

/* ---------- keyframes ---------- */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.32; }
}
@keyframes ping {
  0%   { box-shadow: 0 0 0 0 rgba(55, 224, 176, 0.55); }
  100% { box-shadow: 0 0 0 11px rgba(55, 224, 176, 0); }
}
@keyframes slosh {
  from { background-position-x: 0; }
  to   { background-position-x: 120px; }
}
@keyframes slosh-mini {
  from { background-position-x: 0; }
  to   { background-position-x: 60px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .bulbs span { opacity: 1; }
  .sticky-cta { transition: none; }
}
