/* ============================================================
   Divly Help Center — shared styles
   Aligned to the app's brand kit v5 (apps/mobile/src/lib/theme.ts):
   Nunito 900 wordmark · Fraunces display headings · Inter 400/500
   body/UI (capped at 500); brand #2563FF + teal/purple/pink accents;
   white/near-black surfaces; attribute + prefers-color-scheme dark.
   Variable names are unchanged so the 14 help pages need no markup edits.
   ============================================================ */

:root {
  /* Brand — app accents */
  --blue: #2563FF;
  --blue-deep: #1E4FD6;
  --teal: #57DCBE;
  --purple: #9B30FF;
  --pink: #FF3D7F;
  --primary-tint: rgba(37,99,255,0.12);

  /* Surfaces (light) — app palette */
  --paper: #FFFFFF;
  --surface: #FFFFFF;
  --surface-subtle: #FAFAFB;
  --soft-bg: #F4F4F4;
  --border: rgba(14,23,38,0.22);
  --border-strong: rgba(14,23,38,0.34);

  /* Text */
  --ink: #0E1726;
  --muted: #6B7280;
  --hint: #5B6470;

  /* Radii — app radii */
  --r-md: 12px;
  --r-lg: 14px;
  --r-xl: 16px;
  --r-2xl: 18px;
  --r-3xl: 24px;
  --r-pill: 999px;

  /* Spacing scale */
  --s-xs: 4px;
  --s-sm: 6px;
  --s-base: 8px;
  --s-md: 10px;
  --s-lg: 12px;
  --s-xl: 14px;
  --s-2xl: 16px;
  --s-3xl: 20px;
  --s-4xl: 24px;
  --s-5xl: 32px;
  --s-6xl: 40px;
  --s-7xl: 56px;

  /* Elevation — app light shadows (borders carry separation) */
  --shadow-row: 0 2px 6px rgba(14,23,38,0.04);
  --shadow-card: 0 4px 12px rgba(14,23,38,0.06);
  --shadow-pop: 0 12px 30px rgba(14,23,38,0.10);

  --maxw: 1120px;
  --sidebar-w: 264px;

  --font-head: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-logo: 'Nunito', var(--font-body);
}

/* Dark mode — app dark palette. Attribute wins; prefers-color-scheme default. */
@media (prefers-color-scheme: dark) {
  :root {
    --blue: #6690FF;
    --blue-deep: #7AA2FF;
    --primary-tint: rgba(102,144,255,0.16);
    --paper: #000000;
    --surface: #14141A;
    --surface-subtle: #0B0B10;
    --soft-bg: rgba(255,255,255,0.06);
    --border: #2A2A33;
    --border-strong: #2A2A33;
    --ink: #FFFFFF;
    --muted: #9A9AA3;
    --hint: #9A9AA3;
    --shadow-row: none;
    --shadow-card: none;
    --shadow-pop: 0 20px 50px rgba(0,0,0,0.55);
  }
}
:root[data-theme="dark"] {
  --blue: #6690FF;
  --blue-deep: #7AA2FF;
  --primary-tint: rgba(102,144,255,0.16);
  --paper: #000000;
  --surface: #14141A;
  --surface-subtle: #0B0B10;
  --soft-bg: rgba(255,255,255,0.06);
  --border: #2A2A33;
  --border-strong: #2A2A33;
  --ink: #FFFFFF;
  --muted: #9A9AA3;
  --hint: #9A9AA3;
  --shadow-row: none;
  --shadow-card: none;
  --shadow-pop: 0 20px 50px rgba(0,0,0,0.55);
}
:root[data-theme="light"] {
  --blue: #2563FF;
  --blue-deep: #1E4FD6;
  --primary-tint: rgba(37,99,255,0.12);
  --paper: #FFFFFF;
  --surface: #FFFFFF;
  --surface-subtle: #FAFAFB;
  --soft-bg: #F4F4F4;
  --border: rgba(14,23,38,0.22);
  --border-strong: rgba(14,23,38,0.34);
  --ink: #0E1726;
  --muted: #6B7280;
  --hint: #5B6470;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Wordmark — Nunito 900 lowercase ---------- */
.wordmark {
  font-family: var(--font-logo);
  font-weight: 900;
  letter-spacing: -0.03em;
  text-transform: lowercase;
  color: var(--blue);
  font-size: 24px;
  line-height: 1;
}
.wordmark .dot { color: var(--blue); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--s-lg) var(--s-4xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2xl);
}
.topbar nav a {
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  margin-left: var(--s-3xl);
}
.topbar nav a:hover { color: var(--ink); text-decoration: none; }

/* ---------- Hero ---------- */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--s-7xl) var(--s-4xl) var(--s-5xl);
  text-align: center;
}
.hero h1 {
  font-family: var(--font-head);
  font-weight: 400;
  font-size: clamp(2.3rem, 5.4vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin: 0 0 var(--s-2xl);
}
.hero p {
  font-size: 18px;
  color: var(--muted);
  max-width: 620px;
  margin: 0 auto var(--s-4xl);
}
.search {
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}
.search input {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  padding: var(--s-xl) var(--s-3xl) var(--s-xl) 48px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-card);
  outline: none;
}
.search input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px var(--primary-tint); }
.search svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); }

