/* ============================================================
   Brain Nine — Landing page styles
   Design language: dark "graph paper at night" — reuses the same
   semantic accent colors as the app itself (indigo/teal/amber/coral)
   so the marketing site and the product feel like one artifact.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* ── Ink / paper ─────────────────────────────────────────── */
  --ink-900: #12131c;
  --ink-800: #191c28;
  --ink-700: #1f2331;
  --paper: #f3f4f8;
  --paper-dim: #b7bacb;

  /* ── Grid lines (literal content, not decoration) ──────────── */
  --grid-line: rgba(255, 255, 255, 0.09);
  --grid-line-strong: rgba(255, 255, 255, 0.22);

  /* ── Semantic accents — same roles as the app's own UI ─────── */
  --accent-indigo: #8b93f5;   /* selected cell */
  --accent-teal: #2fd9c4;     /* same-digit / success */
  --accent-amber: #ffb300;    /* pencil notes */
  --accent-coral: #ff6b6b;    /* conflict / error */

  /* ── Type ───────────────────────────────────────────────────── */
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --radius: 14px;
  --radius-sm: 8px;
  --max-width: 1120px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink-900);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  color: var(--paper);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Accessibility floor ─────────────────────────────────────── */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent-indigo);
  color: var(--ink-900);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  z-index: 100;
}
.skip-link:focus { left: 16px; top: 16px; }

:focus-visible {
  outline: 2px solid var(--accent-indigo);
  outline-offset: 2px;
}

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

/* ── Nav ─────────────────────────────────────────────────────── */

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(18, 19, 28, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--grid-line);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
}

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

/* Real app logo — flat white background baked into the source file,
   so we round its corners here rather than trying to key out a bg. */
.brand__mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.brand__mark img { width: 100%; height: 100%; object-fit: cover; }

.nav__links {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 14px;
}

.nav__link {
  text-decoration: none;
  color: var(--paper-dim);
  transition: color 0.15s ease;
}
.nav__link:hover { color: var(--paper); }

.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--grid-line-strong);
  border-radius: 999px;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 12px;
}
.lang-toggle button {
  background: transparent;
  border: 0;
  color: var(--paper-dim);
  padding: 6px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}
.lang-toggle button[aria-pressed="true"] {
  background: var(--accent-indigo);
  color: var(--ink-900);
  font-weight: 600;
}

/* ── Hero ────────────────────────────────────────────────────── */

.hero {
  padding: 72px 0 96px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--accent-teal);
  text-transform: uppercase;
  margin: 0 0 14px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(38px, 5vw, 58px);
  line-height: 1.05;
  margin: 0 0 20px;
  letter-spacing: -0.01em;
}
.hero h1 em { font-style: normal; color: var(--accent-indigo); }

.hero p.lede {
  font-size: 18px;
  color: var(--paper-dim);
  max-width: 46ch;
  margin: 0 0 32px;
}

.hero__badges {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--grid-line-strong);
  background: var(--ink-800);
  text-decoration: none;
  color: var(--paper);
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.15s ease, transform 0.15s ease;
  position: relative;
}
.store-badge:hover { border-color: var(--accent-indigo); transform: translateY(-1px); }
.store-badge__icon { width: 20px; height: 20px; flex-shrink: 0; }
.store-badge__text { display: flex; flex-direction: column; line-height: 1.2; }
.store-badge__text small { font-size: 10px; color: var(--paper-dim); }
.store-badge__soon {
  position: absolute;
  top: -9px;
  right: -8px;
  background: var(--accent-amber);
  color: var(--ink-900);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
}

.hero__facts {
  display: flex;
  gap: 28px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--paper-dim);
}
.hero__facts strong { display: block; color: var(--paper); font-size: 15px; }

/* ── Live sudoku demo (signature element) ───────────────────── */

.demo {
  background: var(--ink-800);
  border: 1px solid var(--grid-line-strong);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.55);
}

.demo__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--paper-dim);
}

.demo__status { color: var(--accent-teal); }
.demo__status[data-state="error"] { color: var(--accent-coral); }

.sudoku-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  aspect-ratio: 1;
  background: var(--ink-900);
  border: 2px solid var(--grid-line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0.5px solid var(--grid-line);
  font-family: var(--font-mono);
  font-size: clamp(13px, 2.6vw, 20px);
  font-weight: 500;
  color: var(--accent-indigo);
  background: transparent;
  cursor: text;
  user-select: none;
  transition: background 0.12s ease;
}
.cell.given { color: var(--paper); font-weight: 600; cursor: default; }
.cell.selected { background: rgba(139, 147, 245, 0.16); }
.cell.error { background: rgba(255, 107, 107, 0.18); color: var(--accent-coral); }
.cell.correct-flash { animation: correctFlash 0.5s ease; }

