/* Cast lookup styles.
 *
 * A separate file rather than an append to app.css, so app.css and index.php's
 * ?v= are both untouched and this whole feature stays a delete away from gone.
 * Every colour comes from the variables app.css already defines, so the page
 * reads as part of the same site and a palette change still reaches it.
 */

/* One centred reading column. .page is up to 1400px wide, which suits the home
   page's multi-list grid but strands a name at one edge of a cast row and its
   verdict at the other. The lede matches the search bar's width and centring. */
#cast-results, .tmdb-credit{
  width:100%; max-width:960px; margin-left:auto; margin-right:auto;
}

.cast-lede{
  width:100%; max-width:720px; margin:0 auto 18px; text-align:center;
  color:var(--muted); font-size:15px; line-height:1.5;
}

.cast-loading{ color:var(--muted); font-size:15px; padding:8px 0; }

.cast-error{
  border:1px solid var(--border-strong); border-radius:12px;
  background:var(--card-bg); padding:16px 18px; margin-top:18px;
  font-size:15px; color:#374151;
}

.cast-h2{ font-size:22px; font-weight:700; letter-spacing:-.01em; margin:0; }
.cast-sub{ margin:4px 0 0; color:var(--muted); font-size:14px; }
.cast-head{ margin:22px 0 0; display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.cast-head-text{ min-width:0; }
.cast-head .btn-ghost.btn-icon{ flex:none; }

.cast-title-link{ color:inherit; text-decoration:none; overflow-wrap:anywhere; }
.cast-title-link:hover{ color:var(--accent); text-decoration:underline; }

/* ---------- browse tabs ---------- */

/* Tabs wrap on a wide screen. On a phone they stay on one line and the row
   scrolls sideways on its own, so the page never does. */
.browse-tabs{
  display:flex; flex-wrap:wrap; gap:6px; margin:8px 0 0; padding:0 0 10px;
  border-bottom:1px solid var(--border);
}
.browse-tab{
  flex:none; white-space:nowrap; cursor:pointer;
  padding:7px 14px; border-radius:999px;
  border:1px solid var(--border-strong); background:#fff; color:#374151;
  font:inherit; font-size:14px; font-weight:600;
}
.browse-tab:hover{ border-color:var(--accent); color:var(--accent); }
.browse-tab[aria-selected="true"]{ background:var(--accent); border-color:var(--accent); color:#fff; }
.browse-tab:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }

.browse-note{ margin:10px 0 12px; font-size:13px; color:var(--muted); min-height:1.5em; }
.browse-empty{ margin:0; padding:24px 0; color:var(--muted); font-size:15px; }
#browse-grid{ min-height:120px; }
#browse-panel + .trend-caveat{ margin-top:16px; }

.trend-grid{
  list-style:none; margin:0; padding:0;
  display:grid; gap:14px;
  /* 175px, not 150: the count pill ("None of 125 cast on a list") needs about
     155px inside the card. That gives 7 columns on the widest panel. */
  grid-template-columns:repeat(auto-fill, minmax(175px, 1fr));
}

.trend-card{
  display:flex; flex-direction:column; gap:3px; height:100%;
  text-decoration:none; color:inherit;
  border:1px solid var(--border); border-radius:12px;
  background:var(--card-bg); padding:8px 8px 10px;
}
.trend-card:hover{ border-color:var(--accent); }
.trend-card:hover .trend-title{ color:var(--accent); }
.trend-card:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }

.trend-poster{
  display:block; width:100%; aspect-ratio:2 / 3; object-fit:cover;
  border-radius:8px; background:var(--page-bg); margin-bottom:5px;
}
.trend-poster-none{ border:1px dashed var(--border-strong); }

/* Two lines at most, then "...", so a long title never makes its card taller
   than the rest of the row. The full title is in the card's title attribute. */
.trend-title{
  font-weight:650; font-size:14px; line-height:1.3; overflow-wrap:anywhere;
  display:-webkit-box; -webkit-box-orient:vertical;
  -webkit-line-clamp:2; line-clamp:2; overflow:hidden;
}
.trend-meta{ color:var(--muted); font-size:12px; }
/* In Theaters: an old film back in cinemas. Kept whole (nowrap), so on a
   narrow card it drops below the year rather than splitting. */
