:root {
  /* palette in OKLCH (perceptual) — values computed from the original hex, visually identical */
  --bg: oklch(0.187 0.025 214);          /* #05161a */
  --bg-deep: oklch(0.135 0.017 210);     /* #020a0c */
  --text: oklch(0.971 0.004 220);        /* #f3f6f7 */
  --muted: oklch(0.676 0.020 222);       /* #8a9aa0 */
  --accent: oklch(0.801 0.128 202.5);    /* #2fd6e2 */
  --accent-strong: oklch(0.86 0.128 202.5); /* hover — one tonal step up */
  --cta: #0f8190;                        /* deep teal — legible with white text (4.6:1) */
  --cta-hover: #119aa8;
  --card: rgba(255, 255, 255, 0.035);
  --hairline: rgba(255, 255, 255, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; background: var(--bg-deep); }

/* Page-anchored gradient: teal glow pooled at the bottom of the whole document,
   fading up to near-black at the top. Lives on `body` (full page height) rather
   than a fixed pseudo so it spans the entire scroll, not just the viewport. */
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Helvetica, Arial, sans-serif;
  min-height: 100vh;
  background: radial-gradient(135% 52% at 50% 100%, #0b2a37 0%, #06181e 34%, var(--bg-deep) 68%) no-repeat;
  color: var(--text);
  line-height: 1.5;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--accent); color: #04181c; }

.nobr { white-space: nowrap; }

a { color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Screen-reader-only text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link — visible only on focus */
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: #04181c;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 10px;
  transform: translateY(-150%);
  transition: transform 0.2s ease;
}
.skip-link:focus-visible { transform: translateY(0); outline-offset: 2px; }

/* Entrance reveals (only when JS is active) — Jakub's recipe: fade + small rise + slight unblur */
.anim .reveal {
  opacity: 0;
  transform: translateY(9px);
  filter: blur(4px);
  transition:
    opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.anim .reveal.in {
  opacity: 1;
  transform: none;
  filter: none;
}

main { width: 100%; }

/* ---- Type ---- */
h1 {
  font-size: clamp(40px, 7vw, 62px);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin-bottom: 20px;
  max-width: 13ch;
  text-wrap: balance;
}
h2 {
  font-size: clamp(26px, 3.6vw, 37px);
  font-weight: 500;
  letter-spacing: -0.006em;
  line-height: 1.14;
  margin-bottom: 15px;
  max-width: 16ch;
  text-wrap: balance;
}
.lede {
  font-size: clamp(16px, 2.2vw, 19px);
  font-weight: 300;
  letter-spacing: -0.003em;
  color: #cdd7da;
  max-width: 34ch;
  text-wrap: pretty;
}

/* ---- App Store badge button ---- */
.badge {
  display: inline-block;
  margin-top: 30px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, filter 0.18s ease;
}
.badge img { display: block; height: 54px; width: auto; }
.badge:hover { transform: translateY(-1px); }
.badge:active { transform: scale(0.96); opacity: 0.92; }

/* App Store rating (real: 4.8 from 34 ratings) */
.rating {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 16px;
  font-size: 14px;
  font-weight: 300;
  color: #cdd7da;
  letter-spacing: 0.1px;
}
.rating .stars {
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 1px;
}
.rating-text { font-variant-numeric: tabular-nums; }

.note {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 300;
  color: var(--muted);
}

/* ---- Header: brand lockup (left) + Get (right) ---- */
.brand {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
}
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}
.brand-name {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
}
.get-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 22px;
  background: var(--cta);
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  border-radius: 999px;
  text-decoration: none;
  transition: transform 0.18s ease, background 0.18s ease;
}
.get-btn:hover { transform: translateY(-1px); background: var(--cta-hover); }
.get-btn:active { transform: scale(0.96); }

/* ---- Hero ---- */
/* The standalone hero is mobile-only; on desktop the hero is merged into the morph (act 1). */
.hero {
  max-width: 1040px;
  margin: 0 auto;
  padding: 52px 24px 92px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}
@media (min-width: 761px) {
  .hero { display: none; }
}
/* caption source for the mobile morph step 0 — never shown directly */
.for-caption { display: none; }

/* ---- Sticky morph ---- */
.scrolly-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: start;
}
.steps { min-width: 0; }
.step {
  min-height: 74vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
}
.step h2 { max-width: 14ch; }
.step p {
  font-size: clamp(15px, 2vw, 18px);
  font-weight: 300;
  letter-spacing: -0.003em;
  color: #cdd7da;
  max-width: 32ch;
  text-wrap: pretty;
}
.step-visual { display: none; }

