/* vCardr site — shared styles.
   Theming via progressive enhancement (progressive-theme-toggle skill):
   Tier 0 = OS preference, Tier 1 = CSS-only toggle (no JS), Tier 2 = JS persistence.
   Every colour is a token on .page; the manual toggle is defined *relative to the OS*
   scheme, so it must appear in both media branches. WCAG AA contrast in both themes. */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; }

/* Keeps the toggle checkbox in the a11y tree + tab order while off-screen.
   NOT display:none (that would drop it from keyboard/screen-reader use). */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ─────────────────────────────────────────────────────────────
   THEME TOKENS — baseline is DARK; light comes via media query;
   the checked toggle flips relative to whatever the OS asked for.
   ───────────────────────────────────────────────────────────── */
.page {
  --accent: #8b9bff; --accent-strong: #aab6ff;
  --bg: #0d0f14; --surface: #161922; --surface-2: #1e2230;
  --text: #f2f4f8; --text-muted: #a2a9b6; --border: #2a2f3c;
  --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 10px 30px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  .page {                                  /* OS light → light */
    --accent: #3538cd; --accent-strong: #272aa8;
    --bg: #f6f7f9; --surface: #ffffff; --surface-2: #eef0f3;
    --text: #16181d; --text-muted: #5b6069; --border: #d9dce1;
    --shadow: 0 1px 3px rgba(16, 18, 29, .08), 0 8px 24px rgba(16, 18, 29, .06);
    color-scheme: light;
  }
  #themeswitch:checked ~ .page {           /* toggled on a light OS → dark */
    --accent: #8b9bff; --accent-strong: #aab6ff;
    --bg: #0d0f14; --surface: #161922; --surface-2: #1e2230;
    --text: #f2f4f8; --text-muted: #a2a9b6; --border: #2a2f3c;
    --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 10px 30px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

@media (prefers-color-scheme: dark) {
  #themeswitch:checked ~ .page {           /* toggled on a dark OS → light */
    --accent: #3538cd; --accent-strong: #272aa8;
    --bg: #f6f7f9; --surface: #ffffff; --surface-2: #eef0f3;
    --text: #16181d; --text-muted: #5b6069; --border: #d9dce1;
    --shadow: 0 1px 3px rgba(16, 18, 29, .08), 0 8px 24px rgba(16, 18, 29, .06);
    color-scheme: light;
  }
}

/* Wrapper fills the viewport so the painted theme covers the whole page. */
.page {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Crossfade the palette on toggle. Custom properties can't animate, but every
   rule that *reads* one tweens when its computed value changes. Explicit list —
   never `all` (would sweep in layout props). */
.page, .page *, .page *::before, .page *::after {
  transition: background-color .35s ease, border-color .35s ease,
              color .35s ease, box-shadow .35s ease;
}
@media (prefers-reduced-motion: reduce) {
  .page, .page *, .page *::before, .page *::after { transition: none; }
  html { scroll-behavior: auto; }
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(1.4) blur(10px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between; height: 60px;
}
.wordmark {
  font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em;
  color: var(--text); text-decoration: none;
}
.wordmark:hover { text-decoration: none; }
.wordmark .v { color: var(--accent); }
.nav { display: flex; align-items: center; gap: 18px; }
.nav a { color: var(--text-muted); font-weight: 600; font-size: .95rem; }
.nav a:hover { color: var(--text); text-decoration: none; }

/* Theme toggle — a <label> for the off-screen checkbox. */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; font-size: 1.2rem; line-height: 1;
  user-select: none;
}
.theme-toggle:hover { background: var(--surface-2); }
/* Focus lands on the hidden checkbox; show the ring on the visible label. */
#themeswitch:focus-visible ~ .page .theme-toggle {
  outline: 3px solid var(--accent); outline-offset: 2px;
}

