/* mySDAtv · Movies & Series: the Home/Watch section, title cards, the
   spotlight, and the movie, series and episode pages. */

/* ---------- section on Home, and the Movies & Series page ---------- */
.titles-section--home { padding-block: var(--s-7); }
.titles-section--home .section-head { margin-bottom: var(--s-5); }
.titles-section--home .spotlight { margin-bottom: var(--s-5); }
@media (min-width: 900px) {
  .titles-section--home .spotlight { min-height: clamp(300px, 26vw, 380px); }
  .titles-section--home .spotlight__body { padding: var(--s-6); }
}
.titles-page { padding-top: calc(var(--header-h) + var(--s-7)); background: var(--grad-stage), var(--bg); }
.titles-page__head { display: grid; justify-items: start; gap: var(--s-3); margin-bottom: var(--s-5); }
.titles-page__head h1 { font-size: var(--fs-3xl); }
.titles-tabs--page { margin-bottom: var(--s-5); }

.titles-tabs { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.tab[aria-current="page"] { background: var(--text); border-color: var(--text); color: var(--on-gold); box-shadow: 0 0 24px -6px var(--glow-sky); }
.tab[aria-current="page"] .tab__count { background: rgba(5, 10, 26, 0.1); }

/* ---------- tags and meta ---------- */
.title-tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-pill);
  background: rgba(5, 10, 26, 0.82); border: 1px solid var(--line-strong); color: var(--text);
  font-size: var(--fs-xs); font-weight: 800; line-height: 1.25; white-space: nowrap; font-variant-numeric: tabular-nums;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.title-tag--free { color: #8BF2B8; border-color: rgba(61, 220, 132, 0.45); }
.title-tag--free::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #3DDC84; }
.title-tag--price { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.title-tag--pass { color: var(--gold); border-color: rgba(255, 210, 31, 0.45); }
.title-tag--live { border-color: rgba(124, 198, 234, 0.5); }
.title-tag--live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--sky); box-shadow: 0 0 0 3px rgba(124, 198, 234, 0.25); }

.title-meta { display: flex; flex-wrap: wrap; align-items: center; row-gap: 2px; margin: 0; color: var(--muted); font-size: var(--fs-sm); font-weight: 600; }
.title-meta > span + span::before { content: ""; display: inline-block; width: 3px; height: 3px; margin: 0 0.6em; border-radius: 50%; background: currentColor; opacity: 0.55; vertical-align: middle; }
.title-meta__kind { color: var(--sky); font-weight: 800; }

/* ---------- poster cards ---------- */
/* a short row stretches to the full width, but one or two cards stay card-sized (--n = how many) */
.titles-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: var(--s-6) var(--s-4); max-width: calc(var(--n, 99) * 480px); margin: 0; padding: 0; list-style: none; }
@media (max-width: 560px) {
  .titles-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-5) var(--s-3); max-width: none; }
  .title-card__name { font-size: var(--fs-md); }
  .title-card .title-tag { top: 6px; left: 6px; padding: 2px 8px; }
  .title-card__len { right: 6px; bottom: 6px; }
  .title-card .title-meta { font-size: var(--fs-xs); }
}
.title-card { position: relative; display: grid; align-content: start; gap: var(--s-3); min-width: 0; padding-top: 8px; }
.title-card__media {
  position: relative; z-index: 1; aspect-ratio: 16 / 9; border-radius: var(--r-md); overflow: hidden;
  background: var(--surface-2); box-shadow: 0 0 0 1px var(--line);
  transition: box-shadow var(--dur), transform var(--dur) var(--ease);
}
.title-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 600ms var(--ease); }
.title-card__media::after { content: ""; position: absolute; inset: auto 0 0 0; height: 45%; background: linear-gradient(0deg, rgba(5, 10, 26, 0.75), rgba(5, 10, 26, 0)); pointer-events: none; }
.title-card__blank {
  display: block; width: 100%; height: 100%;
  background: radial-gradient(80% 90% at 85% 0%, rgba(10, 143, 216, 0.4), rgba(10, 143, 216, 0) 60%), radial-gradient(60% 70% at 0% 100%, rgba(255, 210, 31, 0.16), rgba(255, 210, 31, 0) 60%), var(--surface-2);
}
.title-card .title-tag { position: absolute; top: 10px; left: 10px; z-index: 1; }
.title-card__len { position: absolute; right: 10px; bottom: 10px; z-index: 1; padding: 2px 8px; border-radius: var(--r-xs); background: rgba(5, 10, 26, 0.85); color: var(--text); font-size: var(--fs-xs); font-weight: 800; font-variant-numeric: tabular-nums; }
.title-card__play {
  position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; width: 56px; height: 56px; margin: auto;
  border-radius: 50%; background: var(--gold); color: var(--on-gold); box-shadow: 0 10px 30px -6px var(--glow-gold);
  opacity: 0; transform: scale(0.85); transition: opacity var(--dur), transform var(--dur) var(--ease);
}
.title-card__play .icon { width: 24px; height: 24px; margin-left: 3px; }
.title-card:hover .title-card__play, .title-card:focus-within .title-card__play { opacity: 1; transform: none; }
.title-card:hover .title-card__media, .title-card:focus-within .title-card__media { box-shadow: 0 0 0 2px var(--sky), 0 22px 44px -18px rgba(0, 0, 0, 0.85); }
.title-card:hover .title-card__media img { transform: scale(1.04); }
/* a series is a stack: two more episodes peek out above its poster */
.title-card--series::before, .title-card--series::after {
  content: ""; position: absolute; z-index: 0; height: 14px; border: 1px solid var(--line-strong); border-bottom: 0;
  border-radius: var(--r-md) var(--r-md) 0 0; background: var(--surface-3);
}
.title-card--series::before { top: 0; left: 12%; right: 12%; opacity: 0.5; }
.title-card--series::after { top: 4px; left: 6%; right: 6%; }
.title-card__body { display: grid; gap: 4px; min-width: 0; }
.title-card__name { font-size: var(--fs-lg); line-height: var(--lh-snug); letter-spacing: -0.015em; }
.title-card__link { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--text); text-decoration: none; }
.title-card__link:hover { color: var(--text); }
.title-card__link::after { content: ""; position: absolute; inset: 0; z-index: 2; }
.title-card__link:focus-visible { outline: none; box-shadow: none; }
.title-card:has(.title-card__link:focus-visible) .title-card__media { outline: 2px solid var(--focus); outline-offset: 3px; }

