/* ==========================================================================
   Galaxy Block Puzzle — landing page
   Palette follows the game: deep space navy/violet, candy-glass blocks, gold.
   ========================================================================== */

:root {
  --bg: #0b0620;
  --bg-2: #140b33;
  --panel: rgba(34, 22, 78, 0.55);
  --panel-border: rgba(160, 130, 255, 0.22);
  --text: #f1edff;
  --muted: #b8aee0;
  --violet: #8b5cf6;
  --magenta: #d946ef;
  --cyan: #22d3ee;
  --gold: #fbbf24;
  --gold-deep: #f59e0b;
  --radius: 20px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --font-display: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 80% -10%, rgba(139, 92, 246, 0.35), transparent 60%),
    radial-gradient(900px 600px at -10% 30%, rgba(217, 70, 239, 0.18), transparent 60%),
    radial-gradient(900px 700px at 110% 80%, rgba(34, 211, 238, 0.12), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 50%, var(--bg) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }

#starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }
.wrap--narrow { width: min(760px, 100% - 32px); }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.3rem, 5.2vw, 3.8rem); font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 600; }
p { margin: 0 0 1em; }

.grad {
  background: linear-gradient(90deg, var(--cyan), var(--violet) 45%, var(--magenta) 75%, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow {
  font-family: var(--font-display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.8rem;
  color: var(--gold);
  margin-bottom: 0.6em;
}

/* ---------- Buttons ---------- */

.btn {
  --btn-bg: rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
  padding: 0.85em 1.5em;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none;
  color: var(--text);
  background: var(--btn-bg);
  border: 1px solid var(--panel-border);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  white-space: nowrap;
}
.btn svg {
  width: 1.2em;
  height: 1.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }

.btn--primary {
  color: #2a1400;
  border: 0;
  background: linear-gradient(180deg, #ffd95a 0%, var(--gold) 45%, var(--gold-deep) 100%);
  box-shadow: 0 6px 0 #b45309, 0 12px 30px rgba(251, 191, 36, 0.35);
}
.btn--primary:hover { box-shadow: 0 8px 0 #b45309, 0 16px 36px rgba(251, 191, 36, 0.45); }
.btn--primary:active { transform: translateY(3px); box-shadow: 0 3px 0 #b45309, 0 6px 16px rgba(251, 191, 36, 0.3); }

.btn--ghost { backdrop-filter: blur(6px); }
.btn--ghost:hover { background: rgba(255, 255, 255, 0.14); }

.btn--small { padding: 0.5em 1.1em; font-size: 0.95rem; }

.cta { display: flex; flex-wrap: wrap; gap: 14px; margin: 1.6em 0 0.9em; }
.meta { color: var(--muted); font-size: 0.92rem; margin: 0; }

/* ---------- Nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(11, 6, 32, 0.6);
  border-bottom: 1px solid rgba(160, 130, 255, 0.12);
}
.nav__inner { display: flex; align-items: center; gap: 24px; height: 66px; }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 600;
}
.brand img { width: 40px; height: auto; }
.brand b { color: var(--gold); font-weight: 600; }
.nav__links { display: flex; gap: 26px; margin-inline-start: auto; }
.nav__links a { text-decoration: none; color: var(--muted); font-weight: 600; transition: color 0.15s; }
.nav__links a:hover { color: var(--text); }

@media (max-width: 720px) {
  .nav__links { display: none; }
  .studio-link { margin-inline-start: auto; }
  .brand span { display: none; }
}
@media (max-width: 520px) {
  .nav__inner { gap: 10px; }
  .nav__cta { display: none; } /* the hero has its own download buttons */
}

/* ---------- Hero ---------- */

.hero { padding: clamp(40px, 7vw, 90px) 0 clamp(60px, 8vw, 110px); }
.hero__inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}
.hero__logo {
  width: clamp(130px, 16vw, 200px);
  margin-bottom: 18px;
  filter: drop-shadow(0 16px 40px rgba(139, 92, 246, 0.55));
  animation: float 6s ease-in-out infinite;
}
.lead { font-size: 1.15rem; color: var(--muted); max-width: 34em; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-10px) rotate(2deg); }
}

@media (max-width: 900px) {
  .hero__inner { grid-template-columns: 1fr; text-align: center; }
  .hero__logo { margin-inline: auto; }
  .lead { margin-inline: auto; }
  .hero .cta { justify-content: center; }
}

/* ---------- Phone + demo board ---------- */

.phone {
  --cell: clamp(26px, 3.3vw, 38px);
  direction: ltr; /* the board is a picture of the game, so it never mirrors */
  position: relative;
  justify-self: center;
  padding: 14px;
  border-radius: 44px;
  background: linear-gradient(145deg, #2b1d63, #120a2c);
  box-shadow:
    0 0 0 2px rgba(160, 130, 255, 0.35),
    0 0 80px rgba(139, 92, 246, 0.35),
    var(--shadow);
}
.phone__screen {
  position: relative;
  overflow: hidden;
  border-radius: 32px;
  padding: 18px 16px 20px;
  background:
    radial-gradient(400px 300px at 50% 0%, rgba(139, 92, 246, 0.45), transparent 70%),
    linear-gradient(180deg, #1c1150, #0e0826);
}

.hud { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; }
.hud__score { display: flex; flex-direction: column; line-height: 1.1; }
.hud__score small { font-size: 0.66rem; letter-spacing: 0.16em; color: var(--muted); font-weight: 700; }
.hud__score strong { font-family: var(--font-display); font-size: 1.6rem; color: #fff; font-variant-numeric: tabular-nums; }
.hud__stars { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 600; font-size: 0.9rem; }
.hud__stars img { width: 22px; }
.bar { width: 80px; height: 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-deep), #ffe27a);
  transition: width 0.5s ease;
}

.board {
  display: grid;
  grid-template-columns: repeat(9, var(--cell));
  grid-template-rows: repeat(9, var(--cell));
  gap: 2px;
  padding: 6px;
  border-radius: 14px;
  background: rgba(8, 4, 24, 0.75);
  box-shadow: inset 0 0 0 1px rgba(160, 130, 255, 0.2);
}
.cell {
  position: relative;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.05);
  background-size: cover;
}
.cell.filled { background-color: transparent; animation: pop 0.28s ease-out; }
.cell.ghost { background-color: rgba(255, 255, 255, 0.28); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55); }
.cell.clearing { animation: clear 0.42s ease-in forwards; }
.cell.star::after {
  content: "";
  position: absolute;
  inset: 14%;
  background: url("../assets/img/star.webp") center / contain no-repeat;
  animation: twinkle 1.6s ease-in-out infinite;
}

@keyframes pop {
  0% { transform: scale(0.6); }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
@keyframes clear {
  0% { transform: scale(1); filter: brightness(1); }
  35% { transform: scale(1.12); filter: brightness(2.2); }
  100% { transform: scale(0); filter: brightness(3); opacity: 0; }
}
@keyframes twinkle {
  0%, 100% { transform: scale(0.9) rotate(-6deg); }
  50% { transform: scale(1.05) rotate(6deg); }
}

.tray {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  justify-items: center;
  height: calc(var(--cell) * 3);
  margin-top: 14px;
}
.piece {
  display: grid;
  gap: 1px;
  transition: transform 0.35s ease, opacity 0.35s ease;
}
.piece i { width: calc(var(--cell) * 0.52); height: calc(var(--cell) * 0.52); border-radius: 3px; background-size: cover; }
.piece i.empty { visibility: hidden; }
.piece.picked { transform: translateY(-30px) scale(1.25); opacity: 0; }
.piece.dealt { animation: deal 0.4s ease-out backwards; }
@keyframes deal { from { transform: translateY(30px) scale(0.6); opacity: 0; } }

.banner {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 70%;
  translate: -50% -50%;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.5));
}
.banner.show { animation: banner 1.1s cubic-bezier(0.2, 1.4, 0.4, 1) forwards; }
@keyframes banner {
  0% { opacity: 0; transform: scale(0.3) rotate(-8deg); }
  25% { opacity: 1; transform: scale(1.08) rotate(2deg); }
  40% { transform: scale(1) rotate(0); }
  80% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.1) translateY(-20px); }
}

