@font-face {
  font-family: "Archivo";
  src: url("./fonts/archivo-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62.5% 125%;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("./fonts/instrument-serif-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* Old-film ivory on a warm black. Everything on the page uses these two. */
:root {
  color-scheme: dark;
  --ivory: 239 230 208;
  --bright: 255 249 233;
  --ink: #0a0806;
  --grain: none;
}

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

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--ink);
}

body {
  color: rgb(var(--ivory));
  font-family: "Archivo", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

body[data-idle="true"] {
  cursor: none;
}

/* ------------------------------------------------------------ the picture */
.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
  background: var(--ink);
}

.stage canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.film {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Glass wear: the same two scans the portfolio's scope uses. */
.film-glass {
  background:
    url("./assets/glass-scratches.jpg") 40% 30% / cover no-repeat,
    url("./assets/glass-dust.jpg") 62% 48% / cover no-repeat;
  background-blend-mode: screen;
  mix-blend-mode: screen;
  opacity: .55;
  transition: opacity .16s linear;
}

.stage[data-bass="hot"] .film-glass {
  opacity: .85;
}

.film-grain {
  background-image: var(--grain);
  background-size: 240px 240px;
  animation: grain .72s steps(1, end) infinite;
}

@keyframes grain {
  0% { background-position: 0 0; }
  11% { background-position: -67px 41px; }
  22% { background-position: 53px -89px; }
  33% { background-position: -131px -23px; }
  44% { background-position: 97px 113px; }
  55% { background-position: -29px 71px; }
  66% { background-position: 149px -47px; }
  77% { background-position: -83px -127px; }
  88% { background-position: 31px 17px; }
}

.film-vignette {
  background: radial-gradient(ellipse 78% 74% at 50% 46%, transparent 38%, rgb(5 4 3 / .42) 74%, rgb(3 2 1 / .9) 100%);
}

/* ---------------------------------------------------------- the title card */
.title-card {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: clamp(20px, 4.5vh, 46px);
  padding-bottom: 12vh;
  text-align: center;
  pointer-events: none;
  transition: opacity .9s ease, visibility 0s linear .9s;
}

body[data-started="true"] .title-card {
  opacity: 0;
  visibility: hidden;
}

.title-name {
  margin: 0;
  font: italic 400 clamp(110px, 24vw, 330px) / .78 "Instrument Serif", "Times New Roman", serif;
  letter-spacing: -.035em;
  color: rgb(var(--bright));
  text-shadow: 0 0 42px rgb(var(--ivory) / .32), 0 0 2px rgb(var(--ivory) / .5);
}

.title-hint {
  margin: 0;
  padding-left: .5em;
  font-size: 11px;
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: .5em;
  text-transform: uppercase;
  color: rgb(var(--ivory) / .9);
  animation: hint 1.6s steps(1, end) infinite;
}

@keyframes hint {
  0% { opacity: 1; }
  50% { opacity: .28; }
}

/* Short messages appear like a film subtitle and leave again. */
.caption {
  position: fixed;
  left: 50%;
  bottom: clamp(104px, 17vh, 170px);
  z-index: 4;
  margin: 0;
  transform: translateX(-50%);
  font: italic 400 clamp(22px, 2.7vw, 34px) / 1.1 "Instrument Serif", "Times New Roman", serif;
  color: rgb(var(--bright));
  text-shadow: 0 1px 18px rgb(0 0 0 / .9), 0 0 2px rgb(0 0 0 / .8);
  width: max-content;
  max-width: min(88vw, 30em);
  padding: .5em 1.6em;
  background: radial-gradient(ellipse closest-side, rgb(8 6 4 / .82), rgb(8 6 4 / .5) 62%, rgb(8 6 4 / 0));
  text-align: center;
  text-wrap: balance;
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}

.caption[data-show="true"] {
  opacity: 1;
}

/* -------------------------------------------- the player at the bottom edge */
.player {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  padding-bottom: env(safe-area-inset-bottom);
  color: rgb(var(--ivory));
  background: linear-gradient(to bottom, rgb(var(--ivory) / .085), rgb(var(--ivory) / .03));
  border-top: 1px solid rgb(var(--ivory) / .22);
  -webkit-backdrop-filter: blur(20px) brightness(.8);
  backdrop-filter: blur(20px) brightness(.8);
  transform: translateY(calc(100% + 2px));
  opacity: 0;
  transition: transform .46s cubic-bezier(.2, .9, .2, 1), opacity .3s ease;
}

.player[data-open="true"] {
  transform: none;
  opacity: 1;
}

.progress {
  display: grid;
  grid-template-columns: repeat(60, 1fr);
  gap: 2px;
  padding: 9px clamp(12px, 2.2vw, 30px) 0;
}

.progress i {
  height: 3px;
  background: rgb(var(--ivory) / .16);
}

.progress i.on {
  background: rgb(var(--bright) / .95);
}

.player-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  padding: 0 clamp(6px, 1.6vw, 22px);
}

.group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.pix {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: rgb(var(--ivory) / .7);
  text-decoration: none;
  cursor: pointer;
  transition: color .12s linear, background-color .12s linear;
}

.pix svg,
.number svg {
  display: block;
  fill: currentColor;
  shape-rendering: crispEdges;
  pointer-events: none;
}

.pix:hover {
  color: rgb(var(--bright));
  background: rgb(var(--ivory) / .09);
}

.pix:active {
  background: rgb(var(--ivory) / .16);
}

.pix[aria-pressed="true"] {
  color: rgb(var(--bright));
}

.pix:focus-visible,
.volume:focus-visible {
  outline: 1px solid rgb(var(--ivory) / .7);
  outline-offset: -3px;
}

.count {
  position: absolute;
  top: 4px;
  right: 2px;
  min-width: 14px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: rgb(var(--bright));
  text-align: center;
}

.number {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: 0;
  transform: translate(-50%, -50%);
  color: rgb(var(--ivory) / .86);
  line-height: 0;
  pointer-events: none;
}

.volume {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 42px;
  padding: 0 8px 0 2px;
  cursor: pointer;
  touch-action: none;
}

.volume i {
  width: 7px;
  height: 7px;
  background: rgb(var(--ivory) / .2);
}

.volume i.on {
  background: rgb(var(--ivory) / .9);
}

.noscript {
  position: fixed;
  inset: 40% 0 auto;
  z-index: 9;
  margin: 0;
  text-align: center;
  font: italic 400 24px / 1.2 "Instrument Serif", "Times New Roman", serif;
}

/* Phones and tablets: bigger targets; the hardware handles volume. */
@media (hover: none), (pointer: coarse) {
  .desk {
    display: none !important;
  }

  .pix {
    width: 46px;
    height: 46px;
  }

  .player-row {
    height: 62px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .film-grain,
  .title-hint {
    animation: none;
  }

  .player,
  .title-card,
  .caption {
    transition-duration: .01s;
  }
}
