:root {
  --rlvr-title-bg: #f5f6f7;
  --rlvr-title-fg: #1f2328;
  --rlvr-widget-bg: #f8fafc;
  --rlvr-widget-border: #d0d7de;
  --rlvr-detail-fg: #374151;
}

html[data-bs-theme="dark"],
body.quarto-dark {
  --rlvr-title-bg: #111827;
  --rlvr-title-fg: #f9fafb;
  --rlvr-widget-bg: #0f172a;
  --rlvr-widget-border: #334155;
  --rlvr-detail-fg: #cbd5e1;
}

body {
  line-height: 1.65;
}

.sidebar-item-text {
  font-weight: 500;
}

.quarto-title-banner {
  background: var(--rlvr-title-bg);
  color: var(--rlvr-title-fg);
}

.rlvr-stack-widget {
  margin: 1rem 0 1.4rem;
  border: 1px solid var(--rlvr-widget-border);
  border-radius: 12px;
  background: var(--rlvr-widget-bg);
  padding: 1rem;
}

.rlvr-stack-widget svg {
  width: 100%;
  height: auto;
  display: block;
}

.stack-layer {
  cursor: pointer;
}

.stack-layer rect {
  opacity: 0.72;
  transform-origin: center;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.stack-layer:hover rect,
.stack-layer.is-active rect {
  opacity: 1;
  transform: translateY(-1px);
}

.stack-layer text {
  pointer-events: none;
}

.rlvr-stack-detail {
  margin: 0.85rem 0 0;
  font-size: 0.95rem;
  color: var(--rlvr-detail-fg);
}

/* ── Domain map ───────────────────────────────────── */

.dm { margin: 1.2rem 0 1.4rem; }

.dm-hint {
  margin: 0 0 0.6rem;
  font-size: 0.88rem;
  color: #64748b;
}

.dm-svg { width: 100%; height: auto; display: block; }

.dm-bg       { fill: #f8fafc; }
.dm-grid line { stroke: #e2e8f0; stroke-width: 1; }
.dm-axes line { stroke: #334155; stroke-width: 1.8; }

.dm-labels text {
  fill: #334155;
  font-size: 14px;
  font-weight: 600;
}
.dm-labels .dm-tick {
  font-size: 12px;
  font-weight: 400;
  fill: #94a3b8;
}

.dm-point { cursor: pointer; outline: none; }
.dm-halo  { fill: transparent; transition: fill 0.15s; }
.dm-dot   {
  stroke: #fff;
  stroke-width: 3;
  transition: transform 0.15s, stroke-width 0.15s;
  transform-origin: center;
}
.dm-name  { fill: #334155; font-size: 13px; font-weight: 600; }

.dm-c-proof  { fill: #2563eb; }
.dm-c-code   { fill: #d97706; }
.dm-c-math   { fill: #059669; }
.dm-c-lcqa   { fill: #7c3aed; }
.dm-c-multi  { fill: #dc2626; }
.dm-c-agentic { fill: #ea580c; }

.dm-point:hover .dm-halo,
.dm-point:focus .dm-halo,
.dm-point.is-active .dm-halo { fill: rgba(99,102,241,0.10); }

.dm-point:hover .dm-dot,
.dm-point:focus .dm-dot,
.dm-point.is-active .dm-dot { transform: scale(1.15); stroke-width: 4; }

.dm-point.is-active .dm-name { font-weight: 800; }

.dm-detail {
  margin-top: 0.8rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  padding: 0.9rem 1rem;
}
.dm-detail h5 { margin: 0 0 0.3rem; }
.dm-summary   { margin: 0 0 0.6rem; font-size: 0.93rem; color: #475569; }

.dm-facts {
  margin: 0;
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 0.4rem 0.8rem;
  font-size: 0.9rem;
}
.dm-facts dt { margin: 0; font-weight: 700; color: #64748b; }
.dm-facts dd { margin: 0; }

/* ── Domain map: dark mode ───────────────────────── */

body.quarto-dark .dm-hint { color: #94a3b8; }
body.quarto-dark .dm-bg   { fill: #1e293b; }
body.quarto-dark .dm-grid line  { stroke: #334155; }
body.quarto-dark .dm-axes line  { stroke: #cbd5e1; }
body.quarto-dark .dm-labels text { fill: #cbd5e1; }
body.quarto-dark .dm-labels .dm-tick { fill: #64748b; }
body.quarto-dark .dm-name  { fill: #e2e8f0; }
body.quarto-dark .dm-dot   { stroke: #1e293b; }

body.quarto-dark .dm-c-proof  { fill: #60a5fa; }
body.quarto-dark .dm-c-code   { fill: #fbbf24; }
body.quarto-dark .dm-c-math   { fill: #34d399; }
body.quarto-dark .dm-c-lcqa   { fill: #a78bfa; }
body.quarto-dark .dm-c-multi  { fill: #f87171; }
body.quarto-dark .dm-c-agentic { fill: #fb923c; }

body.quarto-dark .dm-point:hover .dm-halo,
body.quarto-dark .dm-point:focus .dm-halo,
body.quarto-dark .dm-point.is-active .dm-halo { fill: rgba(148,163,184,0.12); }

body.quarto-dark .dm-detail {
  border-color: #334155;
  background: #0f172a;
}
body.quarto-dark .dm-summary { color: #94a3b8; }
body.quarto-dark .dm-facts dt { color: #94a3b8; }

@media (max-width: 640px) {
  .dm-facts { grid-template-columns: 1fr; }
  .dm-facts dt { margin-top: 0.3rem; }
}
