/* ═══════════════════════════════════════════════════════
   ThreadTag — Consumer Demo Page
   Dark mode: pure black bg, white text, red CTA
   ═══════════════════════════════════════════════════════ */

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

:root {
  --bg:        #000000;
  --surface:   #111111;
  --surface-2: #1a1a1a;
  --border:    #222222;
  --text:      #FFFFFF;
  --text-muted: #888888;
  --accent:    #DC2626;   /* red CTA */
  --accent-dim: rgba(220,38,38,0.12);
  --green:     #2ea868;
  --green-dim: rgba(46,168,104,0.12);
  --amber:     #d97706;
  --amber-dim: rgba(217,119,6,0.12);

  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans:  'DM Sans', system-ui, sans-serif;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── MINIMAL NAV ────────────────────────────────────────── */
.demo-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
}

.demo-nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.demo-nav-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.demo-nav-logo::after {
  content: '';
  width: 9px;
  height: 9px;
  background: white;
  border-radius: 50%;
}

.demo-nav-name {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}

.demo-nav-back {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.demo-nav-back:hover { color: var(--text); }

/* ── PAGE LAYOUT ────────────────────────────────────────── */
.demo-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.demo-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 4rem 1.5rem 5rem;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

/* ── HEADLINE ───────────────────────────────────────────── */
.demo-headline {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 400;
  color: var(--text);
  text-align: center;
  line-height: 1.15;
  margin-bottom: 2.5rem;
  letter-spacing: 0.01em;
}

.demo-brand-pick {
  max-width: 480px;
  margin: 0 auto 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.demo-brand-pick-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.demo-brand-pick-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.15s;
}
.demo-brand-pick-select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

/* ── UPLOAD ZONE ────────────────────────────────────────── */
.demo-upload-label {
  display: block;
  width: 100%;
  cursor: pointer;
}

.demo-upload-zone {
  background: var(--surface);
  border: 1.5px dashed var(--border);
  border-radius: 16px;
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  transition: border-color 0.2s, background 0.2s;
  min-height: 260px;
  justify-content: center;
}

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

.demo-upload-icon { color: var(--text-muted); margin-bottom: 0.5rem; }

.demo-upload-label-text {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
}

.demo-upload-sub {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
}

.demo-upload-sub span {
  color: var(--accent);
  cursor: pointer;
  font-weight: 500;
}

.demo-upload-sub span:hover { text-decoration: underline; }

/* Hidden file input — NOT display:none, just off-screen */
.demo-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* Upload preview */
.demo-preview {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  margin-top: 1rem;
}

.demo-preview img {
  display: block;
  width: 100%;
  max-height: 400px;
  object-fit: contain;
}

.demo-preview-clear {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s;
}

.demo-preview-clear:hover { background: white; }

/* File type / size error */
.demo-upload-error {
  font-size: 0.8125rem;
  color: var(--accent);
  margin-top: 0.5rem;
  display: none;
}

.demo-upload-error.visible { display: block; }

/* ── RESULT PANEL ───────────────────────────────────────── */
.demo-result {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  margin-top: 1.5rem;
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

/* Idle placeholder */
.demo-result-idle {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}

.demo-result-idle-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--border);
  position: relative;
  animation: demo-pulse 2.5s ease-in-out infinite;
}

.demo-result-idle-ring::after {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  opacity: 0.4;
  animation: demo-pulse 2.5s ease-in-out infinite 0.5s;
}

@keyframes demo-pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.06); }
}

.demo-result-idle-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 200px;
}

/* Loading state */
.demo-result-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.875rem;
}

.demo-spinner {
  width: 40px;
  height: 40px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: demo-spin 0.8s linear infinite;
}

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

.demo-loading-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.demo-loading-sub {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Progress bar */
.demo-progress-wrap {
  width: 200px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.demo-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  animation: demo-progress 2s ease-in-out forwards;
}

@keyframes demo-progress {
  0%   { width: 0%; }
  60%  { width: 70%; }
  100% { width: 100%; }
}

/* Filled result */
.demo-result-filled {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.demo-badge {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.25rem 0.625rem;
  border-radius: 4px;
  align-self: flex-start;
  text-transform: uppercase;
}

.demo-badge--verified     { background: var(--green-dim);  color: var(--green);  border: 1px solid rgba(46,168,104,0.2);  }
.demo-badge--flagged      { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(220,38,38,0.2);   }
.demo-badge--needs-review { background: var(--amber-dim);  color: var(--amber);  border: 1px solid rgba(217,119,6,0.2);  }

.demo-score-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.demo-score-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.demo-score-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.3, 1);
}

.demo-score-fill--pass { background: var(--green); }
.demo-score-fill--warn { background: var(--accent); }

.demo-score-num {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}

.demo-score-num--pass { color: var(--green); }
.demo-score-num--warn { color: var(--accent); }

.demo-brand {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
}

.demo-reasons {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.demo-reasons li {
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding-left: 1rem;
  border-left: 2px solid var(--border);
  line-height: 1.5;
}

.demo-score-explain {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: -0.5rem;
}

.demo-actions { margin-top: 0.5rem; }

.demo-analyze-again {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  font-family: var(--font-sans);
}

.demo-analyze-again:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* CTA below results */
.demo-cta {
  width: 100%;
  margin-top: 1.5rem;
  text-align: center;
}

.demo-cta-btn {
  display: inline-block;
  background: var(--accent);
  color: white;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.875rem 2rem;
  border-radius: 10px;
  text-decoration: none;
  transition: opacity 0.2s;
}

.demo-cta-btn:hover { opacity: 0.85; }

/* Error state */
.demo-result-error {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  text-align: center;
}

.demo-error-icon { color: var(--accent); margin-bottom: 0.25rem; }

.demo-error-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.demo-error-sub { font-size: 0.8125rem; color: var(--text-muted); }

.demo-retry {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  font-family: var(--font-sans);
  margin-top: 0.5rem;
}

.demo-retry:hover { border-color: var(--accent); color: var(--text); }

/* Hide all result sub-states by default */
.demo-result-idle,
.demo-result-loading,
.demo-result-filled,
.demo-result-error { display: none; }

.demo-result-idle.visible { display: flex; }
.demo-result-loading.visible { display: flex; }
.demo-result-filled.visible { display: flex; }
.demo-result-error.visible { display: flex; }

/* ── EMAIL CAPTURE GATE ─────────────────────────────────── */
.demo-email-gate {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  margin-top: 1.5rem;
}

.demo-email-gate-heading {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.375rem;
}

.demo-email-gate-sub {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.demo-email-form {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.demo-email-input {
  flex: 1;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9375rem;
  font-family: var(--font-sans);
  padding: 0.625rem 0.875rem;
  outline: none;
  transition: border-color 0.15s;
}

.demo-email-input::placeholder { color: var(--text-muted); }

.demo-email-input:focus { border-color: var(--accent); }

.demo-email-submit {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font-sans);
  padding: 0.625rem 1.375rem;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.demo-email-submit:hover:not(:disabled) { opacity: 0.85; }
.demo-email-submit:disabled { opacity: 0.5; cursor: not-allowed; }

.demo-email-error {
  font-size: 0.8125rem;
  color: var(--accent);
  margin-top: 0.5rem;
  min-height: 1em;
}

.demo-email-success {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--green);
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 0.25rem 0;
}