:root {
  --maxw: 1640px;
  --gutter: max(16px, env(safe-area-inset-left), env(safe-area-inset-right));
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: "Sora", system-ui, sans-serif;
  --spring: cubic-bezier(0.2, 0.9, 0.25, 1.15);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--color-bg);
}

body {
  padding-bottom: calc(92px + var(--safe-bottom));
  background: var(--color-bg);
  color: var(--color-text);
  font: 400 14px/1.4 var(--font);
}

main {
  max-width: var(--maxw);
  margin-inline: auto;
  overflow-x: clip;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

ul {
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
}

svg {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:focus-visible {
  outline: 2px solid var(--color-accent-light);
  outline-offset: 2px;
}

.sprite {
  display: none;
}

/* Header */

.top {
  position: fixed;
  z-index: 20;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  padding: 0 var(--gutter);
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

.top.is-stuck {
  background: rgba(9, 11, 18, 0.88);
  box-shadow: 0 1px 0 var(--color-line);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.logo {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -1px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.logo b {
  color: var(--color-accent);
  font-weight: 800;
}

/* Hero */

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: clamp(392px, 61svh, 570px);
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.hero__media {
  position: absolute;
  z-index: -2;
  inset: -6% 0 0;
}

.hero__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 12%;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.hero__media img.is-on {
  opacity: 1;
}

.hero__shade {
  position: absolute;
  z-index: -1;
  inset: 0 0 -6px;
  background:
    linear-gradient(180deg, rgba(9, 11, 18, 0.62), transparent 24%),
    linear-gradient(90deg, rgba(9, 11, 18, 0.72), transparent 72%),
    linear-gradient(0deg, var(--color-bg) 4%, rgba(9, 11, 18, 0.82) 24%, transparent 62%);
}

.hero__info {
  padding: 0 var(--gutter) 30px;
}

.hero__meta {
  color: var(--color-chip-text);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero__rating {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  color: var(--color-chip-text);
  font-size: 12.5px;
}

.hero__rating svg {
  width: 15px;
  height: 15px;
  color: var(--color-star);
  fill: currentColor;
  stroke: none;
}

.hero__rating b {
  color: var(--color-text);
  font-weight: 700;
}

h1 {
  display: flex;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: clamp(34px, 11vw, 44px);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -1.4px;
  text-transform: uppercase;
}

h1 span {
  display: inline-block;
  white-space: pre;
}

.hero__sub {
  max-width: 30ch;
  margin-top: 6px;
  color: var(--color-chip-text);
  font-size: 13px;
  line-height: 1.4;
}

.hero__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.btn-watch {
  position: relative;
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  overflow: hidden;
  border-radius: 16px;
  background-image: var(--grad);
  box-shadow: 0 10px 26px -6px rgba(255, 89, 0, 0.7);
  color: var(--color-on-accent);
  font-size: 16px;
  font-weight: 700;
  transition: transform 140ms ease-out;
}

.btn-watch:active {
  transform: scale(0.96);
}

.btn-watch::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 42%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  transform: translateX(-130%) skewX(-20deg);
  animation: sheen 3.6s ease-in-out 1.2s infinite;
}

.btn-watch svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.5;
}

.hero__dots {
  position: absolute;
  right: var(--gutter);
  bottom: 8px;
  left: var(--gutter);
  display: flex;
  justify-content: center;
}

.hero__dots button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 28px;
}

.hero__dots i {
  display: block;
  width: 32px;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.28);
  transition: background-color 0.2s ease;
}

.hero__dots .is-on i {
  background: var(--color-accent-light);
}

/* Tabs */

.tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 2px;
  padding-inline: var(--gutter);
  border-bottom: 1px solid var(--color-line);
}

.tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 46px;
  color: var(--color-muted-2);
  font-size: 12.5px;
  font-weight: 600;
  transition: color 0.2s ease;
}

.tabs svg {
  width: 16px;
  height: 16px;
  transition: transform 0.35s var(--spring);
}

.tabs button[aria-pressed="true"] {
  color: var(--color-text);
}

.tabs button[aria-pressed="true"] svg {
  color: var(--color-accent-light);
  transform: scale(1.18) rotate(-6deg);
}

.tabs__bar {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background-image: linear-gradient(90deg, var(--color-accent-deep), var(--color-accent-light));
  box-shadow: 0 0 12px var(--color-accent);
  transition: transform 0.22s ease-out, width 0.18s ease;
}

/* Genres */

.chips {
  display: flex;
  gap: 7px;
  padding: 10px var(--gutter) 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chips button {
  flex: none;
  height: 40px;
  padding: 0 15px;
  border-radius: var(--radius-pill);
  background: var(--color-card);
  box-shadow: inset 0 0 0 1px var(--color-line);
  color: var(--color-chip-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.3s var(--spring);
}

.chips button:active {
  transform: scale(0.92);
}

.chips button[aria-pressed="true"] {
  background-image: var(--grad);
  box-shadow: 0 6px 16px rgba(255, 89, 0, 0.4);
  color: var(--color-on-accent);
  font-weight: 700;
}

/* Rails */

.rail {
  display: flex;
  gap: 12px;
  padding: 10px var(--gutter) 6px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
}

.rail::-webkit-scrollbar {
  display: none;
}

.poster {
  position: relative;
  flex: 0 0 132px;
  scroll-snap-align: start;
}

.poster__open {
  display: block;
  width: 100%;
  text-align: left;
}

.poster__img {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 16px;
  background: var(--color-card);
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.2s ease-out, box-shadow 0.25s ease;
}

.poster__open:active .poster__img {
  box-shadow: 0 12px 28px -8px rgba(255, 89, 0, 0.7);
  transform: scale(0.96);
}

.poster__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--p, 50% 12%);
}

