/* Feastward — static site styles.
 *
 * Shared by every hand-authored page under public/: the landing page, the
 * missionary-prep page, and the legal/support pages. NOT used by the Expo app
 * itself, which paints from src/design/tokens.ts.
 *
 * Tokens below are lifted verbatim from docs/06-design-system.md section 3 so
 * the marketing surface and the app cannot drift apart. If a value changes
 * there, change it here.
 *
 * Deliberately not Duolingo: no #58CC02 green, no white ground, no circular
 * nodes on a winding path, no cartoon face. Gold on parchment, warm and lit.
 */

:root {
  --parchment: #fbf6ec;
  --parchment-2: #f2e9d8;
  --ink: #2a2118;
  --ink-soft: #6b5d4b;

  --vesper: #1c1726;
  --vesper-2: #2a2236;
  --linen: #f5efe3;
  --linen-soft: #b9ac98;

  --gold: #d9a32b;
  --gold-deep: #a8761a;
  --gold-ink: #805f17;
  --olive: #6e7f4f;
  --olive-deep: #4c5a36;
  --ember: #c4562f;
  --clay: #a85c4a;
  --sky: #5b7fa6;

  --bg: var(--parchment);
  --bg-raised: var(--parchment-2);
  --text: var(--ink);
  --text-soft: var(--ink-soft);
  --border: #e2d6bf;
  /* --gold-ink on parchment. Two gold hexes are wrong for link text here and
     it is worth naming both: --gold #D9A32B is 2.1:1 and obviously fails,
     but --gold-deep #A8761A is the trap, because it LOOKS dark enough. It
     measures 3.70:1 on parchment and 3.31:1 on parchment-2 — both under the
     4.5 section 8 requires. (This comment previously claimed 4.6:1 for it,
     which was simply wrong; corrected 2026-08-31 by measurement.)
     --gold-ink #805F17 is the token the design system already keeps for
     exactly this job — `paletteText.goldInk`, "accent used as text on a
     plain surface (AA-safe tint)" — at 5.47:1 and 4.88:1. */
  --link: var(--gold-ink);

  --display: 'Fraunces', ui-serif, Georgia, 'Times New Roman', serif;
  --ui: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --scripture: 'Source Serif 4', ui-serif, Georgia, serif;

  --measure: 34rem;
  --wide: 62rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--vesper);
    --bg-raised: var(--vesper-2);
    --text: var(--linen);
    --text-soft: var(--linen-soft);
    --border: #3a3147;
    /* On the dark ground full --gold is 7.69:1 — no need to darken it.
       (Measured 2026-08-31; the comment used to say 8.3, still passing.) */
    --link: var(--gold);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  /* Fluid, and it scales with the user's browser text size because the clamp
     is in rem. docs/06 section 8: font scaling honoured to 200%. */
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.075rem);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* ---------- layout ---------- */

.wrap {
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.prose {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem;
}

section {
  padding: clamp(3rem, 8vw, 5.5rem) 0;
}

/* ---------- type ---------- */

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 0 0 0.5em;
}

h1 {
  font-size: clamp(2.25rem, 1.6rem + 3.2vw, 4rem);
}
h2 {
  font-size: clamp(1.6rem, 1.35rem + 1.2vw, 2.25rem);
  margin-top: 2.5em;
}
h3 {
  font-size: clamp(1.15rem, 1.08rem + 0.4vw, 1.35rem);
  margin-top: 2em;
}

p {
  margin: 0 0 1.15em;
  text-wrap: pretty;
}

.lede {
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.35rem);
  color: var(--text-soft);
  line-height: 1.55;
  max-width: 32ch;
}

.eyebrow {
  font-family: var(--ui);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  /* 0.8rem is normal text to WCAG whatever its weight, so this needs 4.5:1
     and --gold-deep only reaches 3.70. Same fix as --link above. */
  color: var(--gold-ink);
  margin: 0 0 1rem;
}

@media (prefers-color-scheme: dark) {
  .eyebrow {
    color: var(--gold);
  }
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--gold-deep);
  outline-offset: 3px;
  border-radius: 3px;
}

blockquote {
  margin: 2rem 0;
  padding-left: 1.25rem;
  border-left: 3px solid var(--gold);
  font-family: var(--scripture);
  font-size: 1.1rem;
  line-height: 1.65;
  color: var(--text);
}

blockquote cite {
  display: block;
  margin-top: 0.6rem;
  font-family: var(--ui);
  font-size: 0.85rem;
  font-style: normal;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}

/* ---------- header / footer ---------- */

.site-head {
  border-bottom: 1px solid var(--border);
}

.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.5rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand img {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 0.45rem;
  display: block;
}

