/* Spike site: shared base (the landing page and the wiki). The "Cajal plate" identity of the game (docs/IDENTITY.md):
   India ink and Golgi stain on rag paper, sienna = excitation, Prussian blue = inhibition, letterpress cards with a hard
   offset shadow, numbered legends, "Fig. N." captions. Colour tokens are the game's (godot/ui/kit.gd). No dependencies. */

@font-face { font-family: "Fraunces"; src: url("assets/fonts/Fraunces.woff2") format("woff2"); font-weight: 300 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("assets/fonts/Fraunces-Italic.woff2") format("woff2"); font-weight: 300 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("assets/fonts/AtkinsonHyperlegible-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url("assets/fonts/AtkinsonHyperlegible-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("assets/fonts/IBMPlexMono-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }

:root {
  --paper: #EFE6D4; --card: #F8F2E6; --raised: #FFFBF2; --rule: #CDBFA3; --grid: #D3DCE0;
  --ink: #231C17; --soft: #5E5246;
  --sienna: #B8461B; --sienna-text: #93360F; --prussian: #1E4F8F; --verdigris: #12808F; --verdigris-text: #0C6672;
  --madder: #6E2A4E; --gamboge: #C9971C; --viridian: #2E7D4F; --ochre: #B7791F; --vermilion: #A3261C;
  --display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "DejaVu Sans Mono", monospace;
  --shadow: 5px 5px 0 var(--ink);
  --gut: clamp(16px, 4vw, 48px);
  --max: 1240px;
  --navh: 60px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--navh) + 16px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; color: var(--ink); font: 400 1.0625rem/1.6 var(--body);
  background-color: var(--paper);
  background-image: radial-gradient(ellipse at 50% 40%, rgba(239, 230, 212, 0) 55%, rgba(90, 63, 28, .10) 100%), url("assets/paper.webp");
  background-attachment: fixed, scroll; background-size: 100% 100%, 512px 512px;
  overflow-x: hidden;
}
img, video, canvas, svg { display: block; max-width: 100%; }
img, video { height: auto; }
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--sienna); text-decoration-thickness: 1.5px; text-underline-offset: .18em; }
a:hover { color: var(--sienna-text); }
:focus-visible { outline: 3px solid var(--prussian); outline-offset: 3px; border-radius: 2px; }
::selection { background: rgba(184, 70, 27, .22); }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 650; line-height: 1.1; margin: 0 0 .5em; font-optical-sizing: auto; letter-spacing: -.005em; text-wrap: balance; }
p { margin: 0 0 1em; }
code, kbd, samp, pre { font-family: var(--mono); font-size: .9em; }
kbd { border: 1px solid var(--ink); border-bottom-width: 2px; border-radius: 3px; padding: 0 .35em; background: var(--raised); font-size: .82em; }

.sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--raised); padding: 10px 16px; font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gut); }

/* ---- running head, kicker, figure captions ---- */
.runhead { font: 600 .74rem/1.3 var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--soft); margin: 0 0 1rem; font-variant-numeric: lining-nums; }
.runhead b { color: var(--ink); font-weight: 700; }
.kicker { display: flex; align-items: center; gap: .7em; font: 600 .76rem/1.2 var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--sienna-text); margin: 0 0 .9rem; }
.kicker::before { content: ""; width: 28px; height: 2px; background: var(--sienna); }
figcaption, .figcap { font: italic 400 .95rem/1.45 var(--display); color: var(--soft); margin-top: .7rem; }
figcaption b, .figcap b { font-style: normal; font-weight: 700; color: var(--ink); margin-right: .3em; }

/* ---- engraved rules ---- */
.rule { height: 7px; border: 0; margin: 0; background:
  linear-gradient(var(--ink), var(--ink)) top / 100% 2px no-repeat,
  linear-gradient(var(--ink), var(--ink)) bottom / 100% 1px no-repeat; }
.hair { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }

/* ---- the letterpress card ---- */
.plate { background: var(--card); border: 1.5px solid var(--ink); box-shadow: var(--shadow); }
.frame { background: var(--raised); border: 1.5px solid var(--ink); box-shadow: var(--shadow); padding: 6px; }
.frame > img, .frame > video, .frame > picture img { width: 100%; border: 1px solid var(--rule); background: var(--paper); }

