/* Newsreader, served from this site (SIL Open Font License, see fonts/OFL.txt). One variable file per style. */
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('../fonts/newsreader-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Newsreader';
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url('../fonts/newsreader-italic-latin.woff2') format('woff2');
}

/* ---------- colours (CLAUDE.md section 8.1) ---------- */
:root {
  --bg:   #000000;
  --ink:  #F2EDE4;
  --dim:  #6E6861;
  --acc:  #C9A227;
  --red:  #C8102E;   /* used once, by the intro, and never again */
  --line: #1C1A18;
  --serif: 'Newsreader', 'Iowan Old Style', Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html.locked, html.locked body { overflow: hidden; height: 100%; }

::selection { background: var(--ink); color: var(--bg); }

/* ---------- the copy ---------- */
main {
  max-width: 620px;
  margin: 0 auto;
  padding: 18vh 28px 45vh;
}

.l {
  font-size: clamp(19px, 5.2vw, 22px);
  line-height: 1.5;
  font-weight: 200;
  margin: 0 0 2.3em;
  text-wrap: pretty;
}

.l em { font-style: italic; font-weight: 200; }

/* the link: one line of the copy, looking exactly like every other line (CLAUDE.md 13.5) */
.l a {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- motion: two sentences at a time ----------
   The sentence he is on is clear. The next one sits under it, glitching:
   real letters he can see but not read, blurred and flickering.
   reveal.js locks the letters in as he scrolls and scrambles them again if he scrolls back. */
.motion main {
  padding-top: calc(50vh - 30px);
  padding-top: calc(50svh - 30px);
  padding-bottom: 30vh;      /* so the last thing on the page can reach the middle of the screen */
}
.motion .l, .motion .door {
  margin: 0;
  min-height: 24vh;          /* how far he scrolls for each sentence */
  opacity: 0;
  will-change: opacity;
}
.motion .w {
  position: relative;
  display: inline-block;
}
.motion .t { opacity: var(--o, 1); }
.motion .w::after {          /* the glitched version of the word, laid over the real one */
  content: attr(data-g);
  position: absolute;
  left: 0;
  top: 0;
  white-space: pre;
  opacity: calc(1 - var(--o, 1));
  filter: blur(var(--bl, 0px));
  transform: translateX(var(--jx, 0px));
  text-shadow: 0.09em 0 rgba(242, 237, 228, 0.35), -0.09em 0 rgba(110, 104, 97, 0.6);
  pointer-events: none;
}

/* ---------- intro ---------- */
#intro { display: none; }

.motion #intro {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #000;
  overflow: hidden;
  transition: opacity .55s ease;
  touch-action: none;
}
.motion #intro.out { opacity: 0; pointer-events: none; }

#gl, #fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#gl { background: #000; }

/* ---------- the threshold: a second way through, after the last line ---------- */
.threshold main { padding-bottom: 0; }
#end > .l {
  position: -webkit-sticky;
  position: sticky;
  top: var(--stick, 27vh);   /* where the last line holds while the point pulls it in */
}
#end .w { transform-origin: 50% 60%; }
#hole {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 40;
  pointer-events: none;
  display: none;
}
