/*-----------------------------------*\
  #style.css
\*-----------------------------------*/

/*-----------------------------------*\
  #CUSTOM PROPERTY
\*-----------------------------------*/

:root {
  /* Colors */
  --background: hsla(220, 17%, 7%, 1);
  --banner-background: hsla(250, 6%, 20%, 1);
  --white-alpha-20: hsla(0, 0%, 100%, 0.2);
  --on-background: hsla(220, 100%, 95%, 1);
  --on-surface: hsla(250, 100%, 95%, 1);
  --on-surface-variant: hsla(250, 1%, 44%, 1);
  --primary: hsla(349, 100%, 43%, 1);
  --primary-variant: hsla(349, 69%, 51%, 1);
  --rating-color: hsla(44, 100%, 49%, 1);
  --surface: hsla(250, 13%, 11%, 1);
  --text-color: hsla(250, 2%, 59%, 1);
  --white: hsla(0, 0%, 100%, 1);

  /* Gradient Colors */
  --banner-overlay: 90deg, hsl(220, 17%, 7%) 0%, hsla(220, 17%, 7%, 0.5) 100%;
  --bottom-overlay: 180deg, hsla(250, 13%, 11%, 0), hsla(250, 13%, 11%, 1);

  /* Typography */

  /* font-family */
  --ff-dm-sans: "DM Sans", sans-serif;

  /* font Size */
  --fs-heading: 4rem;
  --fs-title-lg: 2.6rem;
  --fs-title: 2rem;
  --fs-body: 1.8rem;
  --fs-button: 1.5rem;
  --fs-label: 1.4rem;

  /* font-weight */
  --weight-bold: 700;

  /* Shadows */
  --shadow-1: 0 1px 4px hsla(0, 0%, 0%, 0.75);
  --shadow-2: 0 2px 4px hsla(350, 100%, 43%, 0.3);

  /* Border Radius */
  --radius-4: 4px;
  --radius-8: 8px;
  --radius-16: 16px;
  --radius-24: 24px;
  --radius-36: 36px;

  /* Transition */
  --transition-short: 250ms ease;
  --transition-long: 500ms ease;
}

/*-----------------------------------*\
  #RESET
\*-----------------------------------*/

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

li {
  list-style: none;
}

a,
img,
span,
iframe,
button {
  display: block;
}

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

img {
  height: auto;
}

input,
button {
  background: none;
  border: none;
  font: inherit;
  color: inherit;
}

input {
  width: 100%;
}

button {
  text-align: left;
  cursor: pointer;
}

html {
  font-family: var(--ff-dm-sans);
  font-size: 10px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--background);
  color: var(--on-background);
  font-size: var(--fs-body);
  line-height: 1.5;
}

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

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background-color: var(--banner-background);
  border-radius: var(--radius-8);
}

/*-----------------------------------*\
  #REUSED STYLE
\*-----------------------------------*/

.search-wrapper::before,
.load-more::before {
  content: "";
  width: 20px;
  height: 20px;
  border: 3px solid var(--white);
  border-radius: var(--radius-24);
  border-inline-end-color: transparent;
  animation: loading 500ms linear infinite;
  display: none;
}

.search-wrapper::before {
  position: absolute;
  top: 14px;
  right: 12px;
}

.search-wrapper.searching::before {
  display: block;
}

.load-more {
  background-color: var(--primary-variant);
  margin-inline: auto;
  margin-block: 36px 60px;
}

.load-more:is(:hover, :focus-visible) {
  --primary-variant: hsla(350, 67%, 39%, 1);
}

.load-more.loading::before {
  display: block;
}

@keyframes loading {
  0% {
    transform: rotate(0);
  }
  100% {
    transform: rotate(1turn);
  }
}

.heading,
.title-large,
.title {
  font-weight: var(--weight-bold);
  letter-spacing: 0.5px;
}

.title {
  font-size: var(--fs-title);
}

.heading {
  color: var(--white);
  font-size: var(--fs-heading);
  line-height: 1.2;
}

.title-large {
  font-size: var(--fs-title-lg);
}