.trend-rerelease{
  display:inline-block; white-space:nowrap; margin-left:2px;
  font-size:10.5px; font-weight:650; line-height:1.4; color:#475569;
  background:#eef2f7; border:1px solid #cbd5e1; border-radius:4px; padding:0 5px;
}
/* The count as a pill (.cast-badge), in the cast page's colors (owner's
   decision, 2026-09-17). margin-top:auto keeps the pills on one line across a
   row. .cast-badge sets nowrap and comes later, so the wrap for a narrow card
   (phones) needs the two-class selector. */
.trend-count.cast-badge{
  margin-top:auto; align-self:flex-start; max-width:100%;
  white-space:normal; line-height:1.35; font-weight:650;
  font-size:11.5px; padding:2px 8px;
}
.trend-meta{ margin-bottom:6px; }
.cast-badge.is-clear{
  background:var(--success-bg); color:var(--success-strong);
  border:1px solid var(--success-border);
}
.cast-badge.is-empty{
  background:#f3f4f6; color:#4b5563;
  border:1px solid var(--border-strong);
}
.trend-item[hidden]{ display:none; }

.trend-caveat{ margin:0; font-size:13px; line-height:1.5; color:var(--muted); }

/* ---------- the picker ---------- */

.pick-list{ list-style:none; margin:14px 0 0; padding:0; display:grid; gap:10px; }

.pick-link{
  display:flex; gap:14px; align-items:flex-start;
  border:1px solid var(--border); border-radius:12px;
  background:var(--card-bg); padding:12px 14px;
  text-decoration:none; color:inherit;
}
.pick-link:hover{ border-color:var(--accent); }
.pick-link:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }

.pick-poster{
  width:46px; height:69px; flex:none; border-radius:6px;
  object-fit:cover; background:var(--page-bg);
}
.pick-poster-none{ display:block; border:1px dashed var(--border-strong); }

/* min-width:0 so a long title wraps instead of stretching the row */
.pick-body{ min-width:0; display:flex; flex-direction:column; gap:3px; }
.pick-title{ font-weight:650; font-size:16px; overflow-wrap:anywhere; }
.pick-meta{ color:var(--muted); font-size:13px; }
/* Shown in full: the overview is what tells two same-named titles apart, and
   the picker holds at most ten. */
