/* ============================================================
   Monoco Analysis Zoo — Shared Styles
   Warm/minimal aesthetic with serif headings, cream background.
   Supports light (default) and dark themes.
   ============================================================ */

/* ---------- Theme Variables ---------- */
:root {
  --font-heading: 'Libre Baskerville', Georgia, 'Times New Roman', serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;

  /* Accent palette */
  --accent-blue:   #2563eb;
  --accent-green:  #16a34a;
  --accent-amber:  #d97706;
  --accent-red:    #dc2626;

  --transition: 0.2s ease;
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --max-width:  1120px;
}

/* Light theme (default) */
[data-theme="light"], :root {
  --bg:            #faf9f6;
  --bg-card:       #ffffff;
  --bg-card-hover: #f5f4f1;
  --bg-secondary:  #f3f2ef;
  --bg-input:      #f0efec;
  --text:          #1a1a1a;
  --text-secondary:#4b5563;
  --text-muted:    #9ca3af;
  --text-link:     #2563eb;
  --border:        #e5e2db;
  --border-strong: #d1cec7;
  --shadow:        0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg:     0 8px 24px rgba(0,0,0,0.08);
  --logo-color:    #1a1a1a;
}

/* Dark theme */
[data-theme="dark"] {
  --bg:            #111111;
  --bg-card:       #1a1a1a;
  --bg-card-hover: #242424;
  --bg-secondary:  #1e1e1e;
  --bg-input:      #222222;
  --text:          #e5e2db;
  --text-secondary:#9ca3af;
  --text-muted:    #6b7280;
  --text-link:     #60a5fa;
  --border:        #2a2a2a;
  --border-strong: #3a3a3a;
  --shadow:        0 1px 3px rgba(0,0,0,0.3);
  --shadow-lg:     0 8px 24px rgba(0,0,0,0.4);
  --logo-color:    #e5e2db;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}

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

/* ---------- Zoo Layout ---------- */
.zoo-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */
.zoo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.zoo-header__brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
}
.zoo-header__brand:hover { text-decoration: none; }

.zoo-header__title {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--logo-color);
}

.zoo-header__subtitle {
  font-weight: 300;
  color: var(--accent-blue);
  letter-spacing: 2px;
  font-size: 13px;
}

.zoo-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.zoo-header__nav-link {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.zoo-header__nav-link:hover {
  color: var(--text);
  border-color: var(--border-strong);
  text-decoration: none;
  background: var(--bg-card-hover);
}

/* ---------- Theme Toggle ---------- */
.zoo-theme-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition);
}
.zoo-theme-toggle:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  color: var(--text);
}

/* ---------- Hero ---------- */
.zoo-hero {
  text-align: center;
  padding: 40px 0 32px;
}

.zoo-hero__title {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
  color: var(--text);
}

.zoo-hero__desc {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-style: italic;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ---------- Card Grid ---------- */
.zoo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

/* ---------- Model Card ---------- */
.zoo-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  transition: all 0.25s ease;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.zoo-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--card-accent, var(--accent-blue));
}

.zoo-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
  text-decoration: none;
}

.zoo-card__title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 400;
  margin-bottom: 8px;
  color: var(--text);
}

.zoo-card__desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
  flex: 1;
}

.zoo-card__tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.zoo-card__tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.zoo-card__arrow {
  position: absolute;
  bottom: 20px;
  right: 20px;
  color: var(--text-muted);
  font-size: 1.2rem;
  transition: transform var(--transition), color var(--transition);
}

.zoo-card:hover .zoo-card__arrow {
  transform: translateX(4px);
  color: var(--card-accent, var(--accent-blue));
}

/* ---------- Footer ---------- */
.zoo-footer {
  text-align: center;
  padding: 32px 0 24px;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  margin-top: 32px;
}

/* ---------- Item Page Layout ---------- */
.item-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px 48px;
  color: var(--text);
  min-height: 100vh;
}

/* ---------- Item Nav ---------- */
.item-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.item-nav__back {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-link);
  text-decoration: none;
  font-size: 0.85rem;
}
.item-nav__back:hover { text-decoration: underline; }
.item-nav__back svg { width: 16px; height: 16px; }

/* ---------- Item Hero ---------- */
.item-hero {
  text-align: center;
  margin-bottom: 32px;
}

.item-hero__title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 400;
  margin-bottom: 12px;
}

.item-hero__meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.item-hero__badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.item-hero__desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ---------- Diagram Container ---------- */
.item-diagram {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 32px;
  position: relative;
  min-height: 320px;
}

.item-diagram__controls {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
}

.item-diagram__btn {
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.item-diagram__btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

/* ---------- Tabs ---------- */
.item-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}

