/* KathaSagaram landing — vanilla CSS, mobile-first.
   Tokens mirrored from kathasagaram-app/src/engine/tokens.ts. */

:root {
  --bg-forest: #0F2A2C;
  --bg-deep: #0A1F21;
  --surface: #0D3A38;
  --surface-2: #103E3C;
  --gold: #E0A92E;
  --gold-2: #C5953A;
  --red: #9B2C2C;
  --text: #F4ECCB;
  --text-dim: rgba(244, 236, 203, 0.7);
  --text-muted: rgba(197, 149, 58, 0.65);

  --display: 'Playfair Display', 'Mukta', 'Noto Sans Telugu', Georgia, serif;
  --body: 'Newsreader', 'Mukta', 'Noto Sans Telugu', Georgia, serif;
  --ui: 'Inter', 'Mukta', 'Noto Sans Telugu', system-ui, sans-serif;

  --container: 1120px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-forest);
  color: var(--text);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(circle at 12% -10%, rgba(224, 169, 46, 0.10) 0, transparent 45%),
    radial-gradient(circle at 90% -8%, rgba(155, 44, 44, 0.10) 0, transparent 45%),
    var(--bg-forest);
  min-height: 100vh;
}

img { max-width: 100%; display: block; }
a { color: var(--gold); text-decoration: none; }
a:hover, a:focus-visible { color: var(--gold-2); text-decoration: underline; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; line-height: 1.15; margin: 0 0 0.4em; color: var(--text); }
h1 { font-size: clamp(2rem, 4.5vw + 1rem, 3.6rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.6rem, 2.4vw + 0.8rem, 2.4rem); letter-spacing: -0.005em; }
h3 { font-size: 1.25rem; }
h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--gold); font-family: var(--ui); font-weight: 700; margin-bottom: 0.6em; }
p { margin: 0 0 1em; color: var(--text-dim); }

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

/* ── Skip link ──────────────────────────── */
.skip-link {
  position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden;
}
.skip-link:focus { left: 12px; top: 12px; width: auto; height: auto; padding: 8px 16px; background: var(--gold); color: var(--bg-deep); border-radius: 6px; z-index: 100; }

/* ── Header ─────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 31, 33, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(224, 169, 46, 0.12);
}
.header-row {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; padding-bottom: 14px; gap: 16px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--display); font-weight: 700; font-size: 1.2rem;
  color: var(--text); text-decoration: none;
}
.brand:hover, .brand:focus-visible { text-decoration: none; color: var(--gold); }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-2) 100%);
  color: var(--bg-deep); font-size: 1.2rem; font-weight: 700;
  font-family: var(--display);
}
.site-nav { display: flex; gap: 22px; }
.site-nav a { color: var(--text-dim); font-family: var(--ui); font-size: 0.92rem; }
.site-nav a:hover, .site-nav a:focus-visible { color: var(--gold); text-decoration: none; }
@media (max-width: 640px) { .site-nav { gap: 14px; font-size: 0.85rem; } .site-nav a { font-size: 0.85rem; } }
@media (max-width: 480px) { .site-nav a:nth-child(3), .site-nav a:nth-child(4) { display: none; } }

/* ── Hero ───────────────────────────────── */
.hero {
  padding: 80px 0 64px;
  position: relative;
  text-align: center;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(224, 169, 46, 0.12) 0, transparent 60%);
  pointer-events: none;
}
.hero-eyebrow {
  display: inline-block; font-family: var(--ui); font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--gold); padding: 6px 14px;
  border: 1px solid rgba(224, 169, 46, 0.3); border-radius: 999px;
  margin-bottom: 24px;
}
.hero h1 {
  max-width: 16ch; margin-left: auto; margin-right: auto;
  background: linear-gradient(180deg, var(--text) 0%, #d9c995 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead {
  max-width: 38ch; margin: 18px auto 36px;
  font-size: 1.15rem; color: var(--text-dim);
  font-family: var(--body); font-style: italic;
}
.cta-row {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: center;
}
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 24px; border-radius: 999px;
  font-family: var(--ui); font-weight: 600; font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer; transition: transform 120ms ease, background 200ms ease, color 200ms ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary {
  background: var(--gold); color: var(--bg-deep);
}
.btn-primary:hover, .btn-primary:focus-visible { background: var(--gold-2); color: var(--bg-deep); }
.btn-ghost {
  background: transparent; color: var(--text);
  border-color: rgba(244, 236, 203, 0.25);
}
.btn-ghost:hover, .btn-ghost:focus-visible { border-color: var(--gold); color: var(--gold); }

.store-badges {
  display: flex; flex-wrap: wrap; gap: 14px; justify-content: center;
  margin-top: 32px;
}
.store-badge {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 12px 18px; border-radius: 14px;
  background: var(--bg-deep); border: 1px solid rgba(224, 169, 46, 0.18);
  color: var(--text); text-decoration: none;
  font-family: var(--ui);
}
.store-badge:hover { border-color: var(--gold); color: var(--text); text-decoration: none; }
.store-badge svg { width: 22px; height: 22px; flex: none; color: var(--gold); }
.store-badge .small { display: block; font-size: 0.7rem; color: var(--text-muted); letter-spacing: 0.06em; text-transform: uppercase; }
.store-badge .large { display: block; font-size: 1rem; font-weight: 600; line-height: 1; margin-top: 2px; }
.store-badge.coming { opacity: 0.55; }
.store-badge.coming .large::after { content: ' · soon'; font-weight: 400; color: var(--text-muted); font-size: 0.85rem; }

/* ── Section ────────────────────────────── */
section.block { padding: 64px 0; }
section.block.tinted { background: linear-gradient(180deg, var(--bg-forest) 0%, var(--bg-deep) 100%); }
.section-head { text-align: center; margin-bottom: 40px; }
.section-head .eyebrow {
  font-family: var(--ui); font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.18em; color: var(--gold); margin-bottom: 14px; display: block;
}
.section-head p { max-width: 50ch; margin: 12px auto 0; }

/* ── Cards grid ─────────────────────────── */
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid rgba(224, 169, 46, 0.10);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color 200ms ease, transform 200ms ease;
}
.card:hover { border-color: rgba(224, 169, 46, 0.45); transform: translateY(-2px); }
.card h3 { color: var(--text); margin-bottom: 4px; }
.card p { color: var(--text-dim); margin: 0; font-size: 0.95rem; }