/* Hero = act 1 of the pinned sequence */
.hero-step { min-height: 90vh; }
.hero-step h1 { margin-bottom: 20px; }
.hero-step .lede {
  font-size: clamp(16px, 2.2vw, 19px);
  font-weight: 300;
  letter-spacing: -0.003em;
  color: #cdd7da;
  max-width: 34ch;
  text-wrap: pretty;
}
.hero-step .badge { margin-top: 30px; }
.hero-step .rating { margin-top: 16px; }
.hero-step .note { font-size: 14px; font-weight: 300; color: var(--muted); margin-top: 10px; }

.visual {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.visual-stage {
  position: relative;
  width: 286px;
  aspect-ratio: 589 / 1655;
  filter: drop-shadow(0 36px 70px rgba(0, 0, 0, 0.55));
}
/* base layer always opaque so the page background never shows between screens;
   each screen cross-dissolves in place, no movement */
.visual-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: auto;
  opacity: 0;
  will-change: opacity;
  transition: opacity 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}
.visual-stage img.on { opacity: 1; }

/* Captions + dots are only used by the mobile pinned morph */
.visual-captions { display: none; }
.visual-dots { display: none; }

/* ---- At home on iOS ---- */
.ios {
  max-width: 1040px;
  margin: 0 auto;
  padding: 112px 24px 104px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}
.ios-grid {
  margin-top: 52px;
  width: 100%;
  max-width: 880px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 40px;
}
/* four across on big screens */
@media (min-width: 920px) {
  .ios-grid {
    grid-template-columns: repeat(4, 1fr);
    max-width: none;
    gap: 30px;
  }
}
.ios-card {
  padding: 22px 0;
  text-align: left;
}
/* fixed-height icon slot so a non-square logo (Widgets) causes no layout shift */
.ios-ic {
  display: flex;
  align-items: center;
  height: 52px;
  margin-bottom: 16px;
}
.ios-ic img {
  height: 48px;
  width: auto;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 0 0 0.5px rgba(255, 255, 255, 0.06);
}
.ios-ic img.logo-wide {
  height: auto;
  width: 78px;
  border-radius: 0;
  box-shadow: none;
}
.ios-card h3 {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.004em;
  margin-bottom: 6px;
}
.ios-card p {
  font-size: 15px;
  font-weight: 300;
  letter-spacing: -0.002em;
  color: var(--muted);
  text-wrap: pretty;
  max-width: 34ch;
}

