:root {
  --bg: #0d0d0c;
  --fg: #e8e4dc;
  --muted: #8f8a81;
  --line: rgba(255, 255, 255, .1);
  --serif: 'Instrument Serif', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --pad: 44px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); }
body { font-family: var(--serif); -webkit-font-smoothing: antialiased; }
a { color: var(--muted); text-decoration: none; transition: color .2s; }
a:hover, a[aria-current="page"] { color: var(--fg); }

.page { min-height: 100%; display: flex; flex-direction: column; }
.masthead {
  flex: none; display: flex; justify-content: space-between; align-items: baseline;
  padding: 20px var(--pad) 16px; border-bottom: 1px solid var(--line);
}
.wordmark { font: italic 400 28px var(--serif); color: var(--fg); }
.nav { display: flex; gap: 32px; font: 500 11px var(--mono); letter-spacing: .18em; }

/* ---------- Projector (Work) ---------- */
body.work { overflow: hidden; }
body.work .page { height: 100%; }
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; cursor: pointer; }
.frame {
  position: absolute; inset: 0; background-position: center; background-repeat: no-repeat;
  opacity: 0; transition: opacity 800ms ease;
}
.frame.on { opacity: 1; }
.stage.cut .frame { transition: none; }
.shade {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, rgba(13,13,12,0) 58%, rgba(13,13,12,.82) 100%);
  transition: opacity .8s ease;
}
.shade.off { opacity: 0; }
.grain {
  position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: .275; mix-blend-mode: overlay;
  background-size: 280px 280px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='280' height='280'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='280' height='280' filter='url(%23n)'/%3E%3C/svg%3E");
}
.caption {
  position: absolute; left: var(--pad); bottom: 76px; z-index: 3; max-width: min(600px, 70%);
  display: flex; flex-direction: column; gap: 12px; pointer-events: none;
  opacity: 0; filter: blur(12px); transform: translateY(8px);
  transition: opacity 1.5s ease, filter 1.5s ease, transform 1.5s ease;
}
.caption.in { opacity: 1; filter: blur(0); transform: none; }
.caption-text {
  font: italic 400 clamp(26px, 3.4vw, 44px)/1.15 var(--serif);
  text-shadow: 0 2px 24px rgba(0,0,0,.55); text-wrap: pretty;
}
.caption-text:empty { display: none; }
.caption-meta, .counter, .hint { font: 400 11px var(--mono); letter-spacing: .18em; }
.caption-meta { color: rgba(255,255,255,.7); }
.controls {
  position: absolute; left: 0; right: 0; bottom: 6px; z-index: 4;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px;
  padding: 14px var(--pad) 18px;
}
.hint { font-size: 10px; color: rgba(255,255,255,.45); text-shadow: 0 1px 8px rgba(0,0,0,.8); }
.dots {
  display: flex; gap: 9px; align-items: center; padding: 9px 15px;
  background: rgba(15,15,14,.5); border-radius: 999px; backdrop-filter: blur(10px);
}
.dot { flex: none; border-radius: 50%; cursor: pointer; transition: all .35s ease; border: 0; padding: 0; }
.counter { justify-self: end; color: rgba(255,255,255,.7); text-shadow: 0 1px 8px rgba(0,0,0,.8); }
.progress { position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: rgba(255,255,255,.12); z-index: 5; }
.progress-bar { height: 100%; width: 0; background: rgba(255,255,255,.75); }
.empty { position: absolute; inset: 0; display: grid; place-items: center; font: 400 11px var(--mono); letter-spacing: .18em; color: var(--muted); }

/* ---------- Text pages ---------- */
.text-page { flex: 1; display: flex; justify-content: center; padding: 12vh var(--pad) 10vh; }
.text-inner { max-width: 620px; width: 100%; }
.text-inner h1 { font: italic 400 clamp(40px, 6vw, 64px)/1.05 var(--serif); margin: 0 0 32px; }
.text-inner p { font: 400 22px/1.5 var(--serif); color: #cfcac1; margin: 0 0 20px; }
.label { font: 500 11px var(--mono); letter-spacing: .18em; color: var(--muted); margin: 40px 0 10px; display: block; }
.big-link { font: italic 400 28px var(--serif); color: var(--fg); border-bottom: 1px solid var(--line); }
.big-link:hover { border-color: var(--fg); }

@media (max-width: 700px) {
  :root { --pad: 20px; }
  .wordmark { font-size: 22px; }
  .nav { gap: 16px; font-size: 10px; letter-spacing: .12em; }
  .caption { bottom: 70px; max-width: calc(100% - 2 * var(--pad)); }
  .controls { grid-template-columns: 1fr auto; }
  .hint { display: none; }
  .text-inner p { font-size: 19px; }
}
