/* Studio Badbadak — one stylesheet, no external requests (works on the national network). */

@font-face {
  font-family: "Yekan";
  src: url("fonts/Yekan.ttf") format("truetype");
  font-display: swap;
}

:root {
  --sky-top: #2a8cff;
  --sky-mid: #5fbdff;
  --sky-low: #ffd6a0;
  --sun: #ffd25e;
  --hill-1: #8be0a4;
  --hill-2: #5cc98a;

  --bg: #f6fbff;
  --surface: #ffffff;
  --surface-2: #eef6ff;
  --ink: #16224a;
  --ink-2: #4a587f;
  --line: rgba(22, 34, 74, .1);
  --glass: rgba(255, 255, 255, .62);
  --glass-line: rgba(255, 255, 255, .8);
  --shadow: 0 24px 60px -24px rgba(22, 50, 110, .35);

  --kite-1: #ff5a6e;  /* coral  */
  --kite-2: #ffc23c;  /* sun    */
  --kite-3: #22c7a9;  /* teal   */
  --kite-4: #7b61ff;  /* violet */
  --kite-5: #ff8a3d;  /* orange */
  --x: var(--kite-1);
  --o: var(--kite-3);

  --radius: 22px;
  --font: "Yekan", Tahoma, "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sky-top: #070b26;
    --sky-mid: #18245e;
    --sky-low: #4b3a7a;
    --sun: #f4f1ff;
    --hill-1: #1f2b5c;
    --hill-2: #141d45;

    --bg: #0b1033;
    --surface: #131a45;
    --surface-2: #19225a;
    --ink: #eef2ff;
    --ink-2: #aab4e0;
    --line: rgba(238, 242, 255, .12);
    --glass: rgba(19, 26, 69, .62);
    --glass-line: rgba(255, 255, 255, .14);
    --shadow: 0 24px 60px -24px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.9;
  overflow-x: hidden;
}
h1, h2, h3 { line-height: 1.35; margin: 0; }
p { margin: 0; }
a { color: inherit; }
svg { display: block; }

.skip {
  position: absolute; inset-inline-start: 12px; top: -60px; z-index: 50;
  background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 10px;
}
.skip:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--kite-2); outline-offset: 3px; border-radius: 8px; }