/* ── Story / character cards ────────────── */
.story-card {
  background: var(--surface);
  border: 1px solid rgba(224, 169, 46, 0.12);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  text-decoration: none; color: var(--text);
  transition: transform 200ms ease, border-color 200ms ease;
}
.story-card:hover, .story-card:focus-visible {
  text-decoration: none; transform: translateY(-3px);
  border-color: rgba(224, 169, 46, 0.45);
}
.story-card.coming { opacity: 0.85; }
.story-card .hero-img {
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #1a4f4d 0%, var(--surface) 100%);
  background-size: cover; background-position: center;
  display: flex; align-items: flex-end; padding: 14px;
}
.story-card .body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 6px; }
.story-card .pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(224, 169, 46, 0.18); color: var(--gold);
  font-family: var(--ui); font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 4px 10px; border-radius: 999px;
  align-self: flex-start;
}
.story-card .pill.coming { background: rgba(244, 236, 203, 0.08); color: var(--text-muted); }
.story-card h3 { font-size: 1.2rem; margin: 6px 0 4px; }
.story-card .summary { color: var(--text-dim); font-size: 0.95rem; }
.story-card .meta { font-family: var(--ui); font-size: 0.78rem; color: var(--text-muted); margin-top: 8px; }

.story-card .hero-img { background-size: cover; background-position: center; }

/* ── Character bridge: portrait + "More like" rail ─── */
/* Square portrait on character bridge pages — matches the in-app circular framing
   the kid sees, but rendered as a soft-rounded square for web composition. */
.bridge-hero img[alt] { aspect-ratio: 1 / 1; object-fit: cover; }

/* Horizontal scrolling rail of related characters. On wide viewports it wraps
   into a flex grid; on mobile it stays single-row scrollable so kids can swipe. */
.character-row {
  display: flex; gap: 16px; overflow-x: auto; padding: 4px 4px 12px;
  scroll-snap-type: x mandatory; scrollbar-width: thin;
}
.character-tile {
  flex: 0 0 auto; width: 96px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-decoration: none; color: var(--text);
  scroll-snap-align: start;
  transition: transform 160ms ease;
}
.character-tile:hover, .character-tile:focus-visible {
  transform: translateY(-3px); text-decoration: none;
}
.character-tile-img {
  width: 96px; height: 96px; border-radius: 50%; overflow: hidden;
  background: linear-gradient(135deg, #1a4f4d, var(--surface));
  border: 2px solid rgba(224, 169, 46, 0.45);
}
.character-tile-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.character-tile span {
  font-family: var(--ui); font-size: 0.85rem; text-align: center;
  color: var(--text); line-height: 1.2;
}

/* ── How it works ───────────────────────── */
.how-row {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 32px;
}
.how-step {
  text-align: center; padding: 26px 18px;
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid rgba(224, 169, 46, 0.10);
}
.how-step .step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: var(--bg-deep); font-family: var(--display); font-size: 1.4rem;
  font-weight: 700; margin-bottom: 14px;
}
.how-step h3 { color: var(--text); }

/* ── Languages strip ────────────────────── */
.lang-row {
  display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 28px;
}
.lang-chip {
  font-family: var(--ui); font-size: 1rem;
  padding: 12px 22px; border-radius: 999px;
  background: var(--surface); border: 1px solid rgba(224, 169, 46, 0.2);
  color: var(--text);
}
.lang-chip[lang="hi"] { font-family: 'Mukta', var(--ui); }
.lang-chip[lang="te"] { font-family: 'Noto Sans Telugu', var(--ui); }

