/*
 * Shared stylesheet for QuizzyApp's public, crawlable pages — the legal
 * and info pages in web/, and the /learn/ pages emitted by
 * tools/prerender_site.mjs.
 *
 * Deliberately uses a system font stack rather than Google Fonts: the
 * Flutter app bundles Lexend as an asset and sets
 * `GoogleFonts.config.allowRuntimeFetching = false` specifically to
 * keep fonts.gstatic.com off the critical path. Pulling a webfont in
 * here would reintroduce exactly that request on the pages whose whole
 * job is to load fast for a crawler.
 */

:root {
  --brand: #2E3192;
  --brand-dark: #1F226B;
  --brand-light: #5258C7;
  --accent: #FFA000;
  --bg: #ffffff;
  --surface: #f7f7fb;
  --text: #1a1b2e;
  --muted: #5b5c72;
  --border: #e3e3ee;
  --radius: 14px;
  --maxw: 760px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --surface: #1c1c24;
    --text: #ececf5;
    --muted: #a2a3b4;
    --border: #2e2e3a;
    --brand-light: #8b8fe8;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

a { color: var(--brand-light); }
@media (prefers-color-scheme: light) { a { color: var(--brand); } }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.wrap--wide { max-width: 1080px; }

/* ── Header / footer ─────────────────────────────────────────────── */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
}

.brand img { width: 30px; height: 30px; border-radius: 8px; display: block; }

.site-nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-nav a { font-size: 14px; text-decoration: none; color: var(--muted); }
.site-nav a:hover { color: var(--brand-light); text-decoration: underline; }

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 64px;
  padding: 32px 0 48px;
  color: var(--muted);
  font-size: 14px;
}

.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.site-footer a { color: var(--muted); }

/* ── Typography ──────────────────────────────────────────────────── */

main { padding: 40px 0 0; }

h1 { font-size: 2rem; line-height: 1.25; margin: 0 0 8px; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; margin: 40px 0 10px; letter-spacing: -0.01em; }
h3 { font-size: 1.02rem; margin: 26px 0 6px; }

.lede { font-size: 1.08rem; color: var(--muted); margin: 0 0 8px; }
.updated { font-size: 0.85rem; color: var(--muted); margin: 0 0 8px; }

ul, ol { padding-left: 22px; }
li { margin: 6px 0; }

table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: 0.93rem; }
th, td { border: 1px solid var(--border); padding: 9px 11px; text-align: left; vertical-align: top; }
th { background: var(--surface); font-weight: 600; }

/* Wide content must scroll inside its own box, never the page body. */
.scroll-x { overflow-x: auto; }

/* ── Components ──────────────────────────────────────────────────── */

.hero {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  color: #fff;
  border-radius: 20px;
  padding: 34px 28px;
  margin-bottom: 32px;
}
.hero h1 { color: #fff; }
.hero p { color: rgba(255, 255, 255, 0.86); margin: 0; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  padding: 12px 22px;
  border-radius: var(--radius);
  margin-top: 18px;
}
.btn:hover { filter: brightness(1.06); }
.btn--ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.45);
  margin-left: 8px;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  background: var(--surface);
  margin: 14px 0;
}

.note {
  border-left: 3px solid var(--accent);
  background: var(--surface);
  padding: 12px 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 20px 0;
  font-size: 0.95rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.tile {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  display: block;
}
.tile:hover { border-color: var(--brand-light); }
.tile h3 { margin: 0 0 6px; font-size: 1rem; }
.tile p { margin: 0; font-size: 0.88rem; color: var(--muted); }

.meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.85rem; color: var(--muted); margin: 10px 0 0; }
.meta span { white-space: nowrap; }

.pill {
  display: inline-block;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(46, 49, 146, 0.1);
  color: var(--brand-light);
  border: 1px solid var(--border);
}

.prose { white-space: pre-wrap; }

.q { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; background: var(--surface); }
.q p { margin: 0 0 8px; font-weight: 600; }
.q ol { margin: 0; }

img { max-width: 100%; height: auto; }

@media (max-width: 560px) {
  h1 { font-size: 1.6rem; }
  .hero { padding: 26px 20px; }
  main { padding-top: 28px; }
}
