@font-face {
  font-family: 'EB Garamond';
  src: url('assets/fonts/EBGaramond.woff2') format('woff2');
  font-weight: 400 800;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: 'EB Garamond';
  src: url('assets/fonts/EBGaramond-Italic.woff2') format('woff2');
  font-weight: 400 800;
  font-style: italic;
  font-display: block;
}

:root {
  --bg: #060605;
  --ink: #f1ece3;
  --ink-2: rgba(241, 236, 227, 0.66);
  --ink-3: rgba(241, 236, 227, 0.42);
  --ink-s: rgba(241, 236, 227, 0.52);
  --serif: 'EB Garamond', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --title: clamp(29px, max(4.1vw, 3.4vh), 56px);
  --halo: 0 0 2px var(--bg), 0 0 8px var(--bg), 0 0 16px var(--bg), 0 0 26px var(--bg);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
body {
  font-family: var(--serif);
  font-kerning: normal;
  font-feature-settings: 'kern', 'liga', 'onum';
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

#stage { position: fixed; inset: 0; overflow: hidden; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
#gl, #pen { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#pen { pointer-events: none; }

/* ---------------------------------------------------------------- opening */

#opening {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  cursor: pointer;
  padding: 0 16px;
  opacity: 0;
  transition: opacity 1.4s ease;
}
.fonts-ready #opening { opacity: 1; }
.playing #opening {
  opacity: 0; pointer-events: none;
  transition: opacity 1.05s cubic-bezier(.4, 0, .2, 1);
}
.opening-inner {
  display: flex; flex-direction: column; align-items: center;
  transform: translateY(-3vh);
  transition: transform 1.6s cubic-bezier(.3, 0, .2, 1);
}
.playing .opening-inner { transform: translateY(calc(-3vh - 10px)); }

#title {
  margin: 0;
  font-weight: 400;
  font-size: var(--title);
  line-height: 1.12;
  letter-spacing: 0.004em;
  text-align: center;
  color: var(--ink);
}
/* the "s" of "ones" is already a little fainter: the film is more for the one than for everyone */
#title .s { color: var(--ink-s); }
#date {
  margin: 0.95em 0 0;
  font-size: clamp(16.5px, 1.5vw, 21.5px);
  letter-spacing: 0.13em;
  font-variant-caps: all-small-caps;
  font-variant-numeric: lining-nums;
  color: var(--ink-2);
}

#play {
  margin-top: clamp(30px, 6.2vh, 64px);
  width: clamp(54px, 5.2vw, 68px);
  height: clamp(54px, 5.2vw, 68px);
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
  border-radius: 50%;
  position: relative;
}
#play svg { width: 100%; height: 100%; overflow: visible; display: block; }
#play path { fill: none; stroke: currentColor; stroke-width: 1.15; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
#play-ring { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .5s ease, opacity .6s ease; opacity: .9; }
#play-tri { opacity: 0; transform: translateX(-3px); transform-origin: center; transition: opacity .7s ease .1s, transform .9s cubic-bezier(.2, .7, .2, 1) .1s; }
.ready #play-tri { opacity: .95; transform: none; }
.ready #play-ring { stroke-dashoffset: 0 !important; }
#play:hover #play-tri, #play:focus-visible #play-tri { opacity: 1; }
#play:focus-visible { outline: 1px solid var(--ink-3); outline-offset: 8px; }
.queued:not(.ready) #play-ring { animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; } }

/* ---------------------------------------------------------------- captions */

#captions { position: absolute; inset: 0; pointer-events: none; }
.caption, .caption-final {
  position: absolute; left: 0; top: 0;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  white-space: nowrap;
  text-shadow: var(--halo);
  visibility: hidden;
  will-change: opacity, transform;
}
.caption, .caption-final { color: inherit; text-decoration: none; cursor: pointer; -webkit-touch-callout: none; }
.caption .name, .caption-final .name {
  font-size: clamp(18px, 1.6vw, 25px);
  letter-spacing: 0.015em;
  color: var(--ink);
  line-height: 1.25;
}
.caption .years, .caption-final .years {
  margin-top: 0.22em;
  font-size: clamp(14.5px, 1.2vw, 18.5px);
  letter-spacing: 0.05em;
  font-variant-numeric: oldstyle-nums;
  color: var(--ink-2);
  line-height: 1.2;
}

/* ---------------------------------------------------------------- the closing */

#final {
  position: absolute; left: 0; top: 0;
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}
#final .caption-final { position: static; visibility: visible; }
#final .caption-final .name { font-size: clamp(24px, 2.3vw, 38px); letter-spacing: 0.01em; }
#final .caption-final .years { font-size: clamp(16.5px, 1.5vw, 23px); }
.final-on #final .caption-final { pointer-events: auto; }
.caption:hover .name, .caption:focus-visible .name, .caption-final:hover .name, .caption-final:focus-visible .name {
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.22em;
  text-decoration-color: rgba(241, 236, 227, 0.35);
}
.caption:focus-visible, .caption-final:focus-visible { outline: none; }
#final[data-mode='side'] .caption-final { align-items: flex-start; text-align: left; }
#final[data-mode='side'] #line { text-align: left; }
#final[data-mode='below'] { text-align: center; }