/* ---- Close ---- */
.close {
  max-width: 1040px;
  margin: 0 auto;
  padding: 112px 24px 112px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

/* ---- Legal / privacy page ---- */
.legal {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 24px 96px;
}
.legal h1 {
  font-size: clamp(30px, 5vw, 42px);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  max-width: none;
  text-wrap: balance;
}
.legal .updated {
  color: var(--muted);
  font-size: 14px;
  font-weight: 300;
  margin-bottom: 34px;
}
.legal p {
  font-size: 16px;
  font-weight: 300;
  line-height: 1.65;
  color: #cdd7da;
  margin-bottom: 18px;
  max-width: none;
  text-wrap: pretty;
}
.legal a { color: var(--accent); text-decoration: none; }
.legal a:hover { text-decoration: underline; }
.legal-back { margin-top: 36px; font-size: 15px; }

/* ---- Footer ---- */
footer {
  max-width: 1040px;
  margin: 0 auto;
  padding: 52px 24px 60px;
  text-align: left;
  border-top: 1px solid var(--hairline);
}
footer p { font-size: 13.5px; font-weight: 300; }
footer .muted { color: var(--muted); margin-top: 5px; }
footer .credit { margin-top: 14px; color: #7c8a90; }
footer .credit a {
  color: #aeb9bd;
  text-decoration: none;
  transition: color 0.18s ease;
}
footer .credit a:hover { color: var(--accent-strong); }

/* ---- Modal ---- */
.modal[hidden] { display: none; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 10, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 320px;
  background: #fdfdfd;
  color: #0a1316;
  border-radius: 26px;
  padding: 30px 26px 24px;
  text-align: center;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(10px) scale(0.97);
  filter: blur(3px);
  transition:
    opacity 0.3s ease,
    transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.3s ease;
}
.modal.is-open .modal-backdrop { opacity: 1; }
.modal.is-open .modal-card { opacity: 1; transform: translateY(0) scale(1); filter: none; }

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(10, 19, 22, 0.06);
  color: #4a565a;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}
/* extend the tap target to 44x44 without changing the visual size */
.modal-close::before {
  content: "";
  position: absolute;
  inset: -7px;
}
.modal-close:hover { background: rgba(10, 19, 22, 0.12); }
.modal-close:active { transform: scale(0.94); }

.qr {
  width: 188px;
  height: 188px;
  margin: 4px auto 18px;
  padding: 10px;
  border-radius: 16px;
  background: #fff;
}
.qr img { width: 100%; height: 100%; display: block; }

.modal-card h2 {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.2;
  color: #0a1316;
  margin-bottom: 5px;
  max-width: none;
}
.modal-card > p {
  font-size: 14.5px;
  font-weight: 400;
  line-height: 1.4;
  color: #5b6970;
  text-wrap: pretty;
  margin: 0 auto;
  max-width: 25ch;
}
.modal-link {
  display: inline-block;
  margin-top: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: #0a7f8a;
  text-decoration: none;
}
.modal-link:hover { text-decoration: underline; }

/* dark focus ring on the light modal card (the cyan ring is too faint on white) */
.modal-card :focus-visible { outline-color: #0a1316; }

/* ---- Responsive ---- */
@media (max-width: 760px) {
  .hero { padding-top: 34px; padding-bottom: 52px; }
  /* larger on phones, but clamped so the longest word never overflows */
  h1 {
    font-size: clamp(34px, 11vw, 50px);
    max-width: none;
  }

  /* ---- Mobile pinned morph (when JS is active): phone stays, screen + caption cross-fade ---- */
  html.anim .scrolly-inner {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
  }
  /* steps and the pinned visual share one grid cell so the phone overlays the scroll track */
  html.anim .steps { grid-area: 1 / 1; }
  html.anim .step {
    min-height: 72svh;
    padding: 0;
  }
  /* step content becomes invisible scroll spacers; the pinned overlay shows everything */
  html.anim .step h1,
  html.anim .step h2,
  html.anim .step p,
  html.anim .step .badge,
  html.anim .step-visual { display: none; }

  html.anim .visual {
    grid-area: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    position: sticky;
    top: 0;
    height: 100svh;
    padding: 7svh 0 0;
    pointer-events: none;
  }
  html.anim .visual-stage {
    width: auto;
    height: 46svh;
    aspect-ratio: 589 / 1655;
    margin: 0;
  }
  html.anim .visual-stage img {
    inset: auto;
    top: 0;
    left: 0;
    width: auto;
    height: 100%;
    transform: none;
  }
  html.anim .visual-captions {
    display: block;
    position: relative;
    width: 100%;
    height: 14svh;
    margin-top: 3svh;
    padding: 0;
    text-align: left;
  }
  html.anim .vc {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    opacity: 0;
    transform: translateY(6px);
    /* outgoing: fade out fully and quickly, so two captions never overlap */
    transition: opacity 0.22s ease, transform 0.22s ease;
  }
  html.anim .vc.on {
    opacity: 1;
    transform: none;
    /* incoming: wait for the outgoing caption to clear before fading in */
    transition: opacity 0.3s ease 0.24s, transform 0.4s ease 0.24s;
  }
  html.anim .vc h2 {
    font-size: clamp(22px, 6.2vw, 27px);
    margin-bottom: 9px;
    max-width: 17ch;
    text-wrap: balance;
  }
  html.anim .vc p {
    font-size: 15px;
    font-weight: 300;
    color: #cdd7da;
    max-width: 32ch;
    text-wrap: balance;
  }
  /* dotted pagination — which act you're on */
  html.anim .visual-dots {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 1.5svh;
  }
  html.anim .vd {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    transition: background 0.35s ease, width 0.35s ease;
  }
  html.anim .vd.on {
    width: 22px;
    border-radius: 999px;
    background: var(--accent);
  }

  /* ---- No-JS fallback: simple stacked text + screenshot ---- */
  .scrolly-inner { grid-template-columns: 1fr; gap: 0; }
  .visual { display: none; }
  .step {
    min-height: 0;
    align-items: flex-start;
    padding: 58px 0;
  }
  .step-visual {
    display: block;
    width: 100%;
    margin-top: 30px;
  }
  .step-visual img {
    display: block;
    width: 100%;
    max-width: 244px;
    height: auto;
    margin: 0 auto;
    filter: drop-shadow(0 26px 52px rgba(0, 0, 0, 0.55));
  }

  .ios { padding-top: 92px; }
  .ios-grid { grid-template-columns: 1fr; }
  .close { padding-top: 92px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .visual-stage img { transition: opacity 0.2s ease; }
  .modal-card { transition: opacity 0.2s ease; transform: none; filter: none; }
  .modal.is-open .modal-card { transform: none; }
  .anim .reveal {
    opacity: 1;
    transform: none;
    filter: none;
    transition: opacity 0.2s ease;
  }
}