/* ---- buttons: Fraunces lettering on a cut card ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .55em; min-height: 46px; padding: .55em 1.25em; font: 650 1.05rem/1.1 var(--display);
  color: var(--ink); background: var(--raised); border: 1.5px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); text-decoration: none; cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease; }
.btn:hover { color: var(--ink); transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn.ink { background: var(--ink); color: var(--raised); box-shadow: 4px 4px 0 var(--sienna); }
.btn.ink:hover { color: var(--raised); box-shadow: 5px 5px 0 var(--sienna); }
.btn.mini { min-height: 38px; padding: .4em .9em; font-size: .95rem; box-shadow: 3px 3px 0 var(--sienna); }
.btn i { font-style: italic; font-weight: 400; opacity: .8; }

/* ---- header ---- */
.nav { position: sticky; top: 0; z-index: 50; height: var(--navh); background: rgba(239, 230, 212, .94); border-bottom: 1px solid var(--ink); box-shadow: 0 3px 0 -1px var(--paper), 0 4px 0 -1px var(--ink);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.nav .wrap { height: 100%; display: flex; align-items: center; gap: 1rem; }
.logo { font: 800 1.85rem/1 var(--display); text-decoration: none; letter-spacing: -.02em; color: var(--ink); margin-right: auto; font-variation-settings: "opsz" 72; }
.logo span { color: var(--sienna); }
.logo:hover { color: var(--ink); }
.links { display: flex; gap: .2rem; align-items: center; }
.links a { font: 600 1rem/1 var(--display); text-decoration: none; padding: .55em .7em; color: var(--ink); }
.links a:hover, .links a[aria-current=page] { text-decoration: underline; text-decoration-color: var(--sienna); text-decoration-thickness: 2px; text-underline-offset: .3em; }
.menubtn { display: none; font: 600 1rem/1 var(--display); background: none; border: 1.5px solid var(--ink); padding: .5em .8em; color: var(--ink); cursor: pointer; min-height: 40px; }
@media (max-width: 860px) {
  .menubtn { display: inline-flex; align-items: center; }
  .links { display: none; position: absolute; top: calc(var(--navh) + 3px); left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--paper); border-bottom: 1.5px solid var(--ink); padding: .5rem var(--gut) 1rem; box-shadow: 0 6px 0 rgba(35, 28, 23, .08); }
  .links.open { display: flex; }
  .links a { padding: .8em 0; border-bottom: 1px dotted var(--rule); }
}
@media (max-width: 420px) { .nav .btn.mini { display: none; } }

/* ---- footer ---- */
.foot { margin-top: 4rem; padding: 2.2rem 0 3rem; font-size: .92rem; color: var(--soft); }
.foot .rule { margin-bottom: 1.6rem; }
.foot .cols { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 1.6rem 2rem; }
.foot h2 { font: 600 .74rem/1.2 var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--ink); margin: 0 0 .7rem; }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { margin: 0 0 .35rem; }
.foot a { color: var(--soft); }
.foot .fig { font: italic 400 .95rem/1.5 var(--display); }
.foot .fig b { font-style: normal; color: var(--ink); }
@media (max-width: 760px) { .foot .cols { grid-template-columns: 1fr 1fr; } .foot .cols > :first-child { grid-column: 1 / -1; } }

/* ---- lightbox (both pages) ---- */
.lb { border: 1.5px solid var(--ink); box-shadow: var(--shadow); background: var(--raised); padding: 10px; max-width: min(96vw, 1680px); max-height: 96vh; width: auto; color: var(--ink); }
.lb::backdrop { background: rgba(35, 28, 23, .72); }
.lb img, .lb video { max-height: calc(96vh - 110px); width: auto; margin: 0 auto; border: 1px solid var(--rule); }
.lb .lbbar { display: flex; align-items: center; gap: .6rem; margin-top: .6rem; }
.lb .lbbar figcaption { margin: 0 auto 0 0; }
.lb button { font: 600 .95rem/1 var(--display); min-height: 40px; min-width: 40px; padding: .4em .8em; border: 1.5px solid var(--ink); background: var(--raised); color: var(--ink); cursor: pointer; }
.lb button:hover { background: var(--card); }

/* ---- clips: a still poster until the loop is on screen ---- */
.clip { position: relative; }
.clip .play { position: absolute; inset: 0; margin: auto; width: 64px; height: 64px; border-radius: 50%; border: 1.5px solid var(--ink); background: rgba(255, 251, 242, .92); box-shadow: 3px 3px 0 var(--ink); cursor: pointer; display: none; }
.clip .play::after { content: ""; position: absolute; left: 26px; top: 20px; border-left: 18px solid var(--ink); border-top: 12px solid transparent; border-bottom: 12px solid transparent; }
.clip.paused .play { display: block; }

@media print { .nav, .skip, .menubtn { display: none; } body { background: #fff; } }
