/* The Rules Lexicon shares the Spellbook's reader palette and type.
   Keep these rules external: the public site's CSP blocks inline styles. */
@font-face {
  font-family: 'Spynn Research';
  src: url('/assets/gameplay/truesdell.otf') format('opentype');
  font-display: swap;
}
:root {
  color-scheme: dark;
  --bg: #111014;
  --reader: #060c12;
  --cream: #f5e6c9;
  --title: #ebcfa1;
  --gold: #d4b783;
  --muted: #bbb5bb;
  --line: #d4b78335;
  --book: 'Spynn Research', Georgia, 'Times New Roman', serif;
  --sans: Arial, Helvetica, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 24px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--cream);
  font: 16px/1.65 var(--sans);
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--title); }
:focus-visible { outline: 2px solid var(--title); outline-offset: 4px; }
::selection { background: var(--gold); color: var(--bg); }
.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 2;
  padding: 12px 18px;
  background: var(--cream);
  color: var(--bg);
}
.skip-link:focus { top: 16px; }
.site-header {
  min-height: 90px;
  padding: 22px max(5%, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 22px;
  border-bottom: 1px solid #ffffff24;
}
.wordmark { font: 32px/.95 Georgia, 'Times New Roman', serif; letter-spacing: -1.5px; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 12px 26px; font-size: 14px; }
.site-header [aria-current] { color: var(--gold); }
.shell { max-width: 1168px; margin: auto; padding: 58px 24px 64px; }
.eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
}
h1 {
  margin: 14px 0 22px;
  font: 400 clamp(42px, 6vw, 74px)/1.08 Georgia, 'Times New Roman', serif;
  letter-spacing: -1.5px;
}
h1 em { color: var(--title); font-weight: 400; }
.lede { max-width: 64ch; margin: 0; font-size: 17px; line-height: 1.7; color: var(--muted); }
.lexicon-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 52px; align-items: start; margin-top: 42px; }
.term-index { position: sticky; top: 24px; max-height: calc(100svh - 48px); overflow-y: auto; scrollbar-width: thin; padding: 0 12px 8px 0; }
.term-index h2 { margin: 0 0 12px; color: var(--gold); font: 400 12px/1.5 var(--sans); letter-spacing: 1.5px; text-transform: uppercase; }
.term-index ol { list-style: none; margin: 0; padding: 0; }
.term-index a { display: block; border-radius: 5px; padding: 6px 9px; margin-left: -9px; font-size: 14px; color: #d1c2a6; line-height: 1.45; }
.term-index a:hover, .term-index a:focus-visible { background: #d4b78312; color: var(--title); }
.definitions { min-width: 0; background: var(--reader); border: 1px solid #d4b78345; border-radius: 10px; padding: 0 32px; box-shadow: 0 20px 60px #0003; }
.lexicon-entry { padding: 25px 0 28px; border-top: 1px solid var(--line); scroll-margin-top: 24px; }
.lexicon-entry:first-child { border-top: 0; }
.lexicon-entry h2 { margin: 0 0 10px; font: 400 30px/1.2 var(--book); color: var(--title); text-wrap: balance; }
.lexicon-entry p { margin: 0; max-width: 63ch; font: 20px/1.55 var(--book); color: var(--cream); }
.lexicon-term { display: inline; border: 0; border-bottom: 1px dotted #d4b78399; border-radius: 0; padding: 0; background: none; color: inherit; font: inherit; line-height: inherit; text-align: inherit; cursor: help; }
.lexicon-term:hover, .lexicon-term:focus-visible { color: var(--title); border-bottom-color: var(--title); }
.lexicon-tooltip { position: fixed; z-index: 5; width: max-content; max-width: min(360px, calc(100vw - 16px)); padding: 17px 20px; border: 1px solid var(--gold); border-radius: 8px; background: #09121b; color: var(--cream); box-shadow: 0 16px 50px #0009; font: 15px/1.55 var(--sans); }
.lexicon-tooltip strong { display: block; margin-bottom: 7px; color: var(--title); font: 400 24px/1.2 var(--book); }
.lexicon-tooltip p { margin: 0; }
.lexicon-entry:target h2 { text-decoration: underline; text-decoration-color: #d4b78380; text-underline-offset: 7px; text-decoration-thickness: 1px; }
.lexicon-footer { display: flex; justify-content: center; flex-wrap: wrap; gap: 18px 48px; padding: 28px 24px; border-top: 1px solid #ffffff24; font-size: 14px; color: var(--muted); }
.lexicon-footer span { margin-left: 8px; color: var(--gold); }
@media (max-width: 800px) {
  .shell { padding-top: 36px; }
  .lexicon-layout { grid-template-columns: minmax(0, 1fr); gap: 22px; margin-top: 30px; }
  .term-index { position: static; max-height: none; overflow: visible; padding: 0; min-width: 0; }
  .term-index ol { display: flex; gap: 0 8px; overflow-x: auto; padding: 2px 4px 12px; scrollbar-width: thin; border-bottom: 1px solid var(--line); }
  .term-index a { white-space: nowrap; min-height: 44px; display: flex; align-items: center; margin: 0; padding: 8px 10px; }
}
@media (max-width: 480px) {
  .site-header { padding: 24px 20px; gap: 20px; }
  .wordmark { font-size: 28px; }
  .site-header nav { font-size: 13px; gap: 10px 20px; }
  .shell { padding-inline: max(16px, env(safe-area-inset-left)); }
  .definitions { padding: 0 22px; }
  .lexicon-entry { padding: 22px 0 24px; }
  .lexicon-entry h2 { font-size: 27px; }
  .lexicon-entry p { font-size: 19px; }
}
