/* 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; --on-accent: #17185c;
  --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; --on-accent: #ffffff;
    --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; --on-accent: #17185c;
    --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; --on-accent: #ffffff;
    --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: var(--on-accent); font-weight: 700;
  padding: 13px 22px; border-radius: 12px; font-size: 1.02rem;
}
.cta:hover { background: var(--accent-strong); color: var(--on-accent); 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-page { padding-top: 40px; padding-bottom: 20px; }
.language-divider { border: 0; border-top: 1px solid var(--border); margin: 48px 0; }
.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: var(--on-accent); padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; z-index: 20; }

/* Temporary event pages — an event pass, not a permanent public profile. */
.event-page .site-header { position: relative; }
.event-page {
  --event-brand-bg: var(--surface-2);
  --event-brand-text: var(--text);
}
.event-page.event-branded {
  --accent: var(--event-accent-dark);
  --accent-strong: var(--event-surface-tint-dark);
  --on-accent: var(--event-on-accent-dark);
  --event-brand-bg: var(--event-accent-container-dark);
  --event-brand-text: var(--event-on-accent-container-dark);
}
@media (prefers-color-scheme: light) {
  .event-page.event-branded {
    --accent: var(--event-accent-light);
    --accent-strong: var(--event-surface-tint-light);
    --on-accent: var(--event-on-accent-light);
    --event-brand-bg: var(--event-accent-container-light);
    --event-brand-text: var(--event-on-accent-container-light);
  }
  #themeswitch:checked ~ .page.event-page.event-branded {
    --accent: var(--event-accent-dark);
    --accent-strong: var(--event-surface-tint-dark);
    --on-accent: var(--event-on-accent-dark);
    --event-brand-bg: var(--event-accent-container-dark);
    --event-brand-text: var(--event-on-accent-container-dark);
  }
}
@media (prefers-color-scheme: dark) {
  #themeswitch:checked ~ .page.event-page.event-branded {
    --accent: var(--event-accent-light);
    --accent-strong: var(--event-surface-tint-light);
    --on-accent: var(--event-on-accent-light);
    --event-brand-bg: var(--event-accent-container-light);
    --event-brand-text: var(--event-on-accent-container-light);
  }
}
.event-shell {
  width: min(100% - 32px, 620px);
  margin: 0 auto;
  padding: clamp(40px, 9vw, 88px) 0 48px;
}
.event-pass {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: clamp(24px, 7vw, 48px);
  box-shadow: var(--shadow);
}
.event-pass::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 7px;
  background: repeating-linear-gradient(
    90deg,
    var(--accent) 0 26px,
    transparent 26px 34px
  );
}
.event-kicker,
.event-company {
  margin: 0 0 8px;
  color: var(--accent);
  font: 700 .78rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.event-company { color: var(--text-muted); }
.event-pass h1 {
  margin: 0 0 24px;
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(2rem, 8vw, 3.3rem);
  line-height: 1.05;
  letter-spacing: -.04em;
  overflow-wrap: anywhere;
}
.event-state { min-height: 220px; display: grid; place-content: center; text-align: center; }
.event-state[hidden], [hidden] { display: none !important; }
.event-state h1 { font-size: clamp(1.7rem, 6vw, 2.5rem); }
.event-state p { max-width: 42ch; margin: 0 auto; color: var(--text-muted); }
.event-pulse {
  width: 18px;
  height: 18px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--accent);
  animation: event-pulse 1.3s ease-in-out infinite;
}
@keyframes event-pulse { 50% { opacity: .35; transform: scale(.75); } }
@media (prefers-reduced-motion: reduce) { .event-pulse { animation: none; } }
.event-brand {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  margin: 12px 0 28px;
  padding: 14px;
  border-radius: 16px;
  background: var(--event-brand-bg);
  color: var(--event-brand-text);
}
.event-mark {
  width: 100%;
  height: clamp(140px, 28vw, 220px);
  border-radius: 12px;
  background: rgba(255, 255, 255, .94);
  object-fit: contain;
}
.event-brand-copy { min-width: 0; }
.event-brand-label {
  display: block;
  margin-bottom: 2px;
  color: var(--event-brand-text);
  opacity: .76;
  font: 700 .72rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.event-context-name {
  display: block;
  color: var(--event-brand-text);
  font-weight: 750;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.event-website {
  display: inline-block;
  margin-top: 4px;
  color: var(--event-brand-text);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: .08em;
  text-underline-offset: .18em;
}
.event-website:hover { color: var(--event-brand-text); }
.event-website:focus-visible { outline: 3px solid var(--event-brand-text); outline-offset: 3px; }
.profile-photo {
  display: block;
  width: 128px;
  height: 128px;
  margin: 12px 0 24px;
  border-radius: 28px;
  object-fit: cover;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.profile-fields {
  display: grid;
  grid-template-columns: minmax(80px, .45fr) minmax(0, 1fr);
  gap: 8px 20px;
  margin: 0;
  padding: 22px 0;
  border-block: 1px solid var(--border);
}
.profile-fields dt { color: var(--text-muted); font-size: .9rem; }
.profile-fields dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.event-expiry {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 20px 0 0;
  color: var(--text-muted);
  font-size: .88rem;
}
.event-expiry time { color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.event-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.event-actions .cta {
  min-height: 48px;
  justify-content: center;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
}
.event-actions .cta-secondary { border-color: var(--border); }
.event-actions .cta:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.fingerprint {
  margin: 20px 0 0;
  color: var(--text-muted);
  font: .76rem/1.7 ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
}
.event-window {
  display: grid;
  grid-template-columns: 1fr 40px 1fr;
  align-items: center;
  gap: 12px;
  padding: 22px 0;
  border-block: 1px solid var(--border);
}
.event-window p { margin: 0; }
.event-window p:last-child { text-align: right; }
.event-window span { display: block; color: var(--text-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.event-window time { display: block; margin-top: 4px; font-weight: 650; }
.event-timezone { margin: 10px 0 0; color: var(--text-muted); font-size: .82rem; }
.event-window-line { height: 1px; background: var(--accent); position: relative; }
.event-window-line::before,
.event-window-line::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}
.event-window-line::before { left: 0; }
.event-window-line::after { right: 0; }
.event-instruction { margin: 22px 0 0; color: var(--text-muted); }
.event-copy-status { min-height: 1.6em; margin: 12px 0 0; color: var(--text-muted); font-size: .9rem; }
.event-privacy { max-width: 54ch; margin: 18px auto 0; color: var(--text-muted); text-align: center; font-size: .84rem; }

@media (max-width: 520px) {
  .profile-fields { grid-template-columns: 1fr; gap: 2px; }
  .profile-fields dd + dt { margin-top: 10px; }
  .event-expiry { display: block; }
  .event-expiry time { display: block; margin-top: 4px; }
  .event-actions { flex-direction: column; }
  .event-actions .cta { width: 100%; }
  .event-window { grid-template-columns: 1fr; }
  .event-window p:last-child { text-align: left; }
  .event-window-line { width: 1px; height: 24px; margin-left: 5px; }
  .event-window-line::before, .event-window-line::after { left: -4px; }
  .event-window-line::before { top: 0; }
  .event-window-line::after { top: auto; bottom: 0; }
}

/* ─────────────────────────────────────────────────────────────
   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; }
