/* the-third-energy-argument — diagram / instrument readability */

/* —— Key concepts primer (list + detail panel, not accordion) —— */
.energy-primer {
  margin: 2rem 0 2.75rem;
  max-width: 100%;
}
.energy-primer-shell {
  overflow: hidden;
}
.energy-primer-lead {
  margin: 0;
  padding: 0.65rem 1rem 0.55rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: rgb(var(--ink) / 0.5);
  border-bottom: 1px solid rgb(var(--ink) / 0.08);
}
.energy-primer-layout {
  display: grid;
  grid-template-columns: minmax(11.5rem, 15.5rem) minmax(0, 1fr);
  min-height: 22rem;
}
.energy-primer-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 26rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid rgb(var(--ink) / 0.08);
  background: rgb(var(--ink) / 0.02);
  scrollbar-width: thin;
}
.energy-primer-tab {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  margin: 0;
  padding: 0.7rem 0.85rem 0.7rem 0.95rem;
  border: none;
  border-bottom: 1px solid rgb(var(--ink) / 0.06);
  border-left: 2px solid transparent;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.energy-primer-tab:hover {
  background: rgb(var(--accent) / 0.05);
}
.energy-primer-tab:focus-visible {
  outline: 2px solid rgb(var(--accent) / 0.45);
  outline-offset: -2px;
  z-index: 1;
}
.energy-primer-tab.is-active {
  background: rgb(var(--accent) / 0.08);
  border-left-color: rgb(var(--accent));
}
.energy-primer-tab-title {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: rgb(var(--ink) / 0.82);
  line-height: 1.3;
}
.energy-primer-tab.is-active .energy-primer-tab-title {
  color: rgb(var(--ink) / 0.92);
}
.energy-primer-tab-mag {
  font-size: 0.6875rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: rgb(var(--ink) / 0.42);
  line-height: 1.35;
}
.energy-primer-tab.is-active .energy-primer-tab-mag {
  color: rgb(var(--accent) / 0.9);
}
.energy-primer-stage {
  position: relative;
  padding: 1.1rem 1.2rem 1.2rem;
  min-height: 18rem;
  background: rgb(var(--canvas) / 0.35);
}
.energy-primer-panel {
  display: none;
  animation: energyPrimerIn 0.18s ease;
}
.energy-primer-panel.is-active {
  display: block;
}
.energy-primer-panel[hidden] {
  display: none !important;
}
@keyframes energyPrimerIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .energy-primer-panel {
    animation: none;
  }
}
.energy-primer-panel-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgb(var(--accent) / 0.85);
}
.energy-primer-panel-title {
  margin: 0 0 0.85rem;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: rgb(var(--ink) / 0.9);
  line-height: 1.25;
}
.energy-primer-panel p {
  margin: 0 0 0.8rem;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: rgb(var(--ink) / 0.7);
}
.energy-primer-panel p:last-child {
  margin-bottom: 0;
}
.energy-primer-panel strong {
  color: rgb(var(--ink) / 0.9);
  font-weight: 600;
}
.energy-primer-mag {
  margin-top: 0.35rem !important;
  padding: 0.75rem 0.9rem;
  border-radius: 0.5rem;
  background: rgb(var(--ink) / 0.04);
  border: 1px solid rgb(var(--ink) / 0.09);
  font-size: 0.875rem !important;
  line-height: 1.55 !important;
  color: rgb(var(--ink) / 0.68) !important;
}
.energy-primer-mag-k {
  font-weight: 600;
  color: rgb(var(--accent) / 0.95);
  margin-right: 0.3rem;
}
.energy-primer-foot {
  margin: 0;
  padding: 0.55rem 1rem 0.65rem;
  border-top: 1px solid rgb(var(--ink) / 0.08);
  font-size: 0.75rem;
  line-height: 1.45;
  color: rgb(var(--ink) / 0.48);
  background: rgb(var(--accent) / 0.04);
}
.energy-primer-foot-k {
  font-weight: 600;
  color: rgb(var(--ink) / 0.55);
  margin-right: 0.25rem;
}

@media (max-width: 720px) {
  .energy-primer-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .energy-primer-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: none;
    border-bottom: 1px solid rgb(var(--ink) / 0.08);
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    gap: 0.35rem;
    padding: 0.55rem 0.65rem;
  }
  .energy-primer-tab {
    flex: 0 0 auto;
    width: auto;
    min-width: 9.5rem;
    max-width: 12rem;
    border: 1px solid rgb(var(--ink) / 0.1);
    border-radius: 0.55rem;
    border-left: 1px solid rgb(var(--ink) / 0.1);
    border-bottom: 1px solid rgb(var(--ink) / 0.1);
    padding: 0.55rem 0.7rem;
    scroll-snap-align: start;
  }
  .energy-primer-tab.is-active {
    border-color: rgb(var(--accent) / 0.45);
    border-left-color: rgb(var(--accent) / 0.45);
    box-shadow: 0 0 0 1px rgb(var(--accent) / 0.15);
  }
  .energy-primer-stage {
    min-height: 14rem;
    padding: 1rem 0.95rem 1.1rem;
  }
}

/* Taller plot area; room for axis labels */
.prose-essay .cs-canvas-wrap {
  height: 300px;
  min-height: 280px;
  padding: 0.5rem 0.65rem 0.35rem;
}
.prose-essay .cs-canvas-wrap--sankey {
  height: 340px;
  min-height: 300px;
}
.prose-essay .cs-canvas-wrap canvas {
  background: rgb(var(--ink) / 0.02);
}