/* ---------- Sections ---------- */

.section { padding: clamp(60px, 9vw, 110px) 0; }
.section h2 { max-width: 20em; }
.section__lead { color: var(--muted); max-width: 40em; margin-bottom: 0; }

.grid { display: grid; gap: 22px; margin-top: 40px; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 960px) { .grid--4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 820px) { .grid--3 { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .grid--4 { grid-template-columns: 1fr; } }

.card,
.tool {
  padding: 28px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(8px);
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.card:hover,
.tool:hover { transform: translateY(-4px); border-color: rgba(160, 130, 255, 0.45); }
.card p,
.tool p { color: var(--muted); margin: 0; }

.card__icon { height: 64px; display: flex; align-items: center; margin-bottom: 16px; }
.card__icon img { max-height: 58px; width: auto; }
.card__icon--board {
  display: grid;
  grid-template-columns: repeat(3, 18px);
  gap: 3px;
  width: max-content;
  height: auto;
}
.card__icon--board i { width: 18px; height: 18px; border-radius: 4px; background: url("../assets/img/block-cyan.webp") center / cover; }
/* A full row crossing a full column */
.card__icon--board i:nth-child(odd):not(:nth-child(5)) { background: rgba(255, 255, 255, 0.08); }
.card__icon--board i:nth-child(4),
.card__icon--board i:nth-child(6) { background-image: url("../assets/img/block-magenta.webp"); }
.card__icon--board i:nth-child(5) { background-image: url("../assets/img/block-yellow.webp"); }

.section--tools {
  background: linear-gradient(180deg, transparent, rgba(139, 92, 246, 0.08) 30%, rgba(139, 92, 246, 0.08) 70%, transparent);
}
.tool { position: relative; text-align: center; }
.tool__icon {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin: 4px auto 16px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 10px 24px rgba(0, 0, 0, 0.35);
}
.tool__icon svg { width: 64px; height: 64px; fill: none; stroke: var(--c); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 10px var(--c)); }
.tool__icon svg .fill { fill: var(--c); stroke: none; }
.tool__icon--red { --c: #f43f5e; }
.tool__icon--green { --c: #4ade80; }
.tool__icon--blue { --c: #38bdf8; }
.tool__icon--rotate svg { stroke-width: 6; }
.tool__icon--hold {
  grid-template-columns: repeat(2, 24px);
  gap: 3px;
  place-content: center;
  border: 3px dashed rgba(251, 191, 36, 0.7);
  background: transparent;
  box-shadow: none;
}
.tool__icon--hold span { width: 24px; height: 24px; border-radius: 5px; background: url("../assets/img/block-orange.webp") center / cover; }
.tool__icon--hold span:first-child { grid-column: span 2; justify-self: center; }

.price {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 4px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--gold);
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
}
.price img { width: 18px; height: 18px; }
.price--free { padding: 3px 10px; color: #4ade80; background: rgba(74, 222, 128, 0.12); border-color: rgba(74, 222, 128, 0.35); }

/* ---------- Steps ---------- */

.steps {
  list-style: none;
  padding: 0;
  margin: 40px 0 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  counter-reset: step;
}
@media (max-width: 820px) { .steps { grid-template-columns: 1fr; } }
.step { position: relative; padding: 28px 28px 24px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--panel-border); }
.step p { color: var(--muted); margin: 0; }
.step__num {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  color: #2a1400;
  background: linear-gradient(180deg, #ffd95a, var(--gold-deep));
  box-shadow: 0 4px 0 #b45309;
}

.extras { display: flex; flex-wrap: wrap; gap: 14px 36px; margin-top: 36px; }
.extra { display: flex; align-items: center; gap: 12px; }
.extra__icon { font-size: 1.7rem; width: 32px; text-align: center; flex: none; }
.extra__svg { height: 32px; fill: none; stroke: var(--cyan); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.extra strong { display: block; font-family: var(--font-display); font-weight: 600; }
.extra span { color: var(--muted); font-size: 0.94rem; }

/* ---------- Download ---------- */

.download {
  display: flex;
  align-items: center;
  gap: clamp(24px, 5vw, 56px);
  padding: clamp(28px, 5vw, 56px);
  border-radius: 32px;
  background:
    radial-gradient(500px 300px at 0% 0%, rgba(251, 191, 36, 0.14), transparent 70%),
    radial-gradient(600px 400px at 100% 100%, rgba(217, 70, 239, 0.18), transparent 70%),
    var(--panel);
  border: 1px solid rgba(251, 191, 36, 0.3);
  box-shadow: var(--shadow);
}
.download__logo { width: clamp(110px, 14vw, 170px); flex: none; filter: drop-shadow(0 14px 30px rgba(139, 92, 246, 0.5)); }
.download__body > p:first-of-type { color: var(--muted); }
@media (max-width: 720px) {
  .download { flex-direction: column; text-align: center; }
  .download .cta { justify-content: center; }
}

.install { margin-top: 22px; color: var(--muted); }
.install summary { cursor: pointer; font-weight: 700; color: var(--text); }
.install ol { margin: 12px 0 0; padding-inline-start: 1.3em; text-align: start; }
.install li { margin-bottom: 4px; }

/* ---------- FAQ ---------- */

.faq {
  margin-top: 14px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  overflow: hidden;
}
.faq:first-of-type { margin-top: 32px; }
.faq summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 22px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.08rem;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--gold); font-size: 1.4rem; line-height: 1; transition: transform 0.2s; }
.faq[open] summary::after { transform: rotate(45deg); }
.faq p { padding: 0 22px 18px; margin: 0; color: var(--muted); }

/* ---------- Footer ---------- */

.footer { padding: 32px 0 40px; border-top: 1px solid rgba(160, 130, 255, 0.12); color: var(--muted); font-size: 0.92rem; }
.footer__inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--text); }

/* ---------- Reveal on scroll ---------- */

.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
.footer__links { display: flex; gap: 20px; }

/* ---------- Studio link (header) and studio strip ---------- */

.studio-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  text-decoration: none;
  font: 600 0.92rem var(--font-display);
  white-space: nowrap;
  background: rgba(139, 92, 246, 0.16);
  border: 1px solid rgba(160, 130, 255, 0.3);
  transition: background 0.15s;
}
[dir="rtl"] .studio-link { padding: 5px 5px 5px 12px; }
.studio-link:hover { background: rgba(139, 92, 246, 0.3); }
.studio-link svg { width: 26px; height: 26px; }

