/* ==========================================================================
   AutoSegmentor Live Showcase — Midnight Slate + Indigo/Cyan Design System
   Matches the PyQt5 Desktop Studio (autosegmentor/ui/UITheme.py)
   ========================================================================== */

:root {
  --indigo: #6366f1;
  --indigo-light: #818cf8;
  --cyan: #38bdf8;
  --emerald: #34d399;
  --amber: #fbbf24;
  --rose: #f87171;
  --grad: linear-gradient(135deg, #6366f1 0%, #38bdf8 100%);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Ubuntu, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", "Fira Code", Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0b0d13;
  --bg-alt: #10131c;
  --surface: #161a26;
  --surface-2: #1e2334;
  --border: #283047;
  --border-hover: #425075;
  --text: #edf2f7;
  --text-muted: #9aa5bd;
  --text-dim: #667391;
  --nav-bg: rgba(11, 13, 19, 0.82);
  --shadow: 0 24px 56px -20px rgba(0, 0, 0, 0.72);
  --kbd-bg: #23293d;
}

[data-theme="light"] {
  --bg: #f8fafc;
  --bg-alt: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-hover: #94a3b8;
  --text: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  --nav-bg: rgba(248, 250, 252, 0.86);
  --shadow: 0 20px 44px -20px rgba(15, 23, 42, 0.16);
  --kbd-bg: #eef2ff;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
}

body {
  margin: 0;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre, kbd { font-family: var(--font-mono); }

kbd {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--cyan);
  background: var(--kbd-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: nowrap;
}

[data-theme="light"] kbd { color: #4338ca; }

.container {
  width: min(1160px, 92vw);
  margin: 0 auto;
}

.hidden { display: none !important; }

/* ── Navbar ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 700;
  text-decoration: none !important;
}

.brand-name { font-size: 1.02rem; letter-spacing: -0.02em; }

.version-chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
}

[data-theme="light"] .version-chip {
  color: #4338ca;
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.28);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.35rem;
  font-size: 0.88rem;
  font-weight: 500;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.nav-links a:hover { color: var(--text); }
.nav-wiki-link { color: var(--cyan) !important; font-weight: 600; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.95rem;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.icon-btn:hover { border-color: var(--cyan); transform: translateY(-1px); }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-dark { display: none; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.72rem 1.35rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none !important;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.btn:hover { transform: translateY(-2px); }

.btn-sm { padding: 0.45rem 0.95rem; font-size: 0.83rem; border-radius: 8px; }

.btn-primary {
  background: var(--grad);
  color: #ffffff !important;
  box-shadow: 0 10px 26px -8px rgba(99, 102, 241, 0.65);
}
.btn-primary:hover { box-shadow: 0 14px 32px -8px rgba(56, 189, 248, 0.6); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text) !important;
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--cyan); }

.btn-outline {
  background: transparent;
  color: var(--text) !important;
  border-color: var(--border);
}
.btn-outline:hover { border-color: var(--cyan); background: var(--surface); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted) !important;
}
.btn-ghost:hover { color: var(--text) !important; }

/* ── Hero ── */
.hero {
  position: relative;
  padding: 4.5rem 0 3.5rem;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.hero-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 65% 55% at 50% -12%, rgba(99, 102, 241, 0.26), transparent 68%),
    radial-gradient(ellipse 45% 45% at 85% 25%, rgba(56, 189, 248, 0.16), transparent 62%);
}

[data-theme="light"] .hero-glow {
  background:
    radial-gradient(ellipse 65% 55% at 50% -12%, rgba(99, 102, 241, 0.14), transparent 68%),
    radial-gradient(ellipse 45% 45% at 85% 25%, rgba(56, 189, 248, 0.12), transparent 62%);
}

.hero-inner {
  position: relative;
  text-align: center;
  max-width: 900px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.34rem 0.95rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cyan);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.28);
  margin-bottom: 1.35rem;
}

[data-theme="light"] .eyebrow {
  color: #4338ca;
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.28);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.22);
}