#line {
  position: relative;
  margin: 1.15em 0 0;
  font-size: var(--title);
  line-height: 1.15;
  letter-spacing: 0.004em;
  white-space: nowrap;
  min-height: 1.2em;
  text-shadow: var(--halo);
}
#final[data-mode='side'] #line { margin-top: 1.25em; }
#line .text { display: inline-block; position: relative; text-align: left; }
#line .glyphs span { display: inline-block; white-space: pre; opacity: 0; }
#line .glyphs span.on { opacity: 1; }
#line .glyphs .last-s { overflow: hidden; vertical-align: bottom; }
#line .caret {
  position: absolute; left: 0; top: 0.17em;
  width: 1.5px; height: 0.92em;
  background: var(--ink);
  opacity: 0;
  border-radius: 1px;
  pointer-events: none;
}
#final[data-mode='below'] #line { display: flex; justify-content: center; }

#end-actions {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-top: clamp(22px, 3.4vh, 38px);
  opacity: 0; visibility: hidden; pointer-events: none;
}
#final[data-mode='below'] #end-actions { justify-content: center; }
.end-actions #end-actions { pointer-events: auto; }
#end-actions button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px 0 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 14px; font-weight: 450; line-height: 1; letter-spacing: 0.015em;
  font-feature-settings: normal; font-variant: normal;
  color: rgba(241, 236, 227, 0.8);
  background: rgba(241, 236, 227, 0.03);
  border: 1px solid rgba(241, 236, 227, 0.2);
  border-radius: 999px;
  cursor: pointer;
  transition: color .3s ease, border-color .3s ease, background-color .3s ease;
}
#end-actions button:hover, #end-actions button:focus-visible {
  color: var(--ink); border-color: rgba(241, 236, 227, 0.45); background: rgba(241, 236, 227, 0.06); outline: none;
}
#end-actions button span { display: block; line-height: 1; padding-top: 0.06em; }
#end-actions svg { width: 17px; height: 17px; flex: none; display: block; }
@media (max-width: 700px), (max-height: 420px) {
  #end-actions { gap: 8px; }
  #end-actions button { padding: 0 14px 0 11px; font-size: 13.5px; }
}
#end-actions svg path { fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- controls */

#controls {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s ease;
}
.show-controls #controls, .paused #controls, #controls:focus-within { opacity: 1; pointer-events: auto; }
#controls button {
  font: inherit;
  color: var(--ink-2);
  background: none; border: 0; cursor: pointer;
  min-width: 44px; height: 44px; padding: 0 10px;
  border-radius: 22px;
  transition: color .3s ease, background-color .3s ease;
}
#controls button:hover, #controls button:focus-visible { color: var(--ink); background: rgba(241, 236, 227, 0.06); outline: none; }
#controls button:focus-visible, #end-actions button:focus-visible { outline: 1px solid var(--ink-3); outline-offset: 3px; }
#controls svg { width: 22px; height: 22px; display: block; margin: auto; }
#controls svg path { fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; }
#btn-pause[data-state='playing'] .i-play, #btn-pause[data-state='paused'] .i-pause { display: none; }
#btn-mute[data-state='on'] .i-off, #btn-mute[data-state='off'] .i-on { display: none; }
.ended #btn-pause { display: none; }

#paused {
  position: absolute; left: 50%; bottom: max(64px, 9vh);
  width: 46px; height: 46px; margin-left: -23px;
  color: var(--ink);
  opacity: 0; pointer-events: none;
  transition: opacity .5s ease;
}
#paused svg { width: 100%; height: 100%; overflow: visible; }
#paused path { fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.paused #paused { opacity: .75; }

/* ---------------------------------------------------------------- credits */

#credits {
  max-width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  overflow: auto;
  padding: 34px 32px 26px;
  background: #0b0b0a;
  color: var(--ink);
  border: 1px solid rgba(241, 236, 227, 0.12);
  border-radius: 6px;
  font-size: 16.5px;
  line-height: 1.55;
}
#credits::backdrop { background: rgba(3, 3, 3, 0.78); }
#credits h2 { margin: 0 0 .6em; font-weight: 400; font-size: 25px; }
#credits h3 { margin: 1.35em 0 .3em; font-weight: 400; font-size: 13.5px; letter-spacing: .14em; font-variant-caps: all-small-caps; color: var(--ink-2); }
#credits p { margin: 0 0 .6em; color: rgba(241, 236, 227, .86); }
#credits a { color: inherit; text-decoration-color: rgba(241, 236, 227, .3); text-underline-offset: .18em; }
#credits a:hover { text-decoration-color: rgba(241, 236, 227, .8); }
#credits .note { font-size: 14.5px; color: var(--ink-2); font-style: italic; }
#credits .close {
  margin-top: 1.2em; font: inherit; font-size: 15px; letter-spacing: .06em; font-variant-caps: all-small-caps;
  color: var(--ink-2); background: none; border: 1px solid rgba(241, 236, 227, .18); border-radius: 18px;
  padding: 11px 20px; min-height: 44px; cursor: pointer;
}
#credits h2:focus { outline: none; }
#credits blockquote { margin: .2em 0 .8em; padding-left: 14px; border-left: 1px solid rgba(241, 236, 227, .18); font-style: italic; color: rgba(241, 236, 227, .8); }
#credits .close:hover, #credits .close:focus-visible { color: var(--ink); border-color: rgba(241, 236, 227, .4); outline: none; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript { position: absolute; inset: auto 0 20% 0; text-align: center; color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) {
  .opening-inner, .playing .opening-inner { transform: translateY(-3vh); transition: none; }
}

.review #controls, .review #paused, .record #controls, .record #paused { display: none; }
.record *, .record *::before, .record *::after { transition: none !important; animation: none !important; }
.record, .record * { cursor: none !important; }
#rec-cursor { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; transform-origin: 6.4px 3.6px; opacity: 0;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .45)); }
#play.hover #play-tri { opacity: 1; }
