/* style.css - Understanding Christianity Interactive Explorer */
:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #273549;
  --border: #334155;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.15);
  --gold: #fbbf24;
  --emerald: #34d399;
  --rose: #fb7185;
  --radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  padding-bottom: 4rem;
}

/* Header */
header {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

header h1 span {
  color: var(--gold);
}

header p {
  color: var(--text-muted);
  font-size: 0.92rem;
  max-width: 680px;
}

.mode-tabs {
  display: flex;
  gap: 0.5rem;
  background: var(--bg);
  padding: 0.35rem;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.mode-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 0.55rem 1rem;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.mode-btn.active {
  background: var(--accent);
  color: #0f172a;
}

.mode-btn:hover:not(.active) {
  color: #fff;
  background: var(--surface);
}

/* Main Container */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
}

/* Section 1: Interactive Chronological Timeline */
.timeline-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.era-legend {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
}

.era-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}

.era-ancient { background: rgba(251, 191, 36, 0.15); color: #fde68a; border-color: rgba(251, 191, 36, 0.4); }
.era-medieval { background: rgba(168, 85, 247, 0.15); color: #e9d5ff; border-color: rgba(168, 85, 247, 0.4); }
.era-reformation { background: rgba(56, 189, 248, 0.15); color: #bae6fd; border-color: rgba(56, 189, 248, 0.4); }
.era-modern { background: rgba(52, 211, 153, 0.15); color: #a7f3d0; border-color: rgba(52, 211, 153, 0.4); }

.timeline-track {
  display: flex;
  overflow-x: auto;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  scrollbar-width: thin;
}

.timeline-node {
  flex: 0 0 185px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.timeline-node:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.timeline-node.selected {
  border-color: var(--gold);
  background: rgba(251, 191, 36, 0.08);
  box-shadow: 0 0 0 1px var(--gold);
}

.timeline-year {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.timeline-name {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
}

.trigger-banner {
  margin-top: 0.85rem;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.7);
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  font-size: 0.9rem;
  color: #e2e8f0;
}

/* Explorer Grid: Left Tree + Right Topics & Visuals */
.explorer-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 980px) {
  .explorer-grid {
    grid-template-columns: 1fr;
  }
}

/* Left Panel: Multi-Level Drill-Down Tree */
.tree-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  max-height: 82vh;
  overflow-y: auto;
}

.search-box {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.search-box:focus {
  outline: none;
  border-color: var(--accent);
}

.branch-item {
  border: 1px solid var(--border);
  border-radius: 9px;
  margin-bottom: 0.6rem;
  background: var(--bg);
  overflow: hidden;
}

.branch-header {
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.15s;
}

.branch-header:hover {
  background: var(--surface-hover);
}

.branch-item.active > .branch-header {
  background: var(--accent-soft);
  border-bottom: 1px solid rgba(56, 189, 248, 0.3);
}

.branch-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.branch-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.pin-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.pin-btn.pinned {
  background: var(--gold);
  color: #0f172a;
  font-weight: 700;
  border-color: var(--gold);
}

/* Level 2 & Level 3 Sub-Denominations */
.subgroups-drawer {
  display: none;
  padding: 0.75rem 0.9rem;
  background: rgba(15, 23, 42, 0.6);
  font-size: 0.85rem;
}

.branch-item.expanded .subgroups-drawer {
  display: block;
}

.l2-group {
  margin-bottom: 0.6rem;
  border-left: 2px solid var(--accent);
  padding-left: 0.65rem;
}

.l2-title {
  font-weight: 700;
  color: #e2e8f0;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.l3-list {
  list-style: none;
  margin-top: 0.35rem;
  padding-left: 0.5rem;
}

.l3-list li {
  color: var(--text-muted);
  font-size: 0.81rem;
  padding: 0.18rem 0;
  position: relative;
  padding-left: 0.85rem;
}

.l3-list li::before {
  content: "↳";
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* Right Panel: Visual Showcase & Topic Comparison */
.detail-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Comparison Tray */
.comparison-tray {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.tray-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.tray-chip {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: #fff;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.83rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tray-chip button {
  background: none;
  border: none;
  color: var(--rose);
  font-weight: 800;
  cursor: pointer;
  font-size: 0.95rem;
}

/* Topic Selector Pills */
.topic-selector {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.topic-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.topic-pill {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.topic-pill:hover {
  border-color: var(--accent);
  color: #fff;
}

.topic-pill.active {
  background: var(--accent);
  color: #0f172a;
  border-color: var(--accent);
}

/* Comparison Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}

.study-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card-visual {
  width: 100%;
  height: 150px;
  background: #0b1120;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.card-visual img,
.card-visual svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-body {
  padding: 1.25rem;
  flex: 1;
}

.card-era-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold);
  background: rgba(251, 191, 36, 0.12);
  padding: 0.15rem 0.55rem;
  border-radius: 5px;
  margin-bottom: 0.4rem;
}

.card-body h3 {
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
  color: #fff;
}

.topic-highlight-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 0.9rem;
  margin-bottom: 1rem;
}

.topic-highlight-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.35rem;
}

.topic-highlight-text {
  font-size: 0.93rem;
  color: #f1f5f9;
}

.all-topics-accordion details {
  border-top: 1px solid var(--border);
  padding: 0.55rem 0;
  font-size: 0.88rem;
}

.all-topics-accordion summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-muted);
}

.all-topics-accordion summary:hover {
  color: #fff;
}

.all-topics-accordion p {
  margin-top: 0.4rem;
  color: #cbd5e1;
  padding-left: 0.5rem;
}

/* Filter by Practice Discovery Matrix */
.matrix-panel {
  display: none;
}

.matrix-panel.active {
  display: block;
}

.filter-cloud {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.practice-tag {
  background: var(--bg);
  border: 1px solid var(--border);
  color: #e2e8f0;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  font-size: 0.84rem;
  cursor: pointer;
  transition: all 0.15s;
}

.practice-tag:hover {
  border-color: var(--emerald);
}

.practice-tag.selected {
  background: var(--emerald);
  color: #064e3b;
  font-weight: 700;
  border-color: var(--emerald);
}

.matrix-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.clear-btn {
  background: var(--rose);
  color: #fff;
  border: none;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.83rem;
}