/* ==========================================================================
   Backspace marketing site — shared stylesheet
   Design tokens mirror the real app's ../Backspace/Backspace/DesignSystem/
   DesignSystem.swift (Color extension) and design-system.md. If either of
   those changes, update this block to match — this is not a separate design.
   ========================================================================== */

:root {
  /* ---- Brand palette — mirrors Backspace/Backspace/DesignSystem/DesignSystem.swift
     exactly (the `Color` extension there is the source of truth; keep this
     block in sync with it, the same way design-system.md's table does). ---- */
  --color-paper: #EDF0F1;
  --color-card: #FFFFFF;
  --color-elevated: #FFFFFF;
  --color-ink: #15191C;
  --color-muted: #5E6A70;
  --color-hairline: #DDE3E5;
  --color-theater: #0D1012;

  /* ---- Brand/semantic colors — fixed across light/dark in the app (already
     vivid enough to read on both), so these are not redefined below. ---- */
  --color-accent: #2AD6C9;    /* tide / reclaim */
  --color-accent-ink: #063A38; /* text-on-accent when accent is used as a flat fill */
  --color-discard: #FF6B2C;
  --color-cat-photo: #12B8D6;
  --color-cat-video: #7B2FF7;
  --color-gold: #E0A62A; /* "fully sorted" achievement state only */

  /* TideGradient equivalent — topLeading to bottomTrailing, sampled from the
     real icon's gradient. Used on primary buttons/progress fills instead of
     a flat accent, matching PrimaryButtonStyle/SortedProgressBar in-app. */
  --gradient-tide: linear-gradient(135deg, #4FE6D8 0%, #139AAE 70%, #0C6E82 100%);

  /* ---- Semantic tokens (theme-aware; redefined under dark below) ---- */
  --bg: var(--color-paper);
  --bg-card: var(--color-card);
  --bg-elevated: var(--color-elevated);
  --text: var(--color-ink);
  --text-muted: var(--color-muted);
  --border: var(--color-hairline);
  --shadow: 0 2px 8px rgba(21, 25, 28, 0.06), 0 8px 24px rgba(21, 25, 28, 0.05);
  --focus-ring: 0 0 0 3px rgba(42, 214, 201, 0.55);

  /* ---- Type scale ---- */
  --font-system: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* ---- Spacing (4pt grid) ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;

  /* ---- Radius ---- */
  --radius-card: 20px;
  --radius-button: 14px;
  --radius-pill: 999px;

  --max-width: 1120px;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18161A;
    --bg-card: #211E22;
    --bg-elevated: #322E35;
    --text: #F5F3F1;
    --text-muted: #9A9298;
    --border: #38343A;
    --shadow: 0 0 0 0 transparent; /* the app draws no shadow in dark mode — outlined cards instead */
    --focus-ring: 0 0 0 3px rgba(42, 214, 201, 0.6);
    --gradient-tide: linear-gradient(135deg, #9FF6EE 0%, #2AD6C9 70%, #1798A8 100%);
  }
}

/* ---------------------------------------------------------------------- */
/* Reset + base                                                            */
/* ---------------------------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-system);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

h1, h2, h3, p, figure { margin: 0; }

ul { margin: 0; padding: 0; }

button { font: inherit; }

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -60px;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-button);
  font-weight: 600;
  z-index: 100;
  transition: top 0.2s ease;
}
.skip-link:focus { top: var(--space-4); }

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 4px;
}

/* ---------------------------------------------------------------------- */
/* Header                                                                   */
/* ---------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
}

.brand img { width: 28px; height: 28px; border-radius: 8px; }

.header-cta img { height: 36px; width: auto; }

/* ---------------------------------------------------------------------- */
/* Buttons + App Store badge                                               */
/* ---------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 52px;
  padding: 0 var(--space-6);
  border-radius: var(--radius-button);
  background: var(--gradient-tide);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(0.98); filter: brightness(0.92); }

.store-badge-link {
  position: relative;
  display: inline-block;
  line-height: 0;
  border-radius: var(--radius-button);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.store-badge-link:hover { transform: translateY(-2px); }
.store-badge-link img { height: 56px; width: auto; }

/* ---------------------------------------------------------------------- */
/* Hero                                                                     */
/* ---------------------------------------------------------------------- */

.hero {
  padding: var(--space-12) 0 var(--space-8);
}

.hero .container {
  display: grid;
  gap: var(--space-12);
  align-items: center;
}

@media (min-width: 900px) {
  .hero .container {
    grid-template-columns: 1.05fr 0.95fr;
  }
}

.hero-copy { text-align: center; }
@media (min-width: 900px) {
  .hero-copy { text-align: left; }
}

.app-icon-mark {
  width: 88px;
  height: 88px;
  border-radius: 25px; /* 0.28 * size, matching AppIconMark's clip in the app */
  box-shadow: var(--shadow);
  margin: 0 auto var(--space-4);
}
@media (min-width: 900px) {
  .app-icon-mark { margin-left: 0; }
}

/* Same treatment as the header .brand wordmark (bold, sentence case, ink
   color) — the brand name gets one consistent style everywhere on the site,
   never the .eyebrow (section-label) styling. */
.brand-wordmark {
  font-weight: 700;
  font-size: 20px;
  margin-bottom: var(--space-3);
}

.hero h1 {
  font-size: clamp(34px, 5.4vw, 52px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.08;
  margin-bottom: var(--space-4);
}

.accent-text { color: var(--color-accent); }

.hero .subhead {
  font-size: clamp(17px, 2vw, 20px);
  color: var(--text-muted);
  max-width: 46ch;
  margin: 0 auto var(--space-8);
}
@media (min-width: 900px) {
  .hero .subhead { margin-left: 0; }
}

.hero-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}
@media (min-width: 900px) {
  /* Scoped to .hero only — .final-cta reuses .hero-cta but stays centered
     at every width, it's never in a two-column layout like the hero is. */
  .hero .hero-cta { align-items: flex-start; }
}

.hero-visual { display: flex; justify-content: center; }

/* ---------------------------------------------------------------------- */
/* Device screenshots (shared by hero + screenshot gallery)                */
/* These PNGs already render their own device bezel — no CSS frame needed, */
/* just sizing + a drop shadow so they lift off the page.                  */
/* ---------------------------------------------------------------------- */

.device-shot {
  display: block;
  width: min(320px, 78vw);
  height: auto;
  flex: none;
  filter: drop-shadow(0 16px 32px rgba(0, 0, 0, 0.28));
}

/* ---------------------------------------------------------------------- */
/* Generic section scaffolding                                             */
/* ---------------------------------------------------------------------- */

section { padding: var(--space-12) 0; }

.section-head {
  max-width: 60ch;
  margin: 0 auto var(--space-8);
  text-align: center;
}

.section-head h2 {
  font-size: clamp(26px, 3.6vw, 36px);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-bottom: var(--space-3);
}

.section-head p {
  color: var(--text-muted);
  font-size: 18px;
}

.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-3);
}

