/* SubSyncer 2.0 — black and white. Loaded last on every page: one ground, one ink, no stars.
 * Tokens are written twice (:root:root) so they outrank the older per-page palettes.
 * Text has no grey: secondary text uses the full ink of the theme, black on light and white on dark. */
:root:root{
 --paper:#0b0b0b;--bg:var(--paper);--panel:#161616;--elevated:#1e1e1e;--hover:#242424;
 --ink:#f5f5f2;--muted:var(--ink);--line:#2e2e2e;--soft-line:#232323;
 --accent:var(--ink);--secondary:var(--muted);--button-ink:var(--paper);--focus:var(--ink);
 --track:#333;--reference:#8a8a86;--demo-cue:var(--ink);--demo-cue-ink:var(--paper);
 --ease-out:cubic-bezier(.23,1,.32,1);--ease-in-out:cubic-bezier(.77,0,.175,1);
 color-scheme:dark;
}
/* Light mode is light sand, not white: a warm ground, panels a step deeper, black text. */
:root:root[data-theme=light]{
 --paper:#f3ebdc;--bg:var(--paper);--panel:#e9dfcb;--elevated:#faf6ee;--hover:#e0d4bc;
 --ink:#0b0b0b;--muted:var(--ink);--line:#d6c8ad;--soft-line:#e0d4bc;
 --track:#d4c5a8;--reference:#7d7262;--success:#1f5a36;--error:#8c1f1f;
 color-scheme:light;
}
html,body{background:var(--paper)}

