:root {
  --paper: #f6f0e3;
  color-scheme: light;
}

html {
  background: var(--paper);
  overscroll-behavior: none;
  scrollbar-width: none; /* the thumb would visibly jump at the loop seam */
}
html::-webkit-scrollbar { display: none; }

body { margin: 0; background: var(--paper); }

/* native scroll distance for one loop (desktop) */
.spacer { height: 1200vh; }

/* touch: Observer drives the piece, no native page scroll */
html.touch, html.touch body { overflow: hidden; height: 100%; touch-action: none; }
html.touch .spacer { display: none; }

/* ---------- stage ---------- */
.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--paper);
  isolation: isolate;
}
/* all painting happens in one WebGL canvas (gl.js): paper, layers, vignette */
canvas.gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
html.nogl .stage::before { content: "This page needs WebGL 2."; position: absolute; inset: 0; display: grid; place-items: center; font: 16px system-ui; }

/* ---------- words ---------- */
.copy {
  position: absolute;
  inset: 0;
  pointer-events: none; /* blends normally: the glow behind each beat must be able to lighten the paint */
  font-family: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
}

.hint {
  position: absolute;
  left: 0; right: 0; bottom: 6vh;
  margin: 0;
  text-align: center;
  color: #5a547c;
  font-size: .72rem;
  letter-spacing: .42em;
  text-transform: uppercase;
  opacity: .75;
  transition: opacity 1.4s ease;
}
.hint.gone { opacity: 0; }

/* seven teaching beats, each placed in a corner (at-bl, at-br, at-tl, at-tr) */
.beat {
  position: absolute;
  margin: 0;
  max-width: 46ch;
  font-style: italic;
  font-size: clamp(20px, 4vw, 60px);
  font-weight: 600;
  line-height: 1.32;
  isolation: isolate; /* keeps the glow just behind its words */
}
.beat > * { display: block; opacity: 0; }
.beat .ln { text-wrap: balance; }
.beat .label {
  font-style: normal;
  font-size: .4em;
  letter-spacing: .42em;
  text-transform: uppercase;
  margin-bottom: 1.3em;
}
/* a soft paper-coloured glow behind the words, so they read over paint */
.beat > .glow {
  position: absolute;
  inset: -1.6em -2.4em;
  z-index: -1;
  background: radial-gradient(closest-side, var(--paper) 35%, rgb(246 240 227 / .7) 65%, rgb(246 240 227 / 0));
}
.at-bl { left: 8vw;  bottom: 13vh; }
.at-br { right: 8vw; bottom: 13vh; text-align: right; }
.at-tl { left: 8vw;  top: 13vh; }
.at-tr { right: 8vw; top: 13vh;    text-align: right; }
.glacier { color: #4a6073; }
.stream  { color: #3d6470; }
.valley  { color: #37492c; }
.delta   { color: #5e4b22; }
.sea     { color: #1b2a5c; }
.sun     { color: #74430f; }
.cloud   { color: #554e78; }

/* phones and narrow windows: centred, larger, clear of the edges and the phone's own bars */
@media (max-aspect-ratio: 4/5) {
  .beat {
    left: 7vw; right: 7vw;
    max-width: none;
    text-align: center;
    font-size: clamp(20px, 6vw, 30px);
    line-height: 1.36;
  }
  .at-bl, .at-br { bottom: calc(15svh + env(safe-area-inset-bottom)); }
  .at-tl, .at-tr { top: calc(15svh + env(safe-area-inset-top)); }
  .beat > .glow { inset: -1.4em -1.2em; }
}

/* words painted with ink (main.js): the painted copy sits in a canvas inside
   each line; the real words stay on top, invisible, for layout and reading */
.beat > .inked { position: relative; }
.beat > .inked .w { color: transparent; }

/* language switch (English, German), quiet in the top right corner */
.lang {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  right: calc(16px + env(safe-area-inset-right));
  z-index: 2;
  display: flex;
  gap: .2em;
  font-family: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
}
.lang button {
  font: inherit;
  font-size: .78rem;
  letter-spacing: .3em;
  padding: .45em .2em .45em .5em;
  color: #5a547c;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  opacity: .55;
  cursor: pointer;
}
.lang button:hover, .lang button:focus-visible { opacity: .9; }
.lang button[aria-pressed="true"] { opacity: .9; border-bottom-color: currentColor; cursor: default; }