/* ---------------------------------------------------------------------- */
/* Problem / benefit                                                       */
/* ---------------------------------------------------------------------- */

.problem { background: var(--bg-card); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.problem .container { max-width: 760px; text-align: center; }

.problem h2 {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-bottom: var(--space-4);
}

.problem p { color: var(--text-muted); font-size: 18px; }

/* ---------------------------------------------------------------------- */
/* Features grid                                                           */
/* ---------------------------------------------------------------------- */

.features-grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .features-grid { grid-template-columns: repeat(3, 1fr); }
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-6);
  box-shadow: var(--shadow);
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--color-accent) 16%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.feature-icon svg { width: 24px; height: 24px; }

.feature-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.feature-card p { color: var(--text-muted); font-size: 15px; }

/* ---------------------------------------------------------------------- */
/* How it works                                                            */
/* ---------------------------------------------------------------------- */

.steps {
  display: grid;
  gap: var(--space-8);
  grid-template-columns: 1fr;
  counter-reset: step;
}

@media (min-width: 760px) {
  .steps { grid-template-columns: repeat(3, 1fr); }
}

.step { text-align: center; }

.step-number {
  counter-increment: step;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gradient-tide);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin: 0 auto var(--space-4);
}

.step-number::before { content: counter(step); }

.step h3 { font-size: 18px; font-weight: 600; margin-bottom: var(--space-2); }
.step p { color: var(--text-muted); font-size: 15px; max-width: 32ch; margin: 0 auto; }

