/* Kajai, a small, hand-made landing page for a small, hand-made game.
   One centered column, the game's own blocks as the only ornament.
   Palette lifted from the Z-surge aurora app icon: cells stepping
   purple, violet, blue down the zigzag into the surge-mint ignition. */

:root {
  --bg:        #070918;
  --bg-2:      #0d1230;
  --surface:   rgba(255, 255, 255, 0.04);
  --border:    rgba(255, 255, 255, 0.10);
  --text:      #eaf0fa;
  --text-2:    #b9c6db;
  --text-3:    #93a1bd;
  --teal:      #6be6c7;
  --violet:    #8c7af2;
  --purple:    #9b6fff;
  --blue:      #5fa6f2;
  --surge:     #b3ffeb;
  --accent-grad: linear-gradient(100deg, #6be6c7, #7dc9f0 45%, #8c7af2);
  --maxw: 880px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: rgba(107, 230, 199, 0.28); color: var(--text); }

/* ── Aurora atmosphere ────────────────────────────────── */
/* Three drifting glows on different periods (mint, violet, blue, like the
   icon's cells), a faint star field, and a film-grain wash that kills
   gradient banding on big soft radials. All of it static under
   prefers-reduced-motion. */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora__base {
  position: absolute; inset: 0;
  background:
    radial-gradient(80% 50% at 50% -8%, rgba(91, 232, 194, 0.10), transparent 60%),
    radial-gradient(70% 50% at 90% 10%, rgba(155, 111, 255, 0.11), transparent 60%),
    radial-gradient(60% 45% at 8% 30%, rgba(95, 166, 242, 0.07), transparent 65%),
    /* faint low tint so scrolling to the pledge/footer keeps ambient aurora
       light instead of dropping to flat black */
    radial-gradient(85% 45% at 18% 112%, rgba(140, 122, 242, 0.08), transparent 60%),
    radial-gradient(70% 40% at 95% 100%, rgba(91, 232, 194, 0.06), transparent 60%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 58%, #060814 100%);
}
/* star field: two repeating layers of pin-prick dots, the second offset and
   larger so the repeat never reads as a grid; a slow shimmer breathes them */
.aurora__stars {
  position: absolute; inset: 0; opacity: 0.5;
  background-image:
    radial-gradient(1px 1px at 22px 34px, rgba(234, 240, 250, 0.55), transparent 100%),
    radial-gradient(1px 1px at 121px 89px, rgba(234, 240, 250, 0.35), transparent 100%),
    radial-gradient(1.5px 1.5px at 203px 151px, rgba(179, 255, 235, 0.4), transparent 100%),
    radial-gradient(1px 1px at 84px 187px, rgba(234, 240, 250, 0.3), transparent 100%),
    radial-gradient(1px 1px at 167px 241px, rgba(196, 181, 253, 0.35), transparent 100%);
  background-size: 260px 280px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.4) 45%, transparent 80%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.4) 45%, transparent 80%);
  animation: stars-breathe 9s ease-in-out infinite alternate;
}
@keyframes stars-breathe { to { opacity: 0.85; } }
.aurora__glow {
  position: absolute; width: 60vw; height: 60vw; border-radius: 50%;
  top: -16vw; left: -8vw; filter: blur(100px); opacity: 0.30;
  background: radial-gradient(circle, #2fae93 0%, transparent 65%);
  animation: drift 30s var(--ease) infinite alternate;
}
.aurora__glow--violet {
  width: 52vw; height: 52vw;
  top: -10vw; left: auto; right: -14vw; opacity: 0.22;
  background: radial-gradient(circle, #6a4fd8 0%, transparent 65%);
  animation: drift-2 38s var(--ease) infinite alternate;
}
.aurora__glow--blue {
  width: 44vw; height: 44vw;
  top: 34vh; left: -18vw; opacity: 0.14;
  background: radial-gradient(circle, #2f6fae 0%, transparent 65%);
  animation: drift-3 46s var(--ease) infinite alternate;
}
@keyframes drift   { to { transform: translate(10vw, 6vw)  scale(1.15); } }
@keyframes drift-2 { to { transform: translate(-8vw, 8vw)  scale(1.08); } }
@keyframes drift-3 { to { transform: translate(9vw, -5vw)  scale(1.12); } }
/* film grain: tiny SVG turbulence tile, barely-there, so the soft radials
   above never band on wide gamut displays */
.grain {
  position: fixed; inset: 0; z-index: 60; pointer-events: none;
  opacity: 0.05; mix-blend-mode: overlay;
  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='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .aurora__glow, .aurora__glow--violet, .aurora__glow--blue, .aurora__stars { animation: none; }
}

/* ── Layout & type ────────────────────────────────────── */
/* Horizontal gutter only. Must NOT clobber the vertical rhythm that the
   `section` rule sets, since `.wrap` is also applied directly to <section>s. */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding-inline: 24px; }
section { padding: clamp(44px, 7vw, 84px) 0; }

h1, h2 { line-height: 1.1; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); }
p { margin: 0; color: var(--text-2); }
.lead { font-size: 1.15rem; color: var(--text-2); max-width: 50ch; }
.lead em { font-style: normal; color: var(--surge); text-shadow: 0 0 18px rgba(179, 255, 235, 0.45); }

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; border-radius: 6px; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--teal); color: #04130f; padding: 10px 16px; border-radius: 0 0 10px 0; font-weight: 700;
}
.skip-link:focus { left: 0; }

