/* Voxa UI. No build step, no framework, no webfont fetch — the CSP is strict
   ('self' only) and the box this ships to is a shared-core ARM instance. */

:root {
  --ink:        #0e0f13;
  --ink-2:      #15171d;
  --ink-3:      #1c1f27;
  --line:       #272b35;
  --line-soft:  #1f232c;
  --text:       #e9e7e2;
  --text-dim:   #9aa0ad;
  --text-faint: #6b7280;
  --accent:     #e8845c;
  --accent-dim: #b8603c;
  --good:       #5db98b;
  --warn:       #d9a441;
  --bad:        #d9615c;
  --radius:     12px;
  --serif: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* The `hidden` attribute is only a UA-stylesheet `display: none`, so ANY author
   `display` rule silently beats it — and this file sets display on .auth (grid),
   .field (block) and .grid (grid), all of which are toggled with `hidden`.
   Without this, `el.hidden = true` sets the property, reports true, and changes
   nothing on screen: signing in rendered the app *underneath* a login card that
   never went away. This rule is the whole reason `hidden` is usable here, so
   !important is load-bearing rather than lazy. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 30px; }
h2 { font-size: 19px; }
p { margin: 0; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }

/* --- brand ------------------------------------------------------------- */
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-size: 22px; font-weight: 600;
  letter-spacing: -0.02em; color: var(--text);
}
.brand-mark {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(232,132,92,.16), 0 0 0 9px rgba(232,132,92,.07);
}
.brand-sub { color: var(--text-dim); font-size: 14px; margin-top: 10px; }
.brand-btn { background: none; border: 0; cursor: pointer; padding: 0; }

/* --- auth -------------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--ink-2); border: 1px solid var(--line);
  border-radius: 16px; padding: 32px;
}
.tabs { display: flex; gap: 4px; margin: 26px 0 20px; background: var(--ink-3); padding: 4px; border-radius: 10px; }
.tab {
  flex: 1; padding: 8px; border: 0; border-radius: 7px; cursor: pointer;
  background: transparent; color: var(--text-dim); font-size: 14px;
}
.tab.is-active { background: var(--ink); color: var(--text); }

/* --- forms ------------------------------------------------------------- */
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.hint { display: block; color: var(--text-faint); font-size: 12px; margin-top: 6px; }

input[type=text], input[type=email], input[type=password], input[type=url], textarea, select {
  width: 100%; padding: 10px 12px;
  background: var(--ink); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px;
  outline: none; transition: border-color .12s, box-shadow .12s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px rgba(232,132,92,.13);
}
textarea { resize: vertical; line-height: 1.5; }
input[type=file] { color: var(--text-dim); font-size: 13px; }

