/* Colour Pop, as in the app: white ground, near-black ink, Unbounded headings, Onest text,
   three brand colours, tilted lime stickers. Dark mode swaps the ground and the text and nothing
   else: --night is the ink that never changes (text on a brand colour, the dark plates).

   The motion (fx.js) is decoration on top: a card that lands and sways, a sticker that slaps
   on, letters that rise, confetti on saving. All of it switches off under reduced motion. */
:root {
  --night: #17121c;
  --ink: #17121c;
  --paper: #ffffff;
  --lime: #d9f25c;
  --orange: #ff6f2e;
  --lilac: #b9a0ff;
  --muted: rgba(23, 18, 28, 0.6);
  --faint: rgba(23, 18, 28, 0.06);
  --glow: 0.22;
  --display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --text: "Onest", system-ui, -apple-system, sans-serif;
  --spring: cubic-bezier(.2, .9, .3, 1.25);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f6f3fa;
    --paper: #17121c;
    --muted: rgba(246, 243, 250, 0.62);
    --faint: rgba(246, 243, 250, 0.07);
    --glow: 0.3;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.5 var(--text);
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overflow-x: hidden;
}
main { position: relative; z-index: 1; max-width: 440px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }

/* Soft light in the three colours, drifting behind everything. Gradients rather than a blur
   filter: cheap enough for any phone. */
.aurora { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.aurora i {
  position: absolute; width: 90vmax; height: 90vmax; border-radius: 50%;
  opacity: var(--glow);
}
.aurora i:nth-child(1) { background: radial-gradient(closest-side, var(--lilac), transparent); top: -45vmax; left: -35vmax; }
.aurora i:nth-child(2) { background: radial-gradient(closest-side, var(--lime), transparent); top: 20vh; right: -50vmax; }
.aurora i:nth-child(3) { background: radial-gradient(closest-side, var(--orange), transparent); bottom: -60vmax; left: -20vmax; opacity: calc(var(--glow) * 0.7); }

.mark {
  display: inline-flex; gap: 0.3em; align-self: flex-start;
  background: var(--night); border-radius: 10px; padding: 8px 12px;
  box-shadow: inset 0 0 0 1px var(--faint);
  font: 900 18px/1 var(--display); letter-spacing: 0.01em; text-decoration: none;
}
.mark span:nth-child(1) { color: var(--lime); }
.mark span:nth-child(2) { color: var(--orange); }
.mark span:nth-child(3) { color: var(--lilac); }

/* Loading: the three HIs bounce in turn. */
.loading { display: grid; place-items: center; min-height: 50vh; }
.bounce { display: flex; gap: 0.35em; font: 900 28px/1 var(--display); }
.bounce b:nth-child(1), .mini b:nth-child(1) { color: var(--lime); }
.bounce b:nth-child(2), .mini b:nth-child(2) { color: var(--orange); }
.bounce b:nth-child(3), .mini b:nth-child(3) { color: var(--lilac); }

/* The card. The stage takes the landing; the card itself takes the tilt, so the two
   transforms never fight. */
.stage { perspective: 1000px; padding-top: 12px; }
.card {
  --rx: 0deg; --ry: 0deg; --gx: 50%; --gy: 30%;
  position: relative;
  border-radius: 28px; padding: 34px 24px 26px;
  display: flex; flex-direction: column; gap: 14px;
  background: var(--lilac); color: var(--night);
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 30px 60px -24px rgba(23, 18, 28, 0.45),
    0 12px 24px -12px rgba(23, 18, 28, 0.3);
  touch-action: pan-y;
  -webkit-user-select: none; user-select: none;
}
/* A light that moves with the tilt, and a fine print grain, so the colour reads as a printed
   card rather than a flat box. */
.card::before, .card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
}
.card::before {
  background: radial-gradient(circle at var(--gx) var(--gy), rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 55%);
  mix-blend-mode: soft-light;
}
.card::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.22; mix-blend-mode: multiply;
}
.card > * { position: relative; z-index: 1; }
.sticker {
  position: absolute; top: -16px; left: 18px; z-index: 2;
  background: var(--lime); color: var(--night);
  font: 900 13px/1 var(--display); text-transform: uppercase;
  padding: 9px 13px; border-radius: 6px; transform: rotate(-4deg);
  box-shadow: 0 6px 14px -6px rgba(23, 18, 28, 0.45);
}
.card[data-colour="lime"] .sticker { background: #ffffff; }
h1 {
  margin: 0; font: 900 clamp(30px, 9vw, 40px)/1.02 var(--display);
  text-transform: uppercase; text-wrap: balance; overflow-wrap: anywhere;
}
h1 .word { display: inline-block; white-space: nowrap; }
h1 .letter { display: inline-block; }
.subtitle { margin: 0; font-size: 18px; font-weight: 500; }
dl { margin: 8px 0 0; display: grid; gap: 12px; }
dl div { display: grid; gap: 1px; }
dt { font: 600 12px/1.2 var(--text); letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.65; }
dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
dd a { color: inherit; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }

.actions { display: grid; gap: 10px; }
.button {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; border: 0; border-radius: 18px; padding: 20px;
  font: 700 15px/1 var(--display); text-transform: uppercase; letter-spacing: 0.02em;
  background: var(--ink); color: var(--paper); cursor: pointer; text-decoration: none;
  transition: transform 160ms var(--spring), background-color 300ms ease, color 300ms ease;
  -webkit-tap-highlight-color: transparent;
}
/* A glint that crosses the button every few seconds. */
.button::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.28) 50%, transparent 65%);
  transform: translateX(-120%);
}
.button:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
.button:active { transform: scale(0.97); }
.button.saved { background: var(--lime); color: var(--night); }
.note { margin: 0; font-size: 14px; color: var(--muted); text-align: center; }
.panel {
  background: var(--faint); border-radius: 22px; padding: 18px 20px; display: grid; gap: 6px;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: inset 0 0 0 1px var(--faint);
}
.panel h2 { margin: 0; font: 900 16px/1.25 var(--display); text-transform: uppercase; text-wrap: balance; }
.panel p { margin: 0; color: var(--muted); font-size: 15px; }
.panel.app { grid-template-columns: auto 1fr; gap: 14px; align-items: center; }
.mini {
  display: grid; place-content: center; width: 56px; height: 56px; border-radius: 14px;
  background: var(--night); font: 900 13px/0.9 var(--display);
}