.img-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.meta-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn {
  color: var(--white);
  font-size: var(--fs-button);
  font-weight: var(--weight-bold);
  max-width: max-content;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-block: 12px;
  padding-inline: 20px 24px;
  border-radius: var(--radius-8);
  transition: var(--transition-short);
}

.card-badge {
  background-color: var(--banner-background);
  color: var(--white);
  font-size: var(--fs-label);
  font-weight: var(--weight-bold);
  padding-inline: 6px;
  border-radius: var(--radius-4);
}

.poster-box {
  background-image: url(../images/poster-bg-icon.png);
  aspect-ratio: 2/3;
}

.poster-box,
.video-card {
  background-repeat: no-repeat;
  background-size: 50px;
  background-position: center;
  background-color: var(--banner-background);
  border-radius: var(--radius-16);
  overflow: hidden;
}

.title-wrapper {
  margin-block-end: 24px;
}

.slider-list {
  margin-inline: -20px;
  overflow-x: overlay;
  padding-block-end: 16px;
  margin-block-end: -16px;
}

.slider-list::-webkit-scrollbar-thumb {
  background-color: transparent;
}

.slider-list:is(:hover, :focus-within)::-webkit-scrollbar-thumb {
  background-color: var(--banner-background);
}

.slider-list::-webkit-scrollbar-button {
  width: 20px;
}

.slider-list .slider-inner {
  position: relative;
  display: flex;
  gap: 16px;
}

.slider-list .slider-inner::before,
.slider-list .slider-inner::after {
  content: "";
  min-width: 4px;
}

.separator {
  width: 4px;
  height: 4px;
  background-color: var(--white-alpha-20);
  border-radius: var(--radius-8);
}

.video-card {
  background-image: url("../images/video-bg-icon.png");
  aspect-ratio: 16/9;
  flex-shrink: 0;
  max-width: 500px;
  width: calc(100% - 40px);
}

.container::after,
.search-modal::after {
  content: "";
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 72px;
  background-image: linear-gradient(var(--bottom-overlay));
  z-index: 1;
  pointer-events: none;
}

/*-----------------------------------*\
  #HEADER
\*-----------------------------------*/

.header {
  position: relative;
  padding-block: 24px;
  padding-inline: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.header .logo {
  margin-inline-end: auto;
}

.search-btn,
.menu-btn {
  padding: 12px;
}

.search-btn {
  background-color: var(--banner-background);
  border-radius: var(--radius-8);
}

.search-btn img {
  opacity: 0.5;
  transition: var(--transition-short);
}

.search-btn:is(:hover, :focus-visible) img {
  opacity: 1;
}

.menu-btn.active .menu,
.menu-btn .close {
  display: none;
}

.menu-btn .menu,
.menu-btn.active .close {
  display: block;
}

.search-box {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--background);
  padding: 24px 16px;
  align-items: center;
  gap: 8px;
  z-index: 1;
  display: none;
}

.search-box.active {
  display: flex;
}

.search-wrapper {
  position: relative;
  flex-grow: 1;
}

.search-field {
  background-color: var(--banner-background);
  height: 48px;
  line-height: 48px;
  padding-inline: 44px 16px;
  outline: none;
  border-radius: var(--radius-8);
  transition: var(--transition-short);
}

.search-field::placeholder {
  color: var(--on-surface-variant);
}

.search-field:hover {
  box-shadow: 0 0 0 2px var(--on-surface-variant);
}

.search-field:focus {
  box-shadow: 0 0 0 2px var(--on-surface);
  padding-inline-start: 16px;
}

.search-wrapper .leading-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 12px;
  opacity: 0.5;
  transition: var(--transition-short);
}

.search-wrapper:focus-within .leading-icon {
  opacity: 0;
}

/*-----------------------------------*\
  #SIDEBAR
\*-----------------------------------*/

.sidebar {
  position: absolute;
  background-color: var(--background);
  top: 96px;
  bottom: 0;
  left: -340px;
  max-width: 340px;
  width: 100%;
  border-block-start: 1px solid var(--banner-background);
  overflow-y: overlay;
  z-index: 4;
  visibility: hidden;
  transition: var(--transition-long);
}

.sidebar.active {
  transform: translateX(340px);
  visibility: visible;
}