.btn {
  padding: 9px 16px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: var(--ink-3); color: var(--text);
  transition: background .12s, border-color .12s, opacity .12s;
  white-space: nowrap;
}
.btn:hover { background: #232732; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #221009; font-weight: 600; }
.btn-primary:hover { background: #f0906a; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--ink-3); }
.btn-block { width: 100%; display: block; margin-top: 4px; }
.btn-sm { padding: 5px 11px; font-size: 13px; }

.form-error {
  margin-top: 12px; padding: 9px 12px; border-radius: 8px; font-size: 13px;
  background: rgba(217,97,92,.11); border: 1px solid rgba(217,97,92,.32); color: #f0a6a3;
}

/* --- chrome ------------------------------------------------------------ */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 15px 28px; border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; background: rgba(14,15,19,.9);
  backdrop-filter: blur(8px); z-index: 10;
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
.who { color: var(--text-dim); font-size: 13px; }
.credits {
  font-size: 12px; padding: 4px 10px; border-radius: 20px;
  background: rgba(232,132,92,.12); border: 1px solid rgba(232,132,92,.3); color: var(--accent);
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 34px 28px 80px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 26px; }
.head-actions { display: flex; gap: 8px; flex-shrink: 0; }
.lede { color: var(--text-dim); margin-top: 7px; max-width: 60ch; }
.back {
  background: none; border: 0; color: var(--text-dim); cursor: pointer;
  padding: 0; margin-bottom: 18px; font-size: 14px;
}
.back:hover { color: var(--text); }

/* --- shows grid -------------------------------------------------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card {
  background: var(--ink-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; cursor: pointer;
  transition: border-color .14s, transform .14s;
}
.card:hover { border-color: #3a404e; transform: translateY(-2px); }
.card h3 { font-size: 17px; margin-bottom: 8px; }
.card-brief {
  color: var(--text-dim); font-size: 13px; margin-bottom: 14px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.pill {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  padding: 3px 9px; border-radius: 20px; border: 1px solid var(--line); color: var(--text-dim);
}
.pill-research { border-color: rgba(93,185,139,.36); color: var(--good); background: rgba(93,185,139,.09); }
.pill-sourced  { border-color: rgba(93,141,185,.36); color: #7fb0d8; background: rgba(93,141,185,.09); }

.meta-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.empty { text-align: center; padding: 70px 20px; border: 1px dashed var(--line); border-radius: 16px; }
.empty p { color: var(--text-dim); margin: 10px 0 20px; }

/* --- feed bar ---------------------------------------------------------- */
.feed-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  background: var(--ink-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 20px; margin-bottom: 28px; flex-wrap: wrap;
}
.feed-bar p { color: var(--text-dim); font-size: 13px; margin-top: 3px; }
.feed-copy { display: flex; gap: 8px; align-items: center; flex: 1; min-width: 280px; max-width: 460px; }
.feed-copy input { font-family: var(--mono); font-size: 12px; color: var(--text-dim); }

/* --- columns ----------------------------------------------------------- */
.cols { display: grid; grid-template-columns: 1fr 330px; gap: 30px; align-items: start; }
.col > h2 { margin-bottom: 14px; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } }

/* --- episodes ---------------------------------------------------------- */
.episode {
  background: var(--ink-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 10px;
}
.episode-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.episode-num { color: var(--text-faint); font-family: var(--mono); font-size: 12px; }
.episode h3 { font-size: 16px; margin: 3px 0 5px; }
.episode-focus {
  color: var(--text-dim); font-size: 13px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.episode-actions { display: flex; gap: 7px; margin-top: 13px; flex-wrap: wrap; }
.episode audio { width: 100%; margin-top: 13px; height: 36px; }

.status { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.status-ready     { background: rgba(93,185,139,.13); color: var(--good); }
.status-planned   { background: rgba(107,114,128,.16); color: var(--text-dim); }
.status-queued,
.status-scripting,
.status-rendering { background: rgba(217,164,65,.13); color: var(--warn); }
.status-failed    { background: rgba(217,97,92,.13); color: var(--bad); }

.episode-error {
  margin-top: 11px; padding: 9px 12px; border-radius: 8px; font-size: 13px;
  background: rgba(217,97,92,.08); border: 1px solid rgba(217,97,92,.24); color: #eda19e;
}

/* Working indicator — the pipeline can run for minutes; silence reads as a hang. */
.working { display: inline-flex; align-items: center; gap: 7px; color: var(--warn); font-size: 13px; margin-top: 11px; }
.spinner {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid rgba(217,164,65,.28); border-top-color: var(--warn);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } .card:hover { transform: none; } }

/* --- sources ----------------------------------------------------------- */
.source {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--ink-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 13px; margin-bottom: 8px;
}
.source-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-meta { color: var(--text-faint); font-size: 11px; font-family: var(--mono); }
.source-x { background: none; border: 0; color: var(--text-faint); cursor: pointer; font-size: 16px; padding: 0 4px; }
.source-x:hover { color: var(--bad); }

.source-form { margin-top: 16px; background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px; }
.source-form input, .source-form textarea { margin-bottom: 9px; }
.seg { display: flex; gap: 3px; background: var(--ink-3); padding: 3px; border-radius: 8px; margin-bottom: 12px; }
.seg-btn { flex: 1; padding: 6px; border: 0; border-radius: 6px; background: transparent; color: var(--text-dim); cursor: pointer; font-size: 13px; }
.seg-btn.is-active { background: var(--ink); color: var(--text); }

/* --- dialogs ----------------------------------------------------------- */
dialog {
  background: var(--ink-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 16px;
  padding: 28px; width: min(560px, 92vw); max-height: 88vh;
}
dialog::backdrop { background: rgba(0,0,0,.62); backdrop-filter: blur(3px); }
dialog h2 { margin-bottom: 20px; }
dialog menu { display: flex; justify-content: flex-end; gap: 9px; margin: 22px 0 0; padding: 0; }
.row { display: flex; gap: 12px; }
.row > .field { flex: 1; }

.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.mode {
  border: 1px solid var(--line); border-radius: 10px; padding: 13px;
  cursor: pointer; display: block; transition: border-color .12s, background .12s;
}
.mode.is-active { border-color: var(--accent-dim); background: rgba(232,132,92,.06); }
.mode input { position: absolute; opacity: 0; pointer-events: none; }
.mode strong { display: block; font-size: 14px; margin-bottom: 4px; }
.mode span { color: var(--text-dim); font-size: 12px; line-height: 1.45; }

.cadence-note {
  font-size: 13px; color: var(--accent); background: rgba(232,132,92,.08);
  border: 1px solid rgba(232,132,92,.22); border-radius: 8px; padding: 9px 12px;
}

.transcript-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
#transcript-dialog { width: min(760px, 94vw); }
.transcript { overflow-y: auto; max-height: 66vh; }
.turn { display: grid; grid-template-columns: 58px 1fr; gap: 14px; margin-bottom: 15px; }
.turn-who { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding-top: 2px; }
.turn-host  { color: var(--accent); }
.turn-guest { color: #7fb0d8; }
.turn p { font-size: 14.5px; line-height: 1.65; }
.citations { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.citations h3 { font-size: 14px; margin-bottom: 10px; }
.citations a { color: var(--text-dim); font-size: 13px; display: block; margin-bottom: 6px; text-decoration: none; }
.citations a:hover { color: var(--accent); }

/* --- toast ------------------------------------------------------------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink-3); border: 1px solid var(--line);
  padding: 11px 18px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45); z-index: 100;
}
.toast.is-bad { border-color: rgba(217,97,92,.45); color: #f0a6a3; }

/* ------------------------------------------------------------- seasons ---- */
/* Episodes are grouped into collapsible folders. A show that runs for a year
   otherwise presents fifty cards in one column, and the one you want is never
   the one on screen. */
.season {
  border: 1px solid var(--line, #2a2a32);
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
}
.season-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  background: var(--panel-2, #16161c);
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.season-head:hover { background: var(--panel-3, #1c1c24); }
.season-caret {
  display: inline-block;
  transition: transform .15s ease;
  opacity: .6;
  font-size: .9em;
}
.season.is-open .season-caret { transform: rotate(90deg); }
.season-name { font-weight: 600; }
.season-meta { margin-left: auto; opacity: .6; font-size: .85em; }

/* Collapsed by default; the class is what opens it, so the markup ships closed
   and nothing flashes open on load. */
.season-body { display: none; padding: 10px 12px 4px; }
.season.is-open .season-body { display: block; }

/* --------------------------------------------------------------- legal ---- */
/* Readable prose column. Terms nobody can read protect nobody, so this is set
   for reading rather than for skipping past. */
.legal { max-width: 760px; }
.legal h1 { margin-bottom: .3em; }
.legal h2 { margin-top: 1.8em; font-size: 1.15rem; }
.legal p, .legal li { line-height: 1.65; }
.legal ul { padding-left: 1.2em; }
.legal li { margin-bottom: .45em; }
.legal code { font-size: .9em; opacity: .85; }
.legal-toc {
  display: flex; flex-wrap: wrap; gap: 10px 16px;
  margin: 20px 0 8px; padding-bottom: 16px;
  border-bottom: 1px solid var(--line, #2a2a32);
  font-size: .9rem;
}
.legal .contact { padding: 10px 12px; border-radius: 8px; background: var(--panel-2, #16161c); }
.legal-foot { margin-top: 2.5em; opacity: .6; font-size: .9rem; }

.site-foot {
  display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between;
  max-width: 1100px; margin: 48px auto 24px; padding: 16px 20px 0;
  border-top: 1px solid var(--line, #2a2a32);
  font-size: .85rem; opacity: .65;
}