/* ---------- spotlight: the first title, wide ---------- */
.spotlight { position: relative; isolation: isolate; display: grid; margin-bottom: var(--s-7); border-radius: var(--r-xl); overflow: hidden; background: var(--surface-1); box-shadow: 0 0 0 1px var(--line), var(--shadow-card); }
.spotlight__media { position: relative; display: block; aspect-ratio: 16 / 9; }
.spotlight__media img, .spotlight__media .title-card__blank { width: 100%; height: 100%; object-fit: cover; }
.spotlight__media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, var(--surface-1) 0%, rgba(12, 21, 48, 0) 50%); }
.spotlight__body { position: relative; z-index: 1; display: grid; justify-items: start; gap: var(--s-3); margin-top: calc(-1 * var(--s-7)); padding: 0 var(--s-5) var(--s-5); }
.spotlight__tags { display: flex; gap: var(--s-2); margin: 0; }
.spotlight__title { font-size: var(--fs-3xl); line-height: var(--lh-tight); letter-spacing: var(--track-tight); }
.spotlight__desc { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; max-width: 52ch; margin: 0; color: var(--muted); }
.spotlight__actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-2); }
.spotlight__actions .icon { width: 18px; height: 18px; }
@media (min-width: 900px) {
  .spotlight { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); min-height: clamp(380px, 34vw, 500px); }
  .spotlight__media { position: absolute; inset: 0 0 0 32%; aspect-ratio: auto; }
  .spotlight__media::after { background: linear-gradient(90deg, var(--surface-1) 0%, rgba(12, 21, 48, 0.55) 28%, rgba(12, 21, 48, 0) 60%), linear-gradient(0deg, rgba(12, 21, 48, 0.55), rgba(12, 21, 48, 0) 35%); }
  .spotlight__body { grid-column: 1; align-self: center; margin: 0; padding: var(--s-7) var(--s-6); }
}

/* ---------- movie, series and episode pages ---------- */
.title-hero { position: relative; isolation: isolate; overflow: hidden; padding-top: calc(var(--header-h) + var(--s-6)); padding-bottom: var(--s-7); background: var(--grad-stage), var(--bg); border-bottom: 1px solid var(--line); }
.title-hero__backdrop { position: absolute; inset: 0; z-index: -1; overflow: hidden; }
.title-hero__backdrop img { width: 100%; height: 100%; object-fit: cover; opacity: 0.32; filter: blur(56px) saturate(1.25); transform: scale(1.2); }
.title-hero__backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5, 10, 26, 0.35) 0%, var(--bg) 92%); }
.title-hero__grid { display: grid; gap: var(--s-5); align-items: start; }
@media (min-width: 1024px) { .title-hero__grid { grid-template-columns: minmax(0, 1fr) 380px; gap: var(--s-6); } }
.title-hero__screen { min-width: 0; }
.title-hero__screen .film-player { border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-card), 0 0 0 1px var(--line); }
.title-hero__screen .film-player video { display: block; border-radius: 0 !important; }
.title-hero__info { display: grid; justify-items: start; gap: var(--s-3); min-width: 0; }
.title-hero__tags { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin: 0; }
.title-hero__name { font-size: var(--fs-3xl); line-height: var(--lh-tight); }
.title-hero__series { color: var(--sky); font-weight: 800; text-decoration: none; }
.title-hero__series:hover { color: var(--text); }
.title-hero__desc { display: grid; gap: var(--s-3); color: var(--muted); max-width: var(--measure); }
.title-hero__desc p { margin: 0; }
.title-hero__actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-2); }
.title-hero__actions form { margin: 0; }
.title-hero__actions .icon { width: 18px; height: 18px; }
.title-hero__next { color: var(--muted); font-weight: 700; }

