/*
 * Reusable components: nav, buttons, cards, proof strip, device frame, footer, forms.
 * Everything here consumes tokens.css. No literal colors, no literal durations.
 */

/* ── Sticky nav (D2.2 §1) ─────────────────────────────────────────────────────────────────────── */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--page) 82%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-standard) var(--ease-standard),
    background-color var(--dur-standard) var(--ease-standard);
}

/* Blur is a nice-to-have; it is applied only where supported and is never animated. */
@supports (backdrop-filter: blur(12px)) {
  .nav {
    backdrop-filter: blur(12px) saturate(1.4);
  }
}

.nav.is-stuck {
  border-bottom-color: var(--line);
}

.nav__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-24);
  min-height: 64px;
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-8);
  font-weight: 700;
  font-size: var(--fs-16);
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav__brand svg {
  width: 28px;
  height: 28px;
  flex: none;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-left: auto;
}

.nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--sp-12);
  border-radius: var(--r-12);
  color: var(--ink-2);
  text-decoration: none;
  font-size: var(--fs-14);
  font-weight: 550;
  transition: color var(--dur-fast) var(--ease-standard),
    background-color var(--dur-fast) var(--ease-standard);
}

.nav__link:hover {
  color: var(--ink);
  background: var(--surface-2);
}

@media (max-width: 860px) {
  .nav__links .is-secondary {
    display: none;
  }
}

/* ── Buttons ──────────────────────────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-8);
  min-height: 48px;
  padding: 0 var(--sp-24);
  border: 1px solid transparent;
  border-radius: var(--r-full);
  font: inherit;
  font-size: var(--fs-16);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease-standard),
    background-color var(--dur-fast) var(--ease-standard),
    border-color var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-fast) var(--ease-standard);
}

.btn:active {
  transform: translateY(1px);
}

@media (prefers-reduced-motion: reduce) {
  .btn:active {
    transform: none;
  }
}

.btn--primary {
  background: var(--brand-600);
  color: var(--on-brand);
  box-shadow: var(--shadow-sm);
}

.btn--primary:hover {
  background: var(--brand-500);
  color: var(--on-brand);
  box-shadow: var(--shadow-md);
}

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn--ghost:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.btn--block {
  width: 100%;
}

/* ── Cards + feature stories ──────────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-18);
  padding: var(--sp-24);
  box-shadow: var(--shadow-sm);
}

.story {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--sp-48);
  align-items: center;
}

.story__copy {
  grid-column: span 6;
}

.story__media {
  grid-column: span 6;
}

/* Alternating: even stories put the media first, so the page reads as a rhythm, not a list. */
.story--flip .story__copy {
  order: 2;
}

@media (max-width: 900px) {
  .story {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--sp-32);
  }
  .story__copy,
  .story__media {
    grid-column: 1 / -1;
  }
  .story--flip .story__copy {
    order: 0;
  }
}

/* ── Proof strip (D2.2 §3) ────────────────────────────────────────────────────────────────────── */

.proof {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-16);
  border-block: 1px solid var(--line);
  padding-block: var(--sp-32);
}

.proof__item {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.proof__label {
  font-size: var(--fs-14);
  font-weight: 650;
  color: var(--ink);
}

.proof__detail {
  font-size: var(--fs-14);
  color: var(--muted);
  margin: 0;
}

@media (max-width: 900px) {
  .proof {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-24);
  }
}

/* ── Device frame for real product screenshots (D2.4) ─────────────────────────────────────────── */

/*
 * A neutral bezel, deliberately: the screenshots are real renders of the Android app, whose accent is
 * the platform blue, while this site's palette is emerald. Framing them on a neutral surface lets both
 * read as themselves instead of fighting. `aspect-ratio` + explicit width/height keep CLS at 0.
 */
.device {
  position: relative;
  margin-inline: auto;
  width: min(280px, 100%);
  border-radius: var(--r-28);
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}

.device img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 680 / 1432;
  border-radius: 20px;
  background: var(--surface);
}

.device--lg {
  width: min(340px, 100%);
}

/* The hero lead screen. Big enough that the net-worth figure reads at a glance - that is the whole
   point of a "product as proof" hero. */
.device--hero {
  width: min(400px, 100%);
}

.device__caption {
  margin: var(--sp-12) 0 0;
  text-align: center;
  font-size: var(--fs-12);
  color: var(--faint);
}

/* ── Pricing ──────────────────────────────────────────────────────────────────────────────────── */

.tiers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-16);
}

.tier {
  display: flex;
  flex-direction: column;
  gap: var(--sp-8);
}

.tier__price {
  font-size: var(--fs-32);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.tier__note {
  font-size: var(--fs-14);
  color: var(--muted);
  margin: 0;
}

@media (max-width: 860px) {
  .tiers {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ── Footer ───────────────────────────────────────────────────────────────────────────────────── */

.footer {
  border-top: 1px solid var(--line);
  padding-block: var(--sp-48);
  color: var(--muted);
  font-size: var(--fs-14);
}

.footer__grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-24);
  align-items: center;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-16);
  margin-left: auto;
}

.footer a {
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.footer a:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* ── Theme toggle ─────────────────────────────────────────────────────────────────────────────── */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-standard),
    color var(--dur-fast) var(--ease-standard);
}

.theme-toggle:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* Show the moon in light mode and the sun in dark, so the icon states the ACTION, not the state. */
.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}

/* ── Forms (delete-account, shared) ───────────────────────────────────────────────────────────── */

.field {
  display: block;
  margin-block: var(--sp-16) var(--sp-8);
  font-weight: 600;
  font-size: var(--fs-14);
}

.input {
  width: 100%;
  min-height: 48px;
  padding: var(--sp-12) var(--sp-16);
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-12);
}

.input:focus-visible {
  border-color: var(--brand-600);
}

.note {
  font-size: var(--fs-14);
  color: var(--muted);
}
