/* ashcrick.com
   The film already carries its own graphics: a lower-third bottom-left, a title
   card bottom-right at the start of each song, set in Baskerville with tracked
   caps and a gold rule. Everything here borrows that language and stays out of
   those corners. */

@font-face {
  font-family: "Baskervville";
  src: url("/fonts/baskervville-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("/fonts/montserrat.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Sampled from the film's title card. */
  --ink: #070b0f;
  --ivory: #efece1;
  --gold: #baa77e;
  --ivory-rgb: 239, 236, 225;
  --ink-rgb: 7, 11, 15;

  --serif: "Baskervville", Baskerville, "Libre Baskerville", "Times New Roman", serif;
  --sans: "Montserrat", "Avenir Next", Avenir, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* How much of the frame may be cropped before the film's own graphics (or the
     top of Ash's head) are touched. Up to these limits the picture fills the
     window edge to edge; beyond them it stops growing rather than cut into them. */
  --crop-x: 0.057;
  --crop-y: 0.135;

  --pad: clamp(18px, 3vw, 54px);
  --u: clamp(13.5px, 1.06vw, 18px);
}

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

html {
  background: var(--ink);
  color: var(--ivory);
  scroll-behavior: smooth;
  scrollbar-color: #2b333b var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 4px;
}

.icon {
  width: 1.2em;
  height: 1.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── The picture ─────────────────────────────────────────────────────────── */

.hero {
  display: grid;
  place-items: center;
  background: #000;
}

.stage {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: min(100%, calc(100vh * 16 / 9 / (1 - var(--crop-y))));
  width: min(100%, calc(100svh * 16 / 9 / (1 - var(--crop-y))));
  height: min(100vh, calc(100vw * 9 / 16 / (1 - var(--crop-x))));
  height: min(100svh, calc(100vw * 9 / 16 / (1 - var(--crop-x))));
  background: #000;
  font-size: var(--u);
}

.picture {
  position: absolute;
  inset: 0;
  touch-action: pan-y pinch-zoom;
}

.picture video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Crops are shared out by how much room each edge can spare. */
  object-position: 38.6% 66.7%;
  background: #000;
  transition: opacity 0.5s var(--ease);
}
.stage.is-cutting .picture video {
  opacity: 0;
  transition-duration: 0.16s;
}

/* Quietens the two places the interface sits: top-right (the chapter list,
   which falls over the piano lid or the far wall) and the bottom edge. */
.picture__shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 58% 82% at 100% 0%, rgba(var(--ink-rgb), 0.6) 0%, rgba(var(--ink-rgb), 0.34) 36%, rgba(var(--ink-rgb), 0) 74%),
    linear-gradient(to top, rgba(var(--ink-rgb), 0.5) 0%, rgba(var(--ink-rgb), 0) 15%);
}

.picture__flash {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 5.2em;
  height: 5.2em;
  margin: -2.6em 0 0 -2.6em;
  border: 1px solid rgba(var(--ivory-rgb), 0.5);
  border-radius: 50%;
  background: rgba(var(--ink-rgb), 0.36);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
}
.picture__flash .icon {
  grid-area: 1 / 1;
  width: 1.7em;
  height: 1.7em;
  display: none;
}
.picture__flash[data-kind="play"] .icon--play,
.picture__flash[data-kind="pause"] .icon--pause {
  display: block;
}
.picture__flash.is-on {
  animation: flash 0.9s var(--ease);
}
@keyframes flash {
  0% { opacity: 0; transform: scale(0.86); }
  22% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.12); }
}

.picture__error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: var(--pad);
  font: 400 1.25em/1.4 var(--serif);
  text-align: center;
}
.picture__error[hidden] {
  display: none;
}

/* ── The rail: the whole film, cut at each chapter marker ────────────────── */