.sidebar-inner {
  display: grid;
  gap: 20px;
  padding-block: 36px;
}

.sidebar::-webkit-scrollbar-thumb {
  background-color: transparent;
}

.sidebar:is(:hover, :focus-within)::-webkit-scrollbar-thumb {
  background-color: var(--banner-background);
}

.sidebar::-webkit-scrollbar-button {
  height: 16px;
}

.sidebar-list,
.sidebar-footer {
  padding-inline: 36px;
}

/* One size for everything that is a destination, so the eye reads a single list. */
.sidebar-link {
  color: var(--on-surface-variant);
  font-size: var(--fs-body);
  transition: var(--transition-short);
}

.sidebar-link:is(:hover, :focus-visible) {
  color: var(--on-background);
}

.sidebar-list {
  display: grid;
  gap: 8px;
}

/* A section label, not a heading competing with the links: smaller and quieter than what it
   introduces. At 20px against 18px links it read as "a slightly bigger link" instead. */
.sidebar-list .title {
  font-size: var(--fs-label);
  letter-spacing: 1px;
  color: var(--on-surface-variant);
  opacity: 0.75;
  margin-block-end: 12px;
}

/* The section label doubles as the control that folds the list away. */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.sidebar-toggle:is(:hover, :focus-visible) {
  opacity: 1;
  color: var(--on-background);
}

.sidebar-chevron {
  width: 16px;
  height: 16px;
  transition: var(--transition-short);
}

.sidebar-toggle[aria-expanded="false"] .sidebar-chevron {
  transform: rotate(-90deg);
}

.sidebar-sublist {
  display: grid;
  gap: 8px;
}

.sidebar-sublist[hidden] { display: none; }

.sidebar-footer {
  border-block-start: 1px solid var(--banner-background);
  padding-block-start: 28px;
  margin-block-start: 16px;
}

/* Two deliberate lines: at desktop width the footer has 138px, and "© 2026 Private Streaming"
   needs 143px even at 12px, so left to itself it broke in the middle of the name. */
.copyright {
  color: var(--on-surface-variant);
  font-size: var(--fs-label);
  line-height: 1.5;
  margin-block-end: 16px;
}

.brand-year {
  font-size: 1.2rem;
  opacity: 0.7;
}

/* Sized to sit with the note above it rather than tower over it. */
.sidebar-footer img {
  width: 84px;
  height: auto;
  opacity: 0.8;
}

.tmdb-credit {
  display: grid;
  gap: 6px;
  justify-items: start;
  color: var(--on-surface-variant);
  font-size: 1.2rem;
  transition: var(--transition-short);
}

.tmdb-credit:is(:hover, :focus-visible) img {
  opacity: 1;
}

.tmdb-credit span {
  display: block;
  opacity: 0.75;
}

.copyright a {
  display: inline-block;
}

.overlay {
  position: fixed;
  top: 96px;
  left: 0;
  bottom: 0;
  width: 100%;
  background: var(--background);
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-short);
  z-index: 3;
}

.overlay.active {
  opacity: 0.5;
  pointer-events: all;
}

/* Login Button */

.btn-login {
  font-size: var(--fs-button);
  font-weight: var(--weight-bold);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 48px;
  padding: 10px 20px;
  background-color: var(--primary);
  border-radius: var(--radius-8);
  transition: var(--transition-short);
}

/*-----------------------------------*\
  #HOME PAGE
\*-----------------------------------*/

.container {
  position: relative;
  background-color: var(--surface);
  color: var(--on-surface);
  padding: 24px 20px 48px;
  height: calc(100vh - 96px);
  overflow-y: overlay;
  z-index: 1;
}

/* Banner */

.banner {
  position: relative;
  height: 700px;
  border-radius: var(--radius-24);
  overflow: hidden;
}

.banner-slider .slider-item {
  position: absolute;
  top: 0;
  left: 120%;
  width: 100%;
  height: 100%;
  background-color: var(--banner-background);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-long);
}

.banner-slider .slider-item::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--banner-overlay));
}

.banner-slider .active {
  left: 0;
  opacity: 1;
  visibility: visible;
}

.banner-content {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 206px;
  z-index: 1;
  color: var(--text-color);
}