.item-tab-btn {
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
  font-family: var(--font-body);
}
.item-tab-btn:hover { color: var(--text); }
.item-tab-btn--active {
  color: var(--text);
  border-bottom-color: var(--accent-blue);
}

.item-tab-content { display: none; }
.item-tab-content--active { display: block; }

/* ---------- Content Sections ---------- */
.item-section { margin-bottom: 28px; }

.item-section h2 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 400;
  margin-bottom: 12px;
  color: var(--text);
}

.item-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  margin-top: 20px;
  color: var(--text-secondary);
}

.item-section p {
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 12px;
}

.item-section ul, .item-section ol {
  color: var(--text-secondary);
  padding-left: 20px;
  margin-bottom: 12px;
}
.item-section li { margin-bottom: 6px; line-height: 1.6; }

/* ---------- Math Blocks (KaTeX) ---------- */
.item-math {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.item-math__label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* KaTeX color override for dark theme */
[data-theme="dark"] .katex { color: var(--text); }

/* ---------- Code Blocks ---------- */
.item-code {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  margin-bottom: 16px;
}

.item-code pre {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text);
  font-family: var(--font-mono);
}

.item-code__label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: var(--font-mono);
}

/* ---------- Pros / Cons ---------- */
.item-proscons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.item-pros, .item-cons {
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.item-pros { background: rgba(22,163,74,0.06); }
.item-cons { background: rgba(220,38,38,0.06); }
.item-pros h4 { color: var(--accent-green); margin-bottom: 8px; font-size: 0.9rem; }
.item-cons h4 { color: var(--accent-red); margin-bottom: 8px; font-size: 0.9rem; }

/* ---------- Step List ---------- */
.item-steps {
  counter-reset: step;
  list-style: none;
  padding-left: 0;
}

.item-steps li {
  counter-increment: step;
  position: relative;
  padding-left: 40px;
  margin-bottom: 16px;
}

.item-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ---------- Related Items ---------- */
.item-related {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.item-related__link {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-link);
  text-decoration: none;
  font-size: 0.82rem;
  transition: border-color var(--transition), background var(--transition);
}
.item-related__link:hover {
  border-color: var(--text-link);
  background: rgba(37,99,235,0.06);
  text-decoration: none;
}

/* ---------- Placeholder Diagram ---------- */
.placeholder-viz {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.9rem;
}

.placeholder-viz canvas,
.placeholder-viz svg {
  max-width: 100%;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .zoo-container { padding: 0 16px; }
  .zoo-hero__title { font-size: 1.5rem; }
  .zoo-grid { grid-template-columns: 1fr; }
  .item-hero__title { font-size: 1.4rem; }
  .item-proscons { grid-template-columns: 1fr; }
  .item-tab-btn { padding: 8px 12px; font-size: 0.78rem; }
  .item-page { padding: 0 16px 32px; }
}

@media (max-width: 480px) {
  .zoo-header__subtitle { display: none; }
}

/* ============================================================
   BLOT (Bottom Line On Top) — McKinsey Pyramid Structure
   ============================================================ */

/* BLOT banner: the core insight, always above the fold */
.blot {
  background: var(--bg-card);
  border: 2px solid var(--accent-blue);
  border-radius: var(--radius-md);
  padding: 28px 32px;
  margin-bottom: 24px;
  position: relative;
}

.blot__tag {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #fff;
  background: var(--accent-blue);
  padding: 3px 10px;
  border-radius: 3px;
  margin-bottom: 12px;
}

.blot__headline {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  margin: 0 0 12px 0;
}

.blot__subtext {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}

/* Key metrics strip below BLOT */
.metrics-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.metrics-strip__item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  text-align: center;
}

.metrics-strip__value {
  font-family: var(--font-body);
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.metrics-strip__value--positive { color: var(--accent-green); }
.metrics-strip__value--negative { color: var(--accent-red); }
.metrics-strip__value--neutral  { color: var(--accent-blue); }

.metrics-strip__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Supporting evidence section */
.evidence {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  margin-bottom: 24px;
}

.evidence__title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 14px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.evidence__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.evidence__list li {
  position: relative;
  padding: 10px 0 10px 28px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
}

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

.evidence__list li::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 17px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-blue);
  opacity: 0.5;
}

/* Action framework */
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.action-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.action-card__label {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text);
  margin-bottom: 6px;
}

/* Enlarged diagram container */
.item-diagram--full {
  min-height: 480px;
  padding: 28px 24px;
}

/* Legacy insight styles (kept for fallback) */
.insight-placeholder {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  font-size: 14px;
}

/* ---------- Scrollbar (dark) ---------- */
[data-theme="dark"] ::-webkit-scrollbar { width: 8px; height: 8px; }
[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--bg); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
