/* The film poster row that lifts with a glass glare
   Every poster is a button with five layers: its shadow, the picture (colour, shape and title, each moved at its own
   depth), the glass glare, a 1px edge of light and the My List check. The script writes the pointer into --sx and
   --sy and the transform of the poster every frame. */
:root {
  --page: #0b0b0e;          /* the page */
  --ink: #f2f0ec;           /* the words */
  --muted: #8d8b93;         /* the small words */
  --line: rgba(255, 255, 255, 0.09); /* thin lines and borders */
  --glare: #ffffff;         /* the glass glare on the posters */
  --accent: #ffb46a;        /* the colour of the poster in focus (the script changes it) */
  --sun-a: #ff9a4d;         /* Paper Sun */
  --sun-b: #c8361f;
  --tide-a: #2e7d8a;        /* Low Tide */
  --tide-b: #0b1c25;
  --hours-a: #6a55c9;       /* The Quiet Hours */
  --hours-b: #140f27;
  --north-a: #ece4d6;       /* Northbound */
  --north-b: #c9bca4;
  --north-red: #d8432b;
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(12px, 4vh, 28px) 16px;
  overflow: hidden;
  isolation: isolate;
}

/* the page takes the colour of the poster in focus */
.ambient {
  position: absolute;
  left: 50%;
  top: 44%;
  width: min(120vw, 1100px);
  height: min(90vh, 640px);
  translate: -50% -50%;
  background:
    radial-gradient(closest-side, color-mix(in srgb, var(--accent) 26%, transparent), transparent),
    radial-gradient(closest-side at 50% 70%, color-mix(in srgb, var(--accent) 10%, transparent), transparent);
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

.stage::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.035), transparent 60%);
}

.shelf {
  --n: 4;
  --gap: clamp(10px, 1.6vw, 18px);
  --pw: min(calc((100vw - 32px - var(--pad) * 2 - var(--gap) * (var(--n) - 1)) / var(--n)), 25vh, 168px);
  --pad: clamp(6px, 1.4vh, 12px);
  width: calc(var(--pw) * var(--n) + var(--gap) * (var(--n) - 1) + var(--pad) * 2);
  opacity: 0;
}

.shelf__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 var(--pad);
  margin-bottom: clamp(8px, 2vh, 16px);
}

.shelf__title {
  margin: 0;
  font-size: clamp(14px, 2.3vh, 17px);
  font-weight: 620;
  font-stretch: 108%;
  letter-spacing: -0.01em;
}

.shelf__all {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.3s ease;
}

.shelf__all svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.45s cubic-bezier(0.34, 1.8, 0.5, 1);
}

@media (hover: hover) {
  .shelf__all:hover {
    color: var(--ink);
  }

  .shelf__all:hover svg {
    transform: translateX(2px);
  }
}

.row {
  position: relative;
  display: flex;
  gap: var(--gap);
  padding: var(--pad);
}

/* ---------------------------------------------------------------- the poster */
.poster {
  position: relative;
  flex: none;
  width: var(--pw);
  aspect-ratio: 2 / 3;
  padding: 0;
  border: 0;
  border-radius: calc(var(--pw) * 0.075);
  background: none;
  cursor: pointer;
  container-type: inline-size;
  transform-origin: 50% 55%;
  -webkit-tap-highlight-color: transparent;
  --sx: 50%;
  --sy: 30%;
  --f: 0;
}

.poster:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

/* the soft shadow under the poster in focus, tinted by its colour */
.poster__shadow {
  position: absolute;
  inset: 12% 8% -6%;
  border-radius: inherit;
  background: var(--tint, #000);
  filter: blur(18px);
  opacity: 0;
  z-index: 0;
}

.poster__img {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  z-index: 1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 10px 24px -14px rgba(0, 0, 0, 0.9);
}

.poster__layer {
  position: absolute;
  inset: -7%;
}

.poster__grain {
  position: absolute;
  inset: 0;
  opacity: 0.16;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.9 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* the glass glare: a soft hot spot under the pointer and a wide band across the glass */
.poster__sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 2;
  pointer-events: none;
  opacity: var(--f);
  mix-blend-mode: soft-light;
  background:
    radial-gradient(70cqw circle at var(--sx) var(--sy), color-mix(in srgb, var(--glare) 85%, transparent), transparent 62%),
    linear-gradient(calc(115deg + var(--band-tilt, 0deg)), transparent calc(var(--band) - 22%), color-mix(in srgb, var(--glare) 38%, transparent) var(--band), transparent calc(var(--band) + 22%));
  --band: 50%;
}

.poster__sheen::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  mix-blend-mode: screen;
  background: radial-gradient(28cqw circle at var(--sx) var(--sy), color-mix(in srgb, var(--glare) var(--hot, 18%), transparent), transparent 70%);
}