.hero h1 {
  margin: 0 auto 1.15rem;
  font-size: clamp(2.15rem, 5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.035em;
  max-width: 17ch;
}

.gradient-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-lead {
  margin: 0 auto 2rem;
  font-size: 1.08rem;
  color: var(--text-muted);
  max-width: 64ch;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
  margin-bottom: 1.65rem;
}

.hero-cmd {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.52rem 0.65rem 0.52rem 1rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.86rem;
  max-width: 100%;
  margin-bottom: 2.5rem;
}

.cmd-prompt { color: var(--emerald); font-family: var(--font-mono); font-weight: 700; }

.copy-btn {
  padding: 0.32rem 0.72rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.copy-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.copy-btn-xs { padding: 0.22rem 0.6rem; font-size: 0.74rem; }

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
}

.stat-card {
  padding: 1.1rem 1rem;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.stat-val {
  font-size: 1.18rem;
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-lbl { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ── Sections ── */
.section { padding: 4.25rem 0; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.section-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: var(--cyan);
  margin-bottom: 0.4rem;
}

[data-theme="light"] .section-tag { color: #4f46e5; }

.section-head h2 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  font-weight: 800;
  letter-spacing: -0.025em;
}

.section-sub {
  margin: 0.45rem 0 0;
  color: var(--text-muted);
  max-width: 62ch;
  font-size: 0.95rem;
}

/* ── Segmented Controls & Badges ── */
.theater-controls {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.3rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.48rem 0.9rem;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border-hover);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-emerald {
  color: var(--emerald);
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.badge-amber {
  color: var(--amber);
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

[data-theme="light"] .badge-emerald { color: #047857; }
[data-theme="light"] .badge-amber { color: #b45309; }

/* ── Demo Video Theater ── */
.demo-grid { display: grid; gap: 1.5rem; }
.demo-grid.mode-single { grid-template-columns: 1fr; max-width: 980px; margin: 0 auto; }
.demo-grid.mode-both { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.video-card {
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease;
}

.video-card:hover { border-color: var(--indigo-light); }

.video-chrome {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.72rem 1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.chrome-left, .chrome-right {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

.window-dots { display: inline-flex; gap: 0.38rem; }
.window-dots i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.window-dots i:nth-child(1) { background: #f87171; }
.window-dots i:nth-child(2) { background: #fbbf24; }
.window-dots i:nth-child(3) { background: #34d399; }

.chrome-title { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600; }

.video-stage {
  background: #000000;
  aspect-ratio: 16 / 9;
}

.video-stage video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-meta { padding: 1rem 1.15rem 1.15rem; }

.chapters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.chapter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.34rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chapter-btn span {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--cyan);
}

.chapter-btn:hover,
.chapter-btn.active {
  color: var(--text);
  border-color: var(--cyan);
  background: rgba(56, 189, 248, 0.1);
}

.video-desc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.callout-bar {
  margin-top: 1.75rem;
  padding: 1rem 1.25rem;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
}

/* ── Steps & Bento ── */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.step-card {
  padding: 1.35rem;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--grad);
  color: #ffffff;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.84rem;
  margin-bottom: 0.85rem;
}

.step-card h3 { margin: 0 0 0.45rem; font-size: 1rem; }
.step-card p { margin: 0; font-size: 0.86rem; color: var(--text-muted); }

.bento-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.bento-card {
  padding: 1.4rem;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.bento-card:hover { transform: translateY(-3px); border-color: var(--indigo-light); }
.bento-icon { font-size: 1.4rem; margin-bottom: 0.6rem; }
.bento-card h3 { margin: 0 0 0.45rem; font-size: 1rem; }
.bento-card p { margin: 0; font-size: 0.86rem; color: var(--text-muted); }

/* ── Studio Spotlight ── */
.studio-showcase {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 1.5rem;
  align-items: center;
}

.studio-image-wrap {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: #000;
}

.studio-image-wrap img { display: block; width: 100%; height: auto; }

.studio-callouts { display: grid; gap: 0.85rem; }

.callout-item {
  padding: 1rem 1.15rem;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.callout-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--cyan);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.callout-item h4 { margin: 0 0 0.25rem; font-size: 0.95rem; }
.callout-item p { margin: 0; font-size: 0.84rem; color: var(--text-muted); }

/* ── Shortcuts Explorer ── */
.search-input {
  width: min(320px, 100%);
  padding: 0.56rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.86rem;
}

.search-input:focus { outline: none; border-color: var(--cyan); }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.35rem;
}

.pill-btn {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill-btn:hover { color: var(--text); border-color: var(--border-hover); }
.pill-btn.active {
  background: var(--grad);
  color: #ffffff;
  border-color: transparent;
}

.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 0.75rem;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.78rem 1rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.shortcut-keys {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.3rem;
}

/* ── Quickstart Code Panel ── */
.code-panel {
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.code-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.72rem 1.15rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.code-panel pre {
  margin: 0;
  padding: 1.25rem;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.7;
}

/* ── Wiki Bridge Cards ── */
.wiki-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.wiki-card {
  display: block;
  padding: 1.4rem;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text) !important;
  text-decoration: none !important;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.wiki-card:hover {
  transform: translateY(-3px);
  border-color: var(--cyan);
  box-shadow: 0 16px 32px -18px rgba(56, 189, 248, 0.35);
}

.wiki-kicker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--indigo-light);
  margin-bottom: 0.35rem;
}

.wiki-card h3 { margin: 0 0 0.45rem; font-size: 1.02rem; }
.wiki-card p { margin: 0; font-size: 0.85rem; color: var(--text-muted); }

/* ── Footer ── */
.footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.86rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer-brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--text); }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--text); }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.65rem 1.1rem;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--cyan);
  box-shadow: var(--shadow);
  font-size: 0.84rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 100;
}

.toast.show { opacity: 1; transform: translateY(0); }

/* ── Responsive ── */
@media (max-width: 960px) {
  .nav-links { display: none; }
  .stat-strip, .steps-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bento-grid, .wiki-grid, .demo-grid.mode-both { grid-template-columns: 1fr; }
  .studio-showcase { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .hero { padding: 3rem 0 2.5rem; }
  .stat-strip, .steps-grid { grid-template-columns: 1fr; }
}
