/* brashear-interactive.css — three bespoke data visualizations for the
   Brashear case study, built from the paper's actual regression output:
   a coefficient comparison chart, a threshold toggle, and an animated
   event-study line chart. Loads alongside case-study.css. */

.brash-viz-wrap {
  display: flex;
  flex-direction: column;
  gap: 40px;
  margin: 28px 0;
}

.brash-viz-caption {
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin-top: 10px;
  max-width: 60ch;
}

.brash-viz-title {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
  margin-bottom: 14px;
}

/* --- 1. Coefficient comparison chart --- */
.brash-chart {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brash-chart-row {
  display: grid;
  grid-template-columns: 110px 1fr 100px;
  align-items: center;
  gap: 12px;
}

.brash-chart-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}

.brash-chart-track {
  position: relative;
  height: 22px;
  background: var(--cream-dark);
  border-radius: 6px;
  overflow: hidden;
}

.brash-chart-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  border-radius: 6px;
  background: var(--sage);
  transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

.brash-chart-bar[data-sig="sig"] { background: var(--accent-green-dark); }
.brash-chart-bar[data-sig="marginal"] { background: var(--accent-green); }

.brash-chart.in-view .brash-chart-bar { width: var(--w); }

.brash-chart-value {
  font-family: 'Fraunces', serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
}

.brash-chart-value .brash-sig-tag {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ink-soft);
}

/* --- 2. Threshold toggle --- */
.brash-slider {
  background: var(--cream);
  border-radius: 16px;
  padding: 24px;
}

.brash-slider-track {
  position: relative;
  display: flex;
  background: var(--cream-dark);
  border-radius: 12px;
  padding: 5px;
  gap: 5px;
}

.brash-slider-thumb {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 0;
  width: 0;
  background: var(--accent-green-dark);
  border-radius: 8px;
  transition: left 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 1;
}

.brash-slider-pos {
  position: relative;
  z-index: 2;
  flex: 1;
  padding: 12px 14px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-soft);
  transition: color 0.3s ease;
  text-align: center;
}

.brash-slider-pos[aria-pressed="true"] { color: var(--white); }
.brash-slider-pos:hover[aria-pressed="false"] { color: var(--ink); }

.brash-slider-readout {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.brash-slider-number {
  font-family: 'Fraunces', serif;
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--accent-green-dark);
  transition: color 0.3s ease;
}

.brash-slider-number.is-ns { color: var(--ink-soft); }

.brash-slider-sig {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--cream-dark);
}

.brash-slider-sig.is-sig {
  background: var(--sage-light);
  color: var(--accent-green-dark);
}

/* --- 3. Animated event-study chart --- */
.brash-eventstudy {
  background: var(--cream);
  border-radius: 16px;
  padding: 24px;
}

.brash-eventstudy-svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

.brash-es-axis {
  stroke: var(--cream-dark);
  stroke-width: 2;
}

.brash-es-zero {
  stroke: var(--ink-soft);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: 0.6;
}

.brash-es-ref-line {
  stroke: var(--coral-dark);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
  opacity: 0;
  transition: opacity 0.5s ease 1.3s;
}

.brash-eventstudy.in-view .brash-es-ref-line { opacity: 0.7; }

.brash-es-ref-label {
  fill: var(--coral-dark);
  font-size: 11px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.5s ease 1.3s;
}

.brash-eventstudy.in-view .brash-es-ref-label { opacity: 1; }

.brash-es-line {
  fill: none;
  stroke: var(--accent-green-dark);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brash-es-dot {
  fill: var(--accent-green-dark);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.brash-eventstudy.in-view .brash-es-dot { opacity: 1; }

.brash-es-label {
  fill: var(--ink-soft);
  font-size: 10px;
  font-family: 'Inter', sans-serif;
}

@media (max-width: 600px) {
  .brash-chart-row { grid-template-columns: 88px 1fr 78px; gap: 8px; }
  .brash-chart-label { font-size: 0.78rem; }
  .brash-chart-value { font-size: 0.82rem; }
  .brash-slider-number { font-size: 1.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  .brash-chart-bar,
  .brash-slider-thumb,
  .brash-slider-number,
  .brash-es-ref-line,
  .brash-es-ref-label,
  .brash-es-dot {
    transition: none !important;
  }
}
