/*
 * theme.css — Spotlight's design-system values.
 *
 * Direction: a quiet editorial workspace for local publishers — warm paper
 * canvas, a newsprint serif for headings, ink-black pill buttons and one
 * walnut-brown accent, in the spirit of a well-set local magazine.
 * Light opens; dark is its own palette (espresso ground, tan accent).
 */

:root {
  --canvas: #f7f5f1;
  --surface: #ffffff;
  --surface-2: #f1ede7;
  --border: #e7e1d9;
  --border-strong: #cdc4b8;
  --ink: #1d1b18;
  --muted: #6c655d;
  --accent: #1d1b18;
  --accent-hover: #3a3631;
  --accent-ink: #ffffff;
  --accent-text: #87563a;
  --accent-strong: #6b4128;
  --accent-soft: #f4e9df;
  --accent-border: #e3ccb9;
  --success: #2f7a4d;
  --success-ink: #ffffff;
  --success-soft: #e4f1e7;
  --success-strong: #286a43;
  --warning: #a35f0f;
  --warning-ink: #ffffff;
  --warning-soft: #f7ebd8;
  --warning-strong: #87500d;
  --danger: #b0464a;
  --danger-ink: #ffffff;
  --danger-soft: #fbe9e9;
  --danger-strong: #a23d41;
  --chart-1: #87563a;
  --chart-2: #1d1b18;
  --chart-3: #c08a5a;
  --chart-4: #5f7a6a;
  --chart-5: #7d6aa8;
  --chart-6: #b0464a;
  --x-band-bg: #1d1b18;
  --x-band-ink: #f7f5f1;

  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-body: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono Variable", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display-weight: 600;
  --display-tracking: -0.01em;
  --eyebrow-tracking: 0.24em;

  --radius-btn: 999px;
  --radius-card: 16px;
  --radius-input: 10px;
  --border-w: 1px;
  --border-strong-w: 1px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-raised: 0 18px 40px -12px rgba(0, 0, 0, 0.18);
  --shadow-btn: none;
  --card-pad: 1.5rem;
  --btn-weight: 500;
}

html[data-theme="dark"] {
  --canvas: #161412;
  --surface: #1f1c19;
  --surface-2: #2a2622;
  --border: #35302b;
  --border-strong: #4f4841;
  --ink: #f3efe9;
  --muted: #aaa096;
  --accent: #f3efe9;
  --accent-hover: #ddd6cd;
  --accent-ink: #161412;
  --accent-text: #dcae88;
  --accent-strong: #e8c19f;
  --accent-soft: #33271e;
  --accent-border: #5a4332;
  --success: #2f7a4d;
  --success-ink: #ffffff;
  --success-soft: #1b2d22;
  --success-strong: #7ccf9b;
  --warning: #a35f0f;
  --warning-ink: #ffffff;
  --warning-soft: #33261a;
  --warning-strong: #e0aa62;
  --danger: #b0464a;
  --danger-ink: #ffffff;
  --danger-soft: #3a1f20;
  --danger-strong: #ef9a9c;
  --chart-1: #dcae88;
  --chart-2: #f3efe9;
  --chart-3: #c08a5a;
  --chart-4: #8fb39f;
  --chart-5: #a996d4;
  --chart-6: #ef9a9c;
  --x-band-bg: #0d0c0b;
  --x-band-ink: #f3efe9;
}

/*
 * app.css — Spotlight's own pieces: the app shell, the builder and its live
 * preview, the interviewee's pages, the article editor. Tokens only.
 */

/* ---- Grounds ------------------------------------------------------------ */
.home-ground {
  background:
    radial-gradient(60rem 30rem at 85% -10%, color-mix(in srgb, var(--accent-soft) 70%, transparent), transparent 70%),
    var(--canvas);
}
.public-ground {
  background:
    radial-gradient(48rem 26rem at 50% -8%, color-mix(in srgb, var(--accent-soft) 55%, transparent), transparent 72%),
    var(--canvas);
}
.band-dark { background: var(--x-band-bg); color: var(--x-band-ink); }
.band-dark h2, .band-dark h3 { color: var(--x-band-ink); }
.step-num {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--x-band-ink) 30%, transparent);
}

.eyebrow {
  font-size: 0.7rem; font-weight: 600; letter-spacing: var(--eyebrow-tracking); text-transform: uppercase;
  color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 0.75rem;
}
.eyebrow::before, .eyebrow::after { content: ""; width: 1.75rem; height: 1px; background: var(--border-strong); }

