/* ═══════════════════════════════════════════════════════════
   Parcane — Design System
   
   The Weaver's Study: dark fantasy aesthetic inspired by the
   Parcae (Roman Fates) and arcane knowledge. Golden threads
   on midnight indigo. Swappable via CSS custom properties.
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700&family=Inter:wght@400;500;600;700&family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

/* ── Tokens ──────────────────────────────────────────────── */

:root {
  /* Warm neutrals */
  --bg:          #faf8f5;
  --bg-subtle:   #f3f0eb;
  --surface:     #ffffff;
  --surface-alt: #f8f6f2;
  --border:      rgba(120, 95, 70, 0.12);
  --border-strong: rgba(120, 95, 70, 0.22);
  
  /* Text */
  --ink:         #2c2520;
  --ink-muted:   #6b5e52;
  --ink-faint:   #9a8d80;
  
  /* Accent — warm amber, not techy blue */
  --accent:      #b86e2c;
  --accent-hover:#a35f22;
  --accent-soft: rgba(184, 110, 44, 0.08);
  --accent-border: rgba(184, 110, 44, 0.2);
  
  /* Success / Status */
  --success:     #4a8c5c;
  --success-bg:  rgba(74, 140, 92, 0.08);
  --error:       #c0392b;
  --error-bg:    rgba(192, 57, 43, 0.06);
  
  /* Layout */
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --shadow-sm:   0 1px 3px rgba(44, 37, 32, 0.06);
  --shadow-md:   0 4px 16px rgba(44, 37, 32, 0.08);
  --shadow-lg:   0 12px 40px rgba(44, 37, 32, 0.1);
  
  --max-width:   960px;
  --header-h:    64px;
}

/* ── Dark Theme — The Weaver's Study ─────────────────────── */
/* Deep indigo + golden thread palette inspired by the Parcae */

[data-theme="dark"] {
  --bg:          #0b0d17;
  --bg-subtle:   #10132a;
  --surface:     #161929;
  --surface-alt: #1c1f35;
  --border:      rgba(212, 163, 77, 0.12);
  --border-strong: rgba(212, 163, 77, 0.22);

  --ink:         #e8e0d4;
  --ink-muted:   #a89e90;
  --ink-faint:   #6e6458;

  /* Golden thread accent */
  --accent:      #d4a34d;
  --accent-hover:#f0c86e;
  --accent-soft: rgba(212, 163, 77, 0.10);
  --accent-border: rgba(212, 163, 77, 0.25);

  /* Arcane glow token — used for hover effects and emphasis */
  --glow:        rgba(212, 163, 77, 0.35);
  --glow-strong: rgba(240, 200, 110, 0.5);

  --success:     #6aad7c;
  --success-bg:  rgba(106, 173, 124, 0.1);
  --error:       #e05a4c;
  --error-bg:    rgba(224, 90, 76, 0.1);

  --shadow-sm:   0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md:   0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg:   0 12px 40px rgba(0, 0, 0, 0.5);

  color-scheme: dark;
}

/* Dark theme overrides for elements with hardcoded colors */
[data-theme="dark"] .site-header {
  background: rgba(11, 13, 23, 0.92);
}

[data-theme="dark"] .mode-tab:hover {
  background: rgba(22, 25, 41, 0.5);
}

[data-theme="dark"] textarea,
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] select {
  background: var(--surface);
  color: var(--ink);
}

/* ── Reset & Base ────────────────────────────────────────── */

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

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 {
  font-family: 'Lora', Georgia, serif;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
}

/* Arcane display font for dark theme headlines */
[data-theme="dark"] h1,
[data-theme="dark"] h2 {
  font-family: 'Cinzel', 'Lora', Georgia, serif;
  font-weight: 500;
  letter-spacing: 0.02em;
}

p { margin: 0 0 1em; }

/* ── Layout ──────────────────────────────────────────────── */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.page-section {
  padding: 80px 0;
}

.page-section + .page-section {
  border-top: 1px solid var(--border);
}

/* ── Header ──────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(250, 248, 245, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.site-logo {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-logo .logo-icon {
  font-size: 1.4rem;
}

.logo-icon-img {
  border-radius: 6px;
  object-fit: contain;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-nav a {
  color: var(--ink-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s;
}

.header-nav a:hover {
  color: var(--ink);
  text-decoration: none;
}

.header-nav a.btn-primary {
  color: #fff;
}

.header-nav a.btn-primary:hover {
  color: #fff;
}

/* ── Buttons ─────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: #fff;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--ink-faint);
  text-decoration: none;
}

.btn-large {
  font-size: 1rem;
  padding: 14px 28px;
  border-radius: var(--radius-lg);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* ── Cards ───────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

/* ── Form Elements ───────────────────────────────────────── */

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.form-hint {
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin-top: 4px;
}