.rail {
  position: absolute;
  z-index: 4;
  inset: auto 0 0;
  height: 34px;
  cursor: pointer;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.rail__track {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  pointer-events: none;
}

.rail__seg {
  position: relative;
  flex: var(--len) 1 0;
  height: 4px;
  background: rgba(var(--ivory-rgb), 0.36);
  transition: height 0.4s var(--ease), background-color 0.4s;
}
.rail__seg.is-current {
  background: rgba(var(--ivory-rgb), 0.5);
}
/* The marker: a tick standing at the start of each chapter, numbered as in the list. */
.rail__seg::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 0;
  width: 1px;
  height: 13px;
  background: rgba(var(--ivory-rgb), 0.7);
  transition: background-color 0.5s;
}
.rail__seg::after {
  content: attr(data-no);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 8px;
  font: 500 9px/1 var(--sans);
  letter-spacing: 0.2em;
  font-variant-numeric: tabular-nums;
  color: rgba(var(--ivory-rgb), 0.74);
  text-shadow: 0 0 10px rgba(var(--ink-rgb), 0.9);
  transition: color 0.5s;
}
.rail__seg.is-current::before {
  background: var(--gold);
}
.rail__seg.is-current::after {
  color: var(--gold);
}
.rail__seg i {
  position: absolute;
  inset: 0;
  background: var(--gold);
  transform: scaleX(var(--p, 0));
  transform-origin: 0 50%;
}
.rail:hover .rail__seg,
.rail.is-scrubbing .rail__seg {
  height: 7px;
}

.stage.is-loading .rail__seg,
.stage.is-buffering .rail__seg.is-current {
  animation: breathe 1.5s ease-in-out infinite;
}
.stage.is-loading .rail__seg:nth-child(2) { animation-delay: 0.12s; }
.stage.is-loading .rail__seg:nth-child(3) { animation-delay: 0.24s; }
.stage.is-loading .rail__seg:nth-child(4) { animation-delay: 0.36s; }
.stage.is-loading .rail__seg:nth-child(5) { animation-delay: 0.48s; }
.stage.is-loading .rail__seg:nth-child(6) { animation-delay: 0.6s; }
@keyframes breathe {
  50% { opacity: 0.35; }
}

.rail__tip {
  position: absolute;
  bottom: 30px;
  left: var(--x, 50%);
  width: 196px;
  padding: 6px 6px 11px;
  border: 1px solid rgba(var(--ivory-rgb), 0.16);
  background: rgba(var(--ink-rgb), 0.8);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 0.3s, transform 0.4s var(--ease);
  pointer-events: none;
}
.rail.is-hot .rail__tip {
  opacity: 1;
  transform: translate(-50%, 0);
}
.rail__thumb {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #000;
}
.rail__label {
  display: flex;
  align-items: baseline;
  gap: 0.7em;
  margin: 10px 6px 0;
  font: 400 15px/1.2 var(--serif);
}
.rail__no {
  font: 500 9px/1 var(--sans);
  letter-spacing: 0.18em;
  color: var(--gold);
}
.rail__time {
  display: block;
  margin: 6px 6px 0;
  font: 500 9px/1 var(--sans);
  letter-spacing: 0.2em;
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
  opacity: 0.6;
}

/* ── Sound ───────────────────────────────────────────────────────────────── */

.listen {
  position: absolute;
  z-index: 5;
  bottom: clamp(34px, 9vh, 92px);
  left: 50%;
  display: inline-flex;
  align-items: center;
  gap: 1em;
  padding: 1.15em 1.9em 1.15em 1.5em;
  border: 1px solid rgba(var(--ivory-rgb), 0.42);
  border-radius: 999px;
  background: rgba(var(--ink-rgb), 0.42);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  backdrop-filter: blur(16px) saturate(1.25);
  font: 500 max(10.5px, 0.66em) / 1 var(--sans);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 10px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease), visibility 0s 0.7s, background-color 0.3s, border-color 0.3s;
}
.listen .icon {
  width: 1.7em;
  height: 1.7em;
}
.listen::after {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid rgba(var(--ivory-rgb), 0.55);
  border-radius: inherit;
  animation: ring 2.6s var(--ease) infinite;
  pointer-events: none;
}
@keyframes ring {
  0% { opacity: 0.7; transform: scale(1); }
  70%, 100% { opacity: 0; transform: scale(1.16, 1.5); }
}
.stage.is-silent .listen,
.stage.is-waiting .listen {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition-delay: 0s;
}
.listen:hover {
  border-color: var(--gold);
  background: rgba(var(--ink-rgb), 0.62);
}
/* While the rail is showing a preview, the button gets out of its way. */
.stage.is-previewing .listen {
  opacity: 0;
  transition-duration: 0.25s;
}

