/* Recollect — brand & layout. "Paper & ink, a fading Memory."
   Palette mirrors recollect-web/scene.rs (docs/decisions/brand_and_accessibility.md),
   so the site and the wgpu client speak one visual language. WCAG-AA contrast. */

:root {
  /* Palette (the canonical brand colours; same values as the renderer). */
  --paper: #f5f0e3;     /* the page / ground */
  --night: #17171f;     /* ink text + the Dusk */
  --seat-a: #2e5c9e;    /* Lorekeepers — cool ink-blue */
  --seat-b: #a83d33;    /* the Solace — warm ink-red */
  --gold: #b07c2e;      /* resolve / accents — a burnished ANTIQUE gold (brass-amber), not the
                           old bright lemon (#ebc72e read cheap); deeper + warmer reads precious */
  --ink-soft: #44434c;  /* secondary ink (meets AA on paper) */
  --rule: #d8d1bf;      /* hairlines on paper */

  --measure: 38rem;            /* readable line length */
  --container: 64rem;
  --space: clamp(1rem, 2.5vw, 1.75rem);
  --radius: 6px;

  /* EB Garamond (bundled webfont, OFL) — one family with the wgpu canvas + mobile shells;
     the system humanist serifs remain as a graceful fallback while the webfont loads / if it fails. */
  --serif: "EB Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

@font-face {
  font-family: "EB Garamond";
  src: url("../fonts/EBGaramond.ttf") format("truetype");
  font-weight: 400 700; /* variable weight axis */
  font-style: normal;
  font-display: swap;   /* show the fallback serif immediately, swap in EB Garamond when ready */
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--night);
  font-family: var(--serif);
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.15rem);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

/* Skip link + visible focus — keyboard a11y. */
.skip-link {
  position: absolute; left: 0; top: -3rem;
  background: var(--night); color: var(--paper);
  padding: 0.5rem 1rem; border-radius: 0 0 var(--radius) 0;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0; }
:focus-visible { outline: 3px solid var(--seat-a); outline-offset: 2px; }

a { color: var(--seat-a); text-underline-offset: 0.15em; }
a:hover { color: var(--seat-b); }

/* Faction ink — the seat colours as utility classes (so prose can tint the
   Lorekeepers / Solace without an inline style attribute; keeps the markup free of
   element-level inline CSS). Both meet AA on paper (verified). */
.ink-a { color: var(--seat-a); }
.ink-b { color: var(--seat-b); }

h1, h2, h3 { line-height: 1.15; font-weight: 700; }
h1 { font-size: clamp(2.2rem, 1.6rem + 3vw, 3.6rem); margin: 0 0 0.4em; }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); margin: 1.6em 0 0.5em; }
p { max-width: var(--measure); }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--space); }

/* Header + nav */
.site-header { border-bottom: 1px solid var(--rule); position: relative; }
.site-header .container {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1.5rem;
  padding-block: 1rem;
}
.brand { font-size: 1.4rem; font-weight: 700; color: var(--night); text-decoration: none; letter-spacing: 0.01em; }
.brand:hover { color: var(--night); }
/* The nav fills the bar to the right of the brand so the Options control can sit at the FAR
   RIGHT (margin-left:auto), opposite the page links — the same layout as the play header. */
.site-nav { flex: 1 1 auto; display: flex; gap: 1.25rem; flex-wrap: wrap; align-items: baseline; }
.site-nav a[aria-current="page"] { color: var(--night); font-weight: 700; text-decoration: none; }

/* The Options disclosure — ported from the play header so every page carries the SAME
   right-aligned settings control. The button is the rightmost nav item; the panel drops
   below it (the header is the positioning context above). */
.nav-options {
  font: inherit; color: var(--seat-a); background: none; border: 0; padding: 0;
  cursor: pointer; text-underline-offset: 0.15em; margin-left: auto;
}
.nav-options:hover { color: var(--seat-b); }
.nav-options[aria-expanded="true"] { color: var(--night); font-weight: 700; }
.nav-options::after { content: " ▾"; font-size: 0.8em; opacity: 0.7; }
.options-panel {
  position: absolute; right: clamp(12px, 4vw, 1.75rem); margin-top: 0.4rem; z-index: 20;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(23, 23, 31, 0.18);
}
.options-panel[hidden] { display: none; }
.options-inner { padding: 0.9rem 1.1rem; }
.options-title {
  margin: 0 0 0.6rem; font-size: 0.95rem; font-weight: 700; color: var(--night);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.site-settings { display: flex; flex-direction: column; align-items: flex-start; gap: 0.7rem; color: var(--ink-soft); font-size: 0.95rem; }
.site-settings .setting { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; cursor: pointer; }
.site-settings .setting input { width: 1rem; height: 1rem; accent-color: var(--seat-a); }
/* Manual reduced-motion: the toggle adds .reduce-motion to <html> (persisted); the OS
   setting is honored on its own below. */
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after {
  animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important; scroll-behavior: auto !important;
}
@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;
  }
}