.poster__img::after {
  content: "";
  position: absolute;
  inset: 55% 0 0;
  background: linear-gradient(transparent, rgba(9, 11, 18, 0.72));
}

.poster__score {
  position: absolute;
  z-index: 2;
  bottom: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 3px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.poster__score svg {
  width: 13px;
  height: 13px;
  color: var(--color-star);
  fill: currentColor;
  stroke: none;
}

.poster b {
  display: block;
  margin-top: 7px;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.poster small {
  color: var(--color-muted-2);
  font-size: 11.5px;
}

.foot {
  padding: 14px var(--gutter) 0;
  color: var(--color-muted-2);
  font-size: 12px;
  text-align: center;
}

.poster__visit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 44px;
  margin-top: 8px;
  border: 1.5px solid rgba(255, 113, 10, 0.5);
  border-radius: 13px;
  color: var(--color-accent-light);
  font-size: 13px;
  font-weight: 600;
  transition: background-color var(--press), transform 140ms ease-out;
}

.poster__visit:active {
  background: rgba(255, 113, 10, 0.16);
  transform: scale(0.96);
}

.poster__visit svg {
  width: 15px;
  height: 15px;
}

/* Dock */

.dock {
  position: fixed;
  z-index: 20;
  right: 12px;
  bottom: calc(10px + var(--safe-bottom));
  left: 12px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: 64px;
  padding: 6px;
  border: 1px solid var(--color-line);
  border-radius: 22px;
  background: rgba(20, 22, 30, 0.94);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
}

.dock a {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  color: var(--color-muted-2);
  font-size: 10.5px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.dock a[aria-current] {
  color: var(--color-on-accent);
  font-weight: 700;
}

.dock__pill {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 6px;
  width: calc((100% - 12px) / 4);
  border-radius: 16px;
  background-image: var(--grad);
  box-shadow: 0 6px 18px rgba(255, 89, 0, 0.45);
  transition: transform 0.22s ease-out;
}

/* Show sheet */

.sheet {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--color-text);
}

.sheet::backdrop {
  background: transparent;
}

.sheet__scrim {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 10, 0.72);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sheet.is-open .sheet__scrim {
  opacity: 1;
}

.sheet__panel {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  max-height: 92dvh;
  overflow: hidden auto;
  border-radius: 26px 26px 0 0;
  background: var(--color-band);
  box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 113, 10, 0.4);
  transform: translateY(100%);
  transition: transform 0.5s var(--ease-out);
}

.sheet.is-open .sheet__panel {
  transform: none;
}

.sheet__image {
  position: relative;
  height: min(46dvh, 340px);
  overflow: hidden;
}

.sheet__image::after {
  content: "";
  position: absolute;
  inset: 45% 0 0;
  background: linear-gradient(transparent, var(--color-band));
}

.sheet__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 12%;
}

.sheet__flyer {
  position: fixed;
  z-index: 2;
  object-fit: cover;
  object-position: 50% 12%;
  pointer-events: none;
}

.sheet__close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(9, 11, 18, 0.6);
  transition: transform 140ms ease-out;
}

.sheet__close:active {
  transform: scale(0.9);
}

.sheet__body {
  padding: 0 var(--gutter) calc(var(--safe-bottom) + 18px);
}

.sheet__body > * {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.35s ease, transform 0.5s var(--ease-out);
}

.sheet.is-open .sheet__body > * {
  opacity: 1;
  transform: none;
}

.sheet.is-open .sheet__body > :nth-child(1) {
  transition-delay: 0.14s;
}

.sheet.is-open .sheet__body > :nth-child(2) {
  transition-delay: 0.19s;
}

.sheet.is-open .sheet__body > :nth-child(3) {
  transition-delay: 0.24s;
}

.sheet.is-open .sheet__body > :nth-child(4) {
  transition-delay: 0.29s;
}

.sheet__rating {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--color-chip-text);
  font-size: 13px;
}

.sheet__rating svg {
  width: 15px;
  height: 15px;
  color: var(--color-star);
  fill: currentColor;
  stroke: none;
}

.sheet__rating b {
  color: var(--color-text);
  font-weight: 700;
}

.sheet h2 {
  margin-top: 4px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.8px;
}

.sheet__text {
  margin-top: 6px;
  color: var(--color-chip-text);
  font-size: 14px;
}

.sheet__actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

@keyframes sheen {
  55%,
  100% {
    transform: translateX(320%) skewX(-20deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .hero__media img {
    transform: none;
  }

  .hero__dots .is-on i::after {
    transform: scaleX(1);
  }
}
