/* FreqAF site: base styles and shared chrome.
   Colours are the app's brand tokens (store/BRAND.md in the app repo). Keep
   the two in step; tests/site.test.mjs checks the values below. */

/* ───── Fonts (self-hosted, variable, latin subset) ───── */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/inter-latin-wght-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/geist-mono-latin-wght-normal.woff2') format('woff2');
}
/* Metric-matched fallbacks so the swap to the web fonts does not move text.
   Inter is 7% wider than Arial and 6.5% wider than Roboto; Geist Mono shares
   its 0.6em advance with Courier New and Android's monospace. */
@font-face {
  font-family: 'Inter Fallback';
  src: local('Arial');
  size-adjust: 107.06%;
  ascent-override: 90.49%;
  descent-override: 22.56%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Inter Fallback Android';
  src: local('Roboto');
  size-adjust: 106.5%;
  ascent-override: 90.96%;
  descent-override: 22.65%;
  line-gap-override: 0%;
}
@font-face {
  font-family: 'Geist Mono Fallback';
  src: local('Courier New');
  ascent-override: 100.5%;
  descent-override: 29.5%;
  line-gap-override: 0%;
}

:root {
  /* Surfaces */
  --bg-app: #07090F;
  --bg-surface: #0E131E;
  --bg-surface-2: #161C2B;
  --bg-surface-3: #1D2538;
  --bg-elev: #232C43;

  /* Hairlines */
  --border: rgba(148, 163, 184, 0.08);
  --border-strong: rgba(148, 163, 184, 0.16);

  /* Text */
  --text: #E7ECF3;
  --text-muted: #8A96B1;
  --text-faint: #5A647E;

  /* Brand */
  --accent: #2CC6FF;
  --accent-glow: #6FD9FF;
  --violet: #8B7CFF;
  --magenta: #FF5CAA;

  /* Status */
  --clear: #34D399;
  --caution: #FBBF24;
  --conflict: #FB5A6B;
  --excluded: #94A3B8;

  /* Derived */
  --spectrum: linear-gradient(90deg, var(--accent) 0%, var(--violet) 55%, var(--magenta) 100%);
  --accent-soft: rgba(44, 198, 255, 0.12);
  --accent-line: rgba(44, 198, 255, 0.28);

  /* Type */
  --font-ui: 'Inter', 'Inter Fallback', 'Inter Fallback Android', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Geist Mono', 'Geist Mono Fallback', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Shape */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-2xl: 32px;

  /* Layout */
  --maxw: 1200px;
  --gutter: clamp(20px, 4vw, 40px);
  --nav-h: 64px;

  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lift: 0 40px 80px -40px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 255, 255, 0.05) inset;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: dark;
  background: var(--bg-app);
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 24px);
}

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-app);
  font-feature-settings: 'zero', 'calt', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overflow-x: clip;
}

/* decorative glows may overhang their sections; never let them widen the page */
main { overflow-x: hidden; overflow-x: clip; }

img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
::selection { background: rgba(44, 198, 255, 0.3); color: #fff; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.mono {
  font-family: var(--font-mono);
  font-feature-settings: 'zero', 'tnum';
  font-variant-numeric: tabular-nums slashed-zero;
}
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 16px; top: -64px; z-index: 200;
  padding: 10px 16px; border-radius: var(--r-sm);
  background: var(--accent); color: #04121C; font-weight: 600;
  transition: top 0.15s ease;
}
.skip:focus { top: 12px; }