textarea, input[type="text"], input[type="email"], input[type="password"], input[type="number"] {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
  resize: vertical;
}

textarea:focus, input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  min-height: 180px;
  line-height: 1.6;
}

select {
  font: inherit;
  font-size: 0.95rem;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

/* ── Checkbox / Consent ──────────────────────────────────── */

.consent-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin: 24px 0;
}

.consent-box h4 {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--ink);
}

.consent-box p {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: 12px;
  line-height: 1.6;
}

.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.consent-check input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.consent-check label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}

/* ── Hero ────────────────────────────────────────────────── */

.hero {
  text-align: center;
  padding: 100px 0 80px;
}

.hero-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

.hero-text {
  text-align: left;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  max-width: 640px;
  margin: 0 0 20px;
  color: var(--ink);
}

.hero .subtitle {
  font-size: 1.15rem;
  color: var(--ink-muted);
  max-width: 520px;
  margin: 0 0 36px;
  line-height: 1.65;
}

.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-illustration {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-book-img {
  max-width: 100%;
  height: auto;
  max-height: 480px;
  object-fit: contain;
  animation: bookFloat 6s ease-in-out infinite;
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.4));
}

@keyframes bookFloat {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(0.5deg); }
}

/* ── Transformation Demo ─────────────────────────────────── */

.demo-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 24px;
  align-items: start;
}

.demo-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 48px;
  font-size: 1.5rem;
  color: var(--accent);
}