/* ---------------------------------------------------------------------- */
/* Screenshots gallery                                                     */
/* ---------------------------------------------------------------------- */

.screenshots-scroller {
  display: flex;
  gap: var(--space-6);
  overflow-x: auto;
  padding: var(--space-4) var(--space-6) var(--space-6);
  margin: 0 calc(var(--space-6) * -1);
  -webkit-overflow-scrolling: touch;
  /* No scroll-snap here on purpose — it fights the slow auto-scroll drift
     in main.js (the browser tries to snap while JS keeps nudging
     scrollLeft), causing visible stutter. Free scroll only. */
}

.screenshots-scroller .device-shot {
  width: min(260px, 70vw);
}

.screenshots-scroller::-webkit-scrollbar { height: 8px; }
.screenshots-scroller::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-pill); }

/* ---------------------------------------------------------------------- */
/* Privacy highlight banner                                                */
/* ---------------------------------------------------------------------- */

.privacy-banner {
  background: var(--color-theater);
  color: #fff;
}

.privacy-banner .container {
  max-width: 720px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.privacy-banner .lock-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--color-accent) 22%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-6);
}

.privacy-banner h2 {
  font-size: clamp(24px, 3.4vw, 32px);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-bottom: var(--space-3);
}

.privacy-banner p { color: rgba(255, 255, 255, 0.72); font-size: 17px; }

/* ---------------------------------------------------------------------- */
/* FAQ                                                                      */
/* ---------------------------------------------------------------------- */

.faq-list { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-3); }

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--space-2) var(--space-6);
}

.faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: var(--space-4) 0;
  font-weight: 600;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: "+";
  font-size: 22px;
  font-weight: 400;
  color: var(--color-accent);
  flex: none;
  transition: transform 0.2s ease;
}

.faq-item[open] summary::after { transform: rotate(45deg); }

.faq-item p { color: var(--text-muted); padding-bottom: var(--space-4); font-size: 15px; }

/* ---------------------------------------------------------------------- */
/* Final CTA                                                               */
/* ---------------------------------------------------------------------- */

.final-cta { text-align: center; }
.final-cta .container { max-width: 640px; }
.final-cta h2 {
  font-size: clamp(26px, 3.6vw, 34px);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-6);
}

/* ---------------------------------------------------------------------- */
/* Footer                                                                   */
/* ---------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-8) 0;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: var(--space-6);
  list-style: none;
}

.footer-links a { text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------------- */
/* Scroll-reveal (progressively enhanced by main.js; safe with JS off)     */
/* ---------------------------------------------------------------------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
[data-reveal].is-visible { opacity: 1; transform: none; }

/* ---------------------------------------------------------------------- */
/* Legal pages (privacy.html / support.html)                               */
/* ---------------------------------------------------------------------- */

.legal-main { padding: var(--space-12) 0 var(--space-12) * 2; }

.legal-card {
  max-width: 720px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: var(--space-8);
}

@media (min-width: 640px) {
  .legal-card { padding: var(--space-12); }
}

.legal-card h1 {
  font-size: 30px;
  font-weight: 700;
  margin-bottom: var(--space-1);
}

.legal-card .updated {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: var(--space-8);
}

.legal-card h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-accent);
  margin: var(--space-8) 0 var(--space-2);
}

.legal-card p, .legal-card li { font-size: 15px; }
.legal-card ul { padding-left: 20px; }
.legal-card ul li + li { margin-top: var(--space-2); }
.legal-card a { color: var(--color-accent); }

.legal-card .back-link {
  display: inline-block;
  margin-bottom: var(--space-6);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
}
.legal-card .back-link:hover { text-decoration: underline; }

.note-box {
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-accent) 35%, transparent);
  border-radius: 12px;
  padding: var(--space-4);
  font-size: 13px;
  margin-bottom: var(--space-8);
}

.faq-plain { margin-bottom: var(--space-6); }
.faq-plain p:first-child { font-weight: 600; margin-bottom: var(--space-2); }
.faq-plain p:last-child { color: var(--text-muted); }
