/* ============================================================================
   AnswerFlow — site design system
   Tokens are ported 1:1 from the app (app/src/theme/colors.ts + metrics.ts) so
   the site and the product share one scale. Craft rules follow the apple-design
   skill: size-specific tracking, translucent material chrome, critically damped
   motion, and honest reduced-motion / -transparency / -contrast fallbacks.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* --- colors.ts --- */
  --bg: #05070A;
  --bg-navy: #07101E;
  --surface: #0C1017;
  --surface-alt: #111722;
  --surface-raised: #171E2A;
  --surface-pressed: #1C2635;
  --text: #F7F8FA;
  --text-muted: #A8AFBC;
  --text-faint: #707887;
  --accent: #0A72FF;
  --accent-pressed: #075FCC;
  --accent-soft: rgba(10, 114, 255, 0.14);
  --cta-border: #318AFF;
  --glow: rgba(10, 114, 255, 0.46);
  --glow-soft: rgba(10, 114, 255, 0.14);
  --shadow: rgba(0, 0, 0, 0.64);
  --border: rgba(255, 255, 255, 0.08);
  --border-bright: rgba(255, 255, 255, 0.16);

  /* --- metrics.ts space scale, in rem so layout grows with the user's text size --- */
  --s-xs: 0.25rem;   /* 4  */
  --s-sm: 0.5rem;    /* 8  */
  --s-md: 0.75rem;   /* 12 */
  --s-lg: 1rem;      /* 16 */
  --s-xl: 1.25rem;   /* 20 */
  --s-2xl: 1.75rem;  /* 28 */
  --s-3xl: 2.5rem;   /* 40 */
  --s-4xl: 4rem;
  --s-5xl: 6rem;

  /* --- metrics.ts radius scale --- */
  --r-sm: 0.75rem;
  --r-md: 1rem;
  --r-lg: 1.375rem;
  --r-xl: 1.75rem;
  --r-pill: 999px;

  /* --- motion: critically damped, no overshoot (apple-design §4) --- */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --response: 0.4s;
  --response-fast: 0.16s;

  --max: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  /* The app renders in SF Pro; the system stack gives the site the same face,
     with its own optical sizing and tracking tables (apple-design §15). */
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  letter-spacing: 0;            /* body sits near zero tracking */
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--cta-border); outline-offset: 3px; border-radius: var(--s-xs); }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--s-xl); }
.narrow { max-width: 46rem; }

/* ---------------------------------------------------------------- type ----
   Tracking is size-specific: display type tightens as it grows, small caps
   labels open up. One fixed letter-spacing would be wrong somewhere. */
h1, h2, h3, h4 { margin: 0; font-weight: 700; }

h1 {
  font-size: clamp(2.5rem, 6.4vw, 4.25rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 800;
}
h2 {
  font-size: clamp(1.875rem, 3.6vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: -0.028em;
  font-weight: 750;
}
h3 {
  font-size: 1.1875rem;
  line-height: 1.3;
  letter-spacing: -0.014em;
}
p { margin: 0; }

.lead {
  color: var(--text-muted);
  font-size: clamp(1.0625rem, 1.7vw, 1.3125rem);
  line-height: 1.55;
  letter-spacing: -0.011em;
  margin-top: var(--s-xl);
}

.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.09em;        /* small text opens up */
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--s-lg);
}

section { padding: var(--s-5xl) 0; }
.section-head { max-width: 38rem; margin-bottom: var(--s-3xl); }
.section-head p { color: var(--text-muted); margin-top: var(--s-md); }

/* ------------------------------------------------------------ material ----
   Translucent chrome as a floating layer; content scrolls underneath it.
   The bright top edge is light catching the material (apple-design §12). */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: rgba(5, 7, 10, 0.62);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid transparent;
  transition: background var(--response) var(--ease), border-color var(--response) var(--ease);
}
/* Scroll edge effect instead of a permanent 1px rule: the divider only appears
   once content is actually sliding under the chrome. */
.nav.scrolled { background: rgba(5, 7, 10, 0.86); border-bottom-color: var(--border); }
.nav .wrap { display: flex; align-items: center; gap: var(--s-2xl); height: 4.25rem; }

.brand { display: flex; align-items: center; gap: var(--s-md); color: var(--text); font-weight: 700; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand img { width: 1.875rem; height: 1.875rem; border-radius: var(--s-sm); }

.nav-links { margin-left: auto; display: flex; gap: var(--s-2xl); }
.nav-links a {
  color: var(--text-muted); font-size: 0.9375rem; font-weight: 500; letter-spacing: -0.006em;
  transition: color var(--response-fast) ease-out;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
@media (max-width: 46rem) { .nav-links { display: none; } }

/* --------------------------------------------------------------- cards ----
   Bigger surfaces read thicker: more blur, deeper shadow than small chips. */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.028), transparent 42%), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--s-2xl);
  box-shadow: 0 0.375rem 1.25rem var(--shadow);
  transition: transform var(--response) var(--ease), border-color var(--response) var(--ease),
              box-shadow var(--response) var(--ease);
}
.card:hover { transform: translateY(-2px); border-color: var(--border-bright); box-shadow: 0 0.75rem 2rem var(--shadow); }
.card p { color: var(--text-muted); margin-top: var(--s-md); font-size: 1rem; letter-spacing: -0.004em; }