.banner :is(.heading, .banner-text) {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.banner .heading {
  -webkit-line-clamp: 3;
  margin-block-end: 16px;
}

.banner .genre {
  margin-block: 12px;
}

.banner-text {
  -webkit-line-clamp: 2;
  margin-block-end: 24px;
}

.banner .btn {
  background-color: var(--primary);
}

.banner .btn:is(:hover, :focus-visible) {
  box-shadow: var(--shadow-2);
}

.slider-control {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 0;
  border-radius: var(--radius-16) 0 0 var(--radius-16);
  user-select: none;
  padding: 4px 0 4px 4px;
  overflow-x: auto;
}

.slider-control::-webkit-scrollbar {
  display: none;
}

.container-inner {
  display: flex;
  gap: 12px;
}

.control-inner {
  display: flex;
  gap: 10px;
}

.control-inner::after {
  content: "";
  min-width: 12px;
}

.slider-control .slider-item {
  width: 100px;
  border-radius: var(--radius-8);
  flex-shrink: 0;
  filter: brightness(0.4);
}

.slider-control .active {
  filter: brightness(1);
  box-shadow: var(--shadow-1);
}

/* Movie List */

.movie-list {
  padding-block-start: 32px;
}

.movie-card {
  position: relative;
  min-width: 200px;
}

.movie-card .card-banner {
  width: 200px;
}

.movie-card .title {
  width: 100%;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  margin-block: 8px 4px;
}

.movie-card .meta-list {
  justify-content: space-between;
}

.movie-card .card-btn {
  position: absolute;
  inset: 0;
  /* Above .poster-fallback (1), .kind-tag and .card-progress (2). Without this the fallback
     poster paints over the link and the card is only clickable on the title line — which is
     every card whose film TMDB has no artwork for. */
  z-index: 3;
}

/*-----------------------------------*\
  #DETAIL PAGE
\*-----------------------------------*/

.backdrop-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 600px;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  z-index: -1;
}

.backdrop-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
    0deg,
    hsla(250, 13%, 11%, 1),
    hsla(250, 13%, 11%, 0.9)
  );
}

.movie-detail .movie-poster {
  max-width: 300px;
  width: 100%;
}

.movie-detail .heading {
  margin-block: 20px 10px;
}

.movie-detail :is(.meta-list, .genre) {
  color: var(--text-color);
}

.movie-detail .genre {
  margin-block: 12px 16px;
}

/* The reset makes every anchor a block, which put each genre — and each comma between them — on
   a line of its own. They belong on one line that wraps when it runs out of room. */
.genre a {
  display: inline;
}

.detail-list {
  margin-block: 24px 32px;
}

.movie-detail .list-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-block-end: 12px;
}

.movie-detail .list-name {
  color: var(--text-color);
  min-width: 112px;
}

/*-----------------------------------*\
  #MOVIE LIST PAGE
\*-----------------------------------*/

.genre-list .title-wrapper {
  margin-block-end: 56px;
}

.grid-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  column-gap: 16px;
  row-gap: 20px;
}

:is(.genre-list, .search-modal) :is(.movie-card, .card-banner) {
  width: 100%;
}

/*-----------------------------------*\
  #SEARCH MODAL
\*-----------------------------------*/

.search-modal {
  position: fixed;
  top: 96px;
  left: 0;
  bottom: 0;
  width: 100%;
  background-color: var(--surface);
  padding: 50px 24px;
  overflow-y: overlay;
  z-index: 4;
  display: none;
}

.search-modal.active {
  display: block;
}

.search-modal .label {
  color: var(--primary-variant);
  font-weight: var(--weight-bold);
  margin-block-end: 8px;
}

/*-----------------------------------*\
  #MEDIA QUERIES
\*-----------------------------------*/

@media only screen and (max-width: 600px) {
  .logo img {
    height: 32px;
  }

  .search-btn {
    height: 44px;
  }

  .btn-login {
    font-size: 1.2rem;
    padding: 9px;
    height: 44px;
  }
}

/* Responsive for larger than 575px screen */

@media (min-width: 575px) {
  /* Home Page */
  .banner-content {
    right: auto;
    max-width: 500px;
  }

  .slider-control {
    left: calc(100% - 400px);
  }

  /* Detail Page */

  .detail-content {
    max-width: 750px;
  }
}