/* ---------- Layout: sidebar + content ---------- */
.layout {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--s-4xl);
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: var(--s-6xl);
  align-items: start;
}
.sidebar {
  position: sticky;
  top: 84px;
  font-size: 14px;
}
.sidebar h4 {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin: var(--s-4xl) 0 var(--s-base);
}
.sidebar h4:first-child { margin-top: 0; }
.sidebar a {
  display: block;
  color: var(--muted);
  padding: var(--s-sm) var(--s-lg);
  border-radius: var(--r-base, 8px);
  margin: 2px 0;
}
.sidebar a:hover { color: var(--ink); background: var(--surface-subtle); text-decoration: none; }
.sidebar a.active { color: var(--blue); background: var(--primary-tint); font-weight: 500; }

/* ---------- Topic cards (index) ---------- */
.cards {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--s-4xl) var(--s-7xl);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-3xl);
}
.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  padding: var(--s-4xl);
  box-shadow: var(--shadow-card);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  color: var(--ink);
}
.card:hover { transform: translateY(-2px); text-decoration: none; box-shadow: var(--shadow-pop); }
.card .badge {
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-lg);
  margin-bottom: var(--s-2xl);
  font-size: 20px;
}
.card h3 { font-family: var(--font-body); font-size: 18px; font-weight: 500; letter-spacing: -0.01em; margin: 0 0 var(--s-sm); }
.card p { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.55; }

/* Accent helpers — app feature colors */
.t-blue   { background: var(--primary-tint); color: var(--blue); }
.t-teal   { background: rgba(87, 220, 190, 0.16); color: #0f9b82; }
.t-purple { background: rgba(155, 48, 255, 0.12); color: var(--purple); }
.t-pink   { background: rgba(255, 61, 127, 0.12); color: var(--pink); }

/* ---------- Article ---------- */
.article { min-width: 0; max-width: 760px; }
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: var(--s-2xl); }
.breadcrumb a { color: var(--muted); }
.article h1 {
  font-family: var(--font-head);
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 2.6rem);
  line-height: 1.12;
  margin: 0 0 var(--s-lg);
  letter-spacing: -0.01em;
}
.article .lede { font-size: 18px; color: var(--muted); margin: 0 0 var(--s-4xl); }
.article h2 {
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: var(--s-6xl) 0 var(--s-lg);
  padding-top: var(--s-lg);
}
.article h3 { font-family: var(--font-body); font-size: 18px; font-weight: 500; margin: var(--s-4xl) 0 var(--s-base); }
.article p, .article li { font-size: 16px; line-height: 1.7; }
.article ul, .article ol { padding-left: var(--s-4xl); }
.article li { margin: var(--s-sm) 0; }
.article strong { font-weight: 500; color: var(--ink); }

/* Steps */
.steps { counter-reset: step; list-style: none; padding: 0; margin: var(--s-3xl) 0; }
.steps li {
  position: relative;
  padding: 0 0 var(--s-3xl) 48px;
  border-left: 2px solid var(--border);
  margin-left: 14px;
}
.steps li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: -15px; top: -4px;
  width: 28px; height: 28px;
  background: var(--blue); color: #fff;
  border-radius: var(--r-pill);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 500;
  font-family: var(--font-body);
}

/* Callouts */
.note, .tip, .warn {
  border-radius: var(--r-lg);
  padding: var(--s-2xl) var(--s-3xl);
  margin: var(--s-3xl) 0;
  font-size: 15px;
  border: 1px solid var(--border);
}
.note { background: var(--surface-subtle); }
.tip  { background: rgba(87, 220, 190, 0.10); border-color: rgba(87, 220, 190, 0.4); }
.warn { background: rgba(255, 61, 127, 0.08); border-color: rgba(255, 61, 127, 0.35); }
.note strong, .tip strong, .warn strong { display: block; margin-bottom: 2px; }

/* Platform pills */
.pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  color: var(--muted);
  margin-right: var(--s-sm);
}
.pill.ios { color: var(--blue); border-color: var(--blue); }
.pill.android { color: #0f9b82; border-color: var(--teal); }

/* Article footer nav */
.article-nav {
  display: flex; justify-content: space-between; gap: var(--s-2xl);
  margin-top: var(--s-7xl);
  padding-top: var(--s-4xl);
  border-top: 1px solid var(--border);
}
.article-nav a {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-2xl);
  color: var(--ink);
}
.article-nav a:hover { border-color: var(--blue); text-decoration: none; }
.article-nav span { display: block; font-size: 12px; color: var(--muted); }
.article-nav .next { text-align: right; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  margin-top: var(--s-7xl);
  background: var(--surface-subtle);
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--s-5xl) var(--s-4xl);
  display: flex; flex-wrap: wrap; gap: var(--s-3xl);
  align-items: center; justify-content: space-between;
  color: var(--muted); font-size: 14px;
}
.footer a { color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: var(--s-3xl); }
  .sidebar {
    position: static;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--s-2xl);
  }
  .topbar nav a { margin-left: var(--s-2xl); }
}
