/* Ultimate Kami — "Above the cloud". Everything here comes from the app
   icon: its night, its blue, its halo, its clouds and its god. */
:root {
  --night: #03060a;
  --night-2: #07101a;
  --blue: #43bcfd;
  --blue-deep: #1f86c9;
  --text: #eef7ff;
  --muted: #8ea3b8;
  --line: rgba(67, 188, 253, 0.2);

  --f-display: "Unbounded", "Arial Black", "Helvetica Neue", sans-serif;
  --f-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --gutter: clamp(20px, 5vw, 72px);
  /* A press that locks out: up, a hair past, and settle. */
  --lockout: cubic-bezier(.2, 1.22, .36, 1);
  --ease: cubic-bezier(.22, .9, .3, 1);
  /* Phone width, never taller than the screen can show. */
  --pw: min(clamp(210px, 21vw, 300px), calc((100svh - 200px) * 9 / 19.5));
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { overflow-x: clip; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--night); color: var(--text);
  font-family: var(--f-body); font-size: 17px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; overflow-x: clip;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 6px; }

h1, h2 { margin: 0; font-family: var(--f-display); font-weight: 700; letter-spacing: -0.03em; text-wrap: balance; }
h2 { font-size: clamp(2rem, 3.9vw, 3.5rem); line-height: 1.04; }
.art { display: block; color: var(--blue); }

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(16px + env(safe-area-inset-top, 0px)) var(--gutter) 16px;
  background: linear-gradient(var(--night) 0%, color-mix(in srgb, var(--night) 70%, transparent) 60%, transparent);
}
.nav-mark { display: flex; align-items: center; gap: 10px; font-family: var(--f-display); font-weight: 700; font-size: .95rem; letter-spacing: -0.01em; }
.nav-mark img { border-radius: 8px; }
.nav-links { display: flex; gap: 32px; font-size: .88rem; color: var(--muted); }
.nav-links a:hover { color: var(--text); }
.nav-store { font-size: .85rem; font-weight: 600; color: var(--night); background: var(--blue); padding: 8px 16px; border-radius: 99px; transition: background .2s; }
.nav-store:hover { background: #7fd3ff; }

/* ---------- App Store badge ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 24px 12px 18px; border-radius: 14px;
  background: var(--blue); color: var(--night);
  box-shadow: 0 16px 40px -14px rgba(67, 188, 253, .6);
  transition: transform .45s var(--lockout), background .2s;
}
.badge:hover { transform: translateY(-4px); background: #7fd3ff; }
.badge svg { width: 26px; height: 26px; fill: currentColor; flex: none; }
.badge span { display: flex; flex-direction: column; line-height: 1.08; font-size: 1.2rem; font-weight: 600; }
.badge small { font-size: .68rem; font-weight: 500; }
.cta { display: flex; align-items: center; justify-content: center; gap: 20px; flex-wrap: wrap; }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: 100vh; min-height: 100svh; overflow: hidden; padding-top: calc(112px + env(safe-area-inset-top, 0px)); }
.lift { display: flex; flex-direction: column; align-items: center; }
.hero-copy { position: relative; z-index: 2; text-align: center; padding: 0 var(--gutter); }
.hero h1 { font-size: clamp(3rem, 8.6vw, 8.4rem); font-weight: 800; line-height: .9; letter-spacing: -0.045em; }
.hero h1 .line { display: block; }
.lede { color: var(--muted); font-size: clamp(1.05rem, 1.35vw, 1.2rem); max-width: 31em; margin: 28px auto 32px; }
/* The art hangs from the stage so the bar sits just under the buttons:
   the bar is 23.4% of the way down the icon. */
.hero-stage { position: relative; width: 100%; height: 0; --art: min(1060px, 128vw); }
.hero-art {
  position: absolute; left: 50%; top: calc(26px - var(--art) * .234);
  width: var(--art); height: var(--art); translate: -50% 0;
  /* The halo sits behind the words, so it's dimmed there; the body fades into the night. */
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,.12) 0%, rgba(0,0,0,.12) 21%, #000 27%, #000 58%, transparent 80%);
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.12) 0%, rgba(0,0,0,.12) 21%, #000 27%, #000 58%, transparent 80%);
  will-change: transform;
}
.js .lift { animation: press 1.7s var(--lockout) .1s both; }
@keyframes press { from { transform: translateY(90px); } }
.js .hero-art { animation: rise-in 1.2s var(--ease) both; }
@keyframes rise-in { from { opacity: 0; } }
.js .hero-copy > * { animation: rise-in 1s var(--ease) both; }
.js .hero-copy .lede { animation-delay: .25s; }
.js .hero-copy .cta { animation-delay: .4s; }