/* ── The chapter list ────────────────────────────────────────────────────── */

.index {
  position: absolute;
  z-index: 4;
  top: clamp(16px, 4.4vh, 46px);
  right: clamp(18px, 3vw, 54px);
  width: clamp(236px, 23.5vw, 360px);
  text-shadow: 0 0 22px rgba(var(--ink-rgb), 0.5);
}
/* Whatever the camera puts behind the list (in the wide shot, a studio light),
   it stays readable: the picture is softened and dimmed beneath it, feathered
   out so there is no panel to see. */
.index::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -64px -64px -240px -300px;
  -webkit-backdrop-filter: blur(22px) brightness(0.62) saturate(1.1);
  backdrop-filter: blur(22px) brightness(0.62) saturate(1.1);
  /* Full strength in the corner, gone long before its own edges. */
  -webkit-mask-image: radial-gradient(ellipse farthest-side at 100% 0%, #000 0%, #000 52%, transparent 100%);
  mask-image: radial-gradient(ellipse farthest-side at 100% 0%, #000 0%, #000 52%, transparent 100%);
  pointer-events: none;
}

.index__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5em;
  padding-bottom: 0.4em;
  border-bottom: 1px solid rgba(186, 167, 126, 0.6);
  transition: border-color 0.9s var(--ease);
}
.index__label {
  font: 500 0.6em/1 var(--sans);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
}

.controls {
  display: flex;
  margin-right: -0.5em;
  transition: opacity 0.9s var(--ease);
}
.control {
  display: grid;
  place-items: center;
  width: 2.15em;
  height: 2.15em;
  border-radius: 50%;
  opacity: 0.74;
  transition: opacity 0.3s, background-color 0.3s, color 0.3s;
}
.control:hover {
  opacity: 1;
  background: rgba(var(--ivory-rgb), 0.12);
}
.control .icon {
  grid-area: 1 / 1;
}
.control .icon--play,
.stage.is-paused .control .icon--pause,
.control .icon--sound-on,
.stage.has-sound .control .icon--sound-off {
  display: none;
}
.stage.is-paused .control .icon--play,
.stage.has-sound .control .icon--sound-on {
  display: block;
}

.index__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.chapter__btn {
  display: grid;
  grid-template-columns: 2.5em minmax(0, 1fr) auto;
  align-items: baseline;
  width: 100%;
  padding: 0.33em 0;
  font: 400 1em/1.28 var(--serif);
  text-align: left;
}
.chapter__no {
  display: block;
  font: 500 0.6em/1 var(--sans);
  letter-spacing: 0.18em;
  font-variant-numeric: tabular-nums;
  opacity: 0.56;
  transition: opacity 0.6s var(--ease), color 0.6s var(--ease);
}
.chapter__title {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: 0.66;
  transition: opacity 0.6s var(--ease);
}

/* The right-hand column says what a row is to the one now playing. */
.chapter__role {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 2px;
  min-width: 5.4em;
  padding-left: 1em;
  font: 500 0.52em/1 var(--sans);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  opacity: 0.62;
  transition: opacity 0.6s var(--ease), color 0.3s;
}
.chapter.is-prev .chapter__role::after { content: "Previous"; }
.chapter.is-next .chapter__role::after { content: "Next"; }
.chapter__role i {
  display: none;
  width: 2px;
  height: 1.7em;
  background: var(--gold);
  transform: scaleY(0.25);
  transform-origin: 50% 100%;
}
.chapter.is-current .chapter__role i {
  display: block;
}
/* The bars move only when there is something to hear. */
.stage.has-sound:not(.is-paused) .chapter.is-current .chapter__role i {
  animation: bars var(--beat, 1.1s) ease-in-out var(--lag, 0s) infinite;
}
.chapter__role i:nth-child(2) { --beat: 0.8s; --lag: -0.3s; }
.chapter__role i:nth-child(3) { --beat: 1.35s; --lag: -0.6s; }
@keyframes bars {
  0%, 100% { transform: scaleY(0.25); }
  50% { transform: scaleY(1); }
}

