/* Spin to win. Mobile first: designed at 360-430px, centred beyond that.
   The look follows joliapp.com's homepage and Ad Studio page: the peach-pink
   hero wash, Gelica headings in plum with a gradient accent line, light Inter
   body text, white cards with soft layered shadows, pink pill buttons. Values
   are copied from joli-marketing-site/src/styles/global.css and Button.astro,
   so check there before changing a colour. No build step: this has to work in
   the WhatsApp, Instagram and LinkedIn in-app browsers. */

@font-face {
  font-family: "gelica";
  src: url("/fonts/gelica-bold.otf") format("opentype");
  font-weight: 600 700;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/Inter-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/Inter-Bold.woff2") format("woff2");
  font-weight: 600 700;
  font-display: swap;
}

:root {
  --primary: #e2327e;
  --primary-soft: hsl(339 76% 58% / 0.12);
  --heading: hsl(251 18% 19%);
  --text: hsl(242 20% 29%);
  --text-secondary: hsl(244 10% 42%);
  --text-tertiary: hsl(233 12% 56%);
  --border: hsl(220 13% 91%);
  --well: #f6f6f7;
  --gradient: linear-gradient(90deg, #fa3cab 13%, #f94c94 39%, #f87c54 67%, #f79a2c 81%, #f7a61d 94%);
  --gradient-text: linear-gradient(to right, #e2327e, #ff8a00);
  --shadow-button: 0 1px 1px rgba(0, 0, 0, 0.05), 0 4px 6px rgba(34, 42, 53, 0.04), 0 24px 68px rgba(47, 48, 55, 0.05), 0 2px 3px rgba(0, 0, 0, 0.04);
  --shadow-button-secondary: 0 1px 1px rgba(0, 0, 0, 0.03), 0 2px 4px rgba(34, 42, 53, 0.02), 0 8px 16px rgba(47, 48, 55, 0.02), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(34, 42, 53, 0.06), 0 32px 80px rgba(47, 48, 55, 0.08);
  --reel-size: min(25vw, 104px);
  color-scheme: light;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, #fdf3f0 0%, #fdf3f7 100%);
  -webkit-font-smoothing: antialiased;
}

.backdrop {
  position: fixed;
  width: 520px;
  opacity: 0.04;
  pointer-events: none;
  z-index: 0;
}
.backdrop--left { left: -300px; top: 120px; transform: rotate(-12deg); }
.backdrop--right { right: -300px; top: -40px; transform: rotate(16deg); }

.page {
  position: relative;
  z-index: 1;
  max-width: 440px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px max(40px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Masthead */
.masthead { text-align: center; }
.masthead__logo { display: block; height: 26px; width: auto; margin: 4px auto 24px; }
.eyebrow {
  display: inline-block;
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--gradient-text);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
}
.title {
  margin: 0;
  font-family: "gelica", Georgia, serif;
  font-weight: 700;
  font-size: clamp(34px, 10.5vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--heading);
  text-wrap: balance;
}
.gradient-text {
  display: block;
  background: var(--gradient-text);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
}
.standfirst { margin: 14px auto 0; max-width: 32ch; font-size: 17px; line-height: 1.5; color: var(--text-secondary); }

/* Cards */
.card {
  background: #fff;
  border: 1px solid rgba(17, 24, 39, 0.06);
  border-radius: 24px;
  box-shadow: var(--shadow-card);
}

/* Machine */
.machine { position: relative; padding: 16px; overflow: hidden; }

/* Confetti over the machine on a win (confetti.js, from transitions.dev). The
   canvas sits above everything and ignores the pointer; the entry button is
   what the flakes land on. */
.confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}
:root {
  --confetti-count: 110;
  --confetti-gravity: 1300;
  --confetti-size: 8px;
  --confetti-sway: 16;
  --confetti-bounce: 0.3;
  --confetti-hold: 1400ms;
  --confetti-fade: 600ms;
}
.reels { display: flex; justify-content: center; gap: 10px; }
.reel {
  position: relative;
  width: var(--reel-size);
  height: var(--reel-size);
  overflow: hidden;
  background: var(--well);
  border-radius: 16px;
  box-shadow: inset 0 1px 2px rgba(17, 24, 39, 0.06);
  transition: box-shadow 0.3s ease, background-color 0.3s ease;
}
.reel::after {
  /* Fade the top and bottom edges so symbols roll in and out of view. */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(var(--well), transparent 22%, transparent 78%, var(--well));
}
.reel__strip { display: flex; flex-direction: column; will-change: transform; }
.reel__strip .symbol {
  display: block;
  width: var(--reel-size);
  height: var(--reel-size);
  flex-shrink: 0;
}
.reel__strip img.symbol { padding: 18%; }
.reel__strip .symbol--emoji {
  font-size: calc(var(--reel-size) * 0.56);
  line-height: var(--reel-size);
  text-align: center;
}
.reel__strip .symbol--flag { font-size: calc(var(--reel-size) * 0.7); } /* Flags draw small in their em box. */
.symbol--emoji {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-style: normal;
  font-weight: 400;
  user-select: none;
}
.reel.is-fast .reel__strip .symbol { filter: blur(1.2px); }
.machine.is-win .reel {
  /* The site's success green (global.css --success), so a win reads as a win. */
  background: #eef9f2;
  box-shadow: inset 0 0 0 2px hsl(143 50% 44%);
}
.machine.is-win .reel::after { background: none; }

/* Stages under the reels */
.stage { margin-top: 16px; }
.stage[hidden] { display: none; }
.stage__title {
  margin: 4px 0 6px;
  text-align: center;
  font-family: "gelica", Georgia, serif;
  font-weight: 700;
  font-size: 26px;
  line-height: 1.15;
  color: var(--heading);
}
.stage__body { margin: 0 0 16px; text-align: center; font-size: 16px; line-height: 1.5; color: var(--text-secondary); }
.stage__body strong { color: var(--heading); }
.spin-note[hidden] { display: none; }
.spin-note .stage__body { margin-bottom: 14px; }
.stage__error { margin: 8px 0 0; font-size: 14px; font-weight: 600; color: #d93a3a; text-align: center; }
.stage__error[hidden] { display: none; }

/* Buttons: Button.astro's pill, primary and secondary. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 52px;
  padding: 12px 24px;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
  transition: filter 0.2s ease, transform 0.08s ease;
}
.button[hidden] { display: none; }
.button--block { width: 100%; }
.button--primary {
  position: relative;
  color: #fff;
  background: var(--primary) linear-gradient(to bottom, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0));
  box-shadow: var(--shadow-button);
}
.button--secondary {
  color: #3d3c5a;
  background: #fff;
  border: 1px solid rgba(17, 24, 39, 0.08);
  box-shadow: var(--shadow-button-secondary);
}
.button:hover { filter: brightness(0.96); }
.button:active:not(:disabled) { transform: scale(0.98); }
.button:focus-visible { outline: 3px solid var(--primary-soft); outline-offset: 2px; }
.button:disabled { cursor: default; filter: saturate(0.6) brightness(1.05); }
.button__chevron {
  width: 20px;
  height: 20px;
  margin-right: -8px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.3s ease;
}
.button:hover .button__chevron { transform: translateX(3px); }
.button__icon { width: 18px; height: 18px; fill: #0a66c2; }
.stage > .button + .button { margin-top: 10px; }

/* Entry form */
.entry { display: grid; gap: 10px; }
.entry[hidden] { display: none; }
.entry__label { font-size: 14px; font-weight: 600; color: var(--heading); }
.entry__input {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  font: inherit;
  font-size: 17px; /* 16px+ stops iOS zooming into the field. */
  color: var(--heading);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
  appearance: none;
}
.entry__input::placeholder { color: var(--text-tertiary); }
.entry__input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.entry__input[aria-invalid="true"] { border-color: #d93a3a; }
.entry__consent { margin: 2px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--text-tertiary); }
.entry__consent a { color: inherit; }

/* Goal, under the reels */
.goal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 14px 0 0;
  padding: 10px 14px;
  background: #fff5f9;
  border: 1px solid hsl(339 76% 58% / 0.2);
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--heading);
}
.goal__flags { display: inline-flex; gap: 6px; }
.goal__flags .symbol { display: inline-block; font-size: 32px; line-height: 1; letter-spacing: 0; }
.goal__flags img.symbol { width: 34px; height: 34px; }

/* How the prizes work: one quiet card, so the machine stays the thing to look at. */
.announce {
  padding: 22px 20px;
  text-align: center;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(17, 24, 39, 0.05);
  border-radius: 20px;
}
.announce__title { margin: 0 0 10px; font-size: 16px; font-weight: 700; color: var(--heading); }
/* The three prizes as one row split by hairlines, not cards inside a card. */
.prize-row {
  list-style: none;
  margin: 4px 0 16px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
.prize-row__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* Counts line up even when a name wraps. */
  gap: 4px;
  padding: 4px 8px;
  text-align: center;
}
.prize-row__item + .prize-row__item { border-left: 1px solid rgba(17, 24, 39, 0.1); }
.prize-row__count {
  font-family: "gelica", Georgia, serif;
  font-weight: 700;
  font-size: 28px;
  line-height: 1;
  color: var(--heading);
}
.prize-row__name { font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--text-secondary); }
.announce p { margin: 0 0 12px; }
.announce .announce__lead { font-size: 16px; font-weight: 700; color: var(--heading); }
.announce .button { margin-top: 6px; }

/* Terms */
.terms { font-size: 13px; line-height: 1.55; color: var(--text-tertiary); }
.terms summary { cursor: pointer; padding: 6px 0; font-weight: 600; color: var(--text-secondary); }
.terms ol { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 6px; }

@media (prefers-reduced-motion: reduce) {
  .reel.is-fast .reel__strip .symbol { filter: none; }
  .button, .reel, .button__chevron { transition: none; }
}
