/* DIGITAL BRIDGE RDC THEME — tokens from the brand guideline, plus a dark-mode mapping. */
:root {
  --color-primary-accent: #41B6E6;
  --color-primary-hover: #2FA8D7;
  --color-secondary-brand: #2E294E;
  --color-surface-white: #FFFFFF;
  --color-surface-subtle: #F8FAFC;
  --color-border-ui: #E2E8F0;
  --color-text-headers: #2E294E;
  --color-text-main: #0F172A;
  --color-text-secondary: #334155;
  --color-text-on-accent: #FFFFFF;
  --color-danger: #B42318;
  --color-ok: #067647;
  --spacing-unit: 1rem;
  --border-radius-ui: 14px;
  --shadow-subtle: 0 8px 24px rgba(15, 23, 42, 0.08);
  --color-input-bg: #FFFFFF;
  --accent-text: #1F7FA8; /* turquoise darkened for readable text on white */
}

:root[data-theme="dark"] {
  --color-surface-white: #0E1424;
  --color-surface-subtle: #131A2E;
  --color-border-ui: #28314A;
  --color-text-headers: #E8ECFF;
  --color-text-main: #E6EAF5;
  --color-text-secondary: #A9B4CF;
  --color-input-bg: #0A0F1D;
  --shadow-subtle: 0 8px 24px rgba(0, 0, 0, 0.45);
  --accent-text: #6CCBF0;
  --color-danger: #FF8A80;
  --color-ok: #5BD69B;
}

