/* www.balloonpopping.space — shared styles */

:root {
  --bg: #000000;
  /* rgba(255,255,255,0.5) over #000 = 5.28:1 — passes 4.5:1 (was 0.32 = 2.67:1, a fail) */
  --footer-text: rgba(255, 255, 255, 0.5);
  --footer-text-hover: rgba(255, 255, 255, 0.7);
  /* rgba(255,255,255,0.5) over #000 = 5.28:1 — passes 4.5:1 (was 0.18 = 1.54:1, a fail) */
  --watermark-text: rgba(255, 255, 255, 0.5);
  /* purely decorative glyphs only (aria-hidden separators) — exempt from 1.4.3 */
  --decorative-text: rgba(255, 255, 255, 0.18);
  --page-text: rgba(255, 255, 255, 0.72);
  --page-heading: rgba(255, 255, 255, 0.92);
  --page-link: rgba(255, 255, 255, 0.85);
  --focus-ring: rgba(255, 255, 255, 0.85);
}

* {
  box-sizing: border-box;
}

/* ---------- Accessibility utilities ---------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 12px;
  z-index: 100;
  background: #000;
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  text-decoration: underline;
  transition: top 150ms ease;
}

.skip-link:focus {
  top: 12px;
}

/* Visible, measured focus style used everywhere by default (3:1+ against
   black; see accessibility report for the full contrast table). Components
   with their own bespoke focus treatment override this locally. */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 2px;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  height: 100%;
}

body {
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Canvas (index) ---------- */

body.canvas-body {
  position: relative;
  min-height: 100dvh;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* Empty spacer so the AI disclosure sits just below the fold —
   reachable, but out of the way of the balloons. */
.scroll-spacer {
  height: 125vh;
  pointer-events: none;
}

.ai-disclosure {
  position: relative;
  z-index: 2;
  background: var(--bg);
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 24px 120px;
  user-select: text;
  -webkit-user-select: text;
}

.ai-disclosure h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--page-heading);
  margin: 0 0 14px;
}

.ai-disclosure p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--page-text);
  margin: 0;
}

.ai-disclosure a {
  color: var(--page-link);
}

.ai-disclosure a:hover,
.ai-disclosure a:focus-visible {
  color: var(--footer-text-hover);
}

#balloon-field {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 1;
}

/* ---------- Music toggle (persistent UI, not a pop-able balloon) ---------- */

.music-toggle {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 5;
  width: 58px;
  height: 58px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  outline: none;
  background-color: transparent;
  background-clip: padding-box;
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.5) 5%, rgba(255, 255, 255, 0) 13%),
    radial-gradient(circle at 68% 72%, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 8%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.05) 50%, rgba(210, 235, 255, 0.28) 76%, rgba(255, 255, 255, 0.45) 88%, rgba(255, 255, 255, 0.05) 100%);
  box-shadow:
    inset 0 0 6px rgba(255, 255, 255, 0.25),
    0 0 16px rgba(255, 255, 255, 0.08);
  transition: box-shadow 200ms ease;
}

.music-icon {
  font-size: 22px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.55);
  user-select: none;
  transition: color 200ms ease, filter 200ms ease;
}

.music-toggle.playing .music-icon {
  color: rgba(255, 255, 255, 0.92);
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.5));
}

/* ---------- Settings toggle + panel (B2: larger / slower / forgiving) ---------- */

.settings-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 5;
  width: 58px;
  height: 58px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  outline: none;
  background-color: transparent;
  background-clip: padding-box;
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.5) 5%, rgba(255, 255, 255, 0) 13%),
    radial-gradient(circle at 68% 72%, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 8%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.05) 50%, rgba(210, 235, 255, 0.28) 76%, rgba(255, 255, 255, 0.45) 88%, rgba(255, 255, 255, 0.05) 100%);
  box-shadow:
    inset 0 0 6px rgba(255, 255, 255, 0.25),
    0 0 16px rgba(255, 255, 255, 0.08);
}

.settings-icon {
  font-size: 22px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.55);
  user-select: none;
  transition: color 200ms ease, filter 200ms ease;
}

.settings-toggle[aria-expanded="true"] .settings-icon {
  color: rgba(255, 255, 255, 0.92);
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.5));
}

.settings-panel {
  position: fixed;
  top: 86px;
  right: 20px;
  z-index: 5;
  width: 240px;
  max-width: calc(100vw - 40px);
  background: rgba(0, 0, 0, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}

.settings-panel[hidden] {
  display: none;
}

.settings-panel-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--page-heading);
}

.settings-option {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--page-text);
  cursor: pointer;
}

.settings-option:last-child {
  margin-bottom: 0;
}

.settings-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: #ffffff;
}

/* .balloon is the real hit target (a <button>) — it owns position and the
   float/fall animation. Its visible balloon artwork is a separate,
   pointer-events:none child (.balloon-visual) sized to the visual balloon,
   so the tap target (B1: 24x24 min, larger with the "forgiving hit area"
   setting) can be bigger than what's drawn without distorting the
   artwork. Shape (round / classic / long) and color or character artwork
   are chosen per-balloon in js/balloons.js. */
.balloon {
  position: absolute;
  bottom: -12vh;
  border: none;
  margin: 0;
  padding: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  touch-action: manipulation;
  will-change: transform, opacity;
  animation-name: float;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

.balloon:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.balloon.popping {
  animation-play-state: paused;
}

.balloon-visual {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* Solid-color balloon body. --balloon-color is set per-balloon in JS;
   the two radial gradients lay a glossy highlight and a soft shadow
   over the flat color so it still reads as a balloon, not a flat sticker. */
.balloon-shape {
  display: block;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.28) 9%, rgba(255, 255, 255, 0) 20%),
    radial-gradient(circle at 72% 80%, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0) 42%),
    var(--balloon-color);
  box-shadow:
    inset 0 0 10px rgba(255, 255, 255, 0.18),
    0 6px 16px rgba(0, 0, 0, 0.35);
}

