/* ════════════════════════════════════════════════════════════════════════
   YATU Civilizational Milestones — Interactive playground styling
   License: CC BY 4.0 — yatubook.com/civilizational-milestones
   ════════════════════════════════════════════════════════════════════════ */

#cm-interactive-mount,
.cm-playground {
  position: relative;
  /* Break out of the article container's max-width to use full viewport. */
  width: 100vw;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  margin-top: 2rem;
  margin-bottom: 3rem;
  padding: 0;
  background: rgba(10, 15, 28, 0.55);
  border-top: 1px solid rgba(212, 168, 67, 0.28);
  border-bottom: 1px solid rgba(212, 168, 67, 0.28);
  /* Subtle gold side gradients to suggest the framework's visual register */
  box-shadow:
    inset 0 1px 0 rgba(212, 168, 67, 0.08),
    0 4px 24px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  /* Maintain a max-width so it doesn't stretch on ultra-wide displays */
  max-width: 2400px;
  /* Cap formula: -1200px is half of max-width; with `left: 50%` reference at
     parent center (which equals viewport center for centered articles),
     this centers the capped box. CSS margin % is parent-width-relative, so
     we must NOT use `+ 50%` here — that polluted the cap with article-width. */
  margin-left: max(-50vw, -1200px);
  margin-right: max(-50vw, -1200px);
}

/* Static fallback hidden when interactive ready */
.cm-figure.cm-static-fallback {
  display: none !important;
}

/* ──────────────────────────────────────────────────────────────────────
   TOOLBAR
   ────────────────────────────────────────────────────────────────────── */
.cm-toolbar {
  padding: 1rem 2rem 0.85rem;
  background: linear-gradient(180deg, rgba(212, 168, 67, 0.10) 0%, rgba(10, 15, 28, 0.55) 100%);
  border-bottom: 1px solid rgba(212, 168, 67, 0.22);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.cm-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.4rem;
  align-items: center;
}

.cm-toolbar-search-row {
  border-bottom: 1px solid rgba(212, 168, 67, 0.14);
  padding-bottom: 0.65rem;
  justify-content: space-between;
  margin-bottom: 0.15rem;
}

