/* Tokens: dark is the default. Light tokens come from either an explicit
   [data-theme="light"] override or, when no override is set, the system
   media query. */
:root {
  --bg: #0e0e0e;
  --bg-elev: #181819;
  --text: #f4f4f5;
  --text-dim: #a1a1aa;
  --text-faint: #71717a;
  --border: #27272a;
  --coral: #e85d5d;
  --coral-light: #f4a085;
  --radius-card: 18px;
  --radius-logo: 22%;
  --maxw: 720px;
  --font-rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #fafafa;
  --bg-elev: #ffffff;
  --text: #18181b;
  --text-dim: #52525b;
  --text-faint: #a1a1aa;
  --border: #e4e4e7;
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #fafafa;
    --bg-elev: #ffffff;
    --text: #18181b;
    --text-dim: #52525b;
    --text-faint: #a1a1aa;
    --border: #e4e4e7;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-rounded);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

html {
  min-height: 100vh;
  min-height: 100lvh;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--coral); }

/* ---------- Scroll reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s ease, transform 0.8s ease;
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- Ambient background (index) ---------- */
/* Drifting radial blobs behind a frosted-glass blur — ported from
   OnboardingBackgroundView.swift in the iOS app. */

.ambient {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  height: 100lvh;
  overflow: hidden;
  pointer-events: none;
  background: var(--bg);
}

/* Fade blob colors to solid bg near the top and bottom edges so they
   blend seamlessly with iOS Safari's chrome (which always paints a
   solid theme-color over those zones). */
.ambient::before,
.ambient::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 140px;
  pointer-events: none;
  z-index: 5;
}
.ambient::before {
  top: 0;
  background: linear-gradient(to bottom, var(--bg) 0%, transparent 100%);
}
.ambient::after {
  bottom: 0;
  background: linear-gradient(to top, var(--bg) 0%, transparent 100%);
}

.ambient__blob {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%);
  will-change: opacity, left, top;
}

.ambient__blob--coral {
  background: radial-gradient(circle at 50% 50%,
    rgba(232, 93, 93, 0.60) 0%,
    rgba(232, 93, 93, 0.35) 40%,
    rgba(232, 93, 93, 0.00) 100%);
}
.ambient__blob--pink {
  background: radial-gradient(circle at 50% 50%,
    rgba(235, 108, 177, 0.60) 0%,
    rgba(235, 108, 177, 0.35) 40%,
    rgba(235, 108, 177, 0.00) 100%);
}
.ambient__blob--lavender {
  background: radial-gradient(circle at 50% 50%,
    rgba(148, 121, 224, 0.60) 0%,
    rgba(148, 121, 224, 0.35) 40%,
    rgba(148, 121, 224, 0.00) 100%);
}
.ambient__blob--lime {
  background: radial-gradient(circle at 50% 50%,
    rgba(170, 204, 0, 0.55) 0%,
    rgba(170, 204, 0, 0.32) 40%,
    rgba(170, 204, 0, 0.00) 100%);
}

.ambient__blur {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  height: 100lvh;
  pointer-events: none;
  backdrop-filter: blur(60px) saturate(140%);
  -webkit-backdrop-filter: blur(60px) saturate(140%);
  background: rgba(14, 14, 14, 0.18);
}

:root[data-theme="light"] .ambient__blur { background: rgba(255, 255, 255, 0.35); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .ambient__blur { background: rgba(255, 255, 255, 0.35); }
}

@media (prefers-reduced-motion: reduce) {
  .ambient__blob { opacity: 0.55; }
}

/* ---------- Coming soon (index) ---------- */

/* ---------- Top bar ---------- */

.topbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1180px;
  margin: 0 auto;
  padding:
    max(20px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    0
    max(24px, env(safe-area-inset-left));
}

.topbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.topbar__brand:hover { color: var(--text); }

.topbar__logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-logo);
  display: block;
}

.topbar__wordmark {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ---------- Hero (copy left, device right) ---------- */

.hero {
  position: relative;
  z-index: 2;
  min-height: calc(100vh - 60px);
  min-height: calc(100dvh - 60px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  max-width: 1180px;
  margin: 0 auto;
  padding:
    32px
    max(24px, env(safe-area-inset-right))
    32px
    max(24px, env(safe-area-inset-left));
  text-align: center;
}

.hero__copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  max-width: 600px;
}

.hero__title {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: clamp(28px, 4.6vw, 44px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
}

.hero__title-em {
  font-size: clamp(60px, 11vw, 104px);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin: 4px 0;
  background: linear-gradient(90deg, var(--coral-light) 0%, var(--coral) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.hero__sub {
  margin: 0;
  max-width: 44ch;
  color: var(--text-dim);
  font-size: clamp(16px, 1.4vw, 19px);
  line-height: 1.5;
}

.hero__device {
  width: min(340px, 76vw);
}

.hero__device img {
  width: 100%;
  height: auto;
  display: block;
}

@media (min-width: 900px) {
  .hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 64px;
    text-align: left;
  }

  .hero__copy {
    align-items: flex-start;
    justify-self: end;
    max-width: 480px;
    gap: 26px;
  }

  .hero__title { align-items: flex-start; }
  .hero__sub { max-width: 38ch; }

  .hero__device {
    justify-self: start;
    width: min(440px, 100%);
  }
}

/* ---------- App Store button ---------- */

.appstore-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  border-radius: 14px;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.appstore-btn:hover {
  transform: translateY(-1px);
  opacity: 0.92;
  color: var(--bg);
}

.appstore-btn:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 3px;
}

.appstore-btn__icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.appstore-btn__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
  text-align: left;
}

.appstore-btn__small {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.78;
  letter-spacing: 0.01em;
}

.appstore-btn__large {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ---------- Shared section title ---------- */

.section-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-align: center;
  margin: 0 0 40px;
  max-width: 16ch;
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 900px) {
  .section-title { margin-bottom: 56px; }
}

/* ---------- Privacy trust strip ---------- */

.trust {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: 0 auto;
  padding:
    16px
    max(24px, env(safe-area-inset-right))
    72px
    max(24px, env(safe-area-inset-left));
}

.trust__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.trust__card {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 26px 22px;
  text-align: center;
  background: color-mix(in srgb, var(--bg-elev) 60%, transparent);
}

.trust__icon {
  width: 38px;
  height: 38px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--coral);
}

