/* Shared by all three directions. Each direction sets the tokens on :root. */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  color-scheme: dark;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, video { display: block; max-width: 100%; }
h1, h2, h3, p, figure { margin: 0; }
a { color: inherit; }

.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;
}

.skip-link {
  position: fixed; top: 12px; left: 12px; z-index: 100;
  display: inline-flex; align-items: center; min-height: 44px;
  padding: 0 16px; background: var(--ink); color: var(--bg);
  font: 600 16px/1 system-ui, sans-serif; text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus-visible { transform: none; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

button, a, [role="button"] { touch-action: manipulation; }
button {
  font: inherit; color: inherit; background: none; border: 0; padding: 0;
  cursor: pointer; -webkit-user-select: none; user-select: none;
}

/* Press feedback on everything pressable */
.press { transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1); }
.press:active { transform: scale(0.96); }

/* Owner-supplied links not provided yet: shown as a visible, non-interactive hole */
.is-missing {
  cursor: default; border-bottom: 0;
  text-decoration: underline dashed; text-decoration-thickness: 1px; text-underline-offset: 0.2em;
}
.missing-note {
  font-size: max(12px, 0.75em); letter-spacing: 0.06em; text-transform: uppercase;
  opacity: 0.85; white-space: nowrap;
}

/* Booking link: a full 44px target even though it sits in a sentence; a long
   email address wraps instead of widening the page */
.listen-booking a, .booking a {
  display: inline-block; max-width: 100%; min-height: 44px; padding-block: 10px;
  overflow-wrap: anywhere;
}

/* Long single words in titles break instead of pushing the page wide */
.release-title, .film-title, .tape-title { overflow-wrap: anywhere; hyphens: auto; }

/* Before and after release */
[data-released] [data-before-release] { display: none; }
html:not([data-released]) [data-after-release] { display: none; }

/* Background-loop pause control: 44px target */
.loop-toggle {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 999px;
  background: rgb(0 0 0 / 0.55); color: #fff;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.loop-toggle svg { width: 16px; height: 16px; }
.loop-toggle[data-state="playing"] .icon-play,
.loop-toggle[data-state="paused"] .icon-pause { display: none; }

/* Countdown digits never shift: tabular figures where the font has them, and each
   digit in a box as wide as the widest digit (set by shared.js) where it doesn't.
   The selector outranks each direction's `font` shorthand, which resets numerics. */
[data-countdown] .unit .digits { font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
[data-countdown] .digit { display: inline-block; width: var(--digit-w, auto); text-align: center; }
[data-countdown]:not([data-live]) .countdown-units { visibility: hidden; }
[data-countdown][data-calm] .unit:has([data-unit="s"]) { display: none; }
[data-countdown][data-done] .countdown-units { display: none; }
[data-countdown]:not([data-done]) .countdown-done { display: none; }

/* Dialogs: trailer player and photo viewer */
dialog.sheet {
  width: min(100vw - 32px, 1200px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  background: var(--dialog-bg);
  color: var(--ink);
  overflow: visible;
  opacity: 1;
  transform: none;
  transition: opacity 200ms cubic-bezier(0.23, 1, 0.32, 1), transform 200ms cubic-bezier(0.23, 1, 0.32, 1),
    overlay 200ms allow-discrete, display 200ms allow-discrete;
}
/* Exit is quicker than entry */
dialog.sheet:not([open]) { opacity: 0; transform: scale(0.96); transition-duration: 150ms; }
@starting-style { dialog.sheet[open] { opacity: 0; transform: scale(0.96); } }
dialog.sheet::backdrop {
  background: rgb(0 0 0 / 0.82);
  transition: background-color 200ms cubic-bezier(0.23, 1, 0.32, 1), overlay 200ms allow-discrete, display 200ms allow-discrete;
}
@starting-style { dialog.sheet[open]::backdrop { background: rgb(0 0 0 / 0); } }
html:has(dialog[open]) { overflow: hidden; }

/* The viewer keeps one height, so Previous/Next stay put between photos */
dialog.sheet[data-viewer] { height: calc(100dvh - 32px); }
dialog.sheet[data-viewer][open] { display: flex; flex-direction: column; }
dialog.sheet[data-viewer] .viewer-img { flex: 1; min-height: 0; height: 100%; }
@media (prefers-reduced-motion: reduce) {
  dialog.sheet, dialog.sheet:not([open]) { transform: none; }
  @starting-style { dialog.sheet[open] { transform: none; } }
}
.sheet-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 52px; padding: 4px 4px 4px 16px;
}
.sheet-close {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
}
.sheet-close svg { width: 18px; height: 18px; }
.sheet video, .sheet .viewer-img {
  width: 100%; max-height: calc(100dvh - 32px - 52px); object-fit: contain; background: #000;
}
.viewer-nav { display: flex; gap: 4px; }
.viewer-nav button { display: inline-grid; place-items: center; width: 44px; height: 44px; }
.viewer-nav svg { width: 18px; height: 18px; }

/* Image outline: pure white at low opacity on these dark pages, never a tinted neutral */
.outlined, .strip img, .collage img, .gallery img, .film-poster img, .tape-poster, .reel-poster, .hero-portrait img {
  outline: 1px solid oklch(1 0 0 / 0.1); outline-offset: -1px;
}
