/* Explore — Shows (filters, sort, grid/list, infinite scroll) and Cast list */

.page-explore .page { gap: 0; }

.xp { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- Mobile header ---------- */
.xp-head { padding-top: calc(var(--safe-t) + 6px); }
.xp-head__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.xp-brand { font-family: var(--disp); font-size: 32px; line-height: 1; }
.xp-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.xp-sub { display: none; }
.xp-switch { flex: none; }
.xp-switch > a { min-height: 36px; }

.xp-pill { display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 16px; border-radius: var(--r-pill); background: var(--s2); border: 1px solid var(--line); color: var(--tx3); font-size: 16px; }
.xp-pill svg { flex: none; }
.xp-pill__text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xp-pill__text.is-q { color: var(--tx); font-weight: 600; }

/* Sticky controls row: Filters · Sort · grid/list */
.xp-tools { position: sticky; top: var(--safe-t); z-index: 20; margin: 2px calc(-1 * var(--gutter)) 0; padding: 10px var(--gutter); background: var(--bg); }
.xp-tools.is-stuck { box-shadow: 0 calc(-1 * var(--safe-t)) 0 var(--bg), 0 1px 0 var(--line2); }
.xp-qform { display: none; }
.xp-controls { display: flex; align-items: center; gap: 8px; }
.xp-ctl { padding: 0 16px; gap: 8px; }
.xp-ctl svg { flex: none; }
.xp-sort-btn { padding: 0 14px; gap: 6px; }
.xp-spacer { flex: 1; }
.xp-sort-d { display: none; }
.xp-view { flex: none; }

.xp-textbtn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 12px; font-size: 15px; font-weight: 700; color: var(--gold-ink); }
.xp-textbtn[aria-disabled="true"] { color: var(--tx3); opacity: .6; }

/* ---------- Results ---------- */
.xp-body { padding-top: 6px; }
.xp-aside { display: none; }
.xp-results { min-width: 0; }
.xp-bar { margin-bottom: 14px; }
.xp-count { font-size: 14px; color: var(--tx3); }
.xp-count b { color: var(--tx2); font-weight: 700; }
.xp-applied { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.xp-applied .xp-textbtn { min-height: 36px; padding: 0 8px; font-size: 14px; }
.xp-pagenote { margin: -4px 0 14px; font-size: 14px; color: var(--tx3); }

.xp-grid { animation: sbl-fade var(--dur-3) var(--ease) both; }
.xp-grid .show-card__mine { display: none; }
.xp-grid[aria-busy="true"] { pointer-events: none; }

.xp-more { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 24px; margin-top: 18px; text-align: center; font-size: 14px; color: var(--tx3); }
.xp-more .btn { min-height: 44px; }
.xp-empty { padding-top: 12px; }

.xp-pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin-top: 32px; }
.xp-pager:empty { display: none; }
.xp-pager__step { display: inline-flex; align-items: center; gap: 4px; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); font-size: 15px; font-weight: 700; }
.xp-pager__step[aria-disabled="true"] { color: var(--tx3); opacity: .55; }
.xp-pager__num { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; padding: 0 6px; border-radius: 12px; font-size: 15px; font-weight: 700; }
.xp-pager__num[aria-current="page"] { background: var(--gold); color: var(--on-gold); font-weight: 800; }
.xp-pager__gap { padding: 0 6px; color: var(--tx3); }
/* With JS the app shell scrolls forever; real pages stay for crawlers and desktop */
.xp.is-js .xp-pager { display: none; }