main { display: block; }
.section { padding-block: clamp(2rem, 5vw, 4rem); }

/* Hero */
.hero { text-align: center; padding-block: clamp(3rem, 8vw, 6rem); }
.hero .lede { font-size: 1.25rem; color: var(--ink-soft); margin-inline: auto; }
.factions { color: var(--ink-soft); font-style: italic; }
.factions .a { color: var(--seat-a); font-style: normal; font-weight: 700; }
.factions .b { color: var(--seat-b); font-style: normal; font-weight: 700; }

/* Buttons / CTAs */
.btn {
  display: inline-block; font: inherit; font-weight: 700;
  padding: 0.7rem 1.5rem; border-radius: var(--radius);
  text-decoration: none; cursor: pointer; border: 2px solid var(--night);
}
.btn-primary { background: var(--night); color: var(--paper); }
.btn-primary:hover { background: var(--seat-a); border-color: var(--seat-a); color: var(--paper); }
.btn + .btn { margin-left: 0.75rem; }

/* Feature grid (what-is-this) */
.features { display: grid; gap: var(--space); grid-template-columns: 1fr; margin-top: var(--space); }
.feature { border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--space); background: #fbf8f0; }
.feature h3 { margin: 0 0 0.3em; }
.feature p { color: var(--ink-soft); margin: 0; }

/* Prose pages (rules, etc.) */
.prose { padding-block: clamp(2rem, 5vw, 3.5rem); }
.prose p, .prose li { max-width: var(--measure); }
.prose ul { padding-left: 1.2em; }

.note { color: var(--ink-soft); font-style: italic; }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); margin-top: 3rem; color: var(--ink-soft); }
.site-footer .container { padding-block: 1.5rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }

/* Responsive — mobile-first; widen the feature grid on larger screens. */
@media (min-width: 40rem) {
  .features { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 56rem) {
  .features { grid-template-columns: repeat(3, 1fr); }
}

/* Motion — subtle + consistent; ALL of it is disabled under prefers-reduced-motion below. */
a, .btn, .site-nav a, .card, .feature {
  transition: color .15s ease, background-color .15s ease, border-color .15s ease,
    transform .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.card:hover, .feature:hover {
  transform: translateY(-2px); border-color: var(--seat-a);
  box-shadow: 0 6px 16px rgba(23, 23, 31, 0.08);
}
@keyframes recollect-fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.hero { animation: recollect-fade-up .55s ease both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Card catalog */
.cards-toolbar { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: end; margin: var(--space) 0; }
.cards-toolbar label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--ink-soft); }
.cards-toolbar input, .cards-toolbar select {
  font: inherit; font-size: 1rem; padding: 0.4rem 0.5rem;
  border: 1px solid var(--rule); border-radius: var(--radius); background: #fff; color: var(--night);
}
.cards-grid { display: grid; gap: var(--space); grid-template-columns: 1fr; }
.card {
  border: 1px solid var(--rule); border-left: 4px solid var(--seat-a);
  border-radius: var(--radius); padding: var(--space); background: #fbf8f0;
}
.card h3 { margin: 0 0 0.4em; font-size: 1.15rem; }
.card .badges { margin: 0 0 0.5em; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.badge {
  font-size: 0.72rem; letter-spacing: 0.03em; text-transform: uppercase;
  padding: 0.15em 0.55em; border-radius: 999px; background: var(--night); color: var(--paper);
}
.badge.res { background: var(--gold); color: var(--night); }
.card .stats { margin: 0 0 0.5em; font-size: 0.9rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.card .rules { margin: 0; max-width: none; }
.keywords { margin: 0.6em 0 0; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.kw {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.1em 0.45em; border: 1px solid var(--seat-b); color: var(--seat-b); border-radius: var(--radius);
}
@media (min-width: 40rem) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 60rem) { .cards-grid { grid-template-columns: repeat(3, 1fr); } }
