/* ==========================================================================
   Touchward. Marketing site design system.
   Dark ground and glowing blue/violet, matching the app icon. Type matches
   the app (src/design/typography.ts): Josefin Sans SemiBold for headings,
   labels and buttons, with moderate tracking; Avenir Next for body text, which
   ships on Apple devices, with Nunito Sans loaded from Google Fonts as the
   fallback everywhere else. Monospace is reserved for code literals.
   ========================================================================== */

:root {
  --bg: #060c2c;
  --bg-2: #0b1a52;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.24);
  --text: #eef2ff;
  --muted: #aab4d8;
  --faint: #7f8bb5;
  --blue: #4fb0ff;
  --blue-ink: #1a6dff;
  --violet: #a58cff;
  --pink: #d4b4ff;
  --danger: #ff8a8a;
  --ok: #7ee2b8;

  --font-heading: "Josefin Sans", "Avenir Next", "Nunito Sans", Helvetica, Arial, sans-serif;
  --font-body: "Avenir Next", "Nunito Sans", "Avenir", "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --track: 0.06em; /* heading tracking, same as the app */

  --radius: 12px;
  --radius-lg: 18px;
  --container: 1040px;
  --glow: 0 0 0 1px rgba(79, 176, 255, 0.35), 0 12px 40px -12px rgba(79, 176, 255, 0.55);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; color-scheme: dark; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(900px 600px at 50% -10%, rgba(79, 176, 255, 0.18), transparent 60%),
    radial-gradient(700px 500px at 100% 100%, rgba(165, 140, 255, 0.12), transparent 60%);
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-family: var(--font-heading); font-weight: 600; line-height: 1.2; letter-spacing: var(--track); }
/* Josefin Sans sits low in its em box, so headings get a hair of top padding to look centred. */
h1, h2, h3, .btn, .eyebrow, .nav-links a, .toc a { padding-top: 0.08em; }
p { margin: 0; }
.mono { font-family: var(--font-mono); font-size: 0.94em; }
.tag { font-family: var(--font-heading); font-weight: 600; letter-spacing: var(--track); }
.link { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(79, 176, 255, 0.5); }
.link:hover { text-decoration-color: var(--blue); }

/* ---------- layout ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.section { padding: 72px 0; }
.section + .section { border-top: 1px solid var(--border); }
.center { text-align: center; }
.stack > * + * { margin-top: 14px; }
.eyebrow { font-family: var(--font-heading); font-weight: 600; font-size: 13px; color: var(--blue); letter-spacing: 0.14em; text-transform: uppercase; }
.lead { font-size: 19px; color: var(--muted); max-width: 60ch; }
.section h2 { font-size: clamp(26px, 3.6vw, 34px); margin-top: 8px; }
.section h3 { font-size: 19px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.contact-grid { grid-template-columns: 1.4fr 1fr; align-items: start; }
@media (max-width: 820px) { .grid-2, .grid-3, .contact-grid { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
}
.card h3 { margin-bottom: 8px; }
.card p, .card li { color: var(--muted); font-size: 15.5px; }
.card ul { margin: 10px 0 0; padding-left: 18px; }
.card li + li { margin-top: 6px; }
.card code { font-family: var(--font-mono); font-size: 13px; color: var(--pink); background: rgba(255, 255, 255, 0.06); padding: 1px 6px; border-radius: 6px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--font-heading); font-size: 15px; font-weight: 600; letter-spacing: var(--track);
  padding: 13px 22px; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; white-space: nowrap;
  transition: transform .12s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: linear-gradient(135deg, var(--blue) 0%, var(--violet) 100%); color: #06102e; box-shadow: var(--glow); }
.btn-primary:hover { box-shadow: 0 0 0 1px rgba(79, 176, 255, 0.6), 0 16px 48px -12px rgba(79, 176, 255, 0.8); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--text); }
.btn-lg { padding: 16px 28px; font-size: 16px; }
.btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }

/* Store buttons: two-line label, like the official badges, without their artwork. */
.store { text-align: left; gap: 12px; padding: 12px 22px 12px 16px; letter-spacing: 0; }
.store svg { width: 26px; height: 26px; }
.store .store-label { display: block; font-family: var(--font-body); font-weight: 500; font-size: 11px; line-height: 1.1; opacity: .8; }
.store .store-name { display: block; font-family: var(--font-heading); font-size: 18px; font-weight: 600; line-height: 1.15; letter-spacing: 0.03em; padding-top: 0.08em; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(6, 12, 44, 0.75);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-heading); font-weight: 600; font-size: 19px; letter-spacing: var(--track); white-space: nowrap; }
.brand span { padding-top: 0.15em; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a { font-family: var(--font-heading); font-weight: 600; font-size: 14px; letter-spacing: var(--track); padding: 8px 14px; border-radius: 999px; color: var(--muted); transition: color .15s, background .15s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); background: var(--surface-2); }
.nav-links a { white-space: nowrap; }
@media (max-width: 480px) { .brand span { display: none; } .nav-links a { padding: 8px 12px; } }