/* Stronger live readout under charts */
.prose-essay .cs-readout {
  padding: 0.55rem 1rem 0.65rem;
  min-height: 1.35em;
  font-size: 0.8125rem;
  line-height: 1.45;
  font-weight: 500;
  color: rgb(var(--ink) / 0.68);
  background: rgb(var(--accent) / 0.04);
  border-bottom: 1px solid rgb(var(--ink) / 0.08);
}

/* Legend key: larger, clearer swatches */
.prose-essay .cs-key {
  gap: 0.55rem 1.35rem;
  padding: 0.5rem 1rem 0.35rem;
  font-size: 0.75rem;
  color: rgb(var(--ink) / 0.55);
  line-height: 1.35;
}
.prose-essay .cs-swatch {
  width: 0.75rem;
  height: 0.75rem;
}

/* Claim / mechanism notes: slightly roomier */
.prose-essay .panel-note.cs-legend {
  padding: 0.95rem 1.05rem 1.1rem;
  font-size: 0.875rem;
  line-height: 1.7;
}
.prose-essay .note-beat + .note-beat {
  margin-top: 0.5rem;
}

/* Toolbar modes: easier tap targets */
.prose-essay .three-toolbar {
  gap: 0.45rem;
  padding: 0.65rem 0.95rem 0.5rem;
}
.prose-essay .three-mode {
  font-size: 0.75rem;
  padding: 0.45rem 0.8rem;
  letter-spacing: 0.03em;
}

/* 3D stage */
.prose-essay .three-mount {
  height: 400px;
  min-height: 320px;
  background: rgb(var(--ink) / 0.03);
}
.prose-essay .three-path-row,
.prose-essay .three-path-row.is-path {
  padding: 0.45rem 1rem 0.75rem;
}
.prose-essay .three-path-label {
  font-size: 0.75rem;
  color: rgb(var(--ink) / 0.5);
  gap: 0.45rem;
}
.prose-essay .three-path-label input[type="range"] {
  max-width: 100%;
  height: 1.5rem;
}
.prose-essay .three-path-ends {
  max-width: 100%;
  font-size: 0.7rem;
  color: rgb(var(--ink) / 0.45);
}

/* Fig. 08 path timeline: three stage marks */
.energy-path-timeline .three-path-label {
  max-width: 100%;
}
.energy-path-timeline .three-path-label input[type="range"] {
  max-width: 100%;
}
.energy-path-year {
  font-variant-numeric: tabular-nums;
  color: rgb(var(--accent) / 0.95);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.energy-path-ticks {
  display: grid !important;
  grid-template-columns: 1fr 1fr 1fr;
  justify-content: stretch;
  max-width: 100% !important;
  gap: 0.35rem;
  margin-top: 0.15rem;
  text-align: center;
  line-height: 1.25;
  font-size: 0.625rem !important;
  font-weight: 500;
  color: rgb(var(--ink) / 0.42);
}
.energy-path-ticks span:first-child {
  text-align: left;
}
.energy-path-ticks span:last-child {
  text-align: right;
}

/* Evidence tables: wrap long row labels, clearer numbers */
.prose-essay .ev-table-wrap {
  margin: 1.5rem 0 2rem;
  border-radius: 0.75rem;
}
.prose-essay .ev-table {
  font-size: 0.875rem;
  line-height: 1.45;
}
.prose-essay .ev-cap {
  padding: 0.85rem 1rem 0.55rem;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: rgb(var(--ink) / 0.52);
  line-height: 1.4;
}
.prose-essay .ev-table th,
.prose-essay .ev-table td {
  padding: 0.6rem 1rem;
}
.prose-essay .ev-table thead th {
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  color: rgb(var(--ink) / 0.48);
  padding-top: 0.65rem;
  padding-bottom: 0.55rem;
}
.prose-essay .ev-table tbody th[scope="row"] {
  white-space: normal;
  max-width: 14rem;
  line-height: 1.35;
}
.prose-essay .ev-table .num {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.prose-essay .ev-source {
  padding: 0.65rem 1rem 0.85rem;
  font-size: 0.75rem;
  line-height: 1.55;
  color: rgb(var(--ink) / 0.48);
}

/* Figure captions slightly stronger */
.prose-essay .fig-cap {
  font-size: 0.75rem;
  color: rgb(var(--ink) / 0.45);
  margin-bottom: 0.75rem;
}
.prose-essay .fig-cap > span:last-child {
  color: rgb(var(--ink) / 0.5);
  letter-spacing: 0.04em;
}

/* Longer instrument titles in chrome */
.prose-essay .cs-id {
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: none;
  font-weight: 600;
  color: rgb(var(--ink) / 0.55);
  max-width: min(100%, 18rem);
  line-height: 1.3;
}

/* Optional HTML claim line above canvas (when present) */
.prose-essay .cs-claim {
  margin: 0;
  padding: 0.55rem 1rem 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgb(var(--ink) / 0.55);
  line-height: 1.4;
}

@media (max-width: 640px) {
  .prose-essay .cs-canvas-wrap {
    height: 280px;
    min-height: 260px;
  }
  .prose-essay .cs-canvas-wrap--sankey {
    height: 320px;
    min-height: 280px;
  }
  .prose-essay .three-mount {
    height: 340px;
    min-height: 280px;
  }
  .prose-essay .ev-table tbody th[scope="row"] {
    max-width: 9rem;
  }
  .prose-essay .three-mode {
    font-size: 0.6875rem;
    padding: 0.4rem 0.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .prose-essay .cs-canvas-wrap,
  .prose-essay .three-mount {
    scroll-margin-top: 0;
  }
}
