/* Publication-grade interactive figure cards and SVG chart typography */
.chart-card {
  padding: 22px 24px 20px;
}

.chart-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.chart-card-head > div:first-child {
  flex: 1 1 300px;
  min-width: 0;
}

.chart-card-title {
  margin: 0;
  font: 600 17.5px/1.3 var(--serif);
  color: var(--ink);
}

.chart-card-sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--mute);
}

/* Segmented pill switcher */
.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  flex-shrink: 0;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.segmented::-webkit-scrollbar {
  display: none;
}

.segmented button {
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  transition: background-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button[aria-selected="true"] {
  background: var(--card);
  color: var(--navy);
  box-shadow: 0 1px 4px rgba(30, 42, 53, 0.1);
}

.segmented-sm button {
  padding: 4px 10px;
  font-size: 11.5px;
}

/* Legend & SVG shared styles */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
}

.chart-key {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.chart-swatch {
  display: inline-block;
  width: 14px;
  height: 9px;
  border-radius: 2px;
}

.chart-swatch-outline {
  width: 16px;
  height: 9px;
  border-radius: 2px;
  background: rgba(63, 122, 108, 0.09);
  border: 1px dashed var(--sage);
}

.chart-swatch-deficit {
  width: 16px;
  height: 9px;
  border-radius: 2px;
  background: rgba(180, 89, 102, 0.14);
  border: 1px dashed rgba(180, 89, 102, 0.6);
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-svg text {
  fill: var(--ink);
  font-family: var(--sans);
}

.chart-svg .chart-tick {
  fill: #8895a1;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.chart-svg .chart-col-title {
  fill: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
}

.chart-grid {
  stroke: #edf1f5;
  stroke-width: 1;
}

.chart-axis {
  stroke: #cdd6df;
  stroke-width: 1.1;
}

.chart-row {
  outline: none;
}

.chart-row-hit {
  fill: transparent;
  transition: fill 0.12s ease;
}

.chart-human .chart-row-hit {
  fill: #eef6f3;
}

.chart-row:hover .chart-row-hit,
.chart-row:focus-visible .chart-row-hit {
  fill: #f2f5f8;
}

.chart-human:hover .chart-row-hit,
.chart-human:focus-visible .chart-row-hit {
  fill: #e4f1ec;
}

.chart-model {
  font-size: 12.5px;
  font-weight: 500;
}

.chart-human .chart-model {
  font-weight: 650;
  fill: #24574b;
}

.chart-svg .chart-val {
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  fill: var(--ink-2);
}

.chart-svg .chart-val-strong {
  font-weight: 650;
  fill: var(--ink);
}

.chart-svg .chart-val-gain {
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  fill: var(--sage);
}

.chart-svg .chart-val-gap {
  font-size: 11.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  fill: var(--crimson);
}

.chart-svg .chart-val-ceiling {
  font-size: 11px;
  font-weight: 650;
  fill: var(--sage);
}

.chart-svg .chart-val-pair {
  font-size: 10.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  fill: var(--ink-2);
}

.chart-gain-compact .chart-model {
  font-size: 11px;
}

.chart-gain-compact .chart-val-pair {
  font-size: 9.8px;
}

.chart-gain-compact .chart-val-gain {
  font-size: 10px;
}

.chart-gain-compact .chart-val-gap,
.chart-gain-compact .chart-val-ceiling {
  font-size: 10px;
}

.chart-gain-compact .chart-val {
  font-size: 9.8px;
}

.chart-sep {
  stroke: var(--line);
  stroke-width: 1;
}

/* Compact parsing task definitions bar (Figure 5) */
.task-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin: -4px 0 16px;
}

.task-chips span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  font-size: 11.5px;
  color: var(--ink-2);
}

