/* The page over the picture: a small card of words, the rail and the marks, set like the
   read-outs of an instrument. DARK and BONE repeat the tokens of Engine/Models/Palette.rs. */
:root {
  --dark: #04060A;
  --bone: #E8EEF3;
  /* What the page writes with: one solid colour, never see-through, so it always reads. */
  --ink: var(--bone);
  --margin: clamp(16px, 2.2vw, 32px);
  /* Every size of the page hangs from this one: it follows the window, within bounds. */
  --type: clamp(10px, 0.55vw + 7px, 13px);
}
/* Over a picture that is mostly light, the page writes in the dark instead. */
body.bright { --ink: var(--dark); }

@font-face {
  font-family: "Share Tech Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("Fonts/ShareTechMono.woff2") format("woff2");
}

* { box-sizing: border-box; margin: 0; }
html { background: var(--dark); }
body { color: var(--ink); font: 400 var(--type) / 1.5 "Share Tech Mono", ui-monospace, Menlo, monospace;
  letter-spacing: 0.08em; text-transform: uppercase; transition: color 0.3s ease; }
a { color: inherit; text-decoration: none; }
/* What Lenis asks of the page it smooths. */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-stopped { overflow: hidden; }

/* The canvas fills the window whatever size winit asked for, and lets the scroll through. */
#picture { position: fixed; inset: 0; display: block; width: 100vw !important;
  height: 100vh !important; pointer-events: none; outline: none; }

.marks { position: fixed; inset: 0; pointer-events: none; }
.crosses { position: absolute; top: 38%; left: var(--margin); right: var(--margin);
  display: flex; justify-content: space-between; font-size: 1.4em; line-height: 1; }
.name { position: absolute; top: var(--margin); left: var(--margin); }
.author { position: absolute; top: var(--margin); right: var(--margin); pointer-events: auto; }
.author:hover { text-decoration: underline; }

/* The card: the chapter between brackets, its name, its line, then its read-outs. */
.card { position: absolute; left: var(--margin); bottom: var(--margin);
  width: min(26em, calc(100vw - 2 * var(--margin))); transition: opacity 0.5s ease, transform 0.5s ease; }
.card.away { opacity: 0; transform: translateY(1em); }
.ruled { padding-bottom: 0.7em; border-bottom: 1px solid var(--ink); }
.card h1 { margin: 0.9em 0 0.5em; font-size: 1.9em; font-weight: 400; line-height: 1.1;
  letter-spacing: 0.04em; }
.line { margin-bottom: 1.6em; }
.row { display: flex; justify-content: space-between; gap: 1em; font-variant-numeric: tabular-nums; }
.bar { margin-top: 0.5em; height: 3px; border-bottom: 1px solid var(--ink); }
.bar i { display: block; height: 100%; width: 0; background: var(--ink); }

.rail { position: fixed; top: 50%; right: var(--margin); transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 0.7em; align-items: flex-end; }
.rail a { display: flex; align-items: center; gap: 0.8em; }
.rail a::after { content: ""; width: 1.2em; height: 1px; background: currentColor; transition: width 0.3s; }
.rail a em { font-style: normal; visibility: hidden; }
.rail a.open::after { width: 2.8em; }
.rail a.open em, .rail a:hover em { visibility: visible; }
/* On a narrow window the names would run over the card: the numbers alone. */
@media (max-width: 700px) { .rail a em { display: none; } }

/* A jump further than the next chapter goes through black. */
.dip { position: fixed; inset: 0; background: var(--dark); opacity: 0; pointer-events: none;
  transition: opacity 0.6s ease; }
.dip.down { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .card, .dip { transition-duration: 0.01s; }
}