/* ── Top bar ─────────────────────────────────────────────── */
.topbar {
  position: fixed; inset: 12px 12px auto; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 1160px; margin-inline: auto;
  padding: 8px 10px 8px 18px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .35);
  transition: transform .35s ease;
}
.topbar.hide { transform: translateY(-120%); }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; font-weight: 800; font-size: 1.05rem; white-space: nowrap;
}
.brand-kite { width: 30px; height: 36px; animation: bob 4s ease-in-out infinite; }
.nav { display: flex; gap: 4px; }
.nav a {
  text-decoration: none; padding: 6px 14px; border-radius: 999px;
  color: var(--ink-2); font-size: .95rem; transition: background .2s, color .2s;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  position: relative; isolation: isolate;
  min-height: 100svh;
  display: grid; align-items: center;
  padding: 110px 16px 90px;
  overflow: hidden;
}
.sky {
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 62%, var(--sky-low) 100%);
}
.sun {
  position: absolute; width: 180px; height: 180px; border-radius: 50%;
  inset-inline-start: 8%; top: 14%;
  background: radial-gradient(circle, var(--sun) 0 45%, transparent 70%);
  filter: blur(2px);
  box-shadow: 0 0 120px 40px color-mix(in srgb, var(--sun) 45%, transparent);
  animation: glow 6s ease-in-out infinite;
}
.stars { position: absolute; inset: 0; opacity: 0; }
@media (prefers-color-scheme: dark) {
  .sun { width: 110px; height: 110px; box-shadow: 0 0 80px 20px rgba(220, 220, 255, .25); }
  .stars {
    opacity: 1;
    background-image:
      radial-gradient(1.5px 1.5px at 10% 20%, #fff 50%, transparent 51%),
      radial-gradient(1px 1px at 25% 65%, #fff 50%, transparent 51%),
      radial-gradient(1.5px 1.5px at 40% 35%, #fff 50%, transparent 51%),
      radial-gradient(1px 1px at 55% 12%, #fff 50%, transparent 51%),
      radial-gradient(2px 2px at 70% 45%, #fff 50%, transparent 51%),
      radial-gradient(1px 1px at 82% 22%, #fff 50%, transparent 51%),
      radial-gradient(1.5px 1.5px at 92% 60%, #fff 50%, transparent 51%),
      radial-gradient(1px 1px at 63% 75%, #fff 50%, transparent 51%),
      radial-gradient(1px 1px at 33% 8%, #fff 50%, transparent 51%),
      radial-gradient(1.5px 1.5px at 5% 50%, #fff 50%, transparent 51%);
    animation: twinkle 5s ease-in-out infinite alternate;
  }
  .cloud { opacity: .18 !important; }
}
.cloud {
  position: absolute; height: 46px; border-radius: 999px;
  background: #fff; opacity: .85;
  filter: drop-shadow(0 10px 18px rgba(30, 80, 160, .15));
  animation: drift linear infinite;
}
.cloud::before, .cloud::after {
  content: ""; position: absolute; background: inherit; border-radius: 50%;
}
.cloud::before { width: 60%; height: 140%; top: -70%; inset-inline-start: 14%; }
.cloud::after  { width: 40%; height: 110%; top: -45%; inset-inline-start: 50%; }
.c1 { width: 170px; top: 18%; animation-duration: 70s; animation-delay: -10s; }
.c2 { width: 120px; top: 34%; animation-duration: 55s; animation-delay: -38s; opacity: .7; transform: scale(.8); }
.c3 { width: 220px; top: 58%; animation-duration: 90s; animation-delay: -60s; opacity: .6; }
.c4 { width: 140px; top: 8%;  animation-duration: 80s; animation-delay: -25s; opacity: .55; }

.kites { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.kites .string { fill: none; stroke: var(--ink); stroke-opacity: .35; stroke-width: 1.2; }
.kites .tail { fill: none; stroke: var(--ink); stroke-opacity: .4; stroke-width: 1.2; }

.hills {
  position: absolute; inset: auto 0 0; height: 18vh; min-height: 110px;
  background:
    radial-gradient(120% 140% at 20% 100%, var(--hill-1) 0 48%, transparent 49%),
    radial-gradient(110% 160% at 85% 100%, var(--hill-2) 0 45%, transparent 46%);
}

.hero-inner {
  position: relative; z-index: 1;
  width: 100%; max-width: 1160px; margin-inline: auto;
  display: grid; grid-template-columns: 1.1fr .9fr; align-items: center; gap: 48px;
}
.eyebrow {
  display: inline-block; font-size: .85rem; font-weight: 700; letter-spacing: .02em;
  color: var(--ink); background: var(--glass); border: 1px solid var(--glass-line);
  padding: 4px 14px; border-radius: 999px; margin-bottom: 14px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
h1 {
  font-size: clamp(2.2rem, 5.6vw, 4.1rem); font-weight: 900;
  color: #fff; text-shadow: 0 4px 30px rgba(10, 40, 110, .35);
}
.hl {
  display: inline-block; padding-inline: .15em;
  background: linear-gradient(90deg, #ffe066, var(--kite-2) 45%, #ffb020);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none; filter: drop-shadow(0 3px 0 rgba(150, 60, 0, .35)) drop-shadow(0 6px 22px rgba(255, 140, 40, .45));
}
.lead {
  margin-top: 18px; max-width: 34em; font-size: clamp(1rem, 1.6vw, 1.15rem);
  color: #fff; text-shadow: 0 1px 2px rgba(10, 40, 110, .45), 0 2px 18px rgba(10, 40, 110, .55);
}
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.btn {
  --b: var(--ink);
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  padding: 12px 24px; border-radius: 999px; border: 0;
  transition: transform .2s ease, box-shadow .2s ease, background .2s;
}
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--kite-1), var(--kite-5));
  box-shadow: 0 14px 30px -12px var(--kite-1);
}
.btn-ghost {
  color: var(--ink); background: var(--glass); border: 1px solid var(--glass-line);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.btn-small { padding: 8px 18px; font-size: .9rem; color: var(--ink); background: var(--surface-2); }

/* ── Board ───────────────────────────────────────────────── */
.board-card {
  justify-self: center; width: min(100%, 400px);
  padding: 22px; border-radius: 30px;
  background: var(--glass); border: 1px solid var(--glass-line);
  backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5);
  box-shadow: var(--shadow);
  animation: float 7s ease-in-out infinite;
}
.board-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.board-head h2 { font-size: 1.25rem; }
.score { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: .8rem; padding: 2px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2);
}
.chip b { color: var(--ink); }
.chip-x { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--x) 55%, transparent); }
.chip-o { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--o) 55%, transparent); }

.board {
  position: relative;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  aspect-ratio: 1; direction: ltr;
}
.cell {
  position: relative; border: 0; padding: 0; cursor: pointer;
  border-radius: 18px; background: var(--surface);
  box-shadow: inset 0 -4px 0 var(--line), 0 6px 14px -10px rgba(0, 0, 0, .4);
  transition: transform .15s ease, background .2s;
}
.cell:hover:not(:disabled) { transform: translateY(-2px); background: var(--surface-2); }
.cell:disabled { cursor: default; }
.cell svg { position: absolute; inset: 18%; width: 64%; height: 64%; overflow: visible; }
.cell .mark-x path, .cell .mark-o circle {
  fill: none; stroke-width: 13; stroke-linecap: round;
  stroke-dasharray: 160; stroke-dashoffset: 160;
  animation: draw .38s cubic-bezier(.6, .1, .3, 1) forwards;
}
.cell .mark-x path { stroke: var(--x); }
.cell .mark-x path + path { animation-delay: .14s; }
.cell .mark-o circle { stroke: var(--o); stroke-dasharray: 220; stroke-dashoffset: 220; }
.cell.win { animation: pop .5s ease; background: color-mix(in srgb, var(--kite-2) 22%, var(--surface)); }

.win-line { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.win-line line {
  stroke: var(--ink); stroke-opacity: .85; stroke-width: 7; stroke-linecap: round;
  stroke-dasharray: 420; stroke-dashoffset: 420; opacity: 0;
}
.win-line.show line { transition: stroke-dashoffset .5s ease .2s; stroke-dashoffset: 0; opacity: 1; }

.board-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }
.status { font-weight: 700; min-height: 1.9em; }

.scroll-hint {
  position: absolute; bottom: 22px; left: 50%; translate: -50% 0; z-index: 1;
  width: 28px; height: 44px; border-radius: 999px; border: 2px solid rgba(255, 255, 255, .85);
}
.scroll-hint span {
  position: absolute; top: 8px; left: 50%; width: 4px; height: 8px; margin-left: -2px;
  border-radius: 4px; background: #fff; animation: scrolly 1.8s ease-in-out infinite;
}

/* ── Sections ────────────────────────────────────────────── */
.section { padding: 100px 16px; max-width: 1160px; margin-inline: auto; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 48px; }
.section-head .eyebrow, .about .eyebrow { background: var(--surface-2); border-color: var(--line); }
.section-head h2, .about h2, .download h2 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); font-weight: 900; }
.sub { color: var(--ink-2); margin-top: 12px; font-size: 1.05rem; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature {
  position: relative; overflow: hidden;
  padding: 26px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--line);
  transition: transform .3s ease, box-shadow .3s ease;
}
.feature::after {
  content: ""; position: absolute; width: 180px; height: 180px; border-radius: 50%;
  inset-inline-end: -70px; top: -70px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
  transition: transform .4s ease;
}
.feature:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.feature:hover::after { transform: scale(1.4); }
/* Accent per card. Classes, not inline style attributes: the CSP forbids those. */
.a1 { --accent: var(--kite-1); } .a2 { --accent: var(--kite-2); } .a3 { --accent: var(--kite-3); }
.a4 { --accent: var(--kite-4); } .a5 { --accent: var(--kite-5); }
.f-icon {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 16%, transparent); margin-bottom: 16px;
}
.f-icon svg { width: 28px; height: 28px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.feature h3 { font-size: 1.15rem; margin-bottom: 6px; }
.feature p { color: var(--ink-2); }

.about-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 56px; align-items: center; }
.about-copy p:not(.eyebrow) { color: var(--ink-2); margin-top: 16px; font-size: 1.05rem; }
.about-art {
  position: relative; aspect-ratio: 1; max-width: 380px; width: 100%; justify-self: center;
  border-radius: 36px; display: grid; place-items: center;
  background: linear-gradient(160deg, var(--sky-top), var(--sky-mid) 60%, var(--sky-low));
  box-shadow: var(--shadow);
}
.mini-board {
  width: 62%; aspect-ratio: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  transform: rotate(-8deg);
}
.mini-board span { border-radius: 14px; background: var(--glass); position: relative; }
.mini-board .x::before, .mini-board .x::after {
  content: ""; position: absolute; inset: 44% 18%; border-radius: 6px; background: var(--x);
  transform: rotate(45deg);
}
.mini-board .x::after { transform: rotate(-45deg); }
.mini-board .o::before {
  content: ""; position: absolute; inset: 20%; border-radius: 50%; border: 8px solid var(--o);
}
.about-kite { position: absolute; width: 22%; top: -6%; inset-inline-end: 4%; animation: bob 5s ease-in-out infinite; }

.download-card {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 24px;
  padding: 40px; border-radius: 32px; color: #fff;
  background:
    radial-gradient(60% 120% at 0% 0%, rgba(255, 255, 255, .25), transparent 60%),
    linear-gradient(135deg, var(--kite-4), var(--kite-1) 70%, var(--kite-5));
  box-shadow: 0 30px 60px -30px var(--kite-4);
}
.download-card p { opacity: .9; margin-top: 6px; }
.store-row { display: flex; flex-wrap: wrap; gap: 12px; }
.store {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
  padding: 10px 20px; border-radius: 16px;
  background: rgba(10, 14, 40, .82); color: #fff;
  transition: transform .2s ease, background .2s;
}
.store:hover { transform: translateY(-3px); background: rgba(10, 14, 40, .95); }
.store svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linejoin: round; }
.store span { display: flex; flex-direction: column; line-height: 1.35; font-weight: 800; }
.store small { font-weight: 400; opacity: .75; font-size: .75rem; }

/* ── Footer ──────────────────────────────────────────────── */
.footer { border-top: 1px solid var(--line); padding: 48px 16px 28px; }
.footer-inner {
  max-width: 1160px; margin-inline: auto;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 28px;
}
.footer .brand-kite { animation: none; }
.muted { color: var(--ink-2); margin-top: 8px; }
.footer-title { font-size: 1rem; margin-bottom: 6px; }
.mail { color: var(--kite-1); font-weight: 700; text-decoration: none; }
.mail:hover { text-decoration: underline; }
.copy { text-align: center; color: var(--ink-2); font-size: .85rem; margin-top: 36px; }

/* ── Reveal on scroll ────────────────────────────────────── */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s ease, transform .8s cubic-bezier(.2, .7, .2, 1); }
.reveal.in { opacity: 1; transform: none; }
.features .reveal:nth-child(2) { transition-delay: .08s; }
.features .reveal:nth-child(3) { transition-delay: .16s; }
.features .reveal:nth-child(5) { transition-delay: .08s; }
.features .reveal:nth-child(6) { transition-delay: .16s; }