/* the 1px edge that catches the light near the pointer */
.poster__edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  z-index: 3;
  pointer-events: none;
  background:
    radial-gradient(90cqw circle at var(--sx) var(--sy), rgba(255, 255, 255, calc(0.12 + var(--f) * 0.6)), rgba(255, 255, 255, 0.07) 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}

/* the My List check in the corner */
.poster__badge {
  position: absolute;
  right: 7cqw;
  top: 7cqw;
  width: max(18px, 17cqw);
  aspect-ratio: 1;
  border-radius: 50%;
  z-index: 4;
  display: grid;
  place-items: center;
  background: rgba(250, 248, 244, 0.94);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35), inset 0 -1px 0 rgba(0, 0, 0, 0.12);
  opacity: 0;
  transform: scale(0.4);
}

.poster__badge svg {
  width: 70%;
  height: 70%;
  fill: none;
  stroke: #0b0b0e;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.poster__badge path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

/* ---------------------------------------------------------------- the words on the poster */
.poster__words {
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 9cqw 9cqw 10cqw;
  text-align: left;
}

.poster__kicker {
  font-size: max(6px, 6.4cqw);
  font-weight: 600;
  font-stretch: 125%;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 248, 240, 0.72);
}

.poster__chip {
  align-self: flex-start;
  font-size: max(6px, 6.2cqw);
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.35em 0.7em;
  border-radius: 99px;
  color: #f4fbfc;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.poster__name {
  font-size: 15cqw;
  line-height: 0.9;
  font-weight: 760;
  font-stretch: 78%;
  letter-spacing: -0.02em;
  color: #fff8ef;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

/* ---------------------------------------------------------------- Paper Sun */
.poster--sun {
  --tint: var(--sun-b);
}

.poster--sun .poster__bg {
  background: linear-gradient(180deg, var(--sun-a) 0%, #e8622f 42%, var(--sun-b) 66%, #3a0f0a 100%);
}

.poster--sun .sun {
  position: absolute;
  left: 50%;
  top: 40%;
  width: 52%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle at 45% 40%, #fff1d6, #ffc58a 55%, #ff9e5a);
  box-shadow: 0 0 40px 6px rgba(255, 196, 130, 0.45);
}

.poster--sun .sun-ring {
  position: absolute;
  left: 50%;
  top: 40%;
  width: 72%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  border: 1px solid rgba(255, 236, 210, 0.32);
}

.poster--sun .sun-ring--2 {
  width: 94%;
  border-color: rgba(255, 236, 210, 0.16);
}

.poster--sun .horizon {
  position: absolute;
  left: 0;
  right: 0;
  top: 58%;
  bottom: 0;
  background: linear-gradient(180deg, rgba(58, 15, 10, 0.55), #2a0a07);
  border-top: 1px solid rgba(255, 220, 190, 0.4);
}

/* ---------------------------------------------------------------- Low Tide */
.poster--tide {
  --tint: var(--tide-a);
}

.poster--tide .poster__bg {
  background: linear-gradient(180deg, #123a46 0%, var(--tide-a) 46%, #1a4a55 52%, var(--tide-b) 100%);
}

.poster--tide .moon {
  position: absolute;
  left: 60%;
  top: 30%;
  width: 22%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, #ffffff, #d8eef0 60%, #a9d4da);
  box-shadow: 0 0 30px 8px rgba(200, 240, 245, 0.28);
}

.poster--tide .water {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  bottom: 0;
  background:
    linear-gradient(90deg, transparent 52%, rgba(225, 248, 250, 0.5) 58%, transparent 64%),
    repeating-linear-gradient(180deg, rgba(210, 240, 244, 0.22) 0 1px, transparent 1px 7px);
  -webkit-mask: linear-gradient(180deg, #000, transparent 80%);
  mask: linear-gradient(180deg, #000, transparent 80%);
}

/* ---------------------------------------------------------------- The Quiet Hours */
.poster--hours {
  --tint: var(--hours-a);
}

.poster--hours .poster__bg {
  background: radial-gradient(90% 60% at 50% 60%, #3b2c7a, var(--hours-b) 75%);
}

.poster--hours .arch {
  position: absolute;
  left: 50%;
  top: 22%;
  width: 46%;
  height: 52%;
  translate: -50% 0;
  border-radius: 999px 999px 2px 2px;
  border: 1px solid rgba(214, 200, 255, 0.4);
  background: linear-gradient(180deg, rgba(190, 170, 255, 0.0), rgba(190, 170, 255, 0.12));
}

.poster--hours .arch--in {
  top: 30%;
  width: 30%;
  height: 44%;
  border: 0;
  background: linear-gradient(180deg, #f3e9ff 0%, #b9a2ff 45%, var(--hours-a) 100%);
  box-shadow: 0 0 34px 6px rgba(160, 130, 255, 0.4);
}

/* ---------------------------------------------------------------- Northbound */
.poster--north {
  --tint: #8b7b5c;
}

.poster--north .poster__bg {
  background: linear-gradient(180deg, var(--north-a), var(--north-b));
}

.poster--north .bar {
  position: absolute;
  left: 24%;
  top: 24%;
  width: 9%;
  height: 40%;
  background: #17151a;
  transform: skewX(-24deg);
}

.poster--north .bar--2 {
  left: 44%;
  top: 30%;
  height: 34%;
}

.poster--north .bar--3 {
  left: 64%;
  top: 36%;
  height: 28%;
}

.poster--north .dot-sun {
  position: absolute;
  left: 72%;
  top: 22%;
  width: 12%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--north-red);
}

.poster--north .poster__kicker {
  color: rgba(23, 21, 26, 0.6);
}

.poster--north .poster__name {
  color: #17151a;
  text-shadow: none;
}

/* ---------------------------------------------------------------- the details */
.info {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 0 var(--pad);
  margin-top: clamp(10px, 2.6vh, 22px);
}

.info__text {
  min-width: 0;
}

.info__kicker {
  margin: 0 0 4px;
  font-size: 10.5px;
  font-weight: 600;
  font-stretch: 120%;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) 70%, var(--ink));
}

.info__title {
  margin: 0;
  font-size: clamp(19px, 4.2vh, 28px);
  line-height: 1.05;
  font-weight: 700;
  font-stretch: 92%;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.info__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.tag {
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  padding: 1px 4px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  color: #c9c7cf;
}

.info__actions {
  display: flex;
  gap: 8px;
  flex: none;
}

.btn {
  position: relative;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn__face {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 0 15px 0 12px;
  border-radius: inherit;
  font-size: 13px;
  font-weight: 600;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.btn--play .btn__face {
  background: #f6f4f0;
  color: #0b0b0e;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 8px 20px -10px rgba(0, 0, 0, 0.8);
}

.btn--list .btn__face {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.btn--list[aria-pressed='true'] .btn__face {
  background: color-mix(in srgb, var(--accent) 20%, rgba(255, 255, 255, 0.06));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

@media (hover: hover) {
  .btn--list:hover .btn__face {
    background: rgba(255, 255, 255, 0.13);
  }
}

.btn__icon {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.btn__icon .tri {
  fill: currentColor;
  stroke-width: 1.2;
}

.btn__icon .plus {
  transform-origin: 8px 8px;
}

.btn__icon .tick {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.btn__words {
  display: inline-block;
  min-width: 3.9em;
}

/* ---------------------------------------------------------------- the phone */
@media (max-width: 560px) {
  .shelf {
    --n: 3;
    --gap: 10px;
  }

  .poster--north {
    display: none;
  }

  .info {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .btn {
    height: 32px;
  }
}

@media (max-height: 460px) {
  .info__kicker {
    display: none;
  }
}