.task-chips strong {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.chart-bar {
  shape-rendering: geometricPrecision;
}

.performance-gap {
  margin-top: 22px;
}

/* Compact stat summary strip below Figure 3 */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.stat-strip-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-item {
  padding: 10px 13px;
  border-radius: 8px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
}

.stat-item-human {
  background: var(--sage-soft);
  border-color: #cbe3dc;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mute);
  margin-bottom: 3px;
}

.stat-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.stat-score {
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
}

.stat-delta {
  font-size: 12px;
  font-weight: 650;
  color: var(--crimson);
}

.stat-item-human .stat-delta {
  color: var(--sage);
}

/* Figure 4: Pairwise diagnostic side-by-side panels + 2x2 heatmap */
.diag-pair-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.diag-box {
  padding: 16px 18px 14px;
  border-radius: 10px;
  background: #fafcfd;
  border: 1px solid var(--line-soft);
}

.diag-box-bottleneck {
  background: #fdf9f9;
  border-color: #eed6da;
}

.diag-box-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.diag-box-title {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
}

.diag-pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--paper);
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.diag-pill-warn {
  background: var(--crimson-soft);
  color: var(--crimson);
}

.diag-box-desc {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--mute);
}

.diag-model-row {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px 0;
}

.diag-model-row:first-of-type {
  padding-top: 6px;
}

.diag-model-row:last-of-type {
  padding-bottom: 2px;
}

.diag-model-row + .diag-model-row {
  border-top: 1px solid var(--line-soft);
}

.diag-model-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.diag-model-id {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.diag-model-id img {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.diag-bars {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.diag-bar-line {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--mute);
}

.diag-track {
  height: 11px;
  border-radius: 3px;
  background: #e9eef3;
  overflow: hidden;
}

.diag-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.2s ease;
}

.diag-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink);
}

.diag-delta {
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.diag-delta-flat {
  background: var(--sage-soft);
  color: var(--sage);
}

.diag-delta-mid {
  background: #eef2f6;
  color: var(--ink-2);
}

.diag-delta-drop {
  background: var(--crimson-soft);
  color: var(--crimson);
}

/* Compact 2x2 per-environment matrix beneath pairwise cards */
.heatmap-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.heatmap-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.heatmap-title {
  margin: 0;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-2);
}

.heatmap-sub {
  font-size: 11.5px;
  color: var(--mute);
}

.hm-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.hm-model-card {
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
}

.hm-model-name {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 10px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink);
}

.hm-model-name img {
  width: 15px;
  height: 15px;
}

.hm-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.hm-table th {
  font-weight: 600;
  color: var(--mute);
  text-align: center;
  padding: 2px 4px;
}

.hm-table th.hm-row-label {
  text-align: right;
  padding-right: 6px;
  font-size: 11px;
  white-space: nowrap;
}

.hm-table th.hm-env-head {
  color: var(--ink);
  font-size: 11px;
  letter-spacing: 0.04em;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.hm-table th.hm-env-head:hover {
  background: var(--paper);
  color: var(--navy);
}

.hm-table th.hm-env-head.active {
  background: var(--slate-soft);
  color: var(--navy);
}

.hm-cell {
  text-align: center;
  padding: 6px 4px;
  border-radius: 5px;
  font-weight: 650;
}

/* Figure 6: Follow-up 2-column probes */
.probes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.probe-card {
  padding: 20px 22px 18px;
  display: flex;
  flex-direction: column;
}

.probe-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.probe-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.probe-lead {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
}

.view-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.view-thumb {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.view-thumb img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border-radius: 7px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.view-thumb span {
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--mute);
}

@media (max-width: 820px) {
  .diag-pair-grid,
  .hm-grid,
  .probes-grid,
  .stat-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .chart-card,
  .probe-card {
    padding: 15px 14px;
  }

  .hm-model-card {
    padding: 10px 8px;
  }

  .hm-table {
    border-spacing: 3px;
    font-size: 10.5px;
  }

  .hm-table th.hm-row-label {
    font-size: 10px;
    padding-right: 4px;
  }

  .hm-cell {
    padding: 5px 2px;
  }
}