.nav {
  display: flex;
  gap: 1.4rem;
  font-size: 0.95rem;
}

.nav a {
  color: var(--text-soft);
  text-decoration: none;
}
.nav a:hover {
  color: var(--text);
  text-decoration: underline;
}

.site-foot {
  border-top: 1px solid var(--border);
  padding: 3rem 0;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.site-foot .nav {
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

/* The donate link. Feastward is free forever and a donation unlocks nothing
   (Terms section 8), so this is an invitation sitting in the footer rather
   than a button anywhere near a lesson. It takes --link rather than the
   footer's --text-soft so it is findable without shouting: --link is already
   the theme-aware, AA-contrast accent (--gold-deep on parchment, --gold on the
   dark ground - see the tokens at the top of this file). Rendered only when
   `donate_url` is set in docs/legal/site-config.json; empty means no link. */
.nav a.donate {
  color: var(--link);
}

/* The endorsement disclaimer. Required to be persistent and findable, not
   buried — docs/05-ip-and-reverence.md section 1. It is styled to be read,
   not to disappear: same size as the rest of the footer, never smaller. */
.disclaimer {
  max-width: 46rem;
  margin: 0 0 0.75rem;
}

/* ---------- components ---------- */

.btn {
  display: inline-block;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  font-family: var(--ui);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border: 2px solid transparent;
  transition: transform 120ms ease, background-color 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  /* Gold ground with near-black ink: 8.9:1. Gold-on-parchment text would fail. */
  background: var(--gold);
  color: #241c10;
}
.btn-primary:hover {
  background: #e6b243;
}

.btn-secondary {
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover {
  border-color: var(--gold-deep);
}

.actions {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.6rem;
}

.card h3 {
  margin-top: 0;
}

.card p:last-child {
  margin-bottom: 0;
}

.card p {
  color: var(--text-soft);
  font-size: 0.97rem;
}

/* The "what Feastward won't do" block. Reverence Guardrails, docs/05 section 5.
   Set apart on the olive side of the palette because it is the promise, not
   a feature list. */
.promise {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-left: 4px solid var(--olive);
  border-radius: 0.9rem;
  padding: 1.5rem 1.75rem;
}

.promise ul {
  margin: 0;
  padding-left: 1.2rem;
}

.promise li {
  margin-bottom: 0.7rem;
}

.promise li:last-child {
  margin-bottom: 0;
}

.note {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 1.25rem 1.5rem;
  font-size: 0.95rem;
  color: var(--text-soft);
}

/* Legal pages: dense, readable, long. */
.legal h2 {
  font-size: 1.4rem;
  margin-top: 2.5em;
  padding-top: 0.6em;
  border-top: 1px solid var(--border);
}

/* The horizontal scroller for wide tables.
 *
 * The overflow used to sit on the `<table>` itself, with `display: block` to
 * make it a scroll box. That was wrong twice: `display: block` on a table
 * drops the table semantics in several browsers, and a bare scroll container
 * cannot be reached by keyboard at all — WCAG 2.1.1 Keyboard, Level A. A
 * mouse user could drag the columns into view and a keyboard-only user simply
 * could not.
 *
 * So the table keeps `display: table` and tools/build_legal_pages.py wraps it
 * in `div.table-scroll[tabindex="0"][role="region"][aria-labelledby]`. That
 * generator carries the full reasoning, including why the name comes from the
 * heading above the table. Both halves are required; neither works alone.
 *
 * The focus ring is the one `:focus-visible` already draws for every element
 * on this site — 3px of --gold-deep. No new colour is introduced here on
 * purpose: --gold-deep #A8761A measures 3.70:1 on --parchment #FBF6EC and
 * 4.39:1 on --vesper #1C1726 (computed 2026-09-01), both clear of the 3:1
 * that 1.4.11 Non-text Contrast asks of a focus indicator, on both grounds.
 */
.legal .table-scroll {
  margin: 1.5rem 0;
  overflow-x: auto;
  /* A scroller that hands its leftover momentum to the page makes the region
     feel broken when you reach the last column. */
  overscroll-behavior-x: contain;
}

/* The wrapper owns the spacing so the focus outline hugs the table rather
   than a rem and a half of air. Tables outside a wrapper keep their own. */
.legal .table-scroll > table {
  margin: 0;
}

.legal table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.93rem;
}

.legal th,
.legal td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.legal th {
  font-weight: 600;
  color: var(--text);
}

.legal td {
  color: var(--text-soft);
}

.updated {
  color: var(--text-soft);
  font-size: 0.9rem;
  margin-bottom: 2.5rem;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
  .btn:hover {
    transform: none;
  }
}