/* ---------- Clouds: the icon's own ---------- */
.clouds { position: absolute; left: 0; right: 0; top: 0; height: clamp(220px, 42vh, 440px); pointer-events: none; z-index: 3; }
.cloud { position: absolute; top: 0; height: 100%; width: auto; color: var(--blue); will-change: transform; }
.cloud-l { left: max(-6vw, -60px); }
.cloud-r { right: max(-6vw, -60px); }
/* The crops cut through the icon's clouds, so their inner edges fade out. */
.cloud-l { -webkit-mask-image: linear-gradient(to right, #000 55%, transparent 96%); mask-image: linear-gradient(to right, #000 55%, transparent 96%); }
.cloud-r { -webkit-mask-image: linear-gradient(to left, #000 55%, transparent 96%); mask-image: linear-gradient(to left, #000 55%, transparent 96%); }

/* ---------- Clips standing in the halo ---------- */
.clip { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 26px; }
.halo { position: relative; display: grid; place-items: center; padding: calc(var(--pw) * .12) 0; }
.halo::before, .halo::after { content: ""; position: absolute; left: 50%; top: 50%; translate: -50% -50%; border-radius: 50%; }
/* The disc, then a gap of night, then the ring, as in the icon. */
.halo::before { width: calc(var(--pw) * 1.58); aspect-ratio: 1; background: radial-gradient(circle at 50% 35%, #6fcdff, var(--blue) 45%, var(--blue-deep)); }
.halo::after { width: calc(var(--pw) * 1.98); aspect-ratio: 1; border: calc(var(--pw) * .05) solid var(--blue); }
.phone {
  position: relative; z-index: 1; width: var(--pw); aspect-ratio: 9 / 19.5;
  border-radius: 15% / 7%; background: #0b0d10;
  box-shadow: inset 0 0 0 8px #050608, 0 40px 70px -24px rgba(0,0,0,.75);
  display: grid; place-items: center; overflow: hidden;
}
.phone:not(.has-video):not(.has-still)::after {
  content: attr(data-file) ".mp4"; font-size: .78rem; color: rgba(255,255,255,.5);
  padding: 6px 12px; border: 1px dashed rgba(255,255,255,.25); border-radius: 8px;
}
.phone .still { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); object-fit: cover; border-radius: 13% / 6.2%; }
.phone.has-video { background: none; box-shadow: none; border-radius: 0; overflow: visible; }
.phone video { width: 100%; height: 100%; object-fit: contain; display: block; }
.clip figcaption { font-size: .86rem; color: var(--muted); text-align: center; max-width: 30em; }
.clip figcaption .rt { color: var(--blue); }
.clip figcaption .rt::before { content: " · "; color: var(--muted); }

/* ---------- Sections ---------- */
.split {
  max-width: 1240px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 5vw;
  padding: clamp(100px, 15vh, 170px) var(--gutter);
}
.split.flip .copy { order: 2; }
.copy { max-width: 30em; position: relative; z-index: 2; }
.copy p { color: var(--muted); font-size: clamp(1.05rem, 1.35vw, 1.2rem); margin: 26px 0 0; }
.feature, .intro, .offline { overflow-x: clip; }

.intro { position: relative; margin-top: -26vh; padding-top: 26vh; }
.intro::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 30vh; z-index: 1; pointer-events: none;
  background: linear-gradient(transparent, var(--night) 70%);
}
.intro .split { position: relative; z-index: 2; }

.offline { position: relative; }

/* ---------- Stats player ---------- */
.stats { position: relative; text-align: center; padding: clamp(100px, 15vh, 170px) var(--gutter); background: radial-gradient(70% 60% at 50% 60%, var(--night-2), var(--night)); overflow-x: clip; }
.stats-head { max-width: 760px; margin: 0 auto 44px; }
.stats-head p { color: var(--muted); font-size: clamp(1.05rem, 1.35vw, 1.2rem); margin: 24px 0 0; }
.player { --pw: min(290px, 58vw, calc((100svh - 330px) * 9 / 19.5)); }
.player-tabs { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; margin-bottom: 30px; }
.player-tabs button { position: relative; border: 0; background: none; cursor: pointer; padding: 10px 18px 16px; font-family: var(--f-display); font-size: .82rem; font-weight: 500; color: var(--muted); transition: color .2s; }
.player-tabs button:hover, .player-tabs button[aria-selected="true"] { color: var(--text); }
.player-tabs .bar { position: absolute; left: 18px; right: 18px; bottom: 5px; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.player-tabs .bar::after { content: ""; position: absolute; inset: 0; background: var(--blue); transform-origin: left; transform: scaleX(var(--p, 0)); }
.player-tabs button[aria-selected="false"] .bar::after { transform: scaleX(0); }
.player-clip { animation: swap .6s var(--lockout); }
@keyframes swap { from { opacity: 0; transform: translateY(24px); } }

/* ---------- Privacy & price ---------- */
.ledger {
  max-width: 1240px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 5vw; align-items: start;
  padding: clamp(90px, 13vh, 150px) var(--gutter);
  border-top: 1px solid var(--line);
}
.facts { margin: 0; border-top: 2px solid var(--blue); }
.facts div { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.facts dt { font-family: var(--f-display); font-weight: 500; font-size: .92rem; }
.facts dd { margin: 0; color: var(--muted); }
.facts-main dt, .facts-main dd { font-family: var(--f-display); font-size: 1.2rem; font-weight: 700; color: var(--text); }

/* ---------- Close ---------- */
.close { position: relative; overflow: hidden; text-align: center; padding-top: clamp(110px, 16vh, 180px); min-height: 100vh; min-height: 100svh; --art: min(900px, 120vw); }
.close-copy { position: relative; z-index: 2; padding: 0 var(--gutter); }
.close h2 { font-size: clamp(2.6rem, 6.4vw, 6rem); font-weight: 800; line-height: .95; letter-spacing: -0.045em; margin-bottom: 36px; }
.close-art {
  width: var(--art); height: var(--art); margin: calc(26px - var(--art) * .234) auto 0;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,.12) 0%, rgba(0,0,0,.12) 21%, #000 27%, #000 55%, transparent 78%);
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.12) 0%, rgba(0,0,0,.12) 21%, #000 27%, #000 55%, transparent 78%);
  transition: transform 1.6s var(--lockout);
}
.js .close:not(.pressed) .close-art { transform: translateY(80px); }

.footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding: 24px var(--gutter) calc(28px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem;
}
.footer p { margin: 0; }

/* ---------- Reveal: everything lifts into place ---------- */
.js .reveal { opacity: 0; transform: translateY(56px); transition: opacity .8s var(--ease), transform 1.2s var(--lockout); }
.js .reveal.in { opacity: 1; transform: none; }
.js .clip.reveal { transition-delay: .08s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .lift, .js .hero-art, .js .hero-copy > *, .player-clip { animation: none; }
  .js .reveal, .js .close:not(.pressed) .close-art { opacity: 1; transform: none; transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .split, .ledger { grid-template-columns: minmax(0, 1fr); gap: 72px; }
  .split.flip .copy { order: 0; }
  :root { --pw: min(230px, 56vw, calc((100svh - 200px) * 9 / 19.5)); }
  .intro { margin-top: -18vh; padding-top: 18vh; }
  .clouds { height: clamp(150px, 26vh, 260px); }
}
@media (max-width: 520px) {
  body { font-size: 16px; }
  .player-tabs { flex-wrap: nowrap; gap: 0; }
  .player-tabs button { padding: 10px 9px 16px; font-size: .68rem; white-space: nowrap; }
  .player-tabs .bar { left: 9px; right: 9px; }
  .facts div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .nav-mark span { font-size: .85rem; }
}