.chapter.is-current .chapter__no {
  color: var(--gold);
  opacity: 1;
}
.chapter.is-current .chapter__title,
.chapter.is-hinted .chapter__title,
.chapter__btn:hover .chapter__title,
.chapter__btn:focus-visible .chapter__title {
  opacity: 1;
}
.chapter.is-current .chapter__role,
.chapter.is-hinted .chapter__role,
.chapter__btn:hover .chapter__role {
  opacity: 1;
}
.chapter.is-hinted .chapter__role,
.chapter__btn:hover .chapter__role {
  color: var(--gold);
}

/* The row now playing opens to show who wrote it and how far through it is. */
.chapter__more {
  grid-column: 2 / -1;
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.75s var(--ease);
}
.chapter.is-current .chapter__more {
  grid-template-rows: 1fr;
}
.chapter__inner {
  display: block;
  min-height: 0;
  overflow: hidden;
}
.chapter__artist {
  display: block;
  padding-top: 0.55em;
  font: 500 0.56em/1 var(--sans);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  opacity: 0.8;
}
.chapter__bar {
  position: relative;
  display: block;
  height: 1px;
  margin: 0.75em 0 0.4em;
  background: rgba(var(--ivory-rgb), 0.26);
}
.chapter__bar i {
  position: absolute;
  inset: 0;
  background: var(--gold);
  transform: scaleX(var(--p, 0));
  transform-origin: 0 50%;
}

/* ── When nobody is touching anything, the interface steps back ──────────── */

/* Only where the interface lies over the picture, and only with a mouse. */
@media (hover: hover) and (min-aspect-ratio: 5/4) {
  .stage.is-idle {
    cursor: none;
  }
  .stage.is-idle .controls {
    opacity: 0;
  }
  .stage.is-idle .index__head {
    border-color: rgba(186, 167, 126, 0.28);
  }
  .stage.is-idle .chapter:not(.is-current) .chapter__title {
    opacity: 0.46;
  }
  .stage.is-idle .chapter:not(.is-current) .chapter__no,
  .stage.is-idle .chapter:not(.is-current) .chapter__role {
    opacity: 0.36;
  }
}

/* ── Wider than the film can safely stretch: let its edges fall away ─────── */

@media (min-aspect-ratio: 2055/1000) {
  .picture video {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  }
}

/* ── Short landscape screens (a phone on its side) ───────────────────────── */

@media (min-aspect-ratio: 5/4) and (max-height: 480px) {
  .stage {
    --u: 13px;
  }
  .index {
    top: 12px;
    width: 230px;
  }
  /* Only the rows that matter: what was, what is, what is next. */
  .chapter:not(.is-current, .is-prev, .is-next) {
    display: none;
  }
  .listen {
    bottom: 30px;
  }
  /* No room to number the markers without crowding the film's lower-third. */
  .rail__seg::after {
    content: none;
  }
  .rail__seg::before {
    height: 8px;
  }
}

/* ── Tall screens: the film on top, the chapters beneath it ──────────────── */

