/* =======================================================================
   LORECRAFT · BASE STYLES
   Shared by every page in web/: the fonts, the page color tokens (light
   and dark), the base reset, the page column and headings, and the
   game-term links made by terms.js. Tokens and layout that only one page
   uses stay in that page.

   Use on a page:
     <link rel="stylesheet" href="../shared/base.css">
   ======================================================================= */
@import url("https://fonts.googleapis.com/css2?family=Alegreya+SC:wght@500;700&family=Alegreya:ital,wght@0,400;0,500;1,400&family=Alegreya+Sans:wght@400;500;700&family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400&display=swap");

/* ---------- page tokens ---------- */
:root{
  --bg:#eeedf1;
  --surface:#f8f7fa;
  --fg:#1c1a21;
  --muted:#5e5967;
  --line:#d8d4de;
  --accent:#5a3d8a;
  --chip:#e4e1ea;
  --display:"Alegreya SC","Palatino Linotype",Georgia,serif;
  --serif:"Alegreya","Palatino Linotype",Georgia,serif;
  --sans:"Alegreya Sans","Segoe UI",system-ui,sans-serif;
  --cardtext:"Atkinson Hyperlegible","Segoe UI",system-ui,sans-serif;
  /* side gutters (16px on a phone, more beside a notch) and the width of the content column; the site menu uses them too */
  --gutter-l:max(16px, env(safe-area-inset-left,0px));
  --gutter-r:max(16px, env(safe-area-inset-right,0px));
  --page-max:1120px;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#131217; --surface:#1b1a20; --fg:#ebe9f0; --muted:#a6a1b0; --line:#2d2a34; --accent:#b9a2e3; --chip:#25232c;
    color-scheme:dark;
  }
}
:root[data-theme="dark"]{
  --bg:#131217; --surface:#1b1a20; --fg:#ebe9f0; --muted:#a6a1b0; --line:#2d2a34; --accent:#b9a2e3; --chip:#25232c;
  color-scheme:dark;
}

/* ---------- the page in one of the 7 colors (09/11/2026; shared/theme.js) ----------
   Each palette only names its color's paint (shared/color-identity.css): its deep tone, the tone of its words and its accent; the
   page's tokens are mixed from them, on a dark page, or for Light and Energy on a light one. Every mix keeps the words far from the ground they
   are on. The cards keep their own paint (card.css reads none of these). Two attributes: the band of the other stylesheets yields */