.wordmark {
  display: inline-block;
  font-family: ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", system-ui, sans-serif;
  font-weight: 800; letter-spacing: -0.02em;
  /* background-clip:text paints the gradient only within the element's box, so
     a tight line-height would clip the "j" descender. Give it room. */
  line-height: 1.18; padding-bottom: 0.12em;
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
/* the hero wordmark alone gets a slow aurora pan; every gradient stop stays
   bright so the pixel-ink lockup test always finds the K's cap span */
.hero h1.wordmark {
  background-size: 180% 100%;
  animation: wordmark-pan 16s ease-in-out infinite alternate;
}
@keyframes wordmark-pan { from { background-position: 0% 0; } to { background-position: 100% 0; } }
@media (prefers-reduced-motion: reduce) { .hero h1.wordmark { animation: none; } }

.btn {
  display: inline-flex; align-items: center; gap: 10px; justify-content: center;
  font-weight: 700; font-size: 1rem; padding: 13px 22px; border-radius: 14px;
  border: 1px solid transparent; cursor: pointer;
  transition: transform 0.15s var(--ease), filter 0.15s var(--ease);
}
/* origin:border-box so the gradient fills the full box under the 1px transparent
   border, otherwise the border ring shows a fringed edge (white-ish stripe). */
.btn--primary { background: var(--accent-grad); background-origin: border-box; color: #06120f; }
.btn--primary:hover { text-decoration: none; transform: translateY(-1px); filter: brightness(1.05); }
.btn--ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn--ghost:hover { text-decoration: none; background: rgba(255, 255, 255, 0.09); }
.btn--small { padding: 9px 16px; font-size: 0.92rem; border-radius: 11px; }
.btn small { display: block; font-size: 0.7rem; font-weight: 600; opacity: 0.75; line-height: 1; margin-bottom: 2px; }
.btn b { font-size: 1.02rem; line-height: 1.1; }
@media (prefers-reduced-motion: reduce) { .btn:hover { transform: none; } }

/* ── Header (quiet: brand + one small CTA, hairline fade) ── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: rgba(7, 9, 24, 0.55);
}
.site-header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08) 30%, rgba(255, 255, 255, 0.08) 70%, transparent);
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; }
.brand img { width: 28px; height: 28px; border-radius: 8px; }
/* In the brand row the wordmark sits next to the icon. Box-centering is not
   enough; the alignment target is CAP-centering: the K's cap-to-baseline span
   centers on the icon and the j descender hangs free (counting the descender
   pushes the caps visibly high). Em-scaled nudge tuned to WebKit (the
   audience is Safari) and verified by a pixel-ink test in site.spec.ts. */
.brand .wordmark { padding-bottom: 0; line-height: 1.3; transform: translateY(-0.02em); }

/* ── Game blocks (mirrors BlockTile.swift: top-lit gradient, soft glow) ── */
.tile {
  --bs: clamp(26px, 6.4vw, 38px);
  width: var(--bs); height: var(--bs);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 22%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 100%, white 0%), color-mix(in srgb, var(--c) 84%, #070918));
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow:
    inset 0 7px 9px -5px rgba(255, 255, 255, 0.35),
    0 2px calc(var(--bs) * 0.3) color-mix(in srgb, var(--c) 50%, transparent);
}
.tile svg { width: 56%; height: 56%; fill: rgba(255, 255, 255, 0.85); }
.tile--dark-sym svg { fill: rgba(0, 0, 0, 0.5); }
.tile--mini { --bs: 26px; border-radius: 7px; flex: none; }

/* ── Hero (one centered column, like the game: nothing fighting for focus) ── */
.hero { padding-top: clamp(40px, 6vw, 64px); text-align: center; }
/* Icon + wordmark as one horizontal lockup, CAP-centered: the K's
   cap-to-baseline span centers on the icon, the j descender hangs free.
   Em-scaled nudge tuned to WebKit, verified by the pixel-ink test. */
.hero__lockup {
  display: flex; align-items: center; justify-content: center;
  gap: clamp(16px, 2.5vw, 24px); margin-bottom: 6px;
}
.hero__icon {
  flex: none;
  width: clamp(64px, 16vw, 84px); height: auto; border-radius: 20px;
  box-shadow: 0 10px 40px rgba(91, 232, 194, 0.22);
  animation: icon-breathe 7s ease-in-out infinite alternate;
}
@keyframes icon-breathe {
  from { box-shadow: 0 10px 40px rgba(91, 232, 194, 0.20); }
  to   { box-shadow: 0 10px 52px rgba(91, 232, 194, 0.34); }
}
@media (prefers-reduced-motion: reduce) { .hero__icon { animation: none; } }
.hero h1 { font-size: clamp(3.2rem, 10vw, 4.8rem); transform: translateY(0.036em); }
.hero__tag { font-size: clamp(1.3rem, 4vw, 1.7rem); color: var(--text); font-weight: 600; margin: 4px 0 22px; }
.hero .lead { margin-inline: auto; }
.hero__cta { margin-top: 28px; }
.hero__note { font-size: 0.85rem; color: var(--text-3); margin-top: 14px; letter-spacing: 0.01em; }

/* The surge line: the slogan acted out. Each tile pops in left to right;
   when the line completes it flashes through in surge light and clears,
   exactly like a monochrome line in the game. Each tile releases a little
   light mote as it dissolves (the in-game clear does the same).
   Pure CSS, ~7s loop. */
.surgeline {
  display: flex; justify-content: center; gap: 6px;
  margin: 0 0 26px; min-height: 40px;
}
.surgeline .tile { animation: surge-cycle 7s infinite both; }
.surgeline .tile::after {
  content: ""; position: absolute; left: 50%; top: 40%;
  width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%;
  background: var(--surge); opacity: 0;
  box-shadow: 0 0 8px var(--surge);
  animation: surge-mote 7s infinite both;
}
.surgeline .tile:nth-child(1), .surgeline .tile:nth-child(1)::after { animation-delay: 0.00s; }
.surgeline .tile:nth-child(2), .surgeline .tile:nth-child(2)::after { animation-delay: 0.22s; }
.surgeline .tile:nth-child(3), .surgeline .tile:nth-child(3)::after { animation-delay: 0.44s; }
.surgeline .tile:nth-child(4), .surgeline .tile:nth-child(4)::after { animation-delay: 0.66s; }
.surgeline .tile:nth-child(5), .surgeline .tile:nth-child(5)::after { animation-delay: 0.88s; }
.surgeline .tile:nth-child(6), .surgeline .tile:nth-child(6)::after { animation-delay: 1.10s; }
.surgeline .tile:nth-child(7), .surgeline .tile:nth-child(7)::after { animation-delay: 1.32s; }
.surgeline .tile:nth-child(8), .surgeline .tile:nth-child(8)::after { animation-delay: 1.54s; }
@keyframes surge-cycle {
  0%        { opacity: 0; transform: scale(0.4); }
  4%        { opacity: 1; transform: scale(1.08); }
  7%        { transform: scale(1); }
  /* hold the placed tile */
  62%       { opacity: 1; transform: scale(1); filter: none; box-shadow:
                inset 0 7px 9px -5px rgba(255, 255, 255, 0.35),
                0 2px calc(var(--bs) * 0.3) color-mix(in srgb, var(--c) 50%, transparent); }
  /* the surge sweeps through (stagger turns this into a travelling flash) */
  68%       { opacity: 1; transform: scale(1.14); filter: brightness(2.1) saturate(0.65); box-shadow:
                inset 0 7px 9px -5px rgba(255, 255, 255, 0.7),
                0 0 calc(var(--bs) * 0.6) var(--surge),
                0 0 calc(var(--bs) * 1.3) color-mix(in srgb, var(--surge) 45%, transparent); }
  /* cleared */
  76%, 100% { opacity: 0; transform: scale(0.6); filter: none; }
}
@keyframes surge-mote {
  0%, 67%   { opacity: 0; transform: translateY(0) scale(0.6); }
  70%       { opacity: 0.9; transform: translateY(-6px) scale(1); }
  88%, 100% { opacity: 0; transform: translateY(-30px) scale(0.4); }
}
@media (prefers-reduced-motion: reduce) {
  .surgeline .tile { animation: none; opacity: 1; }
  .surgeline .tile::after { animation: none; opacity: 0; }
}

/* ── App Store CTA ────────────────────────────────────── */
/* Always the official Apple badge, artwork untouched (only sized).
   Pre-launch it's inert (no dead store links) with "Coming soon" in the
   note right under it; live it's the real store link. */
.appstore-badge { display: inline-block; line-height: 0; border-radius: 13px; }
.appstore-badge img { display: block; width: 180px; height: auto; }
.appstore-badge--nav img { width: 120px; }
a.appstore-badge:hover { filter: brightness(1.12); }
.appstore-badge--soon { cursor: default; }

/* ── Hero phone, floating gently in its own glow ───────── */
.hero__shot { margin-top: clamp(44px, 6vw, 64px); position: relative; }
.hero__shot::before {
  content: ""; position: absolute; inset: -8% 18%;
  background: radial-gradient(50% 45% at 50% 42%, rgba(91, 232, 194, 0.16), rgba(140, 122, 242, 0.11) 55%, transparent 75%);
  filter: blur(24px); pointer-events: none;
}
.hero__shot .device { animation: float 9s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-9px); } }
@media (prefers-reduced-motion: reduce) { .hero__shot .device { animation: none; } }