/* Confetti pieces (fx.js). */
.confetti {
  position: fixed; z-index: 10; pointer-events: none;
  width: 9px; height: 14px; border-radius: 2px;
}
.confetti-dot { width: 10px; height: 10px; border-radius: 50%; }
.confetti-word { width: auto; height: auto; background: none; font: 900 15px/1 var(--display); }

@media (prefers-reduced-motion: no-preference) {
  .aurora i:nth-child(1) { animation: drift-a 22s ease-in-out infinite alternate; }
  .aurora i:nth-child(2) { animation: drift-b 27s ease-in-out infinite alternate; }
  .aurora i:nth-child(3) { animation: drift-c 31s ease-in-out infinite alternate; }
  @keyframes drift-a { to { transform: translate(18vmax, 22vmax) scale(1.15); } }
  @keyframes drift-b { to { transform: translate(-24vmax, 12vmax) scale(0.9); } }
  @keyframes drift-c { to { transform: translate(20vmax, -18vmax) scale(1.1); } }

  .bounce b { animation: hop 900ms var(--spring) infinite; }
  .bounce b:nth-child(2) { animation-delay: 120ms; }
  .bounce b:nth-child(3) { animation-delay: 240ms; }
  @keyframes hop { 0%, 60%, 100% { transform: none; } 30% { transform: translateY(-14px) rotate(-6deg); } }

  .stage { animation: land 640ms var(--spring) both; }
  @keyframes land { from { transform: translateY(40px) scale(0.92) rotate(2deg); opacity: 0; } }

  .sticker { animation: slap 420ms var(--spring) 380ms both; }
  @keyframes slap {
    from { transform: rotate(-24deg) scale(1.9); opacity: 0; }
    70% { transform: rotate(-2deg) scale(0.94); opacity: 1; }
  }

  h1 .letter { animation: letter 520ms var(--spring) both; }
  @keyframes letter { from { transform: translateY(0.6em) rotate(8deg); opacity: 0; } }

  .rise { animation: rise 520ms var(--spring) both; }
  @keyframes rise { from { transform: translateY(14px); opacity: 0; } }

  .button::after { animation: glint 4.5s ease-in-out 2s infinite; }
  @keyframes glint { 0% { transform: translateX(-120%); } 22%, 100% { transform: translateX(120%); } }
  .button.saved::after { animation: none; }
}
