/* ==========================================================================
   Flow Factory — theme (colours sampled from the app icon, the feature graphic and the store screenshots).
   Identity: a ball factory at night. Deep indigo floor, purple machines, gold pipes and gears,
   silver tracks, yellow-and-black hazard edges around every slot, and glossy red and blue balls.
   ========================================================================== */

:root {
  /* Ground and text (a dark page: the factory floor) */
  --page: #171A57;          /* factory indigo */
  --page-deep: #1F2370;     /* gallery floor */
  --ink: #F4F3FF;
  --ink-soft: #C6C8EE;      /* 9.8:1 on --page */
  --link: #FFD15C;

  /* Bands */
  --band: #F6B826;          /* pipe gold */
  --band-ink: #171A57;
  --dark: #0E1040;          /* machine room */
  --dark-ink: #F4F3FF;
  --dark-soft: rgba(244, 243, 255, 0.76);
  --focus: #FFD15C;

  --gold: #FFC83A;
  --purple: #8D55E8;
  --purple-d: #6B33D6;
  --silver: #E9EBF7;
  --red: #EE3F4C;
  --blue: #2F80F5;
  --yellow: #FFC21F;
  --hazard: repeating-linear-gradient(-45deg, #F5C21B 0 10px, #1C1C2A 10px 20px);
}

body {
  background-image:
    radial-gradient(ellipse 70% 45% at 78% 8%, rgba(141, 85, 232, 0.32), transparent 70%),
    radial-gradient(ellipse 50% 40% at 10% 0%, rgba(47, 128, 245, 0.22), transparent 70%);
  background-repeat: no-repeat;
}

/* ---------- Bands: gold pipe band with hazard edges ---------- */
.bar { box-shadow: 0 4px 0 #1C1C2A; }
.bar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -10px;
  height: 6px;
  background: var(--hazard);
  pointer-events: none;
}
.bar .lang:hover { background: #2A2E80; }
.cta { position: relative; }
.cta::before, .cta::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 10px;
  background: var(--hazard);
}
.cta::before { top: 0; }
.cta::after { bottom: 0; }

/* ---------- Coming soon note (instead of the Google Play badge) ---------- */
.soon {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 22px 0 16px;
  border: 2px dashed var(--gold);
  border-radius: 14px;
  color: var(--gold);
  font-family: var(--font-label);
  font-weight: 500;
  font-size: 16px;
}
.soon__icon { flex: none; width: 20px; height: 20px; fill: currentColor; }
.soon--cta { border-color: var(--band-ink); color: var(--band-ink); background: rgba(255, 255, 255, 0.28); }

/* ---------- Hero ---------- */
.hero__icon { box-shadow: 0 0 0 3px var(--gold), 0 16px 34px -14px rgba(141, 85, 232, 0.9); }
.hero__name { color: var(--gold); text-shadow: 0 0.045em 0 #B9661A, 0 0.09em 0 var(--purple-d); }
.hero__rest { color: #8FC0FF; }
.hero__tagline { color: var(--ink); }
.hero__note { color: var(--ink-soft); }

/* ---------- Hero board (js/hero.js plays it once) ---------- */
.factory { position: relative; max-width: 460px; margin-inline: auto; }
.factory__svg { width: 100%; filter: drop-shadow(0 28px 40px rgba(5, 6, 30, 0.6)); }
.factory__board { fill: #444885; stroke: #D7DAF0; stroke-width: 10; }
.factory__tab { fill: #F5C21B; }
.factory__hazard { fill: #F5C21B; opacity: 0.85; }
.factory__track { fill: none; stroke: #ECEEF9; stroke-width: 28; stroke-linecap: butt; }
.factory__groove { fill: none; stroke: #C5CAE6; stroke-width: 10; }
.factory__machine { fill: #ECEEF9; stroke: #9EA4D6; stroke-width: 3; }
.factory__slot { fill: #F5F6FC; }
.factory__slot-edge { fill: none; stroke: #F5C21B; stroke-width: 4.5; stroke-dasharray: 9 6; transition: opacity 0.3s ease; }
.factory.is-filled .factory__slot-edge { opacity: 0; }
.factory__tray { fill: #F4E8CC; stroke: #C9A867; stroke-width: 3; }
.factory__cell { fill: #E6D4A9; }

/* The one moment: lift the splitter, drop it into the slot, let the balls roll. */
.factory__piece {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.75s cubic-bezier(0.3, 1.25, 0.45, 1);
}
.factory__piece.is-lifting { transform: translateY(-14px) scale(1.12); transition-duration: 0.35s; }
.factory__piece.is-lifting.is-placed { transform: translateY(-231px) scale(1.12); }
.factory.is-filled .factory__piece { transform: translateY(-231px) scale(1.1); }
.factory__ball { opacity: 0; }
.factory__ball.is-rolling { opacity: 1; }
.factory__bin.is-full { animation: ff-bin 0.6s ease-out; transform-box: fill-box; transform-origin: center bottom; }
.factory__bin.is-full .factory__lamp { fill: #FFF3B0; }
@keyframes ff-bin {
  0% { transform: none; }
  40% { transform: scale(1.08, 0.94); }
  100% { transform: none; }
}

/* ---------- Modes: three steps, each on a slot plate ---------- */
.patches {
  counter-reset: step;
  gap: 20px;
  margin-top: clamp(36px, 5vw, 56px);
}
.patch {
  counter-increment: step;
  padding-top: 0;
  background: #22266F;
  border: 2px solid #3A3F97;
  border-radius: 20px;
  overflow: hidden;
}
.patch__fabric {
  position: relative;
  height: 64px;
  border-bottom: 2px solid #3A3F97;
}
.patch__fabric::after {
  content: counter(step);
  position: absolute;
  left: clamp(20px, 2.6vw, 36px);
  bottom: -22px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--band-ink);
  font-family: var(--font-label);
  font-weight: 500;
  font-size: 20px;
  box-shadow: 0 0 0 4px #22266F;
}
.patch__title { margin-top: 18px; color: var(--ink); }
.patch--place .patch__fabric { background: var(--hazard); }
.patch--rotate .patch__fabric {
  background-color: var(--purple-d);
  background-image: repeating-conic-gradient(from 0deg at 50% 120%, rgba(255, 255, 255, 0.12) 0 8deg, transparent 8deg 16deg);
}
.patch--sort .patch__fabric {
  background-color: #2C3184;
  background-image:
    radial-gradient(circle at 30% 30%, #FFB3B8 0 2px, var(--red) 3px 12px, transparent 12.5px),
    radial-gradient(circle at 30% 30%, #B8D6FF 0 2px, var(--blue) 3px 12px, transparent 12.5px),
    radial-gradient(circle at 30% 30%, #FFE7A0 0 2px, var(--yellow) 3px 12px, transparent 12.5px);
  background-size: 96px 64px;
  background-position: 18px 18px, 50px 18px, 82px 18px;
}

/* ---------- Feature notes: a glossy ball marks each one ---------- */
.note { border-top: 2px solid #2F347F; }
.note__title::before {
  content: "";
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.85) 0 2px, var(--c, var(--red)) 4px 9px, rgba(0, 0, 0, 0.35) 11px);
}
.note--levels { --c: var(--gold); }
.note--tutorial { --c: var(--purple); }
.note--daily { --c: var(--red); }
.note--missions { --c: var(--blue); }
.note--offline { --c: #3CC58A; }
.note--languages { --c: #FF8A3D; }

/* ---------- Gallery ---------- */
.gallery { background: var(--page-deep); border-top: 10px solid transparent; border-image: var(--hazard) 10; }
.shots { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; }
.shot--wide { grid-column: 1 / -1; justify-self: center; width: min(100%, 720px); margin-top: 8px; }
.shot img {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: 18px;
  border: 4px solid #3A3F97;
  box-shadow: 0 22px 40px -24px rgba(0, 0, 0, 0.8);
}
.shot--wide img { aspect-ratio: auto; }

/* ---------- Tech inside: the blueprint of the machine room ---------- */
.tech {
  background-image:
    linear-gradient(rgba(143, 192, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(143, 192, 255, 0.07) 1px, transparent 1px);
  background-size: 32px 32px;
}
.spec { border-top: 2px solid rgba(143, 192, 255, 0.22); }
.spec__title { color: #8FC0FF; }

/* ---------- Footer meets the floor ---------- */
.foot { border-top: 1px solid #2F347F; }

/* ---------- Smaller screens ---------- */
@media (max-width: 960px) {
  .shot--wide { width: min(86vw, 560px); margin-top: 0; }
}
@media (max-width: 720px) {
  .patches { gap: 16px; }
  .patch__fabric { height: 52px; }
  .soon { min-height: 48px; font-size: 15px; }
}