/* ── Device frame ─────────────────────────────────────── */
.device {
  position: relative; width: 100%; max-width: 320px; margin: 0 auto;
  padding: 9px; border-radius: 44px;
  background: linear-gradient(160deg, #28324e, #0d1426 42%, #1a2440 78%, #0c1322);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.device img { display: block; width: 100%; height: auto; border-radius: 35px; }
/* a slow specular sheen drifts across the glass every few seconds; it lives
   inside the screen radius so it reads as glass, not as an overlay */
.device::after {
  content: ""; position: absolute; inset: 9px; border-radius: 35px;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.065) 50%, transparent 62%);
  background-size: 300% 100%;
  animation: sheen 11s ease-in-out infinite;
}
@keyframes sheen {
  0%, 58%   { background-position: 130% 0; }
  88%, 100% { background-position: -30% 0; }
}
@media (prefers-reduced-motion: reduce) { .device::after { animation: none; background-position: 50% 0; } }

/* ── Features (each one wears its game block) ─────────── */
.features__list {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: clamp(26px, 4vw, 40px) clamp(28px, 5vw, 56px);
  max-width: 740px; margin-inline: auto;
}
.feature h3 {
  font-size: 1.08rem; margin: 0 0 6px; color: var(--text); letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 12px;
}
.feature .tile--mini { transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease); }
.feature:hover .tile--mini {
  transform: translateY(-2px) scale(1.06);
  box-shadow:
    inset 0 7px 9px -5px rgba(255, 255, 255, 0.45),
    0 4px 18px color-mix(in srgb, var(--c) 60%, transparent);
}
@media (prefers-reduced-motion: reduce) { .feature:hover .tile--mini { transform: none; } }
.feature p { font-size: 0.96rem; color: var(--text-3); }
@media (max-width: 560px) { .features__list { grid-template-columns: 1fr; gap: 28px; } }

