/* ============================================================
   VIZ 1.4 — Timeline & uncertainty cone
   Panel: .viz-panel[data-viz="4"]
   Cone (SVG) + slider + per-market buttons + readout.
   Accent cyan #3FA9C4, dark-theme aware via chapter.css vars.
   ============================================================ */

.viz14 {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 22px 24px 18px;
}

/* ---------- Header ---------- */
.viz14-header {
  margin-bottom: 6px;
}
.viz14-title {
  font-family: "Lato", sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.viz14-title i { color: var(--accent); font-size: 17px; }
.viz14-sub {
  font-size: 11.5px;
  color: var(--text-mute);
  margin-top: 3px;
  line-height: 1.4;
}

/* ---------- Market buttons (jump-to) ---------- */
.viz14-markets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 14px 0 10px;
}
.viz14-mkt-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-soft);
  font-family: inherit;
}
.viz14-mkt-btn i { font-size: 16px; }
.viz14-mkt-btn .viz14-mkt-name {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-align: center;
  line-height: 1.1;
}
.viz14-mkt-btn:hover {
  border-color: var(--accent-soft);
  color: var(--text);
}
.viz14-mkt-btn.active {
  border-color: var(--accent);
  background: rgba(63, 169, 196, 0.10);
  color: var(--accent);
}
body.theme-dark .viz14-mkt-btn.active {
  background: rgba(133, 183, 235, 0.12);
}

/* ---------- Cone canvas ---------- */
.viz14-canvas-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.viz14-svg {
  width: 100%;
  height: 100%;
  max-height: 340px;
  overflow: visible;
}

/* SVG element styling via classes (so dark theme can recolor) */
.viz14-axis      { stroke: var(--text-mute); stroke-width: 1; opacity: 0.5; }
.viz14-gridline  { stroke: var(--text-mute); stroke-width: 0.5; stroke-dasharray: 2 3; opacity: 0.35; }
.viz14-cone-fill { fill: var(--accent); opacity: 0.16; transition: opacity 0.3s ease; }
.viz14-cone-edge { stroke: var(--accent); stroke-width: 1; fill: none; opacity: 0.4; }
.viz14-center    { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: 0.7; }

.viz14-tick-label  { font-size: 9.5px; fill: var(--text-mute); }
.viz14-axis-label  { font-size: 10px; fill: var(--text-soft); font-weight: 600; }

/* Moving marker on the cone */
.viz14-marker-line { stroke: var(--accent); stroke-width: 1.5; opacity: 0.85;
                     transition: x1 0.35s ease, x2 0.35s ease; }
.viz14-marker-dot  { fill: var(--accent); transition: cx 0.35s ease, cy 0.35s ease; }
.viz14-marker-band { fill: var(--accent); opacity: 0.30;
                     transition: x 0.35s ease, width 0.35s ease, y 0.35s ease, height 0.35s ease; }

/* Pulse animation reserved for balancing (real-time) */
.viz14-marker-dot.pulsing {
  animation: viz14-pulse 1.1s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}
@keyframes viz14-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}
.viz14-pulse-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  opacity: 0;
}
.viz14-pulse-ring.on {
  animation: viz14-ring 1.1s ease-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}
@keyframes viz14-ring {
  0%   { opacity: 0.6; r: 6px; }
  100% { opacity: 0;   r: 18px; }
}

/* ---------- Slider ---------- */
.viz14-slider-wrap {
  margin: 12px 2px 4px;
}
.viz14-slider-top {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-mute);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}
.viz14-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 3px;
  background: var(--rule);
  outline: none;
  cursor: pointer;
}
.viz14-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-card);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  cursor: pointer;
}
.viz14-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-card);
  cursor: pointer;
}

/* ---------- Readout ---------- */
.viz14-readout {
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(63, 169, 196, 0.06);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  min-height: 78px;
}
body.theme-dark .viz14-readout {
  background: rgba(133, 183, 235, 0.07);
}
.viz14-readout-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}
.viz14-readout-name {
  font-family: "Lato", sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}
.viz14-readout-window {
  font-size: 10.5px;
  color: var(--text-mute);
  font-weight: 600;
  white-space: nowrap;
}
.viz14-readout-body {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
}
.viz14-readout-forecast {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-soft);
}
.viz14-readout-forecast strong {
  color: var(--text);
  font-weight: 700;
}
.viz14-example-tag {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-mute);
  opacity: 0.8;
  margin-left: 4px;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .viz14 { padding: 16px 16px 14px; }
  .viz14-svg { max-height: 150px; }
  .viz14-readout { min-height: 0; }
  .viz14-mkt-btn .viz14-mkt-name { font-size: 9.5px; }
}