.trust__icon svg { width: 100%; height: 100%; }

.trust__title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}

.trust__body {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-dim);
  margin: 0;
}

@media (min-width: 900px) {
  .trust { padding: 0 32px 112px; }
  .trust__grid { grid-template-columns: repeat(3, 1fr); gap: 20px; }
  .trust__card { padding: 32px 26px; }
}

/* ---------- Final CTA ---------- */

.cta {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  text-align: center;
  padding:
    96px
    max(24px, env(safe-area-inset-right))
    96px
    max(24px, env(safe-area-inset-left));
}

.cta__title {
  font-size: clamp(40px, 7vw, 72px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0;
}

.cta__title .hero__title-em {
  display: inline-block;
  font-size: inherit;
  font-weight: 800;
  margin: 0;
}

@media (min-width: 900px) {
  .cta { padding: 140px 32px; gap: 40px; }
}

/* ---------- Feature sections ---------- */

.features {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 80px;
  max-width: 1180px;
  margin: 0 auto;
  padding:
    64px
    max(24px, env(safe-area-inset-right))
    64px
    max(24px, env(safe-area-inset-left));
}

.feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.feature__content {
  max-width: 460px;
  text-align: center;
}

.feature__title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 14px;
}

.feature__sub {
  font-size: 17px;
  line-height: 1.5;
  color: var(--text-dim);
  margin: 0;
}

.feature__device {
  width: min(340px, 80vw);
}

.feature__device img {
  width: 100%;
  height: auto;
  display: block;
}

@media (min-width: 900px) {
  .features {
    gap: 140px;
    padding: 120px 32px 120px;
  }

  .feature {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 64px;
    align-items: center;
  }

  .feature__content {
    text-align: left;
    max-width: 440px;
  }

  .feature__title { font-size: 44px; }
  .feature__sub { font-size: 19px; }

  .feature__device { width: min(420px, 100%); }

  .feature--image-right .feature__content { grid-column: 1; grid-row: 1; justify-self: end; }
  .feature--image-right .feature__device  { grid-column: 2; grid-row: 1; justify-self: start; }

  .feature--image-left  .feature__content { grid-column: 2; grid-row: 1; justify-self: start; }
  .feature--image-left  .feature__device  { grid-column: 1; grid-row: 1; justify-self: end; }
}

/* ---------- Site footer ---------- */

.site-footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px;
  padding:
    32px
    max(24px, env(safe-area-inset-right))
    max(32px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
  font-size: 13px;
  color: var(--text-faint);
}

.site-footer a:hover { color: var(--text); }

.site-footer__dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-faint);
}

/* ---------- Document pages (privacy) ---------- */

.doc {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 56px 24px 96px;
}

.doc__header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 40px;
}

.doc__logo {
  width: 44px;
  height: 44px;
  border-radius: 22%;
}

.doc__brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.doc h1 {
  font-size: 36px;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.doc__effective {
  color: var(--text-faint);
  font-size: 14px;
  margin: 0 0 32px;
}

.doc h2 {
  font-size: 20px;
  letter-spacing: -0.01em;
  margin: 36px 0 12px;
}

.doc p, .doc li {
  color: var(--text-dim);
  line-height: 1.65;
  font-size: 16px;
}

.doc ul {
  padding-left: 20px;
  margin: 0 0 16px;
}

.doc li { margin-bottom: 6px; }

.doc a {
  color: var(--coral);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.doc a:hover { opacity: 0.8; }

.doc hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 48px 0 24px;
}

.doc__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-faint);
  margin-top: 32px;
}

.doc__back:hover { color: var(--text); }

/* ---------- Theme toggle ---------- */

.theme-toggle {
  position: fixed;
  top: max(20px, env(safe-area-inset-top));
  right: max(20px, env(safe-area-inset-right));
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elev) 70%, transparent);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  font-family: inherit;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--coral);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* Show sun in dark mode, moon in light mode. */
.theme-toggle .theme-toggle__icon--moon { display: none; }
.theme-toggle .theme-toggle__icon--sun { display: block; }

:root[data-theme="light"] .theme-toggle .theme-toggle__icon--sun { display: none; }
:root[data-theme="light"] .theme-toggle .theme-toggle__icon--moon { display: block; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .theme-toggle .theme-toggle__icon--sun { display: none; }
  :root:not([data-theme]) .theme-toggle .theme-toggle__icon--moon { display: block; }
}

@media (max-width: 520px) {
  .topbar { padding-top: max(16px, env(safe-area-inset-top)); }
  .topbar__logo { width: 32px; height: 32px; }
  .topbar__wordmark { font-size: 16px; }
  .hero__sub { font-size: 15px; }
  .hero__device { width: min(300px, 80vw); }
  .feature__title { font-size: 28px; }
  .feature__sub { font-size: 16px; }
  .feature__device { width: min(300px, 84vw); }
  .features { gap: 64px; padding-top: 48px; padding-bottom: 48px; }
  .trust { padding-bottom: 56px; }
  .cta { padding-top: 72px; padding-bottom: 72px; }
  .doc { padding: 32px 20px 64px; }
  .doc h1 { font-size: 28px; }
}