/* Hero */
.hero { padding: 72px 0 48px; text-align: center; }
.hero h1 {
  font-size: clamp(2.2rem, 6vw, 3.4rem); line-height: 1.1;
  letter-spacing: -.03em; margin: 0 0 16px;
}
.hero p.lead {
  font-size: clamp(1.05rem, 2.6vw, 1.3rem); color: var(--text-muted);
  max-width: 34ch; margin: 0 auto 28px;
}
.cta {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff; font-weight: 700;
  padding: 13px 22px; border-radius: 12px; font-size: 1.02rem;
}
.cta:hover { background: var(--accent-strong); color: #fff; text-decoration: none; }
.cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
/* Android APK is the secondary route — outlined so the App Store stays primary. */
.cta-secondary {
  background: transparent; color: var(--accent);
  border: 1px solid var(--border); font-weight: 700;
}
.cta-secondary:hover { background: var(--surface-2); color: var(--accent-strong); }
.hint { color: var(--text-muted); font-size: .9rem; margin-top: 12px; }

/* Phone showcase */
.shots { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; margin: 40px 0 8px; }
.shots img {
  width: 240px; max-width: 70vw; height: auto;
  border-radius: 28px; border: 1px solid var(--border); box-shadow: var(--shadow);
}

/* Show the screenshots matching the painted theme. Defined relative to the OS
   scheme in both media branches, exactly like the tokens, so the CSS-only
   toggle swaps the artwork too — no JavaScript involved. Baseline is dark, to
   match the baseline token set above. */
.shot-light { display: none; }
.shot-dark { display: block; }

@media (prefers-color-scheme: light) {
  .shot-light { display: block; }
  .shot-dark { display: none; }
  #themeswitch:checked ~ .page .shot-light { display: none; }
  #themeswitch:checked ~ .page .shot-dark { display: block; }
}

@media (prefers-color-scheme: dark) {
  #themeswitch:checked ~ .page .shot-light { display: block; }
  #themeswitch:checked ~ .page .shot-dark { display: none; }
}

/* Sections & cards */
section { padding: 40px 0; }
h2 { font-size: clamp(1.5rem, 4vw, 2rem); letter-spacing: -.02em; margin: 0 0 8px; }
.section-sub { color: var(--text-muted); margin: 0 0 28px; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 22px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 6px; font-size: 1.1rem; }
/* A short accent rule replaces the icon the cards used to carry — it restores
   the vertical rhythm without depending on emoji fonts. Pseudo-element, so the
   markup stays plain headings. */
.card h3::before {
  content: "";
  display: block;
  width: 28px;
  height: 3px;
  margin-bottom: 14px;
  border-radius: 2px;
  background: var(--accent);
}
.card p { margin: 0; color: var(--text-muted); }

/* Prose (support / privacy) */
.prose {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: clamp(20px, 4vw, 40px); box-shadow: var(--shadow);
}
.prose h1 { margin-top: 0; letter-spacing: -.02em; }
.prose h2 { margin-top: 32px; font-size: 1.3rem; }
.prose h2:first-of-type { margin-top: 8px; }
.prose ul { padding-left: 1.2em; }
.prose li { margin: 6px 0; }
.prose .updated { color: var(--text-muted); font-size: .9rem; }
.faq { margin: 0; }
.faq dt { font-weight: 700; margin-top: 20px; }
.faq dd { margin: 6px 0 0; color: var(--text-muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 28px 0 48px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; }
.site-footer .links { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer a { color: var(--text-muted); font-weight: 600; }
.site-footer a:hover { color: var(--text); text-decoration: none; }
.site-footer .copy { color: var(--text-muted); font-size: .9rem; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; z-index: 20; }

/* ─────────────────────────────────────────────────────────────
   Animated wordmark (index only) — ports the app's "vCardQR"
   naming-story micro-animation. Progressive: with no JS the
   markup renders a static "vCardr". JS drives the keyframes.
   ───────────────────────────────────────────────────────────── */
.wordmark-anim .wm {
  display: inline-flex; align-items: baseline; position: relative; white-space: nowrap;
}
/* Opaque occluder the Q is crushed behind. */
.wm-vcard { position: relative; z-index: 2; background: var(--bg); }
/* Reserved-width slot; its width is what pushes the r right. Q overflows it. */
.wm-qslot { position: relative; z-index: 1; display: inline-block; width: 0; overflow: visible; }
.wm-q { display: inline-block; opacity: 0; transform-origin: center; will-change: transform, opacity; }
/* r ⇄ R cross-fade; an invisible sizer holds the baseline/height. */
.wm-rslot { position: relative; z-index: 2; display: inline-block; overflow: visible; }
.wm-r-sizer { visibility: hidden; }
.wm-r-lower, .wm-r-upper { position: absolute; left: 0; bottom: 0; }
.wm-r-upper { opacity: 0; }
