:root {
  --ink: #f2f0ec;
  --paper: #000000;
  --content-width: 1200px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Fraunces', Georgia, serif;
  overflow-x: hidden;
}

/* ---- backdrop: fixed viewport, scrolled faster than .content by script.js ---- */
.hero-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.hero-bg-track {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  will-change: transform;
}

.hero-bg-item {
  width: 100%;
  max-height: 80vh;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.5;
  transition: opacity 0.4s ease;
}

/* Eye toggle (script.js) lifts the dimming and hides the bio text so the
   backdrop images/videos show at full opacity, undimmed. */
body.reveal-mode .hero-bg-item {
  opacity: 1;
}

body.reveal-mode .content {
  opacity: 0;
  pointer-events: none;
}

.hero-bg-item video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ---- content: sits above the backdrop, scrolls at native speed ---- */
.content {
  position: relative;
  z-index: 1;
  max-width: var(--content-width);
  width: 80vw;
  margin: 0 auto;
  padding: 8rem 1.5rem 10rem;
  transition: opacity 0.4s ease;
}

/* ---- reveal toggle: shows the backdrop at full opacity, text hidden ---- */
.reveal-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 2;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  color: var(--ink);
  font-size: 24px;
  font-variation-settings: 'opsz' 24, 'wght' 400, 'FILL' 0, 'GRAD' 0;
  cursor: pointer;
  transition: background 0.2s ease;
}

.reveal-toggle:hover {
  background: rgba(0, 0, 0, 0.55);
}

/* ---- gallery-more: past the normal page end, reveal mode's "See more"
   grows the actual backdrop track (script.js's makeTrackBuilder) rather than
   a separate foreground gallery. This container only holds invisible
   .gallery-spacer divs — real document height, no content of their own — so
   the backdrop showing through underneath reads as one continuous layer. ---- */
.gallery-more {
  display: none;
  position: relative;
  z-index: 1;
  max-width: var(--content-width);
  width: 80vw;
  margin: 0 auto;
  padding: 0 1.5rem 6rem;
  text-align: center;
}

body.reveal-mode .gallery-more {
  display: block;
}

.gallery-spacer {
  width: 100%;
}

.see-more-btn {
  display: none;
  margin: 0 auto;
  padding: 1.1rem 3rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: #000;
  color: #fff;
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-size: 1.35rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.see-more-btn.visible {
  display: inline-block;
}

.see-more-btn:hover {
  background: #222;
}

.content p {
  font-size: clamp(2.25rem, 9vw, 90px);
  font-weight: 400;
  line-height: 1.3;
  color: var(--ink);
  margin: 0 0 10rem;
  font-optical-sizing: auto;
}

.content a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}

.content a:hover {
  color: #999;
}

/* Per-word random tilt, driven by wrapWordsWithTilt in script.js. */
.tilt-word {
  display: inline-block;
  opacity: 0;
  transition: opacity 0.35s ease;
}

/* Typewriter-style reveal (initTypewriterReveal in script.js): each word
   fades in on its own transition-delay, set inline per-word so they appear
   left-to-right once the paragraph scrolls into view. The tilt itself
   (rotate/translate) is a separate inline transform set by wrapWordsWithTilt
   and is untouched here — only opacity animates. */
.content p.revealed .tilt-word {
  opacity: 1;
}

/* Spellcheck-style red zigzag, cleared while active (initWrongHover in
   script.js toggles .is-active on mouseenter/touchstart, alongside the
   "behavior"/"behaviour" text swap) — driven entirely by JS rather than
   CSS :hover so mouse and touch behave identically, and a tap can't get
   stuck mid-gesture the way :hover does on touch devices. */
.wrong {
  cursor: default;
  text-decoration: underline wavy #ff3b30;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.wrong.is-active {
  text-decoration: none;
}

/* Screen-reader-only text: kept in the DOM for accessibility but removed
   from visual flow, e.g. the real word behind a .confetti mask. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Confetti word mask: letters are hidden (but still occupy their normal
   space, via .confetti-spacer's visibility: hidden) so the dots added by
   initConfetti() in script.js have the word's own footprint to scatter
   across instead of a collapsed box. */
.confetti {
  position: relative;
  display: inline-block;
}

.confetti-spacer {
  visibility: hidden;
}

.confetti-dot {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

@media (max-width: 600px) {
  .content,
  .gallery-more {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}