/* Small knot nub at the base of a solid-color balloon, in the same color.
   Built from a zero-size box plus a colored top border (the classic
   CSS-triangle trick) so it needs no extra markup or image. */
.balloon-knot {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 0;
  height: 0;
  border-style: solid;
  border-color: transparent;
}

/* Thin string hanging from the knot of a solid-color balloon, in white,
   light grey, or light blue (set per-balloon in JS along with its length
   and a slight rotation for a natural, non-identical look). */
.balloon-string {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  border-radius: 2px;
  transform-origin: top center;
  pointer-events: none;
}

/* Custom character/mylar/hot-air balloon artwork from assets/balloons/. */
.balloon-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
  user-drag: none;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
}

/* Balloons float upward and drift rightward — anywhere from a gentle
   bottom-left-to-upper-right diagonal to a broad left-to-right sweep,
   depending on the per-balloon --drift distance (a vw value) set in JS. */
@keyframes float {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 0; }
  8%   { opacity: var(--op, 0.9); }
  25%  { transform: translate(calc(var(--drift) * 0.25), -35vh) rotate(calc(var(--rotate) * 0.3)); }
  50%  { transform: translate(calc(var(--drift) * 0.55), -70vh) rotate(calc(var(--rotate) * -0.4)); }
  75%  { transform: translate(calc(var(--drift) * 0.8), -105vh) rotate(calc(var(--rotate) * 0.6)); }
  92%  { opacity: var(--op, 0.9); }
  100% { transform: translate(var(--drift), -140vh) rotate(var(--rotate)); opacity: 0; }
}

.balloon.popping .balloon-visual {
  animation: pop 220ms ease-out forwards;
}

@keyframes pop {
  0%   { transform: translate(-50%, -50%) scale(1); opacity: 1; filter: blur(0); }
  45%  { transform: translate(-50%, -50%) scale(1.4); opacity: 0.6; filter: blur(0.5px); }
  100% { transform: translate(-50%, -50%) scale(1.85); opacity: 0; filter: blur(1.5px); }
}

.balloon.wobble .balloon-visual {
  animation: wobble 280ms ease-in-out;
}

@keyframes wobble {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.45); }
}

/* Balloon movement is the essential mechanic (2.3.3) and stays; the
   decorative pop-burst scale/blur and the wobble flicker are not
   essential, so they're replaced with a plain opacity fade. */
@media (prefers-reduced-motion: reduce) {
  .balloon.popping .balloon-visual {
    animation: pop-reduced 180ms ease-out forwards;
  }

  .balloon.wobble .balloon-visual {
    animation: none;
  }

  @keyframes pop-reduced {
    0%   { transform: translate(-50%, -50%); opacity: 1; }
    100% { transform: translate(-50%, -50%); opacity: 0; }
  }
}

/* ---------- Footer (shared across all pages) ---------- */

.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 14px 16px 10px;
  text-align: center;
  pointer-events: none;
}

.site-footer * {
  pointer-events: auto;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.footer-nav a {
  color: var(--footer-text);
  text-decoration: none;
  transition: color 200ms ease;
  padding: 4px 2px;
}

.footer-nav a:hover,
.footer-nav a:focus-visible {
  color: var(--footer-text-hover);
}

.footer-nav span {
  color: var(--decorative-text);
  font-size: 10px;
}

.watermark {
  margin: 6px 0 0;
  font-size: 10px;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--watermark-text);
}

/* On the canvas page only, the footer sits in normal document flow after
   the AI disclosure (position stays "positioned" via z-index so it still
   paints over the fixed #balloon-field once scrolled into view) instead of
   pinned to the bottom of the screen — so it takes a deliberate scroll to
   reach and can't be tapped by accident while popping balloons. Content
   pages keep the fixed footer as a persistent nav while reading. */
body.canvas-body .site-footer {
  position: relative;
  bottom: auto;
}

/* ---------- Content pages (terms, privacy, contact, sitemap, whitepaper) ---------- */

body.page-body {
  padding: 64px 20px 140px;
  display: flex;
  justify-content: center;
}

.page-wrap {
  width: 100%;
  max-width: 640px;
}

.page-back {
  display: inline-block;
  margin-bottom: 28px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--footer-text);
  text-decoration: none;
}

.page-back:hover,
.page-back:focus-visible {
  color: var(--footer-text-hover);
}

.page-wrap h1 {
  font-size: 22px;
  font-weight: 500;
  color: var(--page-heading);
  margin: 0 0 6px;
}

.page-updated {
  font-size: 11px;
  color: var(--watermark-text);
  margin: 0 0 32px;
}

.page-wrap h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--page-heading);
  margin: 28px 0 8px;
}

.page-wrap p,
.page-wrap li {
  font-size: 14px;
  line-height: 1.7;
  color: var(--page-text);
}

.page-wrap ul {
  padding-left: 20px;
}

.page-wrap a {
  color: var(--page-link);
}

.page-wrap a:hover,
.page-wrap a:focus-visible {
  color: var(--footer-text-hover);
}

.sitemap-list {
  list-style: none;
  padding: 0;
}

.sitemap-list li {
  margin-bottom: 10px;
}