:root[data-palette="fire"]  {--p-deep:var(--fire-fa);   --p-text:var(--fire-panel);   --p-accent:var(--fire-fb)}
:root[data-palette="frost"] {--p-deep:var(--frost-fa);  --p-text:var(--frost-panel);  --p-accent:var(--frost-fb)}
:root[data-palette="nature"]{--p-deep:var(--nature-fb); --p-text:var(--nature-panel); --p-accent:var(--nature-fb)}
:root[data-palette="light"] {--p-deep:var(--light-fb);  --p-text:var(--light-ink);    --p-accent:var(--light-hi)}
:root[data-palette="shadow"]{--p-deep:var(--shadow-fb); --p-text:var(--shadow-panel); --p-accent:var(--shadow-hi)}
:root[data-palette="arcane"]{--p-deep:var(--arcane-fb); --p-text:var(--arcane-panel); --p-accent:var(--arcane-hi)}
:root[data-palette="energy"]{--p-deep:var(--energy-fa); --p-text:var(--energy-ink);   --p-accent:var(--energy-hi)}
:root[data-theme="dark"][data-palette]{
  --bg:color-mix(in oklab, var(--p-deep) 26%, #0b0a0e);
  --surface:color-mix(in oklab, var(--p-deep) 30%, #17151b);
  --chip:color-mix(in oklab, var(--p-deep) 36%, #221f27);
  --line:color-mix(in oklab, var(--p-deep) 42%, #35313c);
  --fg:color-mix(in oklab, var(--p-text) 55%, #ffffff);
  --muted:color-mix(in oklab, var(--p-text) 45%, #a29dab);
  --accent:color-mix(in oklab, var(--p-accent) 60%, #ffffff);
  --band:color-mix(in oklab, var(--p-deep) 38%, #07060a);
}
:root[data-theme="light"][data-palette]{
  --bg:color-mix(in oklab, var(--p-deep) 16%, #f4f2ee);
  --surface:color-mix(in oklab, var(--p-deep) 8%, #fbfaf7);
  --chip:color-mix(in oklab, var(--p-deep) 24%, #ece8e0);
  --line:color-mix(in oklab, var(--p-deep) 38%, #d9d3c8);
  --fg:var(--p-text);
  --muted:color-mix(in oklab, var(--p-text) 72%, #8d8576);
  --accent:var(--p-accent);
}

/* ---------- base ---------- */
*{box-sizing:border-box}
body{margin:0; background:var(--bg); color:var(--fg); font-family:var(--sans); font-size:16px; line-height:1.5}
p, h1, h2, h3, h4{margin:0}

/* ---------- the page column and its headings ---------- */
.wrap{box-sizing:content-box; max-width:var(--page-max); margin-inline:auto; padding:36px var(--gutter-r) 72px var(--gutter-l)}
h1{font:700 clamp(32px,5vw,46px)/1.05 var(--display); text-wrap:balance}
h2{font:700 28px/1.15 var(--display)}
.eyebrow{font:700 12px/1.2 var(--sans); letter-spacing:.14em; text-transform:uppercase; color:var(--muted)}
.lead{max-width:64ch; color:var(--muted); font-size:17px}

/* ---------- game terms: bold links to the Rules glossary (shared/terms.js) ---------- */
a.term, b.term{color:inherit; font-weight:700; text-decoration:none}
a.term:hover{text-decoration:underline dotted; text-underline-offset:.18em}
a.term:focus-visible{outline:2px solid var(--accent); outline-offset:2px; border-radius:3px}

/* ---------- the meaning of a term, on hover (shared/terms.js) ---------- */
[data-term]:not(a){cursor:help}
.term-tip{position:fixed; z-index:50; max-width:min(380px, calc(100vw - 16px)); padding:10px 12px; border-radius:10px; pointer-events:none;
  background:var(--surface); color:var(--fg); border:1px solid var(--line); box-shadow:0 12px 30px rgba(0,0,0,.35); font:400 14px/1.45 var(--sans)}
.term-tip[popover]{inset:auto; margin:0; overflow:visible}   /* a popover above the windows (terms.js): none of the browser's place for one */

/* Space over a card opens it nearly the whole screen (shared/card.js, cardPreview): the hint, where a page gives it (the Hand of the table,
   the bar of the collection; 26/11/2026), the key drawn as a key; only where there is a mouse */
.space-tip{display:inline-flex; align-items:center; gap:6px; margin:0; color:var(--muted); font:500 12.5px/1.2 var(--sans); white-space:nowrap}
.space-tip kbd{padding:2px 8px; border:1px solid var(--line); border-bottom-width:2px; border-radius:5px; background:var(--chip); color:var(--fg);
  font:700 11px/1.3 var(--sans); letter-spacing:.04em}
@media (hover:none){ .space-tip{display:none} }
/* the tip of Space at the bottom of the collection (shared/collection-page.js, 27/11/2026): until the player has used it once. Dressed as a
   notice of the game: dark between the Arcane and the Shadow, a frame of gold a light runs along, the emblem in a medallion, the key of
   gold pressed again and again, and the seven colors below; the same in every palette */
.space-teach{--gold:var(--light-fb); position:fixed; left:50%; bottom:24px; z-index:30; display:flex; align-items:center; gap:16px;
  max-width:calc(100vw - 32px); padding:14px 14px 18px 16px; overflow:hidden; border:2px solid transparent; border-radius:16px;
  color:var(--light-panel);
  background:linear-gradient(135deg, color-mix(in srgb, var(--arcane-fa) 88%, black), color-mix(in srgb, var(--shadow-fa) 94%, black)) padding-box,
    linear-gradient(110deg, var(--light-fa), var(--gold), var(--light-panel), var(--gold), var(--light-fa)) 0 0 / 300% 100% border-box;
  box-shadow:0 18px 44px rgb(0 0 0 / .55), 0 0 26px color-mix(in srgb, var(--gold) 30%, transparent);
  translate:-50% 0; animation:space-teach-in .55s cubic-bezier(.2, .9, .3, 1.2) .8s both, space-teach-rim 4s linear 1.4s infinite}
/* a light that crosses it once it has come */
.space-teach::after{content:""; position:absolute; inset:0; pointer-events:none;
  background:linear-gradient(105deg, transparent 35%, color-mix(in srgb, var(--light-panel) 22%, transparent) 50%, transparent 65%) -120% 0 / 220% 100% no-repeat;
  animation:space-teach-shine 1.4s ease-out 1.3s both}
.space-teach-mark{position:relative; flex:none; width:48px; height:48px; border-radius:50%;
  background:radial-gradient(circle at 35% 30%, var(--light-panel), var(--gold) 55%, var(--light-fa));
  box-shadow:0 0 0 3px color-mix(in srgb, var(--gold) 28%, transparent), 0 0 18px color-mix(in srgb, var(--gold) 55%, transparent);
  animation:space-teach-glow 2.4s ease-in-out infinite}
.space-teach-mark i{position:absolute; inset:10px; background:var(--light-ink);
  -webkit-mask:url("../../art/icones/lorecraft-emblem.svg") center/contain no-repeat; mask:url("../../art/icones/lorecraft-emblem.svg") center/contain no-repeat}
.space-teach-text{display:grid; gap:3px}
.space-teach-text b{font:800 11.5px/1 var(--sans); letter-spacing:.22em; text-transform:uppercase; color:var(--gold)}
.space-teach p{margin:0; font:500 16px/1.45 var(--sans); color:var(--light-panel)}
.space-teach kbd{display:inline-block; margin:0 .4em; padding:3px 16px 3px; border:1px solid var(--light-fa); border-bottom:4px solid var(--light-fa);
  border-radius:8px; background:linear-gradient(180deg, var(--light-panel), var(--gold)); color:var(--light-ink); font:800 14px/1.25 var(--sans);
  box-shadow:0 3px 8px rgb(0 0 0 / .4); vertical-align:1px; animation:space-teach-key 2.6s ease-in-out 1.6s infinite}
/* a comma or a stop right after the key: no gap before it */
.space-teach kbd.tight{margin-right:.12em}
.space-teach-x{flex:none; align-self:flex-start; width:30px; height:30px; min-height:0; padding:0; border:1px solid color-mix(in srgb, var(--light-panel) 30%, transparent);
  border-radius:50%; background:color-mix(in srgb, black 25%, transparent); color:var(--light-panel); font:700 13px/1 var(--sans); cursor:pointer; transition:background .15s, border-color .15s}
.space-teach-x:hover{background:color-mix(in srgb, var(--gold) 30%, transparent); border-color:var(--gold)}
.space-teach-x:focus-visible{outline:2px solid var(--gold); outline-offset:2px}
/* the seven colors along its foot */
.space-teach-band{position:absolute; left:0; right:0; bottom:0; display:flex; height:4px}
.space-teach-band i{flex:1}
.space-teach.gone{opacity:0; translate:-50% 14px; transition:opacity .25s, translate .25s}
/* at the top of the screen, just below the element the page gives (the bar of the table, whose Hand is at the bottom); it comes down */
.space-teach.up{top:120px; bottom:auto; animation-name:space-teach-down, space-teach-rim}
.space-teach.up.gone{translate:-50% -14px}
@keyframes space-teach-down{from{opacity:0; translate:-50% -30px; scale:.94}}
@keyframes space-teach-in{from{opacity:0; translate:-50% 30px; scale:.94}}
@keyframes space-teach-rim{to{background-position:0 0, 300% 0}}
@keyframes space-teach-shine{to{background-position:220% 0}}
@keyframes space-teach-glow{50%{box-shadow:0 0 0 5px color-mix(in srgb, var(--gold) 18%, transparent), 0 0 30px color-mix(in srgb, var(--gold) 75%, transparent)}}
/* the key pressed: down, held a moment, back up; then a rest */
@keyframes space-teach-key{0%, 30%, 100%{translate:0 0; border-bottom-width:4px} 10%, 20%{translate:0 3px; border-bottom-width:1px;
  box-shadow:0 0 0 4px color-mix(in srgb, var(--gold) 35%, transparent), 0 0 16px color-mix(in srgb, var(--gold) 70%, transparent)}}
@media (prefers-reduced-motion: reduce){ .space-teach, .space-teach::after, .space-teach-mark, .space-teach kbd{animation:none} }
@media (hover:none){ .space-teach{display:none} }
.term-tip p + p{margin-top:6px}
.term-tip-head{display:flex; gap:10px; align-items:baseline; justify-content:space-between}
.term-tip-head b{font:700 16px/1.2 var(--display)}
.term-tip-head span{font:700 11px/1.2 var(--sans); letter-spacing:.1em; text-transform:uppercase; color:var(--muted); white-space:nowrap}
.term-tip-card{color:var(--muted); font-size:13px}