.pick-overview{ color:#4b5563; font-size:13px; line-height:1.45; }

/* ---------- the headline and its caveat ---------- */

.cast-headline{
  margin:16px 0 0; padding:16px 18px;
  border:1px solid var(--border-strong); border-radius:12px;
}
/* Matches the single-name verdict vocabulary: red means somebody is on a list. */
.cast-headline.found{
  border-color:var(--danger-border-strong);
  background:linear-gradient(to bottom, #fff, var(--danger-bg));
}
.cast-headline.clear{
  border-color:var(--success-border-strong);
  background:linear-gradient(to bottom, #fff, var(--success-bg-strong));
}

.cast-count{ margin:0; font-size:20px; font-weight:700; line-height:1.3; }

/* The caveat is part of the claim, not a footnote to it. It stays visible,
   never collapsed behind a tooltip or an expander. */
.cast-caveat{
  margin:10px 0 0; font-size:13.5px; line-height:1.5; color:#374151;
}

/* ---------- the cast table ---------- */

.cast-list{ list-style:none; margin:16px 0 0; padding:0; }

.cast-row{
  display:flex; gap:16px; align-items:baseline; justify-content:space-between;
  padding:10px 0; border-bottom:1px solid var(--border);
}
.cast-row:first-child{ border-top:1px solid var(--border); }

.cast-person{ min-width:0; display:flex; flex-direction:column; gap:2px; }
.cast-person a{ color:inherit; text-decoration:none; font-weight:600; overflow-wrap:anywhere; }
.cast-person a:hover{ color:var(--accent); text-decoration:underline; }

.cast-role{ color:var(--muted); font-size:13px; }
.cast-eps{ color:var(--muted); font-size:12px; }

.cast-verdict{
  flex:none; display:flex; flex-direction:column; align-items:flex-end; gap:3px;
  text-align:right; max-width:52%;
}

/* Badge and episode count share a line, so how slight an appearance was sits
   right beside the claim that somebody is on a list. */
.cast-badge-row{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:flex-end; }

.cast-badge{
  display:inline-block; padding:2px 9px; border-radius:999px;
  font-size:12px; font-weight:700; white-space:nowrap;
}

.cast-eps-flag{ font-size:12px; color:var(--muted); white-space:nowrap; }
.cast-badge.is-found{
  background:var(--danger-bg); color:var(--danger-strong);
  border:1px solid var(--danger-border);
}
.cast-badge.is-close{
  background:var(--warning-bg); color:#92400e;
  border:1px solid var(--warning-border);
}

/* A list name in its badge. Long names wrap rather than widen the row. */
.cast-list-pill{ white-space:normal; text-align:left; text-decoration:none; font-weight:600; }
a.cast-list-pill:hover{ text-decoration:underline; }
.cast-badge-row{ row-gap:4px; }
/* "On N lists" as plain text above the list badges. */
.cast-onlists{ font-size:12.5px; font-weight:600; color:#374151; white-space:nowrap; }
.cast-onlists .cast-eps-flag{ font-weight:400; }

.cast-lists{ font-size:12.5px; color:#4b5563; line-height:1.4; }
.cast-lists a{ color:#4b5563; }
.cast-lists a:hover{ color:var(--accent); }

.cast-listedas{ font-size:12px; color:var(--muted); font-style:italic; }

/* A miss is the common case, so it stays quiet - colouring 33 of 40 rows would
   shout down the handful that actually say something. */
.cast-none{ font-size:12.5px; color:var(--muted); }

/* A possible match is not a finding, so it stays small and grey-blue. */
.cast-possible{ font-size:12px; color:#475569; }
.cast-possible a{ color:#334155; }
.cast-verdict .list-pills{ justify-content:flex-end; margin-top:0; }
@media (max-width: 560px){
  .cast-verdict .list-pills{ justify-content:flex-start; }
}

/* ---------- found-only toggle and paging ---------- */

.cast-tools{ margin:14px 0 0; display:flex; flex-wrap:wrap; gap:8px; }
.cast-filter[aria-pressed="true"]{ border-color:var(--accent); color:var(--accent); }

.cast-showing{ margin:14px 0 0; font-size:13px; color:var(--muted); scroll-margin-top:12px; }
#cast-page{ scroll-margin-top:12px; }
.cast-showing + .cast-list{ margin-top:8px; }

.cast-pager{
  margin:14px 0 0; display:flex; align-items:center; justify-content:center;
  gap:12px; flex-wrap:wrap;
}
.cast-pager[hidden]{ display:none; }
.cast-pager button:disabled{ opacity:.45; cursor:default; }
.cast-pageno{ font-size:14px; color:var(--muted); min-width:9ch; text-align:center; }

.cast-checked{ margin:14px 0 0; font-size:13px; color:var(--muted); }
.cast-back{ margin:18px 0 0; font-size:14px; }
.cast-back a{ color:var(--accent); }

/* ---------- required TMDB attribution ---------- */

.tmdb-credit{
  margin-top:40px; margin-bottom:24px; padding-top:18px; border-top:1px solid var(--border);
  display:flex; gap:14px; align-items:center; flex-wrap:wrap;
}
.tmdb-credit img{ flex:none; }
.tmdb-credit p{ margin:0; font-size:12px; color:var(--muted); line-height:1.5; flex:1 1 280px; }

/* ---------- title suggestions ----------
   The dropdown itself is app.css's .suggest, so it looks like the home page's.
   Only the row contents differ: a title and its year and type, not list tags. */

.suggest-meta{ font-size:12px; color:var(--muted); white-space:nowrap; }

/* ---------- narrow screens ---------- */

@media (max-width: 560px){
  .cast-row{ flex-direction:column; align-items:flex-start; gap:4px; }
  .cast-verdict{ align-items:flex-start; text-align:left; max-width:100%; }
  .cast-badge-row{ justify-content:flex-start; }
  .pick-overview{ display:none; }
  .trend-grid{ grid-template-columns:repeat(2, minmax(0, 1fr)); gap:10px; }
  .browse-tabs{
    flex-wrap:nowrap; overflow-x:auto; overscroll-behavior-x:contain; scrollbar-width:none;
    /* A fade on the right edge says there are more tabs to swipe to. */
    -webkit-mask-image:linear-gradient(to right, #000 82%, transparent);
            mask-image:linear-gradient(to right, #000 82%, transparent);
    padding-right:32px;
  }
}