/* ---- App shell ----------------------------------------------------------- */
.navopen { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 15.5rem; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border); z-index: var(--z-drawer);
  transform: translateX(-100%); transition: transform 280ms var(--ease-out);
}
.navopen:checked ~ .sidebar { transform: none; box-shadow: var(--shadow-raised); }
.nav-scrim { position: fixed; inset: 0; z-index: var(--z-scrim); background: color-mix(in srgb, var(--ink) 35%, transparent); display: none; }
.navopen:checked ~ .nav-scrim { display: block; }
.app-main { min-width: 0; }
.mobilebar {
  position: sticky; top: 0; z-index: var(--z-sticky); display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 0.75rem; background: color-mix(in srgb, var(--canvas) 92%, transparent);
  border-bottom: 1px solid var(--border); backdrop-filter: blur(8px);
}
@media (min-width: 768px) {
  .sidebar { transform: none; }
  .nav-scrim, .navopen:checked ~ .nav-scrim { display: none; }
  .app-main { margin-left: 15.5rem; }
  .mobilebar { display: none; }
}
.nav-link {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0.75rem; border-radius: 0.6rem;
  font-size: 0.875rem; color: var(--muted); text-decoration: none; transition: background-color 150ms, color 150ms;
  background: transparent; border: 0;
}
.nav-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-link.is-active { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.nav-link .icon { width: 1rem; height: 1rem; }
.nav-sub { padding-left: 2.35rem; font-size: 0.82rem; }
.nav-sub .icon { width: 0.9rem; height: 0.9rem; margin-left: -1.5rem; }

/* ---- Segmented control ---------------------------------------------------- */
.seg {
  display: inline-flex; gap: 0.25rem; padding: 0.25rem; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border); max-width: 100%; overflow-x: auto;
}
.seg > a, .seg > button, .seg > label > span {
  display: inline-flex; align-items: center; height: 1.75rem; padding: 0 0.8rem; border-radius: 999px; white-space: nowrap;
  font-size: 0.78rem; font-weight: 500; color: var(--muted); text-decoration: none; cursor: pointer; background: transparent; border: 0;
}
.seg-lg > a, .seg-lg > button { height: 2.1rem; padding: 0 1.05rem; font-size: 0.85rem; }
.seg > [aria-selected="true"], .seg > label > input:checked + span {
  background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 10%, transparent);
}
.seg > a:hover, .seg > button:hover { color: var(--ink); text-decoration: none; }
.seg > label > input:focus-visible + span { box-shadow: var(--ring); }

.chip-xs { height: 1.75rem; padding: 0 0.7rem; font-size: 0.75rem; }
label.chip:has(input:checked) { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent-strong); }
label.chip:has(input:focus-visible) { box-shadow: var(--ring); }

/* ---- Builder ----------------------------------------------------------------- */
.builder-tabs { gap: 1.25rem; }
.builder-panel { padding: 0.5rem 1.5rem 1.5rem; }
.builder-section { padding-top: 1.25rem; }
.builder-section + .builder-section { margin-top: 1.25rem; border-top: 1px solid var(--border); }
.section-label {
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.75rem;
}
.builder-section .field + .field, .builder-panel > .field + .field { margin-top: 1.1rem; }
.builder-foot {
  position: sticky; bottom: 0; padding: 1rem 1.5rem 1.25rem; background: var(--surface);
  border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-card) var(--radius-card);
}
.required-hint {
  display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.75rem; padding: 0.5rem 0.75rem; border-radius: 0.6rem;
  font-size: 0.75rem; background: var(--warning-soft); color: var(--warning-strong);
}
.builder-form.is-ready .required-hint { display: none; }

.range { width: 100%; height: 1.25rem; }

.avatar-gen { margin-top: 0.75rem; padding: 0.9rem; border-radius: 0.8rem; background: var(--surface-2); border: 1px solid var(--border); }

.voice-list {
  max-height: 15.5rem; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-input);
  background: var(--surface);
}
.voice-item {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0.75rem; cursor: pointer;
  border-bottom: 1px solid var(--border); transition: background-color 150ms;
}
.voice-item:last-child { border-bottom: 0; }
.voice-item:hover { background: var(--surface-2); }
.voice-item:has(input:checked) { background: var(--accent-soft); }
.voice-item input { accent-color: var(--accent-text); }
.voice-item.is-playing [data-play] { color: var(--accent-text); }