.demo-panel {
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.demo-panel-header {
  padding: 12px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.demo-input .demo-panel-header {
  background: var(--bg-subtle);
  color: var(--ink-faint);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.demo-output .demo-panel-header {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.demo-content {
  padding: 20px;
  font-size: 0.88rem;
  line-height: 1.7;
}

.demo-input .demo-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  color: var(--ink-muted);
  font-family: 'Inter', monospace;
  white-space: pre-wrap;
}

.demo-output .demo-content {
  background: var(--surface);
  border: 1px solid var(--accent-border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  color: var(--ink);
}

.demo-output .demo-content h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.demo-output .demo-content blockquote {
  margin: 12px 0;
  padding: 8px 16px;
  border-left: 3px solid var(--accent);
  color: var(--ink-muted);
  font-style: italic;
}

/* ── Features ────────────────────────────────────────────── */

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.feature-card {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: box-shadow 0.2s, transform 0.2s;
}

.feature-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.feature-icon {
  font-size: 1.6rem;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.feature-card p {
  font-size: 0.88rem;
  color: var(--ink-muted);
  margin: 0;
}

/* ── Trust / How It Works ────────────────────────────────── */

.trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  text-align: center;
}

.trust-item {
  padding: 20px;
}

.trust-item .trust-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.trust-item h4 {
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.trust-item p {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin: 0;
}

/* ── Recap Output Rendering ──────────────────────────────── */

.recap-result {
  display: none;
}

.recap-result.visible {
  display: block;
  animation: fadeSlideIn 0.4s ease;
}

.recap-narrative {
  font-family: 'Lora', Georgia, serif;
  font-size: 1rem;
  line-height: 1.8;
}

.recap-narrative h2, .recap-narrative h3 {
  margin-top: 24px;
  margin-bottom: 8px;
}

.recap-narrative blockquote {
  margin: 16px 0;
  padding: 12px 20px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--ink-muted);
}

.recap-narrative p {
  margin-bottom: 16px;
}

.recap-metadata {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.meta-section {
  padding: 20px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.meta-section h4 {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  margin-bottom: 10px;
}

.meta-section ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.meta-section li {
  padding: 6px 0;
  font-size: 0.9rem;
  color: var(--ink);
  border-bottom: 1px solid var(--border);
}

.meta-section li:last-child {
  border-bottom: none;
}

.meta-section li::before {
  margin-right: 8px;
}

.meta-events li::before { content: "⚔️"; }
.meta-npcs li::before { content: "🎭"; }
.meta-threads li::before { content: "🧵"; }
.meta-highlights li::before { content: "✨"; }

/* ── Loading State ───────────────────────────────────────── */

.loading-overlay {
  display: none;
  text-align: center;
  padding: 60px 20px;
}

.loading-overlay.visible {
  display: block;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

.loading-text {
  font-size: 0.95rem;
  color: var(--ink-muted);
}

.loading-subtext {
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin-top: 4px;
}

/* ── Error / Notice ──────────────────────────────────────── */

.notice {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  margin-bottom: 20px;
  display: none;
}

.notice.visible { display: block; }

.notice-error {
  background: var(--error-bg);
  border: 1px solid rgba(192, 57, 43, 0.15);
  color: var(--error);
}

.notice-success {
  background: var(--success-bg);
  border: 1px solid rgba(74, 140, 92, 0.15);
  color: var(--success);
}

/* ── Footer ──────────────────────────────────────────────── */

.site-footer {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.site-footer p {
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin: 4px 0;
}

.site-footer a {
  color: var(--ink-muted);
}

/* ── Utilities ───────────────────────────────────────────── */

.text-center { text-align: center; }
.text-muted { color: var(--ink-muted); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-40 { margin-top: 40px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ── Input Mode Toggle ───────────────────────────────────── */

.input-mode-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 20px;
}

.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-tab:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
}

.mode-tab.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.mode-icon {
  font-size: 1.1rem;
}

/* ── Upload Zone ─────────────────────────────────────────── */

.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--surface-alt);
  margin-bottom: 20px;
  position: relative;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.upload-zone.drag-over {
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.upload-zone.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.upload-zone-icon {
  font-size: 2.4rem;
  margin-bottom: 12px;
}

.upload-zone-title {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.upload-zone-subtitle {
  font-size: 0.9rem;
  color: var(--ink-muted);
  margin-bottom: 12px;
}

.upload-zone-formats {
  font-size: 0.8rem;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}

/* ── Upload Progress ─────────────────────────────────────── */

.upload-progress {
  text-align: center;
}

.upload-progress-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  animation: pulse 1.5s ease-in-out infinite;
}

.upload-progress-title {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 16px;
}

.upload-progress-bar-track {
  width: 100%;
  max-width: 400px;
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  margin: 0 auto 12px;
  overflow: hidden;
}

.upload-progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.upload-progress-detail {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Audio Consent Box ───────────────────────────────────── */

.audio-consent-box {
  background: var(--surface-alt);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.audio-consent-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.audio-consent-icon {
  font-size: 1.2rem;
}

.audio-consent-box h4 {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.audio-consent-box p {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: 12px;
  line-height: 1.6;
}

/* ── Animations ──────────────────────────────────────────── */

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 768px) {
  .hero-layout {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-text {
    text-align: center;
  }

  .hero-cta {
    justify-content: center;
  }

  .hero-book-img {
    max-height: 300px;
  }

  .demo-grid {
    grid-template-columns: 1fr;
  }
  
  .demo-arrow {
    transform: rotate(90deg);
    padding: 0;
  }
  
  .hero { padding: 60px 0 48px; }
  .page-section { padding: 48px 0; }
  
  .recap-metadata {
    grid-template-columns: 1fr;
  }

  .input-mode-toggle {
    flex-direction: column;
  }
}

/* ── Session Search ──────────────────────────────────────── */

.campaign-search {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 24px;
}

.search-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.search-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.search-icon {
  font-size: 1.2rem;
}

.search-bar {
  display: flex;
  gap: 8px;
}

.search-bar input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-size: 0.95rem;
  background: var(--bg-subtle);
  color: var(--ink);
  transition: border-color 0.2s;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.search-bar button {
  white-space: nowrap;
  padding: 10px 16px;
}

.search-result-card {
  margin-top: 16px;
  padding: 16px 20px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  line-height: 1.6;
}

.search-result-card p {
  margin: 0 0 8px;
}

.search-result-card p:last-child {
  margin-bottom: 0;
}

.search-refs {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.search-ref-label {
  font-size: 0.82rem;
  color: var(--ink-muted);
  font-weight: 500;
}

.search-ref-badge {
  display: inline-block;
  padding: 2px 10px;
  background: var(--accent);
  color: #fff;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.search-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto;
  animation: search-spin 0.8s linear infinite;
}

@keyframes search-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 600px) {
  .search-bar {
    flex-direction: column;
  }
}

/* ═══════════════════════════════════════════════════════════
   ARCANE VISUAL LAYER — Dark Theme Atmospheric Enhancements
   
   Everything below only applies to [data-theme="dark"].
   To revert to the plain dark theme, delete this entire section.
   To swap brand directions, replace these styles.
   ═══════════════════════════════════════════════════════════ */

/* ── Arcane: Logo ────────────────────────────────────────── */

[data-theme="dark"] .site-logo {
  font-family: 'Cinzel', 'Lora', Georgia, serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 1.1rem;
}

/* ── Arcane: Hero Section ────────────────────────────────── */

[data-theme="dark"] .hero {
  position: relative;
  background: 
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(30, 28, 60, 0.9), transparent),
    linear-gradient(175deg, #0b0d17 0%, #121538 35%, #0d1020 70%, #0b0d17 100%);
  padding: 120px 0 100px;
  overflow: hidden;
}

/* Animated golden thread line across hero */
[data-theme="dark"] .hero::before {
  content: '';
  position: absolute;
  top: 50%;
  left: -10%;
  width: 120%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(212, 163, 77, 0) 15%,
    rgba(212, 163, 77, 0.6) 30%,
    rgba(240, 200, 110, 0.9) 50%,
    rgba(212, 163, 77, 0.6) 70%,
    rgba(212, 163, 77, 0) 85%,
    transparent 100%
  );
  animation: threadWeave 8s ease-in-out infinite;
  pointer-events: none;
}

/* Secondary thread — offset and dimmer */
[data-theme="dark"] .hero::after {
  content: '';
  position: absolute;
  top: 62%;
  left: -10%;
  width: 120%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(212, 163, 77, 0) 20%,
    rgba(212, 163, 77, 0.3) 40%,
    rgba(240, 200, 110, 0.5) 55%,
    rgba(212, 163, 77, 0.3) 70%,
    rgba(212, 163, 77, 0) 80%,
    transparent 100%
  );
  animation: threadWeave 12s ease-in-out infinite reverse;
  pointer-events: none;
}

[data-theme="dark"] .hero h1 {
  color: #f0e8d8;
  text-shadow: 0 2px 20px rgba(212, 163, 77, 0.15);
}

[data-theme="dark"] .hero .subtitle {
  color: #a89e90;
}

/* ── Arcane: Buttons ─────────────────────────────────────── */

[data-theme="dark"] .btn-primary {
  background: linear-gradient(135deg, #c4923a, #d4a34d);
  color: #0b0d17;
  font-weight: 700;
  box-shadow: 0 2px 12px rgba(212, 163, 77, 0.25);
  border: 1px solid rgba(240, 200, 110, 0.3);
}

[data-theme="dark"] .btn-primary:hover {
  background: linear-gradient(135deg, #d4a34d, #f0c86e);
  box-shadow: 0 4px 24px rgba(212, 163, 77, 0.45), 0 0 40px rgba(212, 163, 77, 0.15);
  color: #0b0d17;
  transform: translateY(-2px);
}

[data-theme="dark"] .btn-secondary {
  background: rgba(22, 25, 41, 0.6);
  border: 1px solid rgba(212, 163, 77, 0.2);
  color: var(--ink);
  backdrop-filter: blur(8px);
}

[data-theme="dark"] .btn-secondary:hover {
  background: rgba(28, 31, 53, 0.8);
  border-color: rgba(212, 163, 77, 0.4);
  box-shadow: 0 0 20px rgba(212, 163, 77, 0.1);
}

/* ── Arcane: Section Dividers ────────────────────────────── */

[data-theme="dark"] .page-section + .page-section {
  border-top: 1px solid rgba(212, 163, 77, 0.08);
}

[data-theme="dark"] .page-section {
  position: relative;
}

/* ── Arcane: Feature Cards — Glassmorphism ────────────────── */

[data-theme="dark"] .feature-card {
  background: rgba(22, 25, 41, 0.5);
  border: 1px solid rgba(212, 163, 77, 0.1);
  backdrop-filter: blur(12px);
  transition: all 0.3s ease;
}

[data-theme="dark"] .feature-card:hover {
  background: rgba(28, 31, 53, 0.7);
  border-color: rgba(212, 163, 77, 0.3);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(212, 163, 77, 0.15),
    inset 0 1px 0 rgba(212, 163, 77, 0.1);
  transform: translateY(-4px);
}

[data-theme="dark"] .feature-card h3 {
  color: #f0e8d8;
}

[data-theme="dark"] .feature-icon {
  filter: saturate(1.2) brightness(1.1);
}

/* ── Arcane: Demo Panels ─────────────────────────────────── */

[data-theme="dark"] .demo-input .demo-panel-header {
  background: rgba(16, 19, 42, 0.8);
  border-color: rgba(212, 163, 77, 0.1);
}

[data-theme="dark"] .demo-input .demo-content {
  background: rgba(22, 25, 41, 0.4);
  border-color: rgba(212, 163, 77, 0.1);
}

[data-theme="dark"] .demo-output .demo-panel-header {
  background: rgba(212, 163, 77, 0.08);
  border-color: rgba(212, 163, 77, 0.2);
}

[data-theme="dark"] .demo-output .demo-content {
  background: rgba(22, 25, 41, 0.4);
  border-color: rgba(212, 163, 77, 0.2);
}

[data-theme="dark"] .demo-arrow {
  color: var(--accent);
  text-shadow: 0 0 12px rgba(212, 163, 77, 0.4);
}

/* ── Arcane: Trust / How It Works ────────────────────────── */

[data-theme="dark"] .trust-item {
  padding: 24px;
  border-radius: var(--radius-lg);
  transition: background 0.3s ease;
}

[data-theme="dark"] .trust-item:hover {
  background: rgba(212, 163, 77, 0.04);
}

[data-theme="dark"] .trust-item .trust-icon {
  filter: saturate(1.2) brightness(1.1);
}

/* ── Arcane: Footer ──────────────────────────────────────── */

[data-theme="dark"] .site-footer {
  background: rgba(8, 10, 18, 0.6);
  border-top-color: rgba(212, 163, 77, 0.08);
}

/* ── Arcane: Search ──────────────────────────────────────── */

[data-theme="dark"] .campaign-search {
  background: rgba(22, 25, 41, 0.5);
  border-color: rgba(212, 163, 77, 0.12);
  backdrop-filter: blur(8px);
}

[data-theme="dark"] .search-result-card {
  background: rgba(16, 19, 42, 0.6);
  border-color: rgba(212, 163, 77, 0.1);
}

/* ── Arcane: Cards / Surfaces ────────────────────────────── */

[data-theme="dark"] .card {
  background: rgba(22, 25, 41, 0.5);
  border-color: rgba(212, 163, 77, 0.1);
  backdrop-filter: blur(12px);
}

[data-theme="dark"] .consent-box,
[data-theme="dark"] .audio-consent-box {
  background: rgba(22, 25, 41, 0.4);
  border-color: rgba(212, 163, 77, 0.15);
}

/* ── Arcane: Upload Zone ─────────────────────────────────── */

[data-theme="dark"] .upload-zone {
  background: rgba(22, 25, 41, 0.3);
  border-color: rgba(212, 163, 77, 0.2);
}

[data-theme="dark"] .upload-zone:hover,
[data-theme="dark"] .upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(212, 163, 77, 0.06);
  box-shadow: 0 0 30px rgba(212, 163, 77, 0.1);
}

/* ── Arcane: Meta Sections ───────────────────────────────── */

[data-theme="dark"] .meta-section {
  background: rgba(22, 25, 41, 0.4);
  border-color: rgba(212, 163, 77, 0.1);
}

/* ── Arcane: Loading Spinner ─────────────────────────────── */

[data-theme="dark"] .loading-spinner {
  border-color: rgba(212, 163, 77, 0.15);
  border-top-color: var(--accent);
}

/* ── Arcane: Input Mode Toggle ───────────────────────────── */

[data-theme="dark"] .input-mode-toggle {
  background: rgba(16, 19, 42, 0.6);
  border-color: rgba(212, 163, 77, 0.1);
}

[data-theme="dark"] .mode-tab.active {
  background: rgba(212, 163, 77, 0.1);
  border: 1px solid rgba(212, 163, 77, 0.2);
  color: #f0c86e;
}

/* ── Arcane: Focus States ────────────────────────────────── */

[data-theme="dark"] textarea:focus,
[data-theme="dark"] input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 163, 77, 0.12), 0 0 20px rgba(212, 163, 77, 0.08);
}

/* ── Arcane: Scrollbar ───────────────────────────────────── */

[data-theme="dark"] ::-webkit-scrollbar {
  width: 8px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
  background: var(--bg);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: rgba(212, 163, 77, 0.2);
  border-radius: 4px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 163, 77, 0.35);
}

/* ── Arcane: Animations ──────────────────────────────────── */

@keyframes threadWeave {
  0%, 100% {
    transform: translateX(-5%) scaleX(0.8) rotate(-1deg);
    opacity: 0.4;
  }
  50% {
    transform: translateX(5%) scaleX(1) rotate(1deg);
    opacity: 0.8;
  }
}

/* Subtle golden shimmer for accented elements */
@keyframes arcaneShimmer {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