/* Responsive for larger than 768px screen */

@media (min-width: 768px) {
  /* custom property */

  :root {
    /* gradient color */
    --banner-overlay: 90deg, hsl(220, 17%, 7%) 0%, hsla(220, 17%, 7%, 0) 100%;

    /* font size */
    --fs-heading: 5.4rem;
  }

  /* Home Page */
  .container {
    padding-inline: 24px;
  }

  .slider-list {
    margin-inline: -24px;
  }

  .search-btn {
    display: none;
  }

  .search-box {
    all: unset;
    display: block;
    width: 360px;
  }

  .banner {
    height: 500px;
  }

  .banner-content {
    bottom: 50%;
    transform: translateY(50%);
    left: 50px;
  }

  /* movie detail page */
  .movie-detail {
    display: flex;
    align-items: flex-start;
    gap: 40px;
  }

  .movie-detail .detail-box {
    flex-grow: 1;
  }
  .movie-detail .movie-poster {
    flex-shrink: 0;
    position: sticky;
    top: 0;
  }

  .movie-detail .slider-list {
    margin-inline-start: 0;
    border-radius: var(--radius-16) 0 0 var(--radius-16);
  }

  .movie-detail .slider-inner::before {
    display: none;
  }
}

/* Responsive for larger than 1200px screen */

@media (min-width: 1200px) {
  /* home page */
  .header {
    padding: 28px 56px;
  }

  .logo img {
    width: 160px;
  }

  .menu-btn,
  .overlay {
    display: none;
  }

  main {
    display: grid;
    grid-template-columns: 250px 1fr;
  }

  .sidebar {
    position: static;
    visibility: visible;
    border-block-start: 0;
    height: calc(100vh - 104px);
  }

  .sidebar.active {
    transform: none;
  }

  .sidebar-list,
  .sidebar-footer {
    padding-inline: 56px;
  }

  .container {
    height: calc(100vh - 104px);
    border-top-left-radius: var(--radius-36);
  }

  .banner-content {
    left: 100px;
  }

  .search-modal {
    top: 104px;
    padding: 60px;
  }

  /* Movie Detail Page */
  .backdrop-image {
    border-top-left-radius: var(--radius-36);
  }
}

/*-----------------------------------*\
  #API ERROR
\*-----------------------------------*/

.api-error {
  margin: 24px 0;
  padding: 16px 20px;
  border-radius: var(--radius-8);
  background-color: var(--banner-background);
  border: 1px solid hsla(349, 69%, 51%, 0.5);
  color: var(--on-surface);
  font-size: var(--fs-label);
}

/*-----------------------------------*\
  #PRIVATE STREAMING
\*-----------------------------------*/

/* Player sits above the details at every width (the Tvflix layout put a poster beside them). */
.movie-detail,
.movie-detail .detail-box {
  display: block;
}

.player-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  /* Leave room for the title row under the player on laptop screens. */
  max-height: calc(100vh - 380px);
  min-height: 200px;
  border-radius: var(--radius-16);
  overflow: hidden;
  background-color: hsla(0, 0%, 0%, 1);
  box-shadow: var(--shadow-1);
}

.player {
  width: 100%;
  height: 100%;
  display: block;
  background-color: hsla(0, 0%, 0%, 1);
}

.player-error {
  position: absolute;
  inset: auto 16px 16px;
  padding: 12px 16px;
  border-radius: var(--radius-8);
  background-color: var(--surface);
  color: var(--on-surface);
  font-size: var(--fs-label);
}