* { box-sizing: border-box; }
/* Author display rules (.actions, .panel…) must never override the hidden attribute. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background-color: var(--color-surface-white);
  color: var(--color-text-main);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}

h1, h2, h3 {
  font-family: 'Space Grotesk', 'Poppins', sans-serif;
  font-weight: 700;
  color: var(--color-text-headers);
  margin: 0 0 var(--spacing-unit);
  letter-spacing: -0.02em;
}
h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; }
h2 { font-size: 1.4rem; line-height: 1.2; margin-bottom: .5rem; }
h3 { font-size: 1.1rem; margin-bottom: .25rem; }
p { margin: 0 0 var(--spacing-unit); max-width: 75ch; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.caption { font-size: .85rem; font-weight: 500; color: var(--color-text-secondary); }
.text-highlight {
  display: block; color: var(--accent-text); font-weight: 600; text-transform: uppercase;
  font-size: .875rem; letter-spacing: .05em; margin-bottom: .5rem;
}

/* Header */
.topbar { border-bottom: 1px solid var(--color-border-ui); background: var(--color-surface-subtle); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .6rem; padding-bottom: .6rem; }
.brand { display: inline-flex; text-decoration: none; }
/* Logo is shown untouched (no recolouring, no filters). In dark mode it sits on a white plate so its navy text stays legible. */
.logo-plate { display: inline-flex; background: #FFFFFF; border-radius: 10px; padding: 6px 10px; }
.logo-plate img { display: block; height: clamp(36px, 6vw, 54px); width: auto; }
.toggles { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; justify-content: flex-end; }

/* Toggle switches */
.switch { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; font-size: .8rem; font-weight: 600; color: var(--color-text-secondary); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.slider { position: relative; width: 44px; height: 24px; border-radius: 999px; background: var(--color-primary-accent); transition: background .2s; flex: none; }
.slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch input:checked + .slider::after { transform: translateX(20px); }
.switch input:focus-visible + .slider { outline: 3px solid var(--color-secondary-brand); outline-offset: 2px; }
:root[data-theme="dark"] .switch input:focus-visible + .slider { outline-color: #fff; }

/* Layout */
.layout { display: grid; grid-template-columns: 290px 1fr; gap: 24px; padding-top: 24px; padding-bottom: 48px; align-items: start; }
main { min-width: 0; }
.card-ui { background: var(--color-surface-white); border: 1px solid var(--color-border-ui); border-radius: var(--border-radius-ui); box-shadow: var(--shadow-subtle); }
.sidebar { padding: 20px; position: sticky; top: 90px; background: var(--color-surface-subtle); }
fieldset { border: 1px solid var(--color-border-ui); border-radius: 10px; padding: 12px 14px 14px; margin: 14px 0 0; }
legend { font-family: 'Space Grotesk', sans-serif; font-weight: 700; color: var(--color-text-headers); padding: 0 6px; }
.sidebar label { display: block; font-size: .8rem; font-weight: 600; margin: 10px 0 4px; color: var(--color-text-secondary); }

input[type="text"], input[type="password"], input[type="url"], select {
  width: 100%; padding: .65rem .8rem; border: 1px solid var(--color-border-ui); border-radius: 10px;
  background: var(--color-input-bg); color: var(--color-text-main); font: inherit; font-size: .95rem;
}
input:focus-visible, select:focus-visible, .text-box:focus-visible, button:focus-visible { outline: 3px solid var(--color-primary-accent); outline-offset: 2px; }

/* Hero */
.hero { padding: 8px 0 24px; }
.link-form { display: flex; gap: 12px; margin-top: 1.25rem; }
.link-form input { flex: 1; padding: .85rem 1rem; font-size: 1rem; }

/* Buttons */
.btn-primary {
  background-color: var(--color-primary-accent); color: var(--color-text-on-accent);
  padding: .75rem 1.6rem; border: none; font-weight: 600; font-family: 'Inter', sans-serif; font-size: .95rem; cursor: pointer;
  border-radius: var(--border-radius-ui); transition: background-color .2s ease, transform .1s ease;
  display: inline-flex; align-items: center; justify-content: center; white-space: nowrap;
  box-shadow: 0 4px 6px -1px rgba(65, 182, 230, 0.2);
}
.btn-primary:hover:not(:disabled) { background-color: var(--color-primary-hover); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-secondary, .btn-ghost {
  background: transparent; color: var(--color-text-headers); border: 1.5px solid var(--color-primary-accent);
  padding: .55rem 1.1rem; border-radius: var(--border-radius-ui); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer;
}
.btn-secondary:hover:not(:disabled), .btn-ghost:hover { background: rgba(65, 182, 230, .12); }
.btn-secondary:disabled { opacity: .5; cursor: not-allowed; }
.menu-btn { display: none; }

/* Panels */
.panel { padding: 20px 22px; margin-top: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: .5rem; }
.panel-head h2 { margin: 0; }
.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.controls select { width: auto; min-width: 190px; }
.check { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; font-weight: 500; color: var(--color-text-secondary); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.video-card { display: flex; gap: 18px; align-items: center; padding: 14px; margin-top: 4px; }
.video-card img { width: 160px; height: auto; border-radius: 10px; flex: none; background: var(--color-surface-subtle); }

.text-box {
  max-height: 460px; overflow: auto; padding: 14px 16px; border: 1px solid var(--color-border-ui);
  border-radius: 10px; background: var(--color-surface-subtle); font-size: .95rem; margin-top: 10px;
}
.line { display: flex; gap: 12px; padding: 2px 0; }
.line .ts { flex: none; width: 4.6rem; color: var(--accent-text); font-variant-numeric: tabular-nums; font-weight: 600; font-size: .8rem; padding-top: .15rem; }
.rendered h1, .rendered h2, .rendered h3 { font-size: 1.1rem; margin: 1rem 0 .4rem; }
.rendered h1:first-child, .rendered h2:first-child, .rendered h3:first-child { margin-top: 0; }
.rendered p { max-width: none; margin: 0 0 .7rem; }
.rendered ul, .rendered ol { margin: 0 0 .8rem 1.2rem; padding: 0; }

.msg { margin: .75rem 0 0; font-weight: 500; font-size: .92rem; }
.msg.error { color: var(--color-danger); }
.msg.ok { color: var(--color-ok); }
.msg.info { color: var(--color-text-secondary); }

figure { margin: 14px 0 0; }
figure img { display: block; max-width: 100%; max-height: 80vh; margin: 0 auto; border-radius: 10px; border: 1px solid var(--color-border-ui); }
.foot { margin-top: 32px; }

.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; margin-right: .5rem; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 520px) {
  .container { padding: 0 16px; }
  .toggles { gap: .6rem .9rem; }
  .switch { gap: .3rem; }
  .controls select { min-width: 0; width: 100%; }
  .controls { width: 100%; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; display: none; }
  .sidebar.open { display: block; }
  .menu-btn { display: inline-flex; }
  .link-form { flex-direction: column; }
  .video-card { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