/* Confetti pieces made by app.js on a win */
.confetti {
  position: fixed; top: 0; width: 9px; height: 14px; border-radius: 2px; z-index: 40; pointer-events: none;
  animation: fall var(--t, 1.6s) cubic-bezier(.3, .6, .4, 1) forwards;
}

/* ── Keyframes ───────────────────────────────────────────── */
@keyframes drift { from { transform: translateX(-30vw); } to { transform: translateX(130vw); } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-6px) rotate(4deg); } }
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }
@keyframes glow { 0%, 100% { scale: 1; } 50% { scale: 1.06; } }
@keyframes twinkle { from { opacity: .55; } to { opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { 40% { transform: scale(1.08); } }
@keyframes scrolly { 0% { opacity: 0; transform: translateY(0); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }
@keyframes fall {
  to { transform: translate(var(--dx), 105vh) rotate(var(--r)); opacity: .9; }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: 36px; text-align: center; }
  .cta-row { justify-content: center; }
  .lead { margin-inline: auto; }
  .features { grid-template-columns: repeat(2, 1fr); }
  .about-grid { grid-template-columns: 1fr; gap: 36px; text-align: center; }
  .download-card { justify-content: center; text-align: center; }
  .store-row { justify-content: center; }
}
@media (max-width: 640px) {
  .nav { display: none; }
  .topbar { inset: 10px 10px auto; padding: 8px 16px; justify-content: center; }
  .hero { padding-top: 200px; } /* a band of open sky for the kites */
  .features { grid-template-columns: 1fr; }
  .section { padding: 72px 16px; }
  .download-card { padding: 28px 20px; }
  .board-card { padding: 16px; border-radius: 24px; }
  .sun { width: 120px; height: 120px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  .cell .mark-x path, .cell .mark-o circle { stroke-dashoffset: 0; }
}
