/* ═══════════════════════════════════════════════════════════
   AI Systems Landscape 2026 — Base Layout
   Shared by index.html + Group A/B chapter pages
   ═══════════════════════════════════════════════════════════ */

/* ── RESET ── */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ── HERO ── */
.hero {
  text-align: center;
  padding: 60px 20px 40px;
  background: var(--hero-gradient);
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  font-size: 2.6rem;
  font-weight: 800;
  background: var(--title-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}
.hero .subtitle {
  color: var(--text2);
  font-size: 1.1rem;
  max-width: 700px;
  margin: 0 auto 16px;
}
.hero .author {
  color: var(--accent2);
  font-size: 0.95rem;
  font-weight: 600;
}

/* ── NAV TABS ── */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
.nav-bar button {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text2);
  padding: 14px 22px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}
.nav-bar button:hover { color: var(--text); background: var(--glow); }
.nav-bar button.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── SECTIONS ── */
.section {
  display: none;
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 24px 60px;
  animation: fadeIn 0.35s ease;
}
.section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.section h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--accent);
}
.section .desc {
  color: var(--text2);
  margin-bottom: 32px;
  font-size: 0.95rem;
  max-width: 800px;
}

/* ── CARDS GRID ── */
.cards { display: grid; gap: 16px; }
.cards > .deep-dive-toggle { grid-column: 1 / -1; justify-self: center; order: 9999; }
.cards > .deep-dive { grid-column: 1 / -1; order: 9999; }
.cards-2 { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.cards-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.cards-4 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.cards-5 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ── CARD ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  transition: all 0.25s;
  cursor: default;
}
.card:hover { border-color: var(--accent); box-shadow: 0 0 20px var(--glow); transform: translateY(-2px); }
.card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.card p, .card li { color: var(--text2); font-size: 0.9rem; }
.card ul { padding-left: 18px; }
.card ul li { margin-bottom: 4px; }
.card .badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 10px;
}

/* ── STACK LAYERS ── */
.stack-layers {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 900px;
  margin: 0 auto;
}
.stack-layer {
  padding: 20px 28px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}
.stack-layer:first-child { border-radius: 12px 12px 0 0; }
.stack-layer:last-child { border-radius: 0 0 12px 12px; }
.stack-layer:hover, .stack-layer.expanded { border-color: var(--accent); }
.stack-layer .layer-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.stack-layer .layer-num {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.stack-layer .layer-title { font-weight: 700; font-size: 1.05rem; }
.stack-layer .layer-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.3s;
  color: var(--text2);
  font-size: 0.9rem;
  padding: 0 0 0 50px;
}
.stack-layer.expanded .layer-detail { max-height: 300px; padding: 12px 0 4px 50px; }
.stack-layer .expand-icon {
  margin-left: auto;
  transition: transform 0.3s;
  color: var(--text2);
  font-size: 1.2rem;
}
.stack-layer.expanded .expand-icon { transform: rotate(180deg); color: var(--accent); }

/* ── RISK GRID ── */
.risk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.risk-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 20px 24px;
  border-left: 4px solid;
}
.risk-card h4 { font-size: 0.95rem; margin-bottom: 6px; }
.risk-card p { color: var(--text2); font-size: 0.85rem; }

/* ── TABLE ── */
.fw-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 0.88rem;
}
.fw-table th, .fw-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.fw-table th {
  background: var(--surface2);
  color: var(--accent);
  font-weight: 700;
  position: sticky;
  top: 0;
}
.fw-table tr:hover td { background: var(--glow); }
.fw-table td { color: var(--text2); }

/* ── CHART CONTAINERS ── */
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 32px; }
.chart-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.chart-box.full { grid-column: 1 / -1; }
.chart-box h3 { font-size: 1rem; font-weight: 700; margin-bottom: 16px; color: var(--text); }
.chart-box canvas { max-height: 340px; }

/* ── USE CASE ACCORDION ── */
.domain-acc { max-width: 960px; margin: 0 auto; }
.domain-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.domain-item:hover, .domain-item.open { border-color: var(--accent); }
.domain-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  background: var(--surface);
  font-weight: 700;
  font-size: 0.95rem;
}
.domain-header .arrow { transition: transform 0.3s; color: var(--text2); }
.domain-item.open .domain-header .arrow { transform: rotate(90deg); color: var(--accent); }
.domain-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
  background: var(--surface2);
}
.domain-item.open .domain-body { max-height: 600px; }
.domain-body table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.domain-body th, .domain-body td { padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.domain-body th { color: var(--accent); font-weight: 600; }
.domain-body td { color: var(--text2); }
.domain-body p { color: var(--text2); font-size: 0.88rem; margin-bottom: 6px; }
.domain-body-inner { padding: 16px 20px; color: var(--text2); font-size: 0.9rem; line-height: 1.7; }

/* ── GLOSSARY ── */
.glossary-search {
  width: 100%;
  max-width: 500px;
  padding: 12px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 24px;
  outline: none;
}
.glossary-search:focus { border-color: var(--accent); }
.glossary-list { columns: 2; column-gap: 24px; }
.glossary-entry {
  break-inside: avoid;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 12px;
}
.glossary-entry strong { color: var(--accent); font-size: 0.92rem; }
.glossary-entry span { display: block; color: var(--text2); font-size: 0.84rem; margin-top: 4px; }

/* ── FOOTER ── */
.footer {
  text-align: center;
  padding: 40px 20px;
  border-top: 1px solid var(--border);
  color: var(--text2);
  font-size: 0.85rem;
}
.footer a { color: var(--accent); text-decoration: none; }
.footer .footer-sub { font-size: 0.8rem; margin-top: 6px; color: var(--text2); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.8rem; }
  .chart-row { grid-template-columns: 1fr; }
  .risk-grid { grid-template-columns: 1fr; }
  .glossary-list { columns: 1; }
  .cards-2, .cards-3 { grid-template-columns: 1fr; }
  .pipeline { flex-direction: column; }
  .pipe-arrow { transform: rotate(90deg); }
}