.movie-detail .genre a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.title-wrapper {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.see-all {
  color: var(--text-color);
  font-size: var(--fs-label);
  white-space: nowrap;
}

.see-all:is(:hover, :focus-visible) {
  color: var(--on-background);
}

.empty-state,
.empty-library p {
  color: var(--text-color);
  font-size: var(--fs-body);
  padding-block: 24px;
}

.empty-library {
  padding-block: 64px;
  max-width: 560px;
}

.empty-library a {
  color: var(--primary-variant);
  text-decoration: underline;
}


/* The signed-in name belongs to the same list as the links, so it is the same size. */
.sidebar-user {
  color: var(--on-background);
  font-size: var(--fs-body);
  font-weight: var(--weight-bold);
}

.sidebar-logout {
  background: none;
  border: 0;
  padding: 0;
  text-align: start;
  font: inherit;
  cursor: pointer;
}

/* Series, continue-watching and player controls */

.poster-box { position: relative; }

.kind-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: 2px 8px;
  border-radius: var(--radius-4);
  background-color: var(--primary);
  color: var(--white);
  font-size: 1.2rem;
  font-weight: var(--weight-bold);
}

/* Bottom-left, clear of the "ซีรีส์" tag at the top and sitting above the progress bar, which is
   only 4px tall at the very bottom. */
.dub-tag {
  position: absolute;
  inset: auto auto 10px 8px;
  z-index: 2;
  padding: 3px 8px;
  border-radius: var(--radius-4);
  background-color: hsla(0, 0%, 0%, 0.72);
  color: var(--white);
  font-size: 1.2rem;
  font-weight: var(--weight-bold);
  letter-spacing: 0.3px;
  backdrop-filter: blur(4px);
}

/* Subtitles are the fallback, so it reads as the quieter of the two. */
.dub-tag-sub {
  color: var(--on-surface-variant);
  font-weight: var(--weight-regular, 400);
}

.card-progress {
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  display: block;
  height: 4px;
  background-color: var(--white-alpha-20);
}

.card-progress > span {
  display: block;
  height: 100%;
  background-color: var(--primary);
}

.player-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-block: 16px 0;
}

.player-bar:empty { display: none; }

.track-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-color);
  font-size: var(--fs-label);
}

.track-picker[hidden] { display: none; }

/* Our own dropdown: the button is as wide as the value it shows, so the arrow sits next to the
   text instead of at the far edge of a box sized for the longest option in the list. */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--banner-background);
  border-radius: var(--radius-8);
  background-color: var(--surface);
  color: var(--on-surface);
  font: inherit;
  cursor: pointer;
  transition: var(--transition-short);
}

.dropdown-button:is(:hover, :focus-visible) {
  border-color: var(--on-surface-variant);
}

.dropdown-arrow {
  width: 16px;
  height: 16px;
  opacity: 0.7;
  transition: var(--transition-short);
}

.dropdown-button[aria-expanded="true"] .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  z-index: 5;
  inset-inline-start: 0;
  inset-block-start: calc(100% + 6px);
  min-width: 100%;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--banner-background);
  border-radius: var(--radius-8);
  background-color: var(--surface);
  box-shadow: 0 12px 28px hsla(0, 0%, 0%, 0.5);
}

.dropdown-menu[hidden] { display: none; }

.dropdown-option {
  padding: 8px 12px;
  border-radius: var(--radius-4);
  color: var(--on-surface-variant);
  white-space: nowrap;
  cursor: pointer;
}

.dropdown-option:is(:hover, :focus-visible) {
  background-color: var(--banner-background);
  color: var(--on-surface);
  outline: none;
}

.dropdown-option[aria-selected="true"] {
  color: var(--on-surface);
  font-weight: var(--weight-bold);
}

/* Faces read faster than a comma-separated line, and the row scrolls instead of wrapping into
   a wall on a phone. */
.cast-list {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding-block-end: 4px;
  margin-inline: -4px;
  padding-inline: 4px;
}

.cast-item {
  flex: 0 0 auto;
  width: 96px;
  text-align: center;
}

.cast-photo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  background-color: var(--banner-background);
}

.cast-photo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  font-weight: var(--weight-bold);
  color: var(--on-surface-variant);
  margin-inline: auto;
}

.cast-name {
  display: block;
  margin-block-start: 8px;
  font-size: var(--fs-label);
  line-height: 1.3;
  color: var(--on-surface-variant);
}

