/* Storybook Interactive — 6D.2B.1
   Scoped under .sb-interactive. Uses design tokens from design-tokens.css.
   Mobile-first: base styles target 375–430px, desktop via min-width queries.
*/

/* ── Container ────────────────────────────────────────────────────────────── */

.sb-interactive {
  max-width: 780px;
  margin: 1.5rem auto;
  padding: 1.75rem 2rem;
  background: #FFFEFB;
  border: 1px solid #DFD2C3;
  border-left: 5px solid var(--brand-mahogany, #8B4513);
  border-radius: 0 14px 14px 0;
  box-shadow: 0 8px 24px rgba(44, 24, 16, 0.08);
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--text-body, #4A2E1B);
  line-height: 1.75;
  box-sizing: border-box;
}

/* ── Badge ────────────────────────────────────────────────────────────────── */

.sb-badge {
  display: inline-block;
  padding: 0.3rem 0.85rem;
  background: var(--brand-mahogany, #8B4513);
  color: #fff;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 20px;
  margin-bottom: var(--space-md);
}

/* ── Setup section ────────────────────────────────────────────────────────── */

.sb-setup {
  margin-bottom: var(--space-xl);
}

.sb-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-dark, #1A1A1A);
  margin: 0 0 var(--space-md) 0;
  line-height: 1.25;
}

.sb-body {
  font-size: 1.05rem;
  line-height: 1.8;
  margin: 0 0 var(--space-sm) 0;
  color: var(--text-body, #5D3A1A);
}

.sb-source {
  font-size: 0.78rem;
  color: var(--text-muted, #999);
  font-style: italic;
  margin: 0;
}

/* ── Decision section ─────────────────────────────────────────────────────── */

.sb-decision {
  border-top: 2px solid var(--border-subtle, #D4C5A9);
  padding-top: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.sb-decision-prompt {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-dark, #1A1A1A);
  margin: 0 0 var(--space-md) 0;
}

.sb-choices {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.sb-choice-btn {
  width: 100%;
  padding: 0.9rem 1.25rem;
  background: var(--bg-parchment, #FAF8F3);
  color: var(--text-body, #5D3A1A);
  border: 2px solid var(--border-subtle, #D4C5A9);
  border-radius: var(--radius-md, 8px);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  line-height: 1.4;
}

.sb-choice-btn:hover {
  border-color: var(--brand-mahogany, #8B4513);
  background: var(--bg-warm, #FAF3E8);
}

.sb-choice-btn:focus-visible {
  outline: 3px solid var(--brand-gold, #D4A574);
  outline-offset: 2px;
}

.sb-choice-btn--selected {
  border-color: var(--brand-mahogany, #8B4513);
  background: var(--bg-warm, #FAF3E8);
  box-shadow: inset 3px 0 0 var(--brand-mahogany, #8B4513);
}

/* Explicit selected indicator for non-color accessibility */
.sb-choice-btn--selected::before {
  content: '\2713\00a0';
  color: var(--brand-mahogany, #8B4513);
  font-weight: 700;
}

.sb-historical-note {
  font-size: 0.85rem;
  color: var(--text-muted, #999);
  font-style: italic;
  margin: 0;
  line-height: 1.6;
}

/* ── Pre-reveal payoff ────────────────────────────────────────────────────── */

.sb-payoff-pre {
  border-top: 1px solid var(--border-subtle, #D4C5A9);
  padding-top: var(--space-lg);
  margin-top: var(--space-lg);
}

.sb-you-chose {
  font-size: 1rem;
  color: var(--text-muted, #999);
  margin: 0 0 var(--space-sm) 0;
}

.sb-you-chose strong {
  color: var(--text-dark, #1A1A1A);
}

.sb-consequence {
  font-size: 1rem;
  color: var(--text-body, #5D3A1A);
  font-style: italic;
  margin: 0 0 var(--space-lg) 0;
  line-height: 1.7;
}

.sb-reveal-btn {
  display: inline-block;
  padding: 0.85rem 1.75rem;
  background: var(--gradient-brand, linear-gradient(135deg, #8B4513 0%, #A0522D 100%));
  color: #fff;
  border: none;
  border-radius: var(--radius-md, 8px);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-brand, 0 8px 24px rgba(139,69,19,0.3));
  transition: transform 0.15s, box-shadow 0.15s;
}

.sb-reveal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(139,69,19,0.4);
}

.sb-reveal-btn:focus-visible {
  outline: 3px solid var(--brand-gold, #D4A574);
  outline-offset: 2px;
}

/* ── Reveal section ───────────────────────────────────────────────────────── */

.sb-reveal {
  border-top: 2px solid var(--border-subtle, #D4C5A9);
  padding-top: var(--space-lg);
  margin-top: var(--space-lg);
}

.sb-outcome {
  background: var(--bg-warm, #FAF3E8);
  border-left: 4px solid var(--brand-mahogany, #8B4513);
  border-radius: 0 var(--radius-md, 8px) var(--radius-md, 8px) 0;
  padding: var(--space-lg);
  margin: var(--space-md) 0 var(--space-lg) 0;
}

.sb-outcome-headline {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-dark, #1A1A1A);
  margin: 0 0 var(--space-sm) 0;
}

/* Remove default focus ring — we manage focus programmatically */
.sb-outcome-headline:focus {
  outline: none;
}

.sb-outcome-body {
  font-size: 1rem;
  line-height: 1.8;
  margin: 0 0 var(--space-sm) 0;
  color: var(--text-body, #5D3A1A);
}

/* ── Evidence disclosure ──────────────────────────────────────────────────── */

.sb-evidence-disclosure {
  margin: var(--space-lg) 0;
}

.sb-evidence-toggle {
  background: none;
  border: none;
  color: var(--brand-mahogany, #8B4513);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sb-evidence-toggle:focus-visible {
  outline: 3px solid var(--brand-gold, #D4A574);
  outline-offset: 2px;
  border-radius: 2px;
}

.sb-evidence-panel {
  display: none;
  margin-top: var(--space-md);
  border: 1px solid var(--border-subtle, #D4C5A9);
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
}

.sb-evidence-panel--open {
  display: block;
}

.sb-evidence-item {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-subtle, #D4C5A9);
}

.sb-evidence-item:last-child {
  border-bottom: none;
}

.sb-evidence-item-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-xs);
}

.sb-evidence-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dark, #1A1A1A);
}

/* Claim label badges — text + background, never color alone */
.sb-evidence-label {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 12px;
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sb-evidence-label--documented_history {
  background: #e8f4e8;
  color: #1a5c1a;
  border: 1px solid #a8d5a8;
}

.sb-evidence-label--family_record {
  background: #e8eef8;
  color: #1a3a6c;
  border: 1px solid #a8c0e8;
}

.sb-evidence-label--research_lead {
  background: #fef3e2;
  color: #7a4a00;
  border: 1px solid #f0c878;
}

.sb-evidence-label--unknown {
  background: #f3f3f3;
  color: #666;
  border: 1px solid #ccc;
}

.sb-evidence-explanation {
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--text-body, #5D3A1A);
  margin: 0 0 var(--space-xs) 0;
}

.sb-evidence-source {
  font-size: 0.78rem;
  color: var(--text-muted, #999);
  font-style: italic;
  margin: 0;
}

.sb-evidence-empty {
  padding: var(--space-md);
  color: var(--text-muted, #999);
  font-style: italic;
  font-size: 0.875rem;
  margin: 0;
}

/* ── Family bridge ────────────────────────────────────────────────────────── */

.sb-family-bridge {
  border-top: 1px solid var(--border-subtle, #D4C5A9);
  padding-top: var(--space-lg);
  margin-top: var(--space-lg);
}

.sb-family-heading {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark, #1A1A1A);
  margin: 0 0 var(--space-sm) 0;
}

.sb-family-body {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--text-body, #5D3A1A);
  margin: var(--space-sm) 0 0 0;
}

.sb-family-caveat {
  font-size: 0.82rem;
  color: var(--text-muted, #999);
  font-style: italic;
  margin: var(--space-sm) 0 0 0;
  line-height: 1.6;
}

/* ── Research action ──────────────────────────────────────────────────────── */

.sb-research-action {
  border-top: 2px solid var(--border-subtle, #D4C5A9);
  padding-top: var(--space-lg);
  margin-top: var(--space-lg);
}

.sb-research-cta {
  display: block;
  width: 100%;
  padding: 1rem 1.5rem;
  background: var(--gradient-brand, linear-gradient(135deg, #8B4513 0%, #A0522D 100%));
  color: #fff;
  border: none;
  border-radius: var(--radius-md, 8px);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-brand, 0 8px 24px rgba(139,69,19,0.3));
  transition: transform 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.sb-research-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(139,69,19,0.4);
  color: #fff;
  text-decoration: none;
}

.sb-research-cta:focus-visible {
  outline: 3px solid var(--brand-gold, #D4A574);
  outline-offset: 2px;
}

.sb-research-why {
  font-size: 0.875rem;
  color: var(--text-body, #5D3A1A);
  line-height: 1.65;
  margin: var(--space-sm) 0 var(--space-xs) 0;
}

.sb-research-archive {
  font-size: 0.78rem;
  color: var(--text-muted, #999);
  font-style: italic;
  margin: 0;
}

/* ── Desktop ──────────────────────────────────────────────────────────────── */

@media (min-width: 600px) {
  .sb-interactive {
    padding: var(--space-xl);
  }

  .sb-title {
    font-size: 2rem;
  }

  .sb-choices {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sb-choice-btn {
    flex: 1 1 auto;
    min-width: 140px;
    width: auto;
  }
}

@media (min-width: 800px) {
  .sb-interactive {
    padding: 2.5rem;
  }
}