.grid { display: grid; gap: var(--s-lg); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 56rem) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------- buttons ----
   Feedback lives on the press, not the release, and it is instant (§1). */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-sm);
  height: 3.375rem; padding: 0 var(--s-2xl); border-radius: var(--r-pill);
  font-size: 1rem; font-weight: 700; letter-spacing: -0.01em;
  border: 1px solid transparent;
  transition: transform var(--response-fast) ease-out, background var(--response-fast) ease-out;
  will-change: transform;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); border-color: var(--cta-border); color: #fff; box-shadow: 0 0.5rem 1.75rem var(--glow-soft); }
.btn-primary:hover { background: var(--accent-pressed); }
.btn-ghost { background: var(--surface-alt); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-raised); }
.btn[aria-disabled='true'] { cursor: default; }
.btn[aria-disabled='true']:active { transform: none; }

/* ---------------------------------------------------------- scroll reveal --
   Materialize rather than fade: scale and blur resolve together, so the
   surface reads as arriving instead of turning up the opacity (§12). */
.reveal {
  opacity: 0;
  transform: translateY(1.25rem) scale(0.985);
  filter: blur(6px);
  transition: opacity var(--response) var(--ease), transform var(--response) var(--ease),
              filter var(--response) var(--ease);
  will-change: transform, opacity;
}
.reveal.in { opacity: 1; transform: none; filter: none; }

/* -------------------------------------------------------------- footer ----*/
footer { border-top: 1px solid var(--border); padding: var(--s-3xl) 0 var(--s-4xl); }
footer .wrap { display: flex; flex-wrap: wrap; gap: var(--s-xl) var(--s-3xl); align-items: center; }
footer nav { display: flex; flex-wrap: wrap; gap: var(--s-xl); }
footer a, footer p { color: var(--text-faint); font-size: 0.875rem; }
footer a:hover { color: var(--text-muted); }
footer p { margin: 0; }
footer .spacer { margin-left: auto; }

/* ------------------------------------------------------- legal / support --*/
.doc { padding: var(--s-4xl) 0 var(--s-5xl); }
.doc h1 { font-size: clamp(2rem, 4vw, 2.75rem); letter-spacing: -0.03em; }
.doc h2 { font-size: 1.3125rem; letter-spacing: -0.018em; margin-top: var(--s-3xl); }
.doc h3 { margin-top: var(--s-2xl); font-size: 1.0625rem; }
.doc p, .doc li { color: var(--text-muted); }
.doc p { margin-top: var(--s-lg); }
.doc .date { color: var(--text-faint); font-size: 0.875rem; margin-top: var(--s-sm); }
.doc ul { padding-left: var(--s-xl); }
.doc li { margin-bottom: var(--s-sm); }
.doc strong { color: var(--text); font-weight: 650; }

/* ============================== accessibility ==============================
   Reduced motion is not "no feedback" — it keeps the cross-fade and drops the
   vestibular part. Reduced transparency frosts the material into a solid.
   Increased contrast trades translucency for a defined border. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { transform: none; filter: none; transition: opacity 0.2s ease; }
  .card:hover { transform: none; }
  .btn:active { transform: none; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

@media (prefers-reduced-transparency: reduce) {
  .nav { background: #05070A; backdrop-filter: none; -webkit-backdrop-filter: none; border-bottom-color: var(--border); }
}

@media (prefers-contrast: more) {
  :root { --border: rgba(255,255,255,0.28); --border-bright: rgba(255,255,255,0.42); --text-muted: #C7CDD7; --text-faint: #9AA2AF; }
  .nav { background: #05070A; backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* Pull-quote for the one claim that matters most on the privacy page. */
.callout {
  margin: var(--s-2xl) 0;
  padding: var(--s-xl) var(--s-2xl);
  border: 1px solid rgba(10, 114, 255, 0.42);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(10, 114, 255, 0.12), transparent 70%), var(--surface);
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.65;
  box-shadow: 0 0.5rem 1.75rem var(--glow-soft);
}
.callout strong { display: block; color: var(--text); font-weight: 700; font-size: 1.0625rem; letter-spacing: -0.014em; margin-bottom: var(--s-sm); }
.doc em { color: var(--text); font-style: normal; font-weight: 600; }