.cm-toolbar-brand {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.cm-brand-mark {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--gold-light, #e8c97a);
  text-shadow: 0 0 12px rgba(212, 168, 67, 0.3);
}

.cm-brand-divider {
  width: 1px;
  height: 18px;
  background: rgba(212, 168, 67, 0.4);
  display: inline-block;
}

.cm-brand-tagline {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.94rem;
  color: var(--text-muted, #c8b8a0);
  letter-spacing: 0.02em;
}

/* Inner section title — gives the chart a clear header even at scroll position */
.cm-section-header {
  text-align: center;
  padding: 1.4rem 1rem 0.4rem;
  background: linear-gradient(180deg, rgba(212, 168, 67, 0.06) 0%, transparent 100%);
}
.cm-section-header h2 {
  font-family: 'Cinzel', Georgia, serif;
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
  font-weight: 500;
  color: var(--gold-light, #e8c97a);
  letter-spacing: 0.06em;
  margin: 0 0 0.4rem;
  text-transform: uppercase;
}
.cm-section-header .cm-section-sub {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.94rem;
  color: var(--text-muted, #c8b8a0);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.55;
}

.cm-toolbar-search {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex: 1;
  max-width: 540px;
  min-width: 0; /* allow flex item to shrink below intrinsic width on mobile */
}

#cm-search-input {
  flex: 1;
  min-width: 0; /* shrink below intrinsic when needed */
  padding: 0.5rem 0.8rem;
  background: rgba(10, 15, 28, 0.6);
  border: 1px solid rgba(212, 168, 67, 0.3);
  border-radius: 4px;
  color: var(--text-body, #d4c8b0);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.86rem;
  outline: none;
  transition: border-color 0.18s;
}

#cm-search-input:focus {
  border-color: var(--accent-light, #e8c97a);
  background: rgba(10, 15, 28, 0.8);
}

#cm-search-input::placeholder {
  color: rgba(212, 168, 67, 0.4);
}

.cm-toolbar-version {
  padding: 0.3rem 0.6rem;
  background: rgba(212, 168, 67, 0.1);
  border: 1px solid rgba(212, 168, 67, 0.3);
  border-radius: 3px;
  color: var(--accent-light, #e8c97a);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  cursor: default;
}

.cm-toolbar-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cm-toolbar-label {
  font-family: 'Philosopher', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-light, #e8c97a);
  opacity: 0.85;
}

.cm-chip-group {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.cm-chip {
  padding: 0.35rem 0.8rem;
  background: rgba(10, 15, 28, 0.6);
  border: 1px solid rgba(212, 168, 67, 0.25);
  border-radius: 999px;
  color: var(--text-muted, #9e9e9e);
  font-family: 'Philosopher', sans-serif;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.18s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.cm-chip:hover {
  background: rgba(212, 168, 67, 0.1);
  border-color: rgba(212, 168, 67, 0.5);
  color: var(--gold-light, #e8c97a);
}

.cm-chip.is-active {
  background: rgba(212, 168, 67, 0.18);
  border-color: var(--accent-light, #e8c97a);
  color: var(--gold-light, #e8c97a);
}

.cm-chip-toggle .cm-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chip-color, #d4a843);
  opacity: 0.4;
  transition: opacity 0.2s;
}

.cm-chip-toggle.is-active .cm-chip-dot {
  opacity: 1;
}

/* Slider */
.cm-slider {
  width: 140px;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: rgba(212, 168, 67, 0.25);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.cm-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent-light, #e8c97a);
  border-radius: 50%;
  border: 2px solid var(--bg, #0a0f1c);
  cursor: grab;
  transition: transform 0.15s;
}

.cm-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.15);
}

.cm-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--accent-light, #e8c97a);
  border-radius: 50%;
  border: 2px solid var(--bg, #0a0f1c);
  cursor: grab;
}

#cm-impact-display {
  display: inline-block;
  min-width: 1ch;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.86rem;
  color: var(--gold-light, #e8c97a);
  font-weight: 500;
}

/* ──────────────────────────────────────────────────────────────────────
   HELP BANNER
   ────────────────────────────────────────────────────────────────────── */
.cm-help-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1rem;
  background: linear-gradient(90deg, rgba(212, 168, 67, 0.12) 0%, rgba(212, 168, 67, 0.04) 100%);
  border-bottom: 1px solid rgba(212, 168, 67, 0.18);
  font-family: Georgia, serif;
  font-size: 0.82rem;
  color: var(--text-body, #d4c8b0);
  line-height: 1.5;
  transition: all 0.3s;
  overflow: hidden;
}

.cm-help-banner.is-dismissed {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  border-bottom-color: transparent;
}

.cm-help-icon {
  color: var(--accent-light, #e8c97a);
  font-size: 1rem;
  opacity: 0.9;
}

.cm-help-text {
  flex: 1;
}

.cm-help-text strong {
  color: var(--gold-light, #e8c97a);
  font-weight: 500;
}

.cm-help-dismiss {
  background: transparent;
  border: 1px solid rgba(212, 168, 67, 0.3);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  color: var(--accent-light, #e8c97a);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.18s;
}

.cm-help-dismiss:hover {
  background: rgba(212, 168, 67, 0.2);
  border-color: var(--accent-light, #e8c97a);
}

/* ──────────────────────────────────────────────────────────────────────
   LEGEND
   ────────────────────────────────────────────────────────────────────── */
.cm-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem 1.2rem;
  padding: 0.6rem 1rem;
  border-top: 1px solid rgba(212, 168, 67, 0.18);
  background: rgba(10, 15, 28, 0.5);
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.82rem;
  color: var(--text-muted, #9e9e9e);
}

.cm-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.cm-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 253, 231, 0.3);
}

.cm-legend-swatch {
  width: 18px;
  height: 10px;
  border-radius: 2px;
}

.cm-legend-divider {
  width: 1px;
  height: 16px;
  background: rgba(212, 168, 67, 0.25);
}

/* ──────────────────────────────────────────────────────────────────────
   CHART CONTAINER
   ────────────────────────────────────────────────────────────────────── */
.cm-chart-wrap {
  position: relative;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(212, 168, 67, 0.04) 0%, transparent 60%),
    rgba(255, 253, 231, 0.015);
  padding: 0 1.2rem;
}

.cm-chart-container {
  width: 100%;
  /* Aspect ratio matches the SVG viewBox 1800x640 → ~2.81:1.
     Updated when Statecraft row added in v.1.1. */
  aspect-ratio: 1800 / 640;
  max-height: min(75vh, 880px);
  min-height: 420px;
  overflow: hidden;
  cursor: grab;
}

.cm-chart-container:active {
  cursor: grabbing;
}

#cm-chart {
  width: 100%;
  height: 100%;
  display: block;
}

/* Ultra-wide display: cap the aspect to prevent cartoonish stretching */
@media (min-aspect-ratio: 21/9) {
  .cm-chart-container {
    aspect-ratio: 16 / 5;
  }
}

/* SVG element styles */
.cm-figure circle.cm-fig-dot {
  transition: r 0.2s ease-out, opacity 0.2s, fill 0.3s, stroke-width 0.2s;
}

.cm-figure circle.cm-fig-glow {
  transition: r 0.3s ease-out, opacity 0.2s;
  pointer-events: none;
}

.cm-figure:hover circle.cm-fig-dot {
  filter: drop-shadow(0 0 8px rgba(232, 201, 122, 0.9));
  stroke-width: 1.6;
  stroke: #FFFDE7;
}

.cm-figure:hover circle.cm-fig-glow {
  r: 14;
  opacity: 0.45;
}

.cm-figure text.cm-fig-label {
  transition: opacity 0.2s;
  pointer-events: none;
}

.cm-figure:hover text.cm-fig-label {
  opacity: 1 !important;
  font-weight: 600;
}

.cm-war rect {
  transition: opacity 0.18s, filter 0.2s;
}

.cm-war:hover rect {
  opacity: 1 !important;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.4));
}

/* "Now" pulse — at 2026 marker */
@keyframes cm-now-pulse-ring {
  0%   { r: 8;  opacity: 0.7; stroke-width: 2; }
  100% { r: 28; opacity: 0;   stroke-width: 0.5; }
}

circle.cm-now-pulse {
  animation: cm-now-pulse-ring 2.4s ease-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}

/* Phase labels with subtle entry animation */
.cm-phases .cm-phase-label {
  opacity: 0;
  animation: cm-fade-in 0.6s 0.2s ease-out forwards;
}

@keyframes cm-fade-in {
  to { opacity: 0.95; }
}

/* Reduced-motion override */
@media (prefers-reduced-motion: reduce) {
  circle.cm-now-pulse,
  .cm-phases .cm-phase-label {
    animation: none;
  }
  .cm-phases .cm-phase-label { opacity: 0.95; }
}

/* Zoom controls */
.cm-zoom-controls {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 5;
}

.cm-zoom-btn {
  width: 36px;
  height: 36px;
  background: rgba(10, 15, 28, 0.85);
  border: 1px solid rgba(212, 168, 67, 0.4);
  border-radius: 4px;
  color: var(--gold-light, #e8c97a);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cm-zoom-btn:hover {
  background: rgba(212, 168, 67, 0.2);
  border-color: var(--accent-light, #e8c97a);
}

/* ──────────────────────────────────────────────────────────────────────
   TOOLTIP
   ────────────────────────────────────────────────────────────────────── */
.cm-tooltip {
  position: fixed;
  z-index: 1000;
  display: none;
  max-width: 320px;
  padding: 0.8rem 1rem;
  background: rgba(10, 15, 28, 0.96);
  border: 1px solid var(--accent, #d4a843);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.cm-tt-name {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.96rem;
  font-weight: 500;
  color: var(--gold-light, #e8c97a);
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
}

.cm-tt-meta {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.78rem;
  color: var(--text-muted, #9e9e9e);
  margin-bottom: 0.5rem;
}

.cm-tt-tooltip-text {
  font-family: 'Georgia', serif;
  font-size: 0.86rem;
  color: var(--text-body, #d4c8b0);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.cm-tt-impact {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  color: var(--accent-light, #e8c97a);
  background: rgba(212, 168, 67, 0.12);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  margin-right: 0.4rem;
}

.cm-tt-cta {
  font-family: 'Philosopher', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--accent-light, #e8c97a);
  margin-top: 0.4rem;
  opacity: 0.7;
}

/* ──────────────────────────────────────────────────────────────────────
   SIDEBAR
   ────────────────────────────────────────────────────────────────────── */
.cm-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: clamp(320px, 45vw, 520px);
  height: 100vh;
  background: rgba(10, 15, 28, 0.98);
  border-left: 1px solid var(--accent, #d4a843);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.6);
  z-index: 100;
  overflow-y: auto;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  /* NOTE: transform + transition intentionally NOT set here.
     Framer Motion handles slide animation via inline styles in Sidebar.jsx.
     Setting CSS transform/transition here causes a fight with Framer Motion's
     animation loop and prevents the close animation from completing — sidebar
     stays visible on close. Removed in v.1.1. */
}

/* `.cm-sidebar.is-open` is hardcoded in JSX as a static class. Framer Motion
   handles open/close via inline transform — the class is left for downstream
   styling hooks if needed but should NOT set transform here. */

.cm-sidebar-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  background: rgba(212, 168, 67, 0.1);
  border: 1px solid rgba(212, 168, 67, 0.3);
  border-radius: 50%;
  color: var(--gold-light, #e8c97a);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  transition: all 0.18s;
}

.cm-sidebar-close:hover {
  background: rgba(212, 168, 67, 0.25);
  transform: rotate(90deg);
}

.cm-sidebar-content {
  padding: 2.4rem 1.6rem 2rem;
}

.cm-sb-header {
  margin-bottom: 1.4rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(212, 168, 67, 0.18);
}

.cm-sb-tag {
  font-family: 'Philosopher', sans-serif;
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-light, #e8c97a);
  opacity: 0.85;
  margin-bottom: 0.5rem;
}

.cm-sb-name {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--gold-light, #e8c97a);
  letter-spacing: 0.02em;
  margin: 0 0 0.4rem;
  line-height: 1.25;
}

.cm-sb-dates {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.92rem;
  color: var(--text-muted, #9e9e9e);
}

.cm-sb-section {
  margin-bottom: 1.4rem;
}

.cm-sb-section-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-light, #e8c97a);
  opacity: 0.85;
  margin-bottom: 0.4rem;
}

.cm-sb-empirical {
  font-family: Georgia, serif;
  font-size: 0.96rem;
  line-height: 1.65;
  color: var(--text-body, #d4c8b0);
  margin: 0;
}

.cm-sb-framework {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--gold-light, #e8c97a);
  border-left: 2px solid var(--accent, #d4a843);
  padding-left: 1rem;
  margin: 0;
}

.cm-sb-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin: 1.2rem 0;
  padding: 0.9rem 1rem;
  background: rgba(212, 168, 67, 0.05);
  border-radius: 4px;
  border: 1px solid rgba(212, 168, 67, 0.18);
}

.cm-sb-meta {
  display: flex;
  flex-direction: column;
}

.cm-sb-meta-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted, #9e9e9e);
  opacity: 0.85;
}

.cm-sb-meta-value {
  font-family: Georgia, serif;
  font-size: 0.86rem;
  color: var(--text-body, #d4c8b0);
  margin-top: 0.15rem;
}

.cm-sb-wiki {
  display: inline-block;
  font-family: 'Philosopher', sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--accent-light, #e8c97a);
  text-decoration: none;
  border-bottom: 1px solid var(--accent, #d4a843);
  padding-bottom: 2px;
  transition: color 0.18s;
}

.cm-sb-wiki:hover {
  color: var(--gold-light, #e8c97a);
}

/* CTA Block */
.cm-sb-cta {
  margin-top: 1.6rem;
  padding: 1.2rem 1rem;
  background: linear-gradient(135deg, rgba(212, 168, 67, 0.08) 0%, rgba(212, 168, 67, 0.02) 100%);
  border: 1px solid rgba(212, 168, 67, 0.3);
  border-radius: 6px;
}

.cm-sb-cta-label {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--gold-light, #e8c97a);
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.cm-sb-cta-help {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--text-muted, #9e9e9e);
  margin: 0 0 0.8rem;
}

.cm-sb-cta-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cm-sb-cta-btn {
  flex: 1;
  min-width: 130px;
  padding: 0.55rem 0.8rem;
  background: rgba(10, 15, 28, 0.6);
  border: 1px solid rgba(212, 168, 67, 0.4);
  border-radius: 4px;
  color: var(--gold-light, #e8c97a);
  font-family: 'Philosopher', sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.18s;
}

.cm-sb-cta-btn:hover {
  background: rgba(212, 168, 67, 0.15);
  border-color: var(--accent-light, #e8c97a);
  transform: translateY(-1px);
}

.cm-sb-cta-x:hover {
  background: rgba(29, 161, 242, 0.15);
  border-color: rgba(29, 161, 242, 0.6);
}

.cm-sb-cta-substack:hover {
  background: rgba(255, 102, 22, 0.15);
  border-color: rgba(255, 102, 22, 0.6);
}

/* Footer */
.cm-sb-footer {
  margin-top: 1.4rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(212, 168, 67, 0.15);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.cm-sb-version {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-muted, #9e9e9e);
  opacity: 0.75;
}

.cm-sb-deeplink {
  font-family: 'Philosopher', sans-serif;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--accent-light, #e8c97a);
  text-decoration: none;
  border-bottom: 1px dotted rgba(212, 168, 67, 0.4);
}

.cm-sb-deeplink:hover {
  color: var(--gold-light, #e8c97a);
}

/* ──────────────────────────────────────────────────────────────────────
   MOBILE RESPONSIVE
   ────────────────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .cm-toolbar {
    padding: 0.7rem 0.8rem;
  }
  .cm-toolbar-row {
    gap: 0.6rem;
  }
  .cm-toolbar-search-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .cm-toolbar-search {
    width: 100%;
    max-width: none;
  }
  .cm-toolbar-section {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }
  .cm-chart-container {
    height: clamp(360px, 56vh, 520px);
  }
  .cm-zoom-controls {
    bottom: 8px;
    right: 8px;
  }
  .cm-zoom-btn {
    width: 32px;
    height: 32px;
  }
  .cm-sidebar {
    width: 100vw;
    height: 90vh;
    top: auto;
    bottom: 0;
    border-left: none;
    border-top: 1px solid var(--accent, #d4a843);
    border-radius: 12px 12px 0 0;
    /* Mobile bottom-sheet: Framer Motion's translateX(100%) still slides off-right
       on mobile. For perfect bottom-sheet UX (slide up from bottom), Sidebar.jsx
       would need viewport-aware variants. Day 6 polish item. For now, slide-from-right
       works on mobile too (just less idiomatic than bottom-sheet). */
  }
  .cm-sidebar-content {
    padding: 1.6rem 1.2rem 1.6rem;
  }
  .cm-sb-meta-grid {
    grid-template-columns: 1fr;
  }
  .cm-tooltip {
    max-width: calc(100vw - 32px);
    font-size: 0.84rem;
  }
  /* WCAG 2.5.5 / Apple HIG / Material — 44px minimum touch target */
  .cm-chip {
    min-height: 44px;
    padding: 0.55rem 1rem;
  }
}

/* ──────────────────────────────────────────────────────────────────────
   PRINT — fall back to static SVG, hide interactive
   ────────────────────────────────────────────────────────────────────── */
@media print {
  #cm-interactive-mount,
  .cm-playground {
    display: none;
  }
  .cm-figure.cm-static-fallback {
    display: block !important;
  }
}

/* Reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .cm-sidebar,
  .cm-sidebar-close,
  .cm-sb-cta-btn,
  .cm-figure circle.cm-fig-dot,
  .cm-war rect,
  .cm-chip {
    transition: none;
  }
}