/* ── AI disclosure callout ──────────────── */
.callout {
  border: 1px solid rgba(224, 169, 46, 0.3);
  background: linear-gradient(180deg, rgba(224, 169, 46, 0.06), rgba(224, 169, 46, 0));
  border-radius: var(--radius-lg);
  padding: 32px;
}
.callout h2 { margin-top: 0; }
.callout p:last-child { margin-bottom: 0; }

/* ── FAQ ────────────────────────────────── */
.faq details {
  background: var(--surface);
  border: 1px solid rgba(224, 169, 46, 0.10);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 12px;
}
.faq summary {
  cursor: pointer; list-style: none;
  font-family: var(--display); font-size: 1.08rem; color: var(--text);
  display: flex; justify-content: space-between; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--gold); font-size: 1.5rem; line-height: 1; transition: transform 200ms ease; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin-top: 12px; margin-bottom: 0; }

/* ── Footer ─────────────────────────────── */
.site-footer {
  margin-top: 80px; padding: 56px 0 24px;
  border-top: 1px solid rgba(224, 169, 46, 0.12);
  background: var(--bg-deep);
}
.footer-grid {
  display: grid; gap: 36px;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  margin-bottom: 32px;
}
.brand-footer { font-size: 1.4rem; }
.footer-tagline { color: var(--text-dim); margin-top: 12px; max-width: 38ch; font-size: 0.95rem; }
.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li { margin-bottom: 10px; }
.link-list a { color: var(--text-dim); font-family: var(--ui); font-size: 0.92rem; }
.link-list a:hover, .link-list a:focus-visible { color: var(--gold); text-decoration: none; }
.footer-fineprint { color: var(--text-muted); font-size: 0.85rem; padding-top: 24px; border-top: 1px solid rgba(244, 236, 203, 0.06); }
@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
}

/* ── Bridge page (per-story / per-character) ─── */
.bridge {
  padding: 56px 0 48px;
}
.bridge .crumbs {
  font-family: var(--ui); font-size: 0.8rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 16px;
}
.bridge .crumbs a { color: var(--text-muted); }
.bridge .crumbs a:hover { color: var(--gold); text-decoration: none; }
.bridge h1 { margin-bottom: 8px; }
.bridge .subtitle { font-style: italic; color: var(--text-dim); font-size: 1.15rem; margin-bottom: 28px; }
.bridge-grid {
  display: grid; gap: 36px; margin-top: 32px;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
}
@media (max-width: 820px) { .bridge-grid { grid-template-columns: 1fr; } }
.bridge-hero {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid rgba(224, 169, 46, 0.18);
  overflow: hidden;
}
.bridge-hero img { aspect-ratio: 16 / 10; object-fit: cover; width: 100%; }
.bridge-hero.placeholder {
  aspect-ratio: 16 / 10;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a4f4d 0%, var(--surface) 100%);
  color: var(--gold); font-family: var(--display); font-size: 4rem; opacity: 0.6;
}
.bridge-side {
  display: flex; flex-direction: column; gap: 20px;
}
.bridge-card {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid rgba(224, 169, 46, 0.12);
  padding: 22px;
}
.bridge-card h3 { font-family: var(--ui); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--gold); margin-bottom: 10px; }
.bridge-card p, .bridge-card ul { color: var(--text-dim); font-size: 0.95rem; margin: 0; }
.bridge-card ul { padding-left: 18px; }
.bridge-card .field { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid rgba(244, 236, 203, 0.06); font-size: 0.92rem; }
.bridge-card .field:last-child { border-bottom: 0; }
.bridge-card .field b { color: var(--text); font-family: var(--ui); font-weight: 500; }

.cta-stack { display: flex; flex-direction: column; gap: 10px; }
.cta-stack .btn { justify-content: center; }
.cta-stack .small { font-size: 0.85rem; color: var(--text-muted); text-align: center; margin-top: 4px; }

.langs-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.langs-list .tag {
  font-family: var(--ui); font-size: 0.78rem; padding: 4px 10px;
  background: rgba(224, 169, 46, 0.14); color: var(--gold);
  border-radius: 999px;
}

/* ── Doc pages (privacy, AI disclosure) ─── */
.doc {
  max-width: 720px; margin: 0 auto; padding: 48px 0 24px;
}
.doc h1 { margin-bottom: 8px; }
.doc .updated { color: var(--text-muted); font-size: 0.88rem; font-family: var(--ui); margin-bottom: 32px; }
.doc h2 { margin-top: 36px; }
.doc h3 { margin-top: 24px; color: var(--gold); font-size: 1rem; font-family: var(--ui); text-transform: uppercase; letter-spacing: 0.1em; }
.doc p, .doc li { color: var(--text-dim); }
.doc ul { padding-left: 22px; }
.doc li { margin-bottom: 8px; }
.doc strong { color: var(--text); font-weight: 600; }

/* ── 404 ────────────────────────────────── */
.notfound { padding: 100px 0; text-align: center; }
.notfound h1 { font-size: clamp(3rem, 8vw, 6rem); margin-bottom: 8px; color: var(--gold); }
