/* Light / Dark / System appearance (owner request, PR #27 thread, 2026-11-17).
   One place for theme colours. theme.js sets data-theme="light|dark" on <html> before paint.
   Dark is the existing Rundown Live look and keeps the tokens defined in styles.css and
   control/control.css. Light redefines the same semantic tokens, then adjusts the few rules
   that were written with fixed dark values. Loaded after the page's own stylesheets. */

:root{color-scheme:dark;--focus:#ffb020;--accent-fill:#ffb020;--on-accent:#000}
:root[data-theme="light"]{
  color-scheme:light;
  --bg:#f6f4ef;--bg2:#eceae3;--card:#ffffff;--card2:#f1efe9;--line:#cfcbc1;
  --text:#18181b;--muted:#55535c;
  --red:#c2231a;      /* text, borders and filled buttons with white text */
  --amber:#7c4e00;    /* amber used as text */
  --ok:#156c39;--blue:#1b5cab;
  --focus:#1b5cab;--accent-fill:#ffb020;--on-accent:#000;
}

/* Keyboard focus is always visible, in both themes. */
:focus-visible{outline:2px solid var(--focus);outline-offset:2px}

/* ---------- Light: surfaces that were fixed dark values ---------- */
:root[data-theme="light"] header.site{background:rgba(246,244,239,.9)}
:root[data-theme="light"] .demobar{background:var(--bg2)}
:root[data-theme="light"] .demobar a{border-bottom-color:var(--muted)}
/* Amber is a fill here (dark text on amber), not a text colour. */
:root[data-theme="light"] .badge,
:root[data-theme="light"] .m.me{background:var(--accent-fill);border-color:var(--accent-fill);color:var(--on-accent)}
/* "Selected" chips are filled with the text colour, so their label takes the page colour. */
:root[data-theme="light"] .chip.on,
:root[data-theme="light"] .toggle button.on{color:var(--bg)}
:root[data-theme="light"] .btn:hover,
:root[data-theme="light"] .ep:hover,
:root[data-theme="light"] .eprow:hover{border-color:#8d897f}
:root[data-theme="light"] .ep .thumb,
:root[data-theme="light"] .eprow .t{background-color:#dcd9d1}
:root[data-theme="light"] .types button.on{background:#fbe4e2}
:root[data-theme="light"] .ok{background:#e2f4e8;border-color:#9bcfae;color:#0f4f2a}
:root[data-theme="light"] .tbl td.bad{color:#a0221a}
:root[data-theme="light"] .tbl td.good{color:#156c39}
:root[data-theme="light"] .gcol li{border-bottom-color:var(--line)}
:root[data-theme="light"] .skel{background-image:linear-gradient(90deg,#e4e1d9,#f1efe9,#e4e1d9)}
:root[data-theme="light"] .prod .pimg{background:repeating-linear-gradient(135deg,#eceae3 0 14px,#e3e0d8 14px 28px);color:var(--muted)}
:root[data-theme="light"] .prod .pimg.real{background-color:#e3e0d8}
:root[data-theme="light"] .prod .sample{color:var(--muted)}
:root[data-theme="light"] .cm.mine b{color:var(--blue)}
:root[data-theme="light"] .chat-fab,
:root[data-theme="light"] .chat{box-shadow:0 10px 30px rgba(0,0,0,.18)}

/* Control panel */
:root[data-theme="light"] .pill.ok{background:#dcf1e3;color:#125a30}
:root[data-theme="light"] .pill.red{background:#f9dfdc;color:#96201a}
:root[data-theme="light"] .pill.amber{background:#fbeac4;color:#6b4300}
:root[data-theme="light"] .pill.blue{background:#dde9f9;color:#174f93}
:root[data-theme="light"] .chip.block{border-color:#dba39d;color:#96201a}
:root[data-theme="light"] .grip{color:#77747d}
:root[data-theme="light"] .toggle span{background:#aba79d}
:root[data-theme="light"] .toggle input:checked + span{background:var(--ok)}
:root[data-theme="light"] .msg.flag{background:#f9e6e3}
:root[data-theme="light"] .msg.muted .txt{color:var(--muted)}
:root[data-theme="light"] .thumb{background:repeating-linear-gradient(135deg,#eceae3 0 8px,#e3e0d8 8px 16px)}
:root[data-theme="light"] .toast{background:#3ddc84;color:#04150b}
:root[data-theme="light"] .toast.err{background:#ff8a80}
:root[data-theme="light"] .err,
:root[data-theme="light"] .cmp .n{color:#96201a}
:root[data-theme="light"] .callout.err{border-left-color:var(--red)}
:root[data-theme="light"] input[type=time],
:root[data-theme="light"] input[type=date]{color-scheme:light}

/* Video, the site preview inside Control and the footer logo panel stay dark in both themes:
   they sit on imagery or a dark stage, so they get the dark tokens back. */
:root[data-theme="light"] .player,
:root[data-theme="light"] .shot .frame,
:root[data-theme="light"] .preview{
  --bg:#0b0b0d;--bg2:#141418;--card:#1a1a20;--card2:#1e1e25;--line:#2a2a33;--text:#f2f0ea;--muted:#a3a1a8;
  --red:#ff3b30;--amber:#ffb020;--ok:#3ddc84;--blue:#5aa9ff;color:var(--text);
}

/* ---------- The appearance control: one small icon button and a three-item menu ---------- */
.rdl-theme{position:relative;display:inline-flex;flex:none}
.rdl-theme-btn{display:inline-grid;place-items:center;width:36px;height:36px;padding:0;border:1px solid var(--line);border-radius:10px;background:transparent;color:var(--muted);cursor:pointer}
.rdl-theme-btn:hover,.rdl-theme-btn[aria-expanded="true"]{color:var(--text);border-color:var(--muted)}
.rdl-theme-menu{position:absolute;right:0;top:calc(100% + 6px);z-index:80;min-width:148px;padding:4px;border:1px solid var(--line);border-radius:10px;background:var(--card);box-shadow:0 8px 24px rgba(0,0,0,.28)}
.rdl-theme-menu[hidden]{display:none}
.rdl-theme-menu button{display:flex;align-items:center;gap:10px;width:100%;min-height:36px;padding:6px 10px;border:0;border-radius:7px;background:transparent;color:var(--text);font:500 14px/1.2 var(--body,system-ui,sans-serif);text-align:left;cursor:pointer}
.rdl-theme-menu button:hover,.rdl-theme-menu button:focus-visible{background:var(--bg2)}
.rdl-theme-menu button span:first-of-type{flex:1}
.rdl-theme-check{visibility:hidden;font-weight:700}
.rdl-theme-menu button[aria-checked="true"] .rdl-theme-check{visibility:visible}
.rdl-theme-float{position:fixed;top:12px;right:12px;z-index:80}
.rdl-theme-float .rdl-theme-btn{background:var(--card)}
.demobar .rdl-theme-btn{width:30px;height:30px;border-radius:8px}
@media(max-width:1050px){.public-header .header-actions .rdl-theme-btn{width:44px;height:44px}}
@media print{.rdl-theme{display:none}}
:root[data-theme="light"] .logo .mark{color:#fff}

/* ---------- Action buttons (#77, Chief 2026-11-20) ----------
   Every filled action button uses one brand-red token set with a white label, in both themes:
   public .btn.red / .btn.amber (Watch, Donate, Store, Search, Send, Subscribe…) and Control's
   .btn.amber plus selected tabs/segments. White on --action is 4.78:1 (dark) and 5.92:1 (light).
   Not actions, so unchanged: the yellow staging banner, PREVIEW badge, status pills, editorial
   labels, focus rings and the site announcement banner. */
:root{--action:#dc2a20;--action-hover:#b31d15;--action-active:#a51a13;--on-action:#fff}
:root[data-theme="light"]{--action:#c2231a;--action-hover:#a51a13;--action-active:#8f160f}
:root .btn.red,:root .btn.amber,:root .seg button.on,:root .tabs button.on{background:var(--action);border-color:var(--action);color:var(--on-action)}
:root .btn.red:hover,:root .btn.amber:hover{background:var(--action-hover);border-color:var(--action-hover);color:var(--on-action)}
:root .btn.red:active,:root .btn.amber:active{background:var(--action-active);border-color:var(--action-active)}
:root .btn.red:disabled,:root .btn.amber:disabled,:root .btn.red[aria-disabled="true"],:root .btn.amber[aria-disabled="true"]{opacity:.55;cursor:not-allowed}
:root .btn.red:focus-visible,:root .btn.amber:focus-visible{outline:2px solid var(--focus);outline-offset:2px}
:root .types button.on{border-color:var(--action)}

/* Menu button: dark fill gets a visible white border (Chief, #77); light theme keeps a dark one. */
:root .menu-toggle{border:1px solid #fff;color:#fff;background:#0b0b0d;border-radius:10px}
:root[data-theme="light"] .menu-toggle{border-color:#18181b;color:#18181b;background:#fff}

/* Follow & listen pills in light mode: light bar, dark icons and text, visible borders. */
:root[data-theme="light"] .sbar{background:var(--bg2);border-bottom-color:var(--line)}
:root[data-theme="light"] .sico{background:#fff;border-color:#8d897f;color:#18181b}
:root[data-theme="light"] .sico img{filter:brightness(0)}
:root[data-theme="light"] .sbar .lbl{color:#3f3d44}
:root .sico:hover{border-color:var(--action)}
:root .sico:focus-visible{outline:2px solid var(--focus);outline-offset:2px}