.section--studio { padding-top: 0; }
.studio {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px 26px;
  border-radius: var(--radius);
  text-decoration: none;
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.22), rgba(217, 70, 239, 0.12));
  border: 1px solid rgba(160, 130, 255, 0.35);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.studio:hover { transform: translateY(-3px); border-color: rgba(251, 191, 36, 0.5); }
.studio__mark { width: 56px; height: 56px; flex: none; }
.studio__body { display: flex; flex-direction: column; flex: 1; }
.studio__body small { color: var(--gold); font: 600 0.78rem var(--font-display); text-transform: uppercase; letter-spacing: 0.12em; }
.studio__body strong { font: 600 1.35rem var(--font-display); }
.studio__body span { color: var(--muted); }
.studio__go { font: 600 1rem var(--font-display); color: var(--gold); white-space: nowrap; }
.studio__go::after { content: " →"; }
[dir="rtl"] .studio__go::after { content: " ←"; }
@media (max-width: 620px) {
  .studio { flex-direction: column; text-align: center; }
}

/* ---------- Language menu ---------- */

.lang {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  cursor: pointer;
}
.lang:hover { color: var(--text); }
.lang svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; }
.lang select {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 600 0.92rem var(--font-body);
  cursor: pointer;
  padding: 0 2px;
}
.lang select:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; border-radius: 4px; }
.lang option { background: #1c1150; color: var(--text); }

/* ---------- Persian & Arabic ---------- */

html[lang="fa"],
html[lang="ar"] {
  --font-display: "Vazirmatn", "Fredoka", system-ui, sans-serif;
  --font-body: "Vazirmatn", "Nunito", system-ui, sans-serif;
}
/* Letter-spacing breaks the joins between Arabic-script letters */
[dir="rtl"] .eyebrow,
[dir="rtl"] .hud__score small,
[dir="rtl"] .studio__body small { letter-spacing: 0; }
[dir="rtl"] h1,
[dir="rtl"] h2 { line-height: 1.35; }
[dir="rtl"] body { line-height: 1.8; }