/* ───── Ambient page background ───── */
.bg-field {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1100px 620px at 14% -12%, rgba(44, 198, 255, 0.11), transparent 62%),
    radial-gradient(900px 560px at 86% -10%, rgba(139, 124, 255, 0.12), transparent 60%),
    var(--bg-app);
}
.bg-field::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(110% 70% at 50% 0%, #000 20%, transparent 72%);
  mask-image: radial-gradient(110% 70% at 50% 0%, #000 20%, transparent 72%);
}

/* ───── Layout ───── */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: clamp(64px, 8.5vw, 112px) 0; position: relative; }
.section-tight { padding: clamp(48px, 7vw, 88px) 0; position: relative; }
.center { text-align: center; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* ───── Type ───── */
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.h-display {
  font-size: clamp(2.5rem, 4.6vw + 0.7rem, 4.5rem);
  font-weight: 650;
  letter-spacing: -0.038em;
  line-height: 1.02;
  text-wrap: balance;
}
.h-section {
  font-size: clamp(1.875rem, 3.2vw + 0.6rem, 3rem);
  font-weight: 620;
  letter-spacing: -0.032em;
  line-height: 1.08;
  text-wrap: balance;
}
.h-card { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.014em; line-height: 1.3; }
.lede {
  font-size: clamp(1.0625rem, 0.6vw + 0.95rem, 1.25rem);
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 60ch;
  text-wrap: pretty;
}
.lede strong, .prose strong { color: var(--text); font-weight: 600; }
.grad {
  background: var(--spectrum);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before {
  content: ''; width: 20px; height: 2px; border-radius: 2px;
  background: var(--spectrum);
}
.sec-head { max-width: 760px; }
.sec-head .h-section { margin-top: 18px; }
.sec-head .lede { margin-top: 20px; }
.sec-head.center { margin-left: auto; margin-right: auto; }
.sec-head.center .lede { margin-left: auto; margin-right: auto; }

/* ───── Buttons ───── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  border: 1px solid transparent; border-radius: var(--r-md);
  font-family: var(--font-ui); font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.005em;
  white-space: nowrap; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, var(--accent-glow), var(--accent));
  color: #04121C;
  box-shadow: 0 12px 32px -12px rgba(44, 198, 255, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 18px 44px -14px rgba(44, 198, 255, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.btn-ghost {
  background: rgba(148, 163, 184, 0.06);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover { background: rgba(148, 163, 184, 0.12); border-color: rgba(148, 163, 184, 0.32); }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 0.8125rem; border-radius: 10px; gap: 8px; }
.btn-sm svg { width: 15px; height: 15px; }

/* Store call to action. Until the app is live this is a plain, non-interactive
   label; assets/freqaf.js turns every [data-play-cta] into a real link when
   PLAY_STORE_LIVE is switched on. */
.store {
  position: relative;
  display: inline-flex; align-items: center; gap: 14px;
  min-height: 56px; padding: 8px 24px 8px 18px;
  border-radius: 14px;
  background: linear-gradient(180deg, #131A29, #0B101A);
  color: var(--text);
  text-align: left; white-space: nowrap;
  box-shadow: 0 0 0 1px var(--border-strong), 0 18px 40px -22px rgba(44, 198, 255, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.store::before {
  /* spectrum hairline around the badge */
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: var(--spectrum); opacity: 0.75;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}
.store-glyph { width: 26px; height: 26px; flex: none; color: var(--accent); }
.store-text { display: grid; line-height: 1.15; }
.store-kicker {
  font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted);
}
.store-name { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.015em; }
a.store { cursor: pointer; }
a.store:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px var(--accent-line), 0 22px 48px -20px rgba(44, 198, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.08); }
.store-sm { min-height: 38px; padding: 0 14px 0 11px; gap: 8px; border-radius: 10px; box-shadow: 0 0 0 1px var(--border-strong), inset 0 1px 0 rgba(255, 255, 255, 0.05); }
.store-sm::before { opacity: 0.55; }
.store-sm .store-glyph { width: 14px; height: 14px; }
.store-sm .store-text { display: block; font-size: 0.8125rem; }
.store-sm .store-kicker { font: inherit; letter-spacing: 0; text-transform: none; color: var(--text-muted); }
.store-sm .store-name { font-size: inherit; letter-spacing: -0.005em; }

/* ───── Pills and status chips ───── */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 26px; padding: 0 11px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  background: rgba(148, 163, 184, 0.05);
  white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.is-accent { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.pill.is-clear { color: var(--clear); border-color: rgba(52, 211, 153, 0.3); background: rgba(52, 211, 153, 0.1); }
.pill.is-caution { color: var(--caution); border-color: rgba(251, 191, 36, 0.3); background: rgba(251, 191, 36, 0.1); }
.pill.is-violet { color: #B3A9FF; border-color: rgba(139, 124, 255, 0.36); background: rgba(139, 124, 255, 0.12); }

/* ───── Cards ───── */
.card {
  position: relative;
  background: linear-gradient(180deg, var(--bg-surface), #0A0E17);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}

/* ───── Nav ───── */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(7, 9, 15, 0.72);
  -webkit-backdrop-filter: saturate(140%) blur(16px);
  backdrop-filter: saturate(140%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto;
  min-height: var(--nav-h); padding: 0 var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; border-radius: 10px; }
.brand-mark { width: 32px; height: 32px; flex: none; border-radius: 50%; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 6px 18px -6px rgba(44, 198, 255, 0.5); }
.wordmark {
  font-family: var(--font-mono); font-weight: 600; font-size: 1.125rem;
  letter-spacing: 0.04em; color: var(--text);
  font-feature-settings: 'zero';
}
.wordmark b { font-weight: 600; color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-links a {
  padding: 8px 14px; border-radius: var(--r-sm);
  font-size: 0.90625rem; font-weight: 500; color: var(--text-muted);
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-links a:hover { color: var(--text); background: rgba(148, 163, 184, 0.07); }
.nav-links a[aria-current='page'] { color: var(--text); }
.nav-end { display: flex; align-items: center; gap: 10px; }
.nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; border-radius: 10px;
  background: rgba(148, 163, 184, 0.06); border: 1px solid var(--border-strong);
  cursor: pointer;
}
.nav-toggle svg { width: 20px; height: 20px; }
.nav-toggle .x { display: none; }
.nav-toggle[aria-expanded='true'] .x { display: block; }
.nav-toggle[aria-expanded='true'] .bars { display: none; }
.mobile-menu { display: none; }

@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav-toggle { display: inline-flex; }
  .mobile-menu {
    flex-direction: column; gap: 2px;
    padding: 6px var(--gutter) 18px;
    border-top: 1px solid var(--border);
    background: rgba(7, 9, 15, 0.96);
  }
  .mobile-menu.open { display: flex; }
  .mobile-menu a {
    padding: 13px 12px; border-radius: var(--r-sm);
    font-weight: 500; color: var(--text-muted);
  }
  .mobile-menu a:hover, .mobile-menu a[aria-current='page'] { color: var(--text); background: rgba(148, 163, 184, 0.07); }
}
@media (max-width: 480px) {
  .nav-end .store-sm { display: none; }
}

/* ───── Footer ───── */
.footer {
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, transparent, rgba(4, 6, 10, 0.7));
  padding: 64px 0 40px;
}
.footer-grid {
  display: grid; gap: 40px 32px;
  grid-template-columns: minmax(0, 1.7fr) repeat(3, minmax(0, 1fr));
}
.footer-about p { margin-top: 16px; max-width: 36ch; color: var(--text-muted); font-size: 0.9375rem; }
.footer-col h2 {
  margin: 0 0 14px;
  font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted);
}
.footer-col a, .footer-col span.item {
  display: block; padding: 5px 0;
  color: var(--text-muted); font-size: 0.9375rem;
}
.footer-col a { transition: color 0.15s ease; }
.footer-col a:hover { color: var(--accent); }
.footer-legal {
  margin-top: 48px; padding-top: 24px;
  border-top: 1px solid var(--border);
  display: grid; gap: 10px;
  font-size: 0.8125rem; line-height: 1.6; color: var(--text-muted);
}
.footer-legal p { max-width: 96ch; }
.footer-legal .copy { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.02em; }
@media (max-width: 860px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-about { grid-column: 1 / -1; }
}
@media (max-width: 420px) {
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
}

/* ───── Reveal on scroll ─────
   Visible by default so content never depends on script. freqaf.js arms the
   hidden state only once the page is really painting. */
.reveal { opacity: 1; transform: none; }
html.js-reveal .reveal {
  opacity: 0; transform: translateY(16px);
  transition: opacity 0.7s ease, transform 0.7s var(--ease-out);
  transition-delay: var(--d, 0ms);
}
html.js-reveal .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js-reveal .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ───── Long-form pages (privacy, support) ───── */
.page-head { padding: clamp(56px, 8vw, 104px) 0 clamp(28px, 4vw, 48px); }
.page-head .h-display { font-size: clamp(2.25rem, 4vw + 0.8rem, 3.5rem); margin-top: 16px; }
.page-head .lede { margin-top: 20px; }
.page-meta { margin-top: 16px; font-family: var(--font-mono); font-size: 0.8125rem; color: var(--text-muted); letter-spacing: 0.01em; }
.prose { max-width: 720px; padding-bottom: clamp(72px, 10vw, 120px); color: var(--text-muted); font-size: 1.03125rem; line-height: 1.7; }
.prose h2 {
  margin: 56px 0 14px; padding-top: 28px; border-top: 1px solid var(--border);
  font-size: 1.5rem; letter-spacing: -0.022em; color: var(--text); scroll-margin-top: calc(var(--nav-h) + 16px);
}
.prose h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.prose h3 { margin: 30px 0 10px; font-size: 1.0625rem; letter-spacing: -0.01em; color: var(--text); }
.prose p { margin: 0 0 16px; text-wrap: pretty; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: currentColor; }
.prose ul, .prose ol { margin: 0 0 18px; display: grid; gap: 10px; }
.prose ul > li { position: relative; padding-left: 22px; }
.prose ul > li::before {
  content: ''; position: absolute; left: 4px; top: 0.72em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
.prose code {
  font-family: var(--font-mono); font-size: 0.875em;
  padding: 2px 6px; border-radius: 6px;
  background: var(--bg-surface-2); border: 1px solid var(--border-strong); color: var(--text);
}
.callout {
  margin: 0 0 28px; padding: 18px 20px;
  border: 1px solid var(--accent-line); border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(44, 198, 255, 0.08), rgba(44, 198, 255, 0.03));
  color: var(--text);
}
.callout p:last-child { margin-bottom: 0; }
