/* OPT Chronicles Specific Styles */
.hero-banner {
  background: linear-gradient(135deg, #0e2b44 0%, #174266 100%);
  color: #f0f7fd;
  padding: 3rem max(4vw, 1.5rem);
  border-radius: 8px;
  margin-bottom: 2.5rem;
  box-shadow: 0 4px 20px rgba(14, 43, 68, 0.15);
}

.hero-banner h1 {
  color: #ffffff;
  font-size: clamp(2rem, 5vw, 3.8rem);
  max-width: 24ch;
  margin-bottom: 0.8rem;
}

.hero-banner .lead {
  color: #cde4f7;
  font-size: 1.25rem;
  max-width: 65ch;
  margin-bottom: 2rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1.2rem;
  margin-top: 1.5rem;
}

.stat-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 1.2rem;
  border-radius: 6px;
  backdrop-filter: blur(4px);
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: #48b0ff;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.85rem;
  color: #b5d5ed;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.4rem;
}

/* Timeline & Controls */
.controls-panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.2rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.filter-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-label {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
}

.filter-btn {
  background: var(--wash);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 0.45rem 0.9rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 44px;
}

.filter-btn:hover {
  background: #d0e4f4;
  color: var(--accent);
}

.filter-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.search-box {
  position: relative;
  flex-grow: 1;
  max-width: 400px;
}

.search-box input {
  padding-left: 2rem;
  border-radius: 20px;
  border: 1px solid var(--line);
  font-size: 0.9rem;
}

.search-box svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  fill: var(--muted);
  width: 14px;
  height: 14px;
}

/* Timeline Visualization */
.timeline-viz-container {
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  overflow-x: auto;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.legend {
  display: flex;
  gap: 1.2rem;
  font-size: 0.85rem;
  flex-wrap: wrap;
}

.legend-centered {
  margin-top: 1rem;
  justify-content: center;
}

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

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.swatch-sev { background: #e02424; }
.swatch-hw { background: #d97706; }
.swatch-stability { background: #dc2626; }
.swatch-tune { background: #2563eb; }
.swatch-auto { background: #0d9488; }
.swatch-exp11 { background: #ef4444; }
.swatch-exp12 { background: #0284c7; }
.swatch-gpt3 { background: #f59e0b; }

.timeline-svg {
  width: 100%;
  min-width: 780px;
  height: 180px;
  user-select: none;
}

.event-marker {
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.event-marker:hover {
  filter: brightness(1.2);
}

.event-marker.selected circle {
  stroke: #ffffff;
  stroke-width: 3px;
}

/* Event Detail Inspector */
.event-inspector {
  background: var(--wash);
  border-left: 5px solid var(--accent);
  border-radius: 0 6px 6px 0;
  padding: 1.5rem;
  margin-bottom: 2rem;
  transition: all 0.2s ease;
}

.inspector-meta {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-sev {
  background: #fde8e8;
  color: #9b1c1c;
  border: 1px solid #f8b4b4;
}

.badge-hardware {
  background: #feecdc;
  color: #903c09;
  border: 1px solid #fbd5b5;
}

.badge-stability {
  background: #fdf2f2;
  color: #9c1a1a;
  border: 1px solid #fca5a5;
}

.badge-tune {
  background: #e1effe;
  color: #1e429f;
  border: 1px solid #b3d1ff;
}

.badge-auto {
  background: #def7ec;
  color: #03543f;
  border: 1px solid #84e1bc;
}

.log-quote {
  background: white;
  border: 1px solid var(--line);
  padding: 1rem 1.2rem;
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 0.88rem;
  color: #243b53;
  margin: 1rem 0;
  white-space: pre-wrap;
}

/* Loss & Perplexity Trajectory Section */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 540px), 1fr));
  gap: 1.8rem;
  margin: 2rem 0;
}

.chart-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.5rem;
}

.svg-chart {
  width: 100%;
  height: 260px;
}

/* Learnings Grid */
.learnings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.learning-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.learning-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(24, 47, 70, 0.08);
}

.learning-num {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.learning-card h3 {
  margin: 0 0 0.8rem 0;
  color: var(--ink);
  font-size: 1.25rem;
}

.card-callout {
  background: var(--wash);
  padding: 0.85rem;
  border-radius: 4px;
  margin-top: auto;
  font-size: 0.88rem;
  color: var(--ink);
}

/* Simulator Section */
.simulator-panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2rem;
  margin: 2rem 0;
}

.sim-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  margin-top: 1.5rem;
}

.sim-slider-row {
  margin-bottom: 1.4rem;
}

.sim-slider-row label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.3rem;
  font-size: 0.92rem;
}

.sim-slider-row .slider-val {
  font-weight: 750;
  color: var(--accent);
}

.sim-results {
  background: var(--wash);
  padding: 1.5rem;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  justify-content: center;
}

.sim-metric {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.6rem;
}

.sim-metric:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.sim-metric-label {
  font-size: 0.9rem;
  color: var(--muted);
}

.sim-metric-val {
  font-size: 1.4rem;
  font-weight: 750;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* Event List View */
.event-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.event-row {
  background: white;
  border: 1px solid var(--line);
  padding: 1rem;
  border-radius: 6px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 110px 140px 1fr auto;
  gap: 1rem;
  align-items: center;
  transition: all 0.15s ease;
}

.event-row:hover {
  border-color: var(--accent);
  background: #fbfdff;
}

.event-row.active {
  border-color: var(--accent);
  background: var(--wash);
  box-shadow: 0 0 0 1px var(--accent);
}

.inspector-date {
  font-weight: 700;
  color: var(--ink);
}

.inspector-tokens {
  color: var(--muted);
  font-size: 0.9rem;
}

.inspector-title {
  margin: 0 0 0.6rem 0;
  font-size: 1.4rem;
}

.inspector-summary {
  margin: 0 0 1rem 0;
  font-size: 1.05rem;
}

.inspector-impact {
  font-size: 0.9rem;
  color: var(--muted);
}

.inspector-impact-label {
  color: var(--ink);
}

.ledger-heading {
  margin: 2rem 0 0.8rem 0;
}

.event-empty {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}

.event-row-date {
  font-weight: 700;
  font-size: 0.88rem;
}

.event-row-title {
  color: var(--ink);
  font-size: 0.95rem;
}

.event-row-summary {
  font-size: 0.84rem;
  color: var(--muted);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  max-width: 480px;
}

.event-row-tokens {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.chart-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.8rem;
}

.no-margin {
  margin: 0;
}

.no-top-margin {
  margin-top: 0;
}

.chart-sub {
  font-size: 0.85rem;
  color: var(--muted);
}

.chart-card-centered {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card-copy {
  font-size: 0.95rem;
}

.sim-metric-danger {
  color: #dc2626;
}

.references-section {
  margin-top: 3rem;
  border-top: 1px solid var(--line);
  padding-top: 2rem;
}

@media (max-width: 860px) {
  .sim-columns {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .event-row {
    grid-template-columns: 1fr auto;
    gap: 0.4rem;
  }
  .event-row .event-category {
    grid-column: 1 / -1;
  }
}