/* ---- Preview + mock browser window ------------------------------------------ */
.mock-window {
  border-radius: 1.1rem; border: 1px solid var(--border); background: var(--canvas); overflow: hidden;
  box-shadow: var(--shadow-raised);
}
.mock-bar {
  display: flex; align-items: center; gap: 0.35rem; padding: 0.6rem 0.9rem; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.mock-bar > span { width: 0.55rem; height: 0.55rem; border-radius: 999px; background: var(--border-strong); }
.mock-bar > em {
  margin-left: 0.75rem; flex: 1; min-width: 0; font-style: normal; font-size: 0.7rem; color: var(--muted);
  padding: 0.2rem 0.6rem; border-radius: 0.4rem; background: var(--surface-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mock-body {
  padding: 2rem 1.25rem 2.25rem;
  background: radial-gradient(36rem 16rem at 50% -10%, color-mix(in srgb, var(--accent-soft) 55%, transparent), transparent 70%), var(--canvas);
}
.preview .mock-body h1 { font-size: 1.9rem; }
.hero-stage { position: relative; padding-bottom: 3rem; }
.mock-transcript {
  position: absolute; right: -0.5rem; bottom: 0; width: min(19rem, 80%); padding: 0.9rem 1rem; border-radius: 1rem;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-raised);
}
@media (max-width: 640px) { .mock-transcript { position: relative; right: auto; width: auto; margin-top: -1.5rem; margin-inline: 1rem; } .hero-stage { padding-bottom: 0; } }

/* ---- Interviewee pages --------------------------------------------------------- */
.iv-card {
  border-radius: 1.25rem; border: 1px solid var(--border); background: var(--surface); padding: 1.75rem 1.5rem;
  box-shadow: 0 30px 60px -30px color-mix(in srgb, var(--ink) 25%, transparent);
}
.iv-avatar {
  position: relative; display: inline-grid; place-items: center; flex-shrink: 0; border-radius: 999px; overflow: visible;
  background: var(--accent-soft); color: var(--accent-strong); font-family: var(--font-display);
  box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--border);
}
.iv-avatar > img { width: 100%; height: 100%; object-fit: cover; border-radius: 999px; }
.iv-card .iv-avatar { margin-inline: auto; }
.iv-avatar.is-live::after {
  content: ""; position: absolute; inset: -10px; border-radius: 999px; border: 2px solid var(--accent-text); opacity: 0;
}
[data-mode="speaking"] .iv-avatar.is-live::after { animation: ring 1.6s var(--ease-out) infinite; }
[data-mode="listening"] .iv-avatar.is-live::after { animation: ring 2.8s var(--ease-out) infinite; }
@keyframes ring { 0% { transform: scale(0.92); opacity: 0.55; } 100% { transform: scale(1.25); opacity: 0; } }
.iv-rule { display: flex; justify-content: center; margin: 1rem 0; }
.iv-rule > span { position: relative; width: 6rem; height: 1px; background: var(--border); }
.iv-rule > span::after { content: ""; position: absolute; left: 50%; top: -2px; width: 5px; height: 5px; border-radius: 999px; transform: translateX(-50%); background: var(--border-strong); }
.countdown { margin-bottom: 1.25rem; }
.count-cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0.45rem 0 0.35rem;
  border-radius: 0.6rem; background: var(--danger-soft); color: var(--danger-strong); font-weight: 600; font-variant-numeric: tabular-nums;
}
.count-cell b { font-size: 1.05rem; line-height: 1.1; }
.count-cell small { font-size: 0.55rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.8; }