@media (max-aspect-ratio: 5/4) {
  :root {
    --u: clamp(16px, 4.3vw, 21px);
  }
  .hero {
    display: block;
    background: var(--ink);
  }
  .stage {
    width: 100%;
    height: auto;
    overflow: visible;
    background: none;
  }
  .picture {
    position: relative;
    inset: auto;
    aspect-ratio: 16 / 9;
    background: #000;
  }
  /* Nothing is cropped here: the film is shown whole. */
  .picture video {
    object-fit: contain;
  }
  .picture__shade {
    display: none;
  }
  .hero:fullscreen {
    display: grid;
    align-content: center;
    background: #000;
  }

  .rail {
    position: relative;
    inset: auto;
    height: 26px;
  }
  .rail__track {
    inset: 0 0 auto;
    align-items: flex-start;
  }
  .rail__seg::before {
    top: 100%;
    bottom: auto;
    height: 9px;
  }
  .rail__seg::after {
    top: calc(100% + 5px);
    bottom: auto;
    left: 7px;
    text-shadow: none;
  }
  .rail:hover .rail__seg,
  .rail.is-scrubbing .rail__seg {
    height: 4px;
  }
  .rail__tip {
    display: none;
  }

  /* Tucked into the picture's quiet top-right corner. */
  .listen {
    top: 12px;
    right: 12px;
    bottom: auto;
    left: auto;
    padding: 0.9em 1.3em 0.9em 1em;
    font-size: 9.5px;
    transform: translateY(-6px);
  }
  .stage.is-silent .listen,
  .stage.is-waiting .listen {
    transform: none;
  }

  .index {
    position: static;
    width: auto;
    max-width: 640px;
    margin: 0 auto;
    padding: 14px var(--pad) 34px;
    text-shadow: none;
  }
  .index::before {
    display: none;
  }
  .index__head {
    margin-bottom: 0.3em;
    padding-bottom: 0.55em;
  }
  .control {
    width: 2.5em;
    height: 2.5em;
  }
  .chapter__btn {
    padding: 0.72em 0;
  }
  .chapter + .chapter {
    border-top: 1px solid rgba(var(--ivory-rgb), 0.08);
  }
}

/* ── The card beneath: the film's own title card, set in type ────────────── */

.card {
  display: grid;
  /* One column, as wide as the plate, so the place line can hang from its right edge. */
  grid-template-columns: max-content;
  justify-content: center;
  justify-items: center;
  align-content: center;
  min-height: 68vh;
  padding: clamp(84px, 16vh, 180px) var(--pad);
  text-align: center;
  background: radial-gradient(ellipse 70% 60% at 50% 46%, #0c151c 0%, var(--ink) 100%);
}
.card__eyebrow {
  margin: 0 0 clamp(34px, 6vh, 64px);
  font: 500 clamp(9.5px, 0.78vw, 12px) / 1 var(--sans);
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--gold);
}
.card__plate {
  position: relative;
  padding: clamp(6px, 0.9vw, 14px) clamp(40px, 10vw, 170px);
}
.card__plate::before,
.card__plate::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: max(1px, 0.14vw);
  background: var(--ivory);
}
.card__plate::before { left: 0; }
.card__plate::after { right: 0; }
.card__name {
  margin: 0;
  font: 300 clamp(38px, 7.2vw, 112px) / 1.05 var(--sans);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  white-space: nowrap;
}
.card__role {
  margin: 0.9em 0 0;
  padding-left: 0.6em; /* balances the trailing letter-space */
  font: 500 clamp(9px, 1.16vw, 17px) / 1 var(--sans);
  letter-spacing: 0.6em;
  text-transform: uppercase;
  white-space: nowrap;
}
.card__place {
  justify-self: end;
  margin: clamp(14px, 1.8vw, 26px) clamp(4px, 1.2vw, 20px) 0 0;
  font: 700 clamp(8.5px, 0.86vw, 13px) / 1 var(--sans);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.card--alone {
  min-height: 100vh;
  min-height: 100svh;
}
.card__place a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--gold);
  padding-bottom: 0.35em;
}

.foot {
  display: flex;
  justify-content: space-between;
  gap: 2em;
  padding: 26px var(--pad) calc(26px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(var(--ivory-rgb), 0.1);
  font: 500 9.5px/1 var(--sans);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(var(--ivory-rgb), 0.5);
}
.foot a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s;
}
.foot a:hover {
  color: var(--gold);
}

.noscript {
  margin: 0;
  padding: 24px var(--pad);
  font: 400 17px/1.4 var(--serif);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}