/* ═══════════════════════════════════════════════════════════
   Chapter Visual Components — Pipeline / Loop / Funnel
   Multiple variants using distinct class names
   ═══════════════════════════════════════════════════════════ */

/* ── PIPELINE — generative-ai / multimodal base ── */
.pipeline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
  padding: 20px 0 40px;
}
.pipe-step {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 22px 26px;
  text-align: center;
  min-width: 170px;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
}
.pipe-step:hover { border-color: var(--accent); box-shadow: 0 0 20px var(--glow); transform: translateY(-3px); }
.pipe-step .pipe-num {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.85rem;
  margin: 0 auto 8px;
}
.pipe-step .pipe-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 4px; }
.pipe-step .pipe-sub { color: var(--text2); font-size: 0.78rem; }
.pipe-arrow { color: var(--text2); font-size: 1.8rem; padding: 0 6px; flex-shrink: 0; }

/* ── PIPELINE CONTAINER — bayesian / cognitive / conversational / explainable / federated ── */
.pipeline-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0;
  padding: 20px 0 40px;
}
.pipeline-step {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
  text-align: center;
  min-width: 130px;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
}
.pipeline-step:hover, .pipeline-step.active-step, .pipeline-step.active {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--glow);
  transform: translateY(-2px);
}
.pipeline-step .step-icon { font-size: 1.6rem; margin-bottom: 6px; }
.pipeline-step .step-num {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}
.pipeline-step .step-label { font-weight: 700; font-size: 0.92rem; }
.pipeline-step .step-sub { color: var(--text2); font-size: 0.78rem; margin-top: 4px; }
.pipeline-arrow {
  color: var(--text2);
  font-size: 1.4rem;
  padding: 0 4px;
  flex-shrink: 0;
}
.pipeline-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-top: 24px;
  min-height: 80px;
  transition: all 0.3s;
}
.pipeline-info h3 { color: var(--accent); margin-bottom: 6px; }
.pipeline-info p { color: var(--text2); font-size: 0.92rem; }

/* ── PIPELINE — explainable variant override ── */
.pipeline-step .step-icon { font-size: 1.8rem; margin-bottom: 6px; }

/* ── PIPELINE WRAPPER — multimodal (multi-input converging) ── */
.pipeline-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 0 40px;
}
.pipe-inputs {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
}
.pipe-input-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.pipe-arrow-down { color: var(--text2); font-size: 1.5rem; }
.converge-arrows {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 80px;
  margin: 4px 0;
  color: var(--text2);
  font-size: 1.5rem;
}
.pipe-row {
  display: flex;
  align-items: center;
  gap: 0;
}
.pipe-arrow-h { color: var(--text2); font-size: 1.8rem; padding: 0 6px; flex-shrink: 0; }

/* ── LOOP — agentic / evolutionary / physical / reactive / reinforcement ── */
.loop-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 0 40px;
}
.loop-svg { max-width: 700px; width: 100%; }
.loop-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-top: 24px;
  min-height: 80px;
  transition: all 0.3s;
}
.loop-info h3 { color: var(--accent); margin-bottom: 6px; }
.loop-info p { color: var(--text2); font-size: 0.92rem; }

/* ── FUNNEL — recommendation-retrieval ── */
.funnel-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 0 40px;
}
.funnel-svg { max-width: 720px; width: 100%; }
.funnel-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-top: 24px;
  min-height: 80px;
  transition: all 0.3s;
}
.funnel-info h3 { color: var(--accent); margin-bottom: 6px; }
.funnel-info p { color: var(--text2); font-size: 0.92rem; }

/* ── PIPELINE — generic (Group B: analytical / autonomous / predictive) ── */
.pipeline .step {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 18px 22px;
  text-align: center;
  min-width: 120px;
  transition: all 0.25s;
  cursor: default;
}
.pipeline .step:hover { border-color: var(--accent); box-shadow: 0 0 16px var(--glow); transform: translateY(-2px); }
.pipeline .step h4 { font-size: 0.95rem; margin-bottom: 4px; }
.pipeline .step p { color: var(--text2); font-size: 0.78rem; }
.pipeline .arrow { color: var(--text2); font-size: 1.4rem; margin: 0 4px; }