.transcript-box { border: 1px solid var(--border); border-radius: 0.9rem; background: var(--canvas); padding: 0.85rem 1rem; }
.live-lines { margin-top: 0.5rem; max-height: 11rem; overflow-y: auto; display: flex; flex-direction: column; gap: 0.45rem; font-size: 0.85rem; line-height: 1.45; }
.live-lines p { margin: 0; }
.live-lines .is-agent b { color: var(--accent-text); }
.live-lines:empty::before { content: "The conversation will appear here…"; color: var(--muted); font-style: italic; }
.live-dot { display: inline-block; width: 0.45rem; height: 0.45rem; border-radius: 999px; background: var(--danger); margin-right: 0.25rem; vertical-align: middle; }
[data-mode] .live-dot { animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

.video-frame {
  position: relative; aspect-ratio: 16 / 9; border-radius: 0.9rem; overflow: hidden; background: var(--x-band-bg); color: var(--x-band-ink);
  display: grid; place-items: center;
}
.video-frame iframe, .video-frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.offer {
  display: flex; align-items: flex-start; gap: 0.9rem; padding: 1.1rem 1.2rem; border-radius: 1rem; text-align: left;
  background: radial-gradient(14rem 8rem at 100% 100%, color-mix(in srgb, var(--x-band-ink) 8%, transparent), transparent 70%), var(--x-band-bg);
  color: var(--x-band-ink);
}
.offer-icon { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; flex-shrink: 0; border-radius: 999px; background: color-mix(in srgb, var(--x-band-ink) 12%, transparent); }
.offer .offer-btn { background: var(--x-band-ink); color: var(--x-band-bg); border-color: var(--x-band-ink); }
.offer .offer-btn:hover { background: color-mix(in srgb, var(--x-band-ink) 88%, transparent); }

.file-input { height: auto; padding: 0.5rem; font-size: 0.85rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.qr { border-radius: 0.5rem; background: var(--surface); padding: 0.5rem; }

/* ---- Lists, cards ----------------------------------------------------------------- */
.add-row {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.9rem; border-radius: var(--radius-card);
  border: 1px dashed var(--border-strong); color: var(--muted); font-size: 0.875rem; text-decoration: none;
}
.add-row:hover { color: var(--ink); border-color: var(--ink); text-decoration: none; }

.pick-card {
  display: block; padding: 0.8rem 0.9rem; border-radius: 0.8rem; border: 1px solid var(--border-strong); cursor: pointer;
  transition: border-color 150ms, background-color 150ms;
}
.pick-card:hover { border-color: var(--ink); }
.pick-card:has(input:checked) { border-color: var(--accent-text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-text); }
.pick-card:has(input:focus-visible) { box-shadow: var(--ring); }

.gen-wait { display: none; }
form.htmx-request .gen-wait { display: block; }

.meta-list { display: flex; flex-direction: column; gap: 0.55rem; font-size: 0.85rem; }
.meta-list > div { display: flex; justify-content: space-between; gap: 1rem; }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; text-align: right; font-weight: 500; }
.info-grid { display: grid; gap: 1rem 2rem; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }
.info-grid dt { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.info-grid dd { margin: 0.2rem 0 0; overflow-wrap: anywhere; }

/* ---- Article editor ------------------------------------------------------------------ */
.article-title {
  width: 100%; border: 0; background: transparent; padding: 0.25rem 0; color: var(--ink);
  font-family: var(--font-display); font-size: 1.85rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em;
}
.article-title:focus { outline: none; box-shadow: inset 0 -2px 0 var(--accent-border); }
.editor-toolbar {
  position: sticky; top: 0; z-index: 2; display: flex; gap: 0.15rem; margin: 0.75rem 0 0.5rem; padding: 0.3rem;
  border: 1px solid var(--border); border-radius: 0.7rem; background: var(--surface); width: fit-content; max-width: 100%; overflow-x: auto;
}
.editor-toolbar button {
  display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 0.45rem; color: var(--muted); background: transparent; border: 0;
}
.editor-toolbar button:hover { background: var(--surface-2); color: var(--ink); }
.article-body { min-height: 16rem; padding: 0.5rem 0 1.5rem; max-width: 70ch; outline: none; }
.article-body:focus { outline: none; }
.article-body h2 { font-size: 1.35rem; font-weight: 600; }
.article-body h3 { font-size: 1.1rem; font-weight: 600; }
.article-body a { color: var(--accent-text); text-decoration: underline; }

.social-card { border: 1px solid var(--border); border-radius: 0.9rem; padding: 0.9rem 1rem 1rem; background: var(--canvas); }

/* ---- Transcript ------------------------------------------------------------------------- */
.transcript { display: flex; flex-direction: column; gap: 1rem; padding: 1.25rem 1.25rem 1.5rem; }
.transcript li { max-width: 46rem; }
.transcript .who { display: flex; align-items: baseline; gap: 0.5rem; font-size: 0.75rem; font-weight: 600; margin-bottom: 0.2rem; }
.transcript .who span { font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.transcript .is-agent .who { color: var(--accent-text); }
.transcript li > p:last-child { line-height: 1.6; }
.transcript .is-guest > p:last-child { padding-left: 0.85rem; border-left: 2px solid var(--border-strong); }

/* ---- Motion: one moment — the interview stage arriving. ------------------------------------ */
[data-stage]:not([hidden]) { animation: fade-up 360ms var(--ease-out) both; }
html.reduced-motion [data-stage] { animation: none; }