.cell:nth-child(3n) { border-right: 1.5px solid var(--grid-line-strong); }
.cell:nth-child(9n) { border-right: none; }
.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54) { border-bottom: 1.5px solid var(--grid-line-strong); }

@keyframes correctFlash {
  0% { background: rgba(47, 217, 196, 0.35); }
  100% { background: transparent; }
}

.demo__keys {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  margin-top: 14px;
}
.demo__key {
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 9px 0;
  border-radius: 6px;
  border: 1px solid var(--grid-line-strong);
  background: var(--ink-900);
  color: var(--paper);
  cursor: pointer;
}
.demo__key:hover { border-color: var(--accent-indigo); }
.demo__key--erase { color: var(--paper-dim); font-size: 12px; }

.demo__hint { margin-top: 12px; font-size: 12px; color: var(--paper-dim); text-align: center; }

/* ── Section shell ──────────────────────────────────────────── */

section { padding: 88px 0; }

.section__eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-teal);
  margin: 0 0 10px;
}

.section__title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.4vw, 38px);
  margin: 0 0 14px;
  max-width: 20ch;
}

.section__lede {
  color: var(--paper-dim);
  max-width: 60ch;
  font-size: 16px;
  margin: 0 0 48px;
}

/* ── Features — 3×3 grid echoing a sudoku box ─────────────────── */

.feature-box {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 2px solid var(--grid-line-strong);
  border-radius: var(--radius);
  overflow: hidden;
}

.feature-cell {
  padding: 28px 24px;
  border: 0.5px solid var(--grid-line);
  min-height: 168px;
}
.feature-cell:nth-child(3n) { border-right: none; }

.feature-cell__index {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-amber);
  margin-bottom: 12px;
  display: block;
}

.feature-cell h3 { font-family: var(--font-display); font-size: 17px; margin: 0 0 8px; }
.feature-cell p { font-size: 14px; color: var(--paper-dim); margin: 0; }

/* ── Difficulty preview ─────────────────────────────────────── */

.difficulty-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.difficulty-card {
  background: var(--ink-800);
  border: 1px solid var(--grid-line-strong);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
}

.difficulty-card .mini-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  aspect-ratio: 1;
  border: 1.5px solid var(--grid-line-strong);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 14px;
  background: var(--ink-900);
}
.mini-grid span { border: 0.25px solid var(--grid-line); }
.mini-grid span.filled { background: var(--accent-indigo); opacity: 0.55; }

.difficulty-card h4 { font-family: var(--font-display); font-size: 15px; margin: 0 0 4px; }
.difficulty-card .given-count { font-family: var(--font-mono); font-size: 12px; color: var(--paper-dim); }

/* ── Download CTA band ──────────────────────────────────────── */

.cta-band {
  background: var(--ink-800);
  border-top: 1px solid var(--grid-line);
  border-bottom: 1px solid var(--grid-line);
  text-align: center;
}
.cta-band .section__title,
.cta-band .section__lede { margin-left: auto; margin-right: auto; }
.cta-band .hero__badges { justify-content: center; }

/* ── Footer ─────────────────────────────────────────────────── */

footer { padding: 40px 0; border-top: 1px solid var(--grid-line); }
.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--paper-dim);
}
.footer__links { display: flex; gap: 20px; }
.footer__links a { text-decoration: none; color: var(--paper-dim); }
.footer__links a:hover { color: var(--paper); }

/* ── Legal / privacy page ───────────────────────────────────── */

.legal { padding: 64px 0 96px; max-width: 760px; }
.legal h1 { font-family: var(--font-display); font-size: clamp(28px, 4vw, 40px); margin: 0 0 8px; }
.legal .updated { font-family: var(--font-mono); font-size: 12px; color: var(--paper-dim); margin: 0 0 40px; }
.legal h2 { font-family: var(--font-display); font-size: 19px; margin: 36px 0 12px; }
.legal p, .legal li { color: var(--paper-dim); font-size: 15px; line-height: 1.7; }
.legal ul { padding-left: 20px; }
.legal strong { color: var(--paper); }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-teal);
  text-decoration: none;
  margin-bottom: 32px;
}
.back-link:hover { text-decoration: underline; }

/* ── Responsive ─────────────────────────────────────────────── */

@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; padding-top: 48px; }
  .feature-box { grid-template-columns: repeat(1, 1fr); }
  .feature-cell { border-right: none; }
  .difficulty-row { grid-template-columns: repeat(2, 1fr); }
  .nav__links { gap: 12px; }
  .nav__link.hide-mobile { display: none; }
}

@media (max-width: 520px) {
  .difficulty-row { grid-template-columns: repeat(2, 1fr); }
  .demo__keys { grid-template-columns: repeat(5, 1fr); }
  .demo__key--erase { grid-column: span 5; }
}