.player-link {
  color: var(--text-color);
  font-size: var(--fs-label);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.next-episode { margin-inline-start: auto; }

.share-box {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.share-btn {
  gap: 8px;
  padding-block: 8px;
  padding-inline: 14px 16px;
  font-size: var(--fs-label);
  background-color: var(--banner-background);
  cursor: pointer;
}

.share-btn:is(:hover, :focus-visible) {
  background-color: var(--primary);
}

.share-btn .share-mark {
  width: 18px;
  height: 18px;
}

/* Says what happened when the share sheet is not available and the link went to the clipboard. */
.share-status {
  color: var(--on-surface-variant);
  font-size: var(--fs-label);
}

.share-status[hidden] { display: none; }

.resume-notice {
  position: absolute;
  top: 16px;
  left: 16px;
  padding: 8px 14px;
  border-radius: var(--radius-8);
  background-color: hsla(0, 0%, 0%, 0.7);
  color: var(--white);
  font-size: var(--fs-label);
  pointer-events: none;
}

.series-page { padding-block: 32px 16px; max-width: 900px; }
.series-page .heading { margin-block: 0 12px; }
.series-page .kind-inline {
  padding: 2px 8px;
  border-radius: var(--radius-4);
  background-color: var(--primary);
  color: var(--white);
  font-size: 1.2rem;
  font-weight: var(--weight-bold);
}
.series-page :is(.meta-list, .genre) { color: var(--text-color); }
.series-page .genre { margin-block: 12px; }
.series-page .genre a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.series-page .overview { margin-block: 8px 20px; }
.series-play { margin-block: 12px 28px; }

.season-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block-end: 16px;
}

.season-tabs button {
  padding: 8px 16px;
  border-radius: var(--radius-36);
  border: 1px solid var(--banner-background);
  background: none;
  color: var(--text-color);
  font: inherit;
  font-size: var(--fs-label);
  cursor: pointer;
}

.season-tabs button[aria-selected="true"] {
  background-color: var(--on-surface);
  color: var(--background);
  border-color: var(--on-surface);
  font-weight: var(--weight-bold);
}

.episode-list { display: grid; gap: 8px; }
.episode-list[hidden] { display: none; }

.episode-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-8);
  background-color: hsla(250, 20%, 100%, 0.04);
  border: 1px solid hsla(250, 20%, 100%, 0.06);
  transition: var(--transition-short);
}

.episode-item:is(:hover, :focus-visible) { background-color: var(--banner-background); }

.episode-number {
  min-width: 32px;
  color: var(--text-color);
  font-size: var(--fs-title);
  font-weight: var(--weight-bold);
  text-align: center;
}

.episode-text { position: relative; display: grid; gap: 4px; flex: 1; padding-block-end: 8px; }
.episode-title { color: var(--on-surface); font-weight: var(--weight-bold); }
.episode-meta { color: var(--text-color); font-size: var(--fs-label); }
.episode-text .card-progress { border-radius: 2px; overflow: hidden; }

.series-play,
.next-episode {
  background-color: var(--primary);
  padding-inline: 20px 24px;
  border-radius: var(--radius-8);
}

.series-play:is(:hover, :focus-visible),
.next-episode:is(:hover, :focus-visible) {
  background-color: var(--primary-variant);
  box-shadow: var(--shadow-2);
}

/* Poster fallback when there is no TMDB artwork: a tinted title card instead of an empty box.
   --tint is a hue picked from the title so neighbouring cards stay distinguishable. */
.poster-fallback {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  height: 100%;
  padding: 20px 16px;
  text-align: start;
  background:
    radial-gradient(120% 80% at 100% 0%, hsla(var(--tint, 349), 70%, 45%, 0.55), transparent 60%),
    linear-gradient(160deg, hsla(var(--tint, 349), 25%, 22%, 1), hsla(250, 13%, 11%, 1));
}

.poster-fallback .fallback-title {
  color: var(--white);
  font-size: 2.2rem;
  font-weight: var(--weight-bold);
  line-height: 1.2;
  text-wrap: balance;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.poster-fallback .fallback-mark {
  width: 28px;
  height: 28px;
  opacity: 0.85;
}

.movie-card .card-btn:focus-visible {
  outline-offset: 4px;
  border-radius: var(--radius-16);
}

/* Current page in the sidebar */
.sidebar-link[aria-current="page"] {
  color: var(--on-background);
  font-weight: var(--weight-bold);
}

.detail-content .meta-list:empty { display: none; }

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