/* the series' poster, as a button to its first episode */
.title-poster { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: var(--r-lg); overflow: hidden; background: var(--surface-2); box-shadow: var(--shadow-card), 0 0 0 1px var(--line); color: var(--text); text-decoration: none; }
.title-poster img { width: 100%; height: 100%; object-fit: cover; transition: transform 600ms var(--ease); }
.title-poster::after { content: ""; position: absolute; inset: 0; background: linear-gradient(20deg, rgba(5, 10, 26, 0.85) 0%, rgba(5, 10, 26, 0) 55%); }
.title-poster__play { position: absolute; left: var(--s-5); bottom: var(--s-5); z-index: 1; display: flex; align-items: center; gap: var(--s-4); font-size: var(--fs-lg); font-weight: 800; }
.title-poster__play > span:last-child { display: grid; }
.title-poster__disc { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--gold); color: var(--on-gold); box-shadow: 0 10px 30px -6px var(--glow-gold); transition: transform var(--dur) var(--ease); }
.title-poster__disc .icon { width: 28px; height: 28px; margin-left: 3px; }
.title-poster__ep { color: var(--muted); font-size: var(--fs-sm); font-weight: 700; }
.title-poster:hover { color: var(--text); }
.title-poster:hover .title-poster__disc { transform: scale(1.08); }
.title-poster:hover img { transform: scale(1.03); }

/* lock panel (paid titles) */
.title-hero .film-lock { box-shadow: var(--shadow-card), 0 0 0 1px var(--line); }
.film-lock:not(:has(.film-lock__poster)) .film-lock__panel { position: static; }
.film-lock__icon { justify-self: center; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: rgba(255, 210, 31, 0.12); border: 1px solid rgba(255, 210, 31, 0.4); color: var(--gold); }

/* ---------- episodes ---------- */
.episodes__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3) var(--s-5); margin-bottom: var(--s-5); }
.episodes__head h2 { font-size: var(--fs-2xl); }
.episodes__season { margin: 0; color: var(--muted); font-weight: 700; }
.episode-list { display: grid; gap: var(--s-2); margin: 0; padding: 0; list-style: none; }
.episode { position: relative; display: grid; grid-template-columns: clamp(132px, 26vw, 232px) minmax(0, 1fr); align-items: center; gap: var(--s-4); padding: var(--s-3); border: 1px solid transparent; border-radius: var(--r-md); transition: background-color var(--dur), border-color var(--dur); }
.episode:hover { background: var(--surface-1); border-color: var(--line); }
.episode--playing { background: var(--surface-1); border-color: rgba(124, 198, 234, 0.35); }
.episode__thumb { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r-sm); overflow: hidden; background: var(--surface-2); }
.episode__thumb img { width: 100%; height: 100%; object-fit: cover; }
.episode__play { position: absolute; inset: 0; display: grid; place-items: center; width: 40px; height: 40px; margin: auto; border-radius: 50%; background: rgba(5, 10, 26, 0.75); border: 1px solid var(--line-strong); color: var(--text); opacity: 0; transition: opacity var(--dur); }
.episode__play .icon { width: 18px; height: 18px; margin-left: 2px; }
.episode:hover .episode__play, .episode:focus-within .episode__play, .episode--playing .episode__play { opacity: 1; }
.episode--playing .episode__play { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.episode__body { display: grid; gap: 6px; min-width: 0; }
.episode__top { display: flex; align-items: baseline; gap: var(--s-3); min-width: 0; }
.episode__num { min-width: 1.4em; color: var(--muted); font-weight: 800; font-variant-numeric: tabular-nums; }
.episode__link { flex: 1; min-width: 0; color: var(--text); font-weight: 800; text-decoration: none; }
.episode__link:hover { color: var(--text); }
.episode__link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.episode__link:focus-visible { outline: none; box-shadow: none; }
.episode:has(.episode__link:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.episode__len { color: var(--muted); font-size: var(--fs-sm); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.episode__desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: var(--fs-sm); }
.episode__tags { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.episode__tags:empty { display: none; }
.episode__lock { color: var(--muted); }
@media (max-width: 560px) {
  .episode { grid-template-columns: 116px minmax(0, 1fr); gap: var(--s-3); padding: var(--s-2); }
  .episode__desc { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .title-card__media, .title-card__media img, .title-card__play, .title-poster img, .title-poster__disc { transition: none; }
  .title-card:hover .title-card__media img, .title-poster:hover img, .title-poster:hover .title-poster__disc { transform: none; }
}