/* ── Pledge (glass card with a faint aurora edge) ─────── */
.pledge {
  max-width: 560px; margin-inline: auto; text-align: center;
  padding: clamp(28px, 5vw, 40px) clamp(24px, 5vw, 44px);
  border: 1px solid transparent; border-radius: 22px;
  background:
    linear-gradient(rgba(13, 18, 48, 0.66), rgba(13, 18, 48, 0.66)) padding-box,
    linear-gradient(120deg, rgba(107, 230, 199, 0.35), rgba(155, 111, 255, 0.28) 50%, rgba(95, 166, 242, 0.30)) border-box;
  box-shadow: 0 12px 50px rgba(0, 0, 0, 0.35);
}
.pledge p { font-size: 1.05rem; color: var(--text-2); }
.pledge__sig {
  margin-top: 18px; font-size: 0.92rem; color: var(--text-3);
  font-family: ui-rounded, "SF Pro Rounded", system-ui, sans-serif; font-weight: 600;
}

/* ── Scroll reveals ───────────────────────────────────── */
/* Only when JS is present (main.js tags <html class="js">), so nothing is
   ever hidden without it; reduced motion gets everything immediately.
   The hero phone reveals with opacity only: its bounding box is measured
   by the layout-geometry test and a translate would shift it. */
