/* ═══════════════════════════════════════════════════════════════════════════
   base.css — reset, document, typography, animations, a11y primitives
   ═══════════════════════════════════════════════════════════════════════════ */

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

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--gold-dim); color: var(--bg); }

a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--gold-bright); text-decoration: underline; }

img, svg { display: block; max-width: 100%; }

/* Buttons/inputs inherit type by default; never let them shrink below tap size
   on touch — enforced per-component, but provide a sane interactive cursor. */
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Parchment surface helper (main, dialogs, init box share this) ────────── */
.parchment-surface {
  background-color: var(--parchment);
  background-image: var(--grain);
  background-size: 300px 300px;
}

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1;   box-shadow: 0 0 4px 2px rgba(180, 60, 60, 0.6); }
  50%      { opacity: 0.4; box-shadow: 0 0 2px 1px rgba(180, 60, 60, 0.2); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes initPulse {
  0%, 100% { opacity: 0.35; text-shadow: none; }
  50%      { opacity: 0.9;  text-shadow: 0 0 20px rgba(212,168,75,0.6); }
}
@keyframes sheetUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Focus & keyboard a11y ───────────────────────────────────────────────── */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: var(--radius); }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }
* { scrollbar-width: thin; scrollbar-color: var(--gold-dim) var(--bg); }

/* ── Reduced motion ──────────────────────────────────────────────────────── */
@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;
  }
}

[hidden] { display: none !important; }