/* ---------- List view (same cards, restyled as rows) ---------- */
.xp-view-list .xp-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
.xp-view-list .xp-grid > .show-card,
.xp-view-list .xp-grid > .skel-card {
  display: grid; grid-template-columns: 120px minmax(0, 1fr); grid-template-rows: 1fr auto auto auto 1fr;
  column-gap: 12px; row-gap: 1px; align-items: center;
  min-height: 84px; padding: 8px; margin: 0 -8px; border-radius: var(--r-md);
}
.xp-view-list .xp-grid > * > * { grid-column: 2; }
.xp-view-list .xp-grid > * > :first-child { grid-column: 1; grid-row: 1 / -1; }
.xp-view-list .xp-grid .show-card__title { grid-row: 2; -webkit-line-clamp: 1; font-size: 16px; }
.xp-view-list .xp-grid .show-card__meta { grid-row: 3; margin-top: 0; }
.xp-view-list .xp-grid .show-card__mine { display: block; grid-row: 4; }
.xp-view-list .xp-grid .show-card .thumb { border-radius: var(--r-sm); box-shadow: none; }
.xp-view-list .xp-grid .badge-new,
.xp-view-list .xp-grid .thumb__mine { display: none; }
.xp-view-list .xp-grid > .show-card:active { background: var(--s2); transform: none; }
.xp-view-list .xp-grid > .skel-card .skel:nth-child(2) { grid-row: 2; }
.xp-view-list .xp-grid > .skel-card .skel:nth-child(3) { grid-row: 3; }
@media (hover: hover) {
  .xp-view-list .xp-grid > .show-card:hover { background: var(--s2); transform: none; }
}