/* ---------- hero ---------- */
.hero { padding: 72px 0 56px; text-align: center; }
.hero-icon {
  width: clamp(150px, 26vw, 220px); height: auto; margin: 0 auto 30px;
  border-radius: 22.4%;
  box-shadow: 0 30px 80px -20px rgba(79, 176, 255, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.hero h1 { font-size: clamp(40px, 7.5vw, 72px); letter-spacing: 0.08em; padding-left: 0.08em; /* balances the tracking on the last letter */ }
.hero .tagline { margin-top: 12px; font-family: var(--font-heading); font-weight: 600; font-size: clamp(20px, 2.6vw, 26px); color: var(--muted); letter-spacing: 0.1em; padding-left: 0.1em; }
.hero .lead { margin: 18px auto 0; }
.hero-actions { margin-top: 32px; display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.hero-note { margin-top: 18px; font-family: var(--font-heading); font-weight: 600; font-size: 13px; letter-spacing: var(--track); color: var(--faint); }

/* ---------- facts strip ---------- */
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.fact { padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.fact b { display: block; font-family: var(--font-heading); font-weight: 600; letter-spacing: var(--track); font-size: 17px; margin-bottom: 4px; }
.fact span { color: var(--muted); font-size: 14.5px; }
@media (max-width: 720px) { .facts { grid-template-columns: 1fr; } }

/* ---------- definition lists (code structure) ---------- */
.deflist { margin: 0; display: grid; gap: 10px; }
.deflist div { display: grid; grid-template-columns: 220px 1fr; gap: 12px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--border); }
.deflist div:first-child { border-top: 0; }
.deflist dt { font-family: var(--font-mono); font-size: 13px; color: var(--pink); }
.deflist dd { margin: 0; color: var(--muted); font-size: 15px; }
@media (max-width: 640px) { .deflist div { grid-template-columns: 1fr; gap: 4px; } }

/* ---------- forms ---------- */
.form-grid { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row.full { grid-template-columns: 1fr; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.field { display: grid; gap: 6px; }
.field-label { font-family: var(--font-heading); font-weight: 600; font-size: 13px; letter-spacing: var(--track); color: var(--muted); }
.field-label .opt { color: var(--faint); }
.input, .select, .textarea {
  width: 100%; font: inherit; font-size: 15.5px; color: var(--text);
  background: rgba(3, 8, 30, 0.6); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 12px 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(79, 176, 255, 0.25); }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23aab4d8' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center;
}
.select option { color: #06102e; }
.textarea { resize: vertical; min-height: 150px; }
.form-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.form-note { font-size: 13.5px; color: var(--faint); }
.form-error { color: var(--danger); font-size: 14.5px; background: rgba(255, 138, 138, 0.08); border: 1px solid rgba(255, 138, 138, 0.35); padding: 12px 14px; border-radius: var(--radius); }
.form-success { border-color: rgba(126, 226, 184, 0.45); }
.form-success h3 { color: var(--ok); outline: none; }

/* ---------- prose (policy) ---------- */
.prose { max-width: 72ch; }
.prose h3 { margin-top: 30px; font-size: 18px; }
.prose h3:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--muted); font-size: 15.5px; margin-top: 10px; }
.prose ul { padding-left: 20px; margin: 8px 0 0; }
.prose strong { color: var(--text); font-weight: 600; }
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.toc a { font-family: var(--font-heading); font-weight: 600; font-size: 13px; letter-spacing: var(--track); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.toc a:hover { color: var(--text); border-color: var(--border-strong); }
.updated { font-family: var(--font-heading); font-weight: 600; font-size: 13px; letter-spacing: var(--track); color: var(--faint); margin-top: 10px; }

/* ---------- FAQ ---------- */
.faq details { border-top: 1px solid var(--border); padding: 14px 0; }
.faq details:last-child { border-bottom: 1px solid var(--border); }
.faq summary { cursor: pointer; font-family: var(--font-heading); font-weight: 600; letter-spacing: var(--track); font-size: 17px; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--blue); flex: none; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin-top: 10px; color: var(--muted); font-size: 15px; max-width: 70ch; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 36px 0 44px; margin-top: 40px; }
.footer-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 6px 18px; flex-wrap: wrap; font-family: var(--font-heading); font-weight: 600; letter-spacing: var(--track); font-size: 14px; color: var(--muted); }
.footer-links a:hover { color: var(--text); }
.footer-bottom { margin-top: 18px; font-size: 13px; color: var(--faint); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- misc ---------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--blue); color: #06102e; padding: 8px 14px; border-radius: 8px; font-family: var(--font-heading); font-weight: 600; z-index: 100; }
.skip:focus { left: 12px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .btn { transition: none; } }