html.js [data-reveal] {
  opacity: 0; visibility: hidden; transform: translateY(14px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease), visibility 0s;
}
html.js [data-reveal="fade"] { transform: none; }
html.js [data-reveal].revealed { opacity: 1; visibility: visible; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html.js [data-reveal] { opacity: 1; visibility: visible; transform: none; transition: none; }
}

/* ── Footer ───────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--border); padding: 40px 0 52px; }
.site-footer__inner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; justify-content: space-between; }
.site-footer .brand { font-size: 1.05rem; }
.site-footer__links { display: flex; gap: 20px; }
.site-footer__links a { color: var(--text-2); font-weight: 600; }
.site-footer__legal { width: 100%; color: var(--text-3); font-size: 0.85rem; margin-top: 6px; }

/* ── Content pages (privacy / support) ────────────────── */
.prose { max-width: 70ch; }
.prose h1 { font-size: clamp(2rem, 6vw, 2.6rem); margin-bottom: 0.4em; }
.prose h2 { margin: 1.7em 0 0.4em; font-size: 1.3rem; }
.prose h3 { margin: 1.4em 0 0.3em; font-size: 1.05rem; color: var(--text); }
.prose p { margin: 0 0 1em; }
.prose ul { padding-left: 1.2em; color: var(--text-2); }
.prose li { margin: 0.4em 0; }
.prose a { font-weight: 600; }
.page-hero { padding-top: 48px; }

/* ── 404 ──────────────────────────────────────────────── */
.notfound { min-height: 62vh; display: grid; place-items: center; text-align: center; }
.notfound .code {
  font-family: ui-rounded, "SF Pro Rounded", system-ui, sans-serif; font-weight: 800;
  font-size: clamp(4rem, 18vw, 8rem); line-height: 1;
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}

.mt-32 { margin-top: 32px; }