/* ---------- Filter panel (sheet skin by default) ---------- */
.xp-f { display: flex; flex-direction: column; gap: 22px; }
.xp-f__group { min-width: 0; margin: 0; padding: 0; border: 0; }
.xp-f__legend { padding: 0; margin-bottom: 10px; font-size: 16px; font-weight: 700; }
.xp-radio { display: none; }
.xp-f-status > button { gap: 5px; font-weight: 700; }
.xp-f-status > [aria-checked="true"] { background: var(--gold); color: var(--on-gold); }
.xp-f-status .chip__count { font-weight: 500; opacity: .75; }
.xp-f-genres .xp-genre-toggle { padding: 0 10px; }
.xp-f-decades { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.xp-dec { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-height: 52px; padding: 4px 2px; border-radius: 12px; border: 1px solid var(--line); background: var(--s2); font-size: 15px; font-weight: 700; line-height: 1.15; }
.xp-dec .chip__check { display: none; }
.xp-dec .chip__count { font-size: 13px; font-weight: 500; opacity: .75; }
.xp-dec[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.xp-f-years { display: flex; align-items: flex-end; gap: 10px; margin-top: 12px; }
.xp-yr { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--tx3); }
.xp-yr .field { min-height: 48px; border-radius: 12px; border-width: 1px; padding-left: 12px; color: var(--tx); }
.xp-yr__dash { margin-bottom: 12px; color: var(--tx3); }
.xp-f select option { background: var(--s1); color: var(--tx); }

.xp-fsheet .sheet__head .xp-textbtn { margin-left: auto; }
.xp-fsheet .sheet__foot .btn--outline { padding: 0 18px; }
.xp-cta { flex: 1; }
.xp-sorts { display: flex; flex-direction: column; gap: 8px; padding-bottom: calc(16px + var(--safe-b)); }

/* ---------- Tablet ---------- */
@media (min-width: 600px) {
  .xp-view-list .xp-grid > .show-card, .xp-view-list .xp-grid > .skel-card { grid-template-columns: 160px minmax(0, 1fr); min-height: 104px; }
}

/* ---------- Desktop: sidebar filters + grid ---------- */
@media (min-width: 1024px) {
  .xp { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "head tools" "body body"; align-items: end; column-gap: 20px; padding-top: 36px; }
  .xp-head { grid-area: head; padding-top: 0; }
  .xp-head__top { display: block; min-height: 0; }
  .xp-brand, .xp-switch, .xp-pill { display: none; }
  .xp-title { position: static; width: auto; height: auto; overflow: visible; clip: auto; clip-path: none; white-space: normal; font-family: var(--disp); font-weight: 400; font-size: 52px; line-height: 1; }
  .xp-sub { display: block; margin-top: 8px; font-size: 17px; color: var(--tx2); }

  .xp-tools { grid-area: tools; position: static; display: flex; align-items: center; gap: 10px; margin: 0; padding: 0; background: none; box-shadow: none !important; }
  .xp-qform { display: block; width: 320px; }
  .xp-qform .search-field { height: 48px; }
  .xp-filters-btn, .xp-sort-btn, .xp-spacer { display: none; }
  .xp-controls { gap: 10px; }
  .xp-sort-d { display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 6px 0 14px; border-radius: 12px; border: 1px solid var(--line); font-size: 15px; color: var(--tx2); }
  .xp-sort-d select { height: 40px; padding: 0 6px; border: 0; border-radius: 8px; background: transparent; color: var(--tx); font-size: 15px; font-weight: 700; cursor: pointer; }
  .xp-sort-d select option { background: var(--s1); color: var(--tx); }
  .xp-view { height: 48px; border-radius: 12px; }
  .xp-view > button { width: 44px; min-height: 40px; border-radius: 9px; }

  .xp-body { grid-area: body; display: flex; align-items: flex-start; gap: 32px; margin-top: 28px; padding-top: 0; }
  .xp-aside { display: flex; flex-direction: column; gap: 18px; flex: 0 0 280px; padding: 20px; border-radius: 20px; background: var(--s1); border: 1px solid var(--line2); }
  .xp-aside__head { display: flex; align-items: center; justify-content: space-between; }
  .xp-aside__head h2 { font-size: 19px; font-weight: 700; }
  .xp-aside__head .xp-textbtn { margin-right: -12px; }
  .xp-results { flex: 1; }

  .xp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 18px; min-height: 36px; }
  .xp-count { font-size: 15px; }
  .xp-count b { color: var(--tx); }
  .xp-applied { margin-top: 0; }
  .xp-grid { gap: 28px 20px; }

  .xp.is-js .xp-pager { display: flex; margin-top: 40px; }
  .xp-more:empty { display: none; }

  /* Sidebar skin: radio + checkbox lists, compact chips */
  .xp-aside .xp-f { gap: 22px; }
  .xp-aside .xp-f__legend { margin-bottom: 8px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--tx3); }
  .xp-aside .xp-f-status, .xp-aside .xp-f-checks { display: flex; flex-direction: column; gap: 2px; padding: 0; border: 0; border-radius: 0; background: none; }
  .xp-aside .xp-f-status > button, .xp-aside .xp-f-checks > .chip {
    justify-content: flex-start; gap: 10px; min-height: 44px; padding: 0 8px; margin: 0 -8px; border: 0; border-radius: 10px;
    background: transparent; color: var(--tx); font-size: 15px; font-weight: 500; transform: none;
  }
  .xp-aside .xp-f-status > button:hover, .xp-aside .xp-f-checks > .chip:hover { background: var(--s2); }
  .xp-aside .xp-f-status > [aria-checked="true"], .xp-aside .xp-f-checks > [aria-pressed="true"] { background: transparent; color: var(--tx); font-weight: 700; }
  .xp-aside .xp-chk__label { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .xp-aside .chip__count { opacity: 1; color: var(--tx3); font-weight: 500; }
  .xp-aside .xp-radio { display: inline-block; flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); }
  .xp-aside [aria-checked="true"] .xp-radio { border: 6px solid var(--gold); }
  .xp-aside .xp-f-checks .chip__check { display: inline-block; flex: none; width: 20px; height: 20px; padding: 1px; border: 2px solid var(--line); border-radius: 5px; color: transparent; }
  .xp-aside .xp-f-checks [aria-pressed="true"] .chip__check { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
  .xp-aside .xp-f-genres { gap: 6px; }
  .xp-aside .xp-f-genres .chip { min-height: 40px; padding: 0 12px; font-size: 14px; }
  .xp-aside .xp-f-genres .chip__check { display: none; }
  .xp-aside .xp-f-genres .chip__count { display: none; }
  .xp-aside .xp-f-genres .xp-genre-toggle { flex-basis: 100%; justify-content: flex-start; padding: 0; min-height: 36px; }
  .xp-aside .xp-f-decades { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .xp-aside .xp-dec { flex-direction: row; gap: 6px; min-height: 40px; font-size: 14px; border-radius: 10px; }
  .xp-aside .xp-yr .field { min-height: 44px; font-size: 15px; }

  /* Desktop list: one bordered table-like list */
  .xp-view-list .xp-grid { border: 1px solid var(--line2); border-radius: 18px; overflow: hidden; }
  .xp-view-list .xp-grid > .show-card, .xp-view-list .xp-grid > .skel-card {
    grid-template-columns: 136px minmax(0, 1fr) minmax(0, 260px); column-gap: 16px; min-height: 0;
    margin: 0; padding: 10px 16px; border-radius: 0; border-bottom: 1px solid var(--line2);
  }
  .xp-view-list .xp-grid > :last-child { border-bottom: 0; }
  .xp-view-list .xp-grid .show-card__title { grid-row: 2 / span 2; align-self: center; font-size: 17px; }
  .xp-view-list .xp-grid .show-card__meta { grid-column: 3; grid-row: 1 / -1; align-self: center; font-size: 15px; }
  .xp-view-list .xp-grid .show-card__mine { grid-row: 4; }
  .xp-view-list .xp-grid .show-card:has(.show-card__mine) .show-card__title { grid-row: 2 / span 1; }
  .xp-view-list .xp-grid > .skel-card .skel:nth-child(3) { grid-column: 3; grid-row: 1 / -1; }
}

/* ==========================================================================
   Cast list
   ========================================================================== */
.cl-tools { display: flex; flex-direction: column; gap: 12px; padding-top: 2px; }
.cl-search { height: 50px; }
.cl-search input { font-size: 16px; }
.cl-search .search-field__clear { flex: none; width: 44px; height: 44px; }
.cl-sortrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cl-count { min-width: 0; font-size: 14px; color: var(--tx3); }
.cl-count b { color: var(--tx2); font-weight: 700; }
.cl-sort { flex: none; }
.cl-sort > a { min-height: 36px; padding: 0 14px; font-size: 14px; font-weight: 700; }
.cl-sort > [aria-current="true"] { background: var(--gold); color: var(--on-gold); }

.cl-letters { margin: 4px calc(-1 * var(--gutter)) 0; padding-bottom: 4px; gap: 6px; scroll-snap-type: none; }
.cl-letter { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--s2); font-size: 15px; font-weight: 700; color: var(--gold-ink); }
.cl-letter[aria-current="true"] { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.cl-letter[aria-disabled="true"] { color: var(--tx3); background: transparent; border-color: var(--line2); opacity: .6; pointer-events: none; }

.cl-body { padding-top: 16px; }
.cl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 10px; animation: sbl-fade var(--dur-3) var(--ease) both; }
.cl-grid .cast-tile { gap: 8px; }
.cl-grid .avatar { --size: 96px; }
.cl-grid .cast-tile__name { font-size: 15px; font-weight: 700; }
.cl-grid[aria-busy="true"] { pointer-events: none; }
.cl-letterhead { grid-column: 1 / -1; margin: 6px 0 -6px; font-family: var(--disp); font-weight: 400; font-size: 24px; line-height: 1; color: var(--gold-ink); }
.cl-letterhead:first-child { margin-top: 0; }
.cl-skel { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cl-skel .skel:first-child { width: 96px; height: 96px; border-radius: 50%; }
.cl-skel .skel:last-child { width: 70%; height: 12px; }
.cl-more { display: flex; justify-content: center; margin-top: 24px; min-height: 24px; font-size: 14px; color: var(--tx3); }

@media (min-width: 600px) {
  .cl-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 24px 14px; }
}

@media (min-width: 1024px) {
  .page-cast-list .xp { grid-template-areas: "head tools" "letters letters" "body body"; }
  .cl-tools { grid-area: tools; flex-direction: row; align-items: center; gap: 12px; padding: 0; }
  .cl-search { width: 320px; height: 48px; }
  .cl-sortrow { gap: 12px; }
  .cl-count { font-size: 15px; }
  .cl-count[data-default] { display: none; }
  .cl-sort { height: 48px; border-radius: 12px; }
  .cl-sort > a { min-height: 40px; border-radius: 9px; font-size: 15px; }
  .cl-letters { grid-area: letters; flex-wrap: wrap; overflow: visible; margin: 24px 0 0; padding: 0; }
  .cl-letter { min-width: 40px; height: 40px; padding: 0 8px; }
  .cl-body { grid-area: body; padding-top: 28px; }
  .cl-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 28px 20px; }
  .cl-grid .avatar, .cl-skel .skel:first-child { --size: 120px; width: 120px; height: 120px; }
  .cl-grid .cast-tile__name { font-size: 16px; }
  .cl-letterhead { font-size: 30px; margin-top: 12px; }
}