/* ---------- Header controls: theme, Ko-fi, language ---------- */
:is(.header-tools,.landing-tools){display:flex;align-items:center;gap:4px}
:is(#theme,#locale,.kofi-link){position:relative;display:inline-grid;place-items:center;width:44px;height:44px;padding:0;border:0;border-radius:999px;background:transparent;color:var(--ink);cursor:pointer;overflow:hidden;transition:background-color .2s ease,transform 160ms var(--ease-out)}
:is(#theme,#locale,.kofi-link):active{transform:scale(.94)}
@media (hover:hover) and (pointer:fine){:is(#theme,#locale,.kofi-link):hover{background:var(--hover)}}

/* Sun and moon share the button and trade places with a turn. */
#theme .theme-icon{grid-area:1/1;display:grid;place-items:center;transition:transform 300ms var(--ease-out),opacity 200ms ease}
#theme svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
:root[data-theme=dark] #theme .theme-moon,:root:not([data-theme]) #theme .theme-moon{opacity:0;transform:rotate(-90deg) scale(.6)}
:root[data-theme=light] #theme .theme-sun{opacity:0;transform:rotate(90deg) scale(.6)}

/* The language glyph rolls: the next language rises in as the current one leaves. */
#locale{font:700 17px/1 "IBM Plex Sans Arabic","Rethink Sans",system-ui,sans-serif}
#locale .glyph{grid-area:1/1;transition:transform 240ms var(--ease-out),opacity 180ms ease}
#locale .glyph-en{font-family:"Rethink Sans",system-ui,sans-serif;font-size:14px;letter-spacing:.02em}
:root[lang=en] #locale .glyph-en,:root:not([lang=ar]) #locale .glyph-en{opacity:0;transform:translateY(110%)}
:root[lang=ar] #locale .glyph-ar{opacity:0;transform:translateY(-110%)}
:root[lang=ar] #locale .glyph-en{opacity:1;transform:none}

/* Ko-fi cup: steam rises and the heart beats once on hover; it presses like a button. */
.kofi-link svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;overflow:visible}
.kofi-link .kofi-heart{fill:currentColor;stroke:none;transform-box:fill-box;transform-origin:center;transition:transform 200ms var(--ease-out)}
.kofi-link .kofi-steam{opacity:0;transform:translateY(3px);transition:opacity 200ms ease,transform 300ms var(--ease-out)}
@media (hover:hover) and (pointer:fine){
 .kofi-link:hover .kofi-steam{opacity:1;transform:none}
 .kofi-link:hover .kofi-heart{animation:kofi-beat 600ms var(--ease-out)}
}
@keyframes kofi-beat{30%{transform:scale(1.25)}60%{transform:scale(.95)}100%{transform:scale(1)}}

/* ---------- Ko-fi panel ---------- */
dialog.kofi-dialog{width:min(480px,calc(100vw - 32px));max-height:calc(100dvh - 32px);padding:20px;border:0;border-radius:20px;background:var(--elevated);color:var(--ink);box-shadow:0 24px 80px rgba(0,0,0,.45);overflow:auto;transform-origin:center}
dialog.kofi-dialog::backdrop{background:rgba(0,0,0,.6)}
dialog.kofi-dialog[open]{animation:kofi-in 250ms var(--ease-out)}
dialog.kofi-dialog[open]::backdrop{animation:kofi-fade 250ms var(--ease-out)}
dialog.kofi-dialog[data-state=closing]{opacity:0;transform:scale(.96);transition:opacity 200ms var(--ease-out),transform 200ms var(--ease-out)}
@keyframes kofi-in{from{opacity:0;transform:scale(.96)}}
@keyframes kofi-fade{from{opacity:0}}
.kofi-head{display:flex;align-items:center;gap:12px}
.kofi-head h2{flex:1;margin:0;font-size:22px;letter-spacing:-.02em;line-height:1.2}
.kofi-close{display:grid;place-items:center;width:40px;height:40px;border:0;border-radius:999px;background:var(--hover);color:var(--ink);cursor:pointer;transition:transform 160ms var(--ease-out)}
.kofi-close:active{transform:scale(.94)}
.kofi-close svg{width:18px;height:18px;stroke:currentColor;stroke-width:2;stroke-linecap:round;fill:none}
.kofi-body{margin:8px 0 16px;color:var(--muted);font-size:16px;line-height:1.55}
.kofi-frame{display:block;width:100%;height:585px;border:0;border-radius:14px;background:#fff;transition:height 300ms var(--ease-out)}
.kofi-frame.is-open{height:712px}
.kofi-open{display:inline-flex;align-items:center;gap:8px;min-height:40px;margin-top:14px;padding:0 16px;border-radius:999px;background:var(--hover);color:var(--ink);font-size:15px;font-weight:600;text-decoration:none;transition:transform 160ms var(--ease-out)}
.kofi-open:active{transform:scale(.97)}
.kofi-open svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;transition:transform 200ms var(--ease-out)}
@media (hover:hover) and (pointer:fine){.kofi-open:hover svg{transform:translate(2px,-2px)}}

/* ---------- Theme and language transitions ---------- */
/* Moving between pages: the old page blurs away, the new one settles in; the header stays put. */
@view-transition{navigation:auto}
:root:not([data-vt]) :is(.landing-header,body>header){view-transition-name:site-header}
::view-transition-old(root),::view-transition-new(root){mix-blend-mode:normal}
:root:not([data-vt])::view-transition-old(root){animation:page-out 280ms cubic-bezier(.77,0,.175,1) both}
:root:not([data-vt])::view-transition-new(root){animation:page-in 460ms cubic-bezier(.23,1,.32,1) 80ms both}
::view-transition-group(site-header){animation-duration:420ms;animation-timing-function:cubic-bezier(.77,0,.175,1)}
@keyframes page-out{to{opacity:0;filter:blur(8px)}}
@keyframes page-in{from{opacity:0;filter:blur(8px)}}
:root[data-vt]::view-transition-old(root),:root[data-vt]::view-transition-new(root){animation:none}
:root[data-vt=theme]::view-transition-new(root){animation:vt-reveal 420ms var(--ease-out)}
:root[data-vt=locale]::view-transition-old(root){animation:vt-out 180ms ease forwards}
:root[data-vt=locale]::view-transition-new(root){animation:vt-in 220ms var(--ease-out) 60ms both}
@keyframes vt-reveal{from{clip-path:circle(0 at var(--vt-x,100%) var(--vt-y,0))}to{clip-path:circle(var(--vt-r,150vmax) at var(--vt-x,100%) var(--vt-y,0))}}
@keyframes vt-out{to{opacity:0}}
@keyframes vt-in{from{opacity:0}}

/* ---------- Buttons press everywhere ---------- */
/* The independent `scale` property, so a press never overrides a transform that positions the control. */
:where(button,.button,.configure-button,input[type=submit]):not(:disabled){transition-property:scale,background-color,color,border-color,opacity;transition-duration:160ms;transition-timing-function:var(--ease-out)}
:where(button,.button,.configure-button):not(:disabled):active{scale:.97}

@media (prefers-reduced-motion:reduce){
 ::view-transition-old(root),::view-transition-new(root),::view-transition-group(*){animation:none!important}
 #theme .theme-icon,#locale .glyph{transition:opacity 150ms ease}
 :root[data-theme] #theme .theme-icon,:root #locale .glyph{transform:none!important}
 .kofi-link:hover .kofi-heart{animation:none}
 dialog.kofi-dialog[open]{animation:kofi-fade 150ms ease}
 dialog.kofi-dialog[data-state=closing]{transform:none}
 .kofi-frame{transition:none}
}

/* ---------- Buttons: one shape (pill), ink on paper ---------- */
.primary{background:var(--ink);color:var(--paper);border:1px solid var(--ink);border-radius:999px;font-weight:700}
.primary:hover{background:var(--ink);border-color:var(--ink);opacity:.86}
.primary:disabled{opacity:.35}
.secondary{border-radius:999px;border-color:var(--line);color:var(--ink);font-size:14px}
.secondary:hover{border-color:var(--ink);background:var(--hover)}
.setup-mode{border-color:var(--line);border-radius:999px}
.setup-mode button{border-radius:999px}
.setup-mode button[aria-pressed=true]{background:var(--ink);color:var(--paper)}

/* ---------- Requests: one title, one switch, two calm lists, one filter row ---------- */
.request-library .request-heading{flex-direction:column;align-items:flex-start;gap:20px;margin-bottom:32px}
.request-library .request-heading h2{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.request-library .request-heading p{max-width:56ch;color:var(--muted);font-size:17px}
.request-library .request-board-tools{display:inline-flex;flex-wrap:nowrap;gap:4px;padding:4px;border-radius:999px;background:var(--panel)}
.request-library .request-board-tools .request-tabs{display:contents}
.request-library .request-board-tools button{min-height:40px;margin:0;padding:0 18px;border:0;border-radius:999px;background:transparent;color:var(--muted);font-size:14px;font-weight:600;width:auto;transition:background-color .25s ease,color .25s ease,transform 160ms var(--ease-out)}
.request-library .request-board-tools button[aria-pressed=true]{background:var(--ink);color:var(--paper)}
@media (hover:hover) and (pointer:fine){.request-library .request-board-tools button:not([aria-pressed=true]):hover{color:var(--ink)}}
.request-library .request-latest{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin-block:0 48px}
.request-library .request-latest>section{padding:24px;border-radius:24px;background:var(--panel)}
.request-library .request-latest h3{font-size:18px}
.request-library .request-latest .hint{margin:0;font-size:15px}
.request-library .request-results-heading{flex-direction:column;align-items:stretch;gap:16px;padding:0;border:0;margin-bottom:16px}
.request-library .request-search-heading{display:block}
.request-library .request-results-heading h3{font-size:22px}
.request-library .request-search-heading+.request-filters,.request-library .request-results-heading{position:relative}
.request-library .request-search{width:100%;margin-top:16px}
.request-library .request-filters{gap:8px}
.request-library .request-filters label>span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.request-library .request-filters label{width:auto;flex:1}
.request-library #requests-status:empty{display:none}
@media (min-width:781px){
 .request-library .request-results-heading{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:auto auto;align-items:end}
 .request-library .request-search-heading{display:contents}
 .request-library .request-results-heading h3{grid-column:1/-1}
 .request-library .request-search{margin:0}
 .request-library .request-filters label{width:200px;flex:none}
}
@media (max-width:780px){.request-library .request-latest{grid-template-columns:minmax(0,1fr)}.request-library .request-board-tools{max-width:100%;overflow-x:auto}}

/* ---------- Title page: the site's own faces at readable sizes (Arabic was falling back to system, serif and mono) ---------- */
.media-detail-open .media-workspace,.media-detail-open .media-workspace :is(p,span,strong,h1,h2,h3,h4,small,li,button,a){font-family:var(--font-body)!important}
.media-detail-open .detail-story,.media-detail-open #versions-status{font-size:17px;line-height:1.75}
.media-detail-open .detail-tagline{font-size:18px;font-style:normal!important}
.media-detail-open .detail-meta,.media-detail-open .detail-kind,.media-detail-open .detail-status{font-size:14px}
.media-detail-open .media-workspace h3{font-size:15px}
.media-detail-open .detail-recommendation-meta,.media-detail-open .media-workspace span{font-size:max(13px,1em)}
:root[lang=ar] .media-detail-open .detail-story,:root[lang=ar] .media-detail-open #versions-status{font-size:18px;line-height:1.9}
:root[lang=ar] .media-detail-open .detail-tagline{font-size:19px}

/* ---------- Footer on every page: X | avatar and name, on the left ---------- */
.foot{justify-content:flex-start!important}
.foot .footer-me{display:flex;align-items:center;gap:14px}
.footer-sep{width:1px;height:24px;background:var(--line)}

/* ---------- Search panel: a filled field, one even row of filters, no dividers ---------- */
.search-dialog{border:0!important;border-radius:24px!important;background:var(--elevated)!important;overflow:hidden}
.search-dialog .media-search{gap:12px;padding:16px 16px 12px!important;border:0!important}
.search-dialog #search-query{min-height:52px;border:0!important;border-radius:999px!important;background:var(--hover)!important;padding-inline:20px!important;font-size:17px}
.search-dialog #search-query:focus{box-shadow:inset 0 0 0 1.5px var(--ink)!important;outline:none}
.search-dialog #search-close{min-height:44px;padding:0 16px;border:0;border-radius:999px;background:transparent;color:var(--muted);font-weight:600}
.search-dialog #search-close:hover{color:var(--ink);background:var(--hover)}
.search-dialog .search-catalogs{display:grid!important;grid-template-columns:repeat(5,minmax(0,1fr))!important;gap:4px!important;margin:0 16px 8px;padding:4px!important;border:0!important;border-radius:999px;background:var(--hover)}
.search-dialog .search-catalogs[hidden]{display:none!important}
.search-dialog .search-catalogs button{grid-column:auto!important;min-width:0;min-height:40px!important;padding:0 10px!important;border:0!important;border-radius:999px!important;background:transparent!important;color:var(--muted)!important;font-size:14px!important;font-weight:600;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:background-color .25s ease,color .25s ease}
.search-dialog .search-catalogs button[aria-pressed=true]{background:var(--ink)!important;color:var(--paper)!important}
@media (hover:hover) and (pointer:fine){.search-dialog .search-catalogs button:not([aria-pressed=true]):hover{color:var(--ink)!important}}
.search-dialog .search-results{border:0!important;padding-top:4px}
@media (max-width:600px){
 .search-dialog .search-catalogs{display:flex!important;overflow-x:auto;scrollbar-width:none;border-radius:999px}
 .search-dialog .search-catalogs::-webkit-scrollbar{display:none}
 .search-dialog .search-catalogs button{flex:0 0 auto;overflow:visible}
}

/* ---------- Rails: no scroll line under Cast and More Like This; they still scroll by swipe or trackpad ---------- */
.detail-cast-list,.detail-recommendation-list,.detail-season-tabs{scrollbar-width:none!important}
.detail-cast-list::-webkit-scrollbar,.detail-recommendation-list::-webkit-scrollbar,.detail-season-tabs::-webkit-scrollbar{display:none}

/* ---------- Cast cards open the actor's page ---------- */
button.detail-cast-card{display:block;width:auto;min-height:0;padding:0;border:0;background:none;color:var(--ink);text-align:start;font:inherit;cursor:pointer;white-space:normal;transition:scale 160ms var(--ease-out)}
button.detail-cast-card .detail-cast-photo{transition:filter .25s ease}
@media (hover:hover) and (pointer:fine){button.detail-cast-card:hover .detail-cast-photo{filter:brightness(1.12)}button.detail-cast-card:hover h3{text-decoration:underline;text-underline-offset:3px}}

/* ---------- Actor page ---------- */
.person-hero{display:grid;grid-template-columns:260px minmax(0,1fr);gap:40px;align-items:start;margin:8px 0 56px}
.person-photo{width:260px;aspect-ratio:2/3;object-fit:cover;border-radius:20px;background:var(--panel)}
.person-photo-empty{display:block}
.person-copy h1{margin:0 0 12px;font-size:clamp(36px,5vw,64px);letter-spacing:-.03em;line-height:1.05}
:root[lang=ar] .person-copy h1{letter-spacing:0;line-height:1.3}
.person-facts{margin:0 0 20px;color:var(--muted);font-size:16px}
.person-bio{margin:0;max-width:70ch;font-size:17px;line-height:1.75;white-space:pre-line}
.person-bio.is-clamped{display:-webkit-box;-webkit-line-clamp:7;-webkit-box-orient:vertical;overflow:hidden}
.person-more{margin-top:12px;min-height:40px;padding:0 16px;border:0;border-radius:999px;background:var(--panel);color:var(--ink);font-weight:600}
.person-credit-grid{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:24px 16px}
.person-credit-grid .detail-recommendation-card{width:100%}
@media (max-width:700px){.person-hero{grid-template-columns:1fr;gap:20px}.person-photo{width:160px}.person-credit-grid{grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:20px 12px}}

/* ---------- Episodes: panels, not ruled rows; the chosen one is the solid card ---------- */
.episode-list{display:grid;gap:10px}
.episode-row{grid-template-columns:240px minmax(0,1fr)!important;gap:20px!important;padding:12px!important;border:0!important;border-radius:20px!important;background:var(--panel)!important;color:var(--ink);transition:background-color .25s ease,color .25s ease,scale 160ms var(--ease-out)}
@media (hover:hover) and (pointer:fine){.episode-row:not([aria-pressed=true]):hover{background:var(--hover)!important}}
.episode-row[aria-pressed=true]{background:var(--ink)!important;color:var(--paper)!important;padding-inline:12px!important}
.episode-row[aria-pressed=true] :is(.episode-meta,.episode-story){color:inherit;opacity:1}
.episode-still{width:240px!important;border-radius:14px!important}
.episode-copy{gap:6px!important;align-content:center}
.episode-copy strong{font-size:18px!important;line-height:1.3!important}
.episode-meta{font-size:13px!important}
.episode-story{font-size:15px!important;line-height:1.6!important;-webkit-line-clamp:2!important}
.episode-row .episode-action{grid-column:2;justify-self:start;margin-top:4px;padding:6px 14px;border-radius:999px;background:var(--hover)!important;color:var(--ink)!important;font-size:13px!important;font-weight:600}
.episode-row[aria-pressed=true] .episode-action{background:var(--paper)!important;color:var(--ink)!important}
@media (max-width:640px){.episode-row{grid-template-columns:1fr!important;gap:12px!important}.episode-still{width:100%!important}.episode-action{grid-column:1}}

/* ---------- Episodes, compact: still, text and button in one row, no gap above the title ---------- */
@media (min-width:641px){
 .media-detail-open .episode-row,.media-detail-open .episode-row[aria-pressed=true]{grid-template-columns:200px minmax(0,1fr) auto!important;align-items:center!important;gap:20px!important;padding:10px!important}
 .media-detail-open .episode-still{grid-column:1;grid-row:1;width:200px!important}
 .media-detail-open .episode-copy{grid-column:2!important;grid-row:1;gap:4px!important}
 .media-detail-open .episode-copy strong{font-size:17px!important}
 .media-detail-open .episode-story{font-size:14px!important;line-height:1.55!important}
 .media-detail-open .episode-row .episode-action{grid-column:3!important;grid-row:1!important;align-self:center;justify-self:end;margin:0 6px 0 0}
}

/* ---------- Footer: © bottom-right on every page except the home page and the guided setup ---------- */
.foot .footer-copy{margin:0 0 0 auto;color:var(--muted);font-size:14px;white-space:nowrap}
body.wizard .foot .footer-copy{display:none}

/* ---------- More Like This: no Movie/TV tag, a small rating chip ---------- */
.media-detail-open .detail-recommendation-art>.facts-rating{top:6px;inset-inline-end:6px;display:inline-flex;align-items:center;gap:3px;padding:1px 5px;border-radius:4px;font-size:10px!important;line-height:1.4}
.media-detail-open .detail-recommendation-art>.facts-rating span{font-size:10px!important}
.media-detail-open .detail-recommendation-art>.facts-rating svg{width:9px;height:9px}

/* ---------- Cast: every card starts at the top, with or without a character name ---------- */
.detail-cast-list{align-items:flex-start}
.detail-cast-card{display:flex!important;flex-direction:column;justify-content:flex-start;align-items:stretch}
.detail-cast-card .detail-cast-photo{flex:none}
@media (max-width:640px){.foot .footer-copy{font-size:13px}}

/* ---------- Phones: search catalogs are one row of chips that swipe, never a wrapped, clipped track ---------- */
@media (max-width:600px){
 .search-dialog .search-catalogs{flex-wrap:nowrap!important;gap:6px!important;margin:0 0 8px!important;padding:2px 16px!important;border-radius:0!important;background:transparent!important;scroll-padding-inline:16px}
 .search-dialog .search-catalogs button{background:var(--hover)!important;color:var(--ink)!important;padding:0 16px!important}
 .search-dialog .search-catalogs button[aria-pressed=true]{background:var(--ink)!important;color:var(--paper)!important}
}

/* ---------- Phones: every episode picture is the same size, whatever the length of the title ---------- */
@media (max-width:640px){
 .media-detail-open .episode-row,.media-detail-open .episode-row[aria-pressed=true]{grid-template-columns:120px minmax(0,1fr)!important;align-items:center!important}
 .media-detail-open .episode-still{grid-column:1;grid-row:1;width:120px!important;aspect-ratio:16/9;object-fit:cover}
 .media-detail-open .episode-copy{grid-column:2!important;grid-row:1;min-width:0}
 .media-detail-open .episode-copy strong{white-space:normal!important;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
}

/* The Ko-fi close button is a true circle on every page; the shared button padding must not push the X. */
dialog.kofi-dialog .kofi-close{width:40px;height:40px;min-width:40px;min-height:40px;padding:0;flex:none}
dialog.kofi-dialog .kofi-close svg{display:block;margin:0}
