/**
 * BioNeMo NIM Inference Benchmark - Sections Stylesheet
 * Module: ./css/sections.css
 * Covers: Section 01 (Race), Section 02 (Benchmark Explorer & Dumbbell Chart), Section 03 (Campaign Calculator)
 */

/* ==========================================================================
   Shared Editorial & Section Styles
   ========================================================================== */
.stage-section {
  position: relative;
  padding: clamp(3.5rem, 6vw, 5.5rem) 1.5rem;
  max-width: 1280px;
  margin: 0 auto;
  border-bottom: 1px solid var(--border-hairline);
  content-visibility: auto;
  contain-intrinsic-size: auto 620px;
}

@media (max-width: 768px) {
  .stage-section {
    padding: 3.5rem 1rem;
  }
}

.section-grid-12 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 2.5rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .section-grid-12 {
    display: flex;
    flex-direction: column;
    gap: 2rem;
  }
}

.section-editorial-col {
  grid-column: span 5;
  position: sticky;
  top: 6rem;
}

.section-content-col {
  grid-column: span 7;
}

.section-numeral {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--color-signal-green);
  background: var(--color-signal-green-dim);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  border: 1px solid rgba(118, 245, 162, 0.2);
  margin-bottom: 1rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--color-ink-primary);
  margin-bottom: 1rem;
}

.section-narrative {
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--color-ink-muted);
  margin-bottom: 1.75rem;
}

/* ==========================================================================
   Section 01: Pinned Scroll-Scrubbed "Time Collapsing" Race
   ========================================================================== */
.workload-pills-wrap {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.workload-pill-btn {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  min-height: 40px;
  padding: 0.4rem 0.75rem;
  border-radius: 7px;
  background: transparent;
  color: var(--color-ink-muted);
  border: 1px solid var(--border-hairline);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.workload-pill-btn:hover {
  color: var(--color-ink-primary);
  border-color: var(--color-ink-secondary);
}

.workload-pill-btn.active,
.workload-pill-btn[aria-selected="true"] {
  color: var(--color-signal-green);
  border-color: var(--color-signal-green);
}

/* Accessible @starting-style Dumbbell Chart Tooltip (Zero Card Blur) */
.dumbbell-tooltip {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-signal-green);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-surface);
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--color-ink-primary);
  max-width: min(320px, calc(100vw - 24px));
  display: none;
  opacity: 0;
}

@supports (anchor-name: --a) {
  .dumbbell-tooltip[data-anchored="true"] {
    position-anchor: --dumbbell-active-row;
    inset-area: top center;
    position-try-fallbacks: flip-block, flip-inline;
    margin: 8px;
  }
}

.dumbbell-tooltip.is-visible {
  display: block;
  opacity: 1;
}

@media (prefers-reduced-motion: no-preference) {
  .dumbbell-tooltip {
    transition: opacity 160ms var(--ease-precision), transform 160ms var(--ease-precision), display 160ms allow-discrete;
  }
  @starting-style {
    .dumbbell-tooltip.is-visible {
      opacity: 0;
      transform: translateY(4px);
    }
  }
}

.race-stage-card {
  background: var(--color-surface);
  border: 1px solid var(--border-hairline);
  border-radius: 14px;
  padding: 1.75rem;
  position: relative;
  box-shadow: var(--shadow-surface);
}

@media (max-width: 640px) {
  .race-stage-card {
    padding: 1.25rem;
  }
}

.race-track-container {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  margin-bottom: 2rem;
}

.race-track {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.track-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.track-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--color-ink-primary);
}

.track-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-cpu {
  background: #FF8A4C;
  box-shadow: 0 0 8px rgba(255, 138, 76, 0.6);
}

.dot-gpu {
  background: var(--color-signal-green);
  box-shadow: 0 0 8px rgba(118, 245, 162, 0.8);
}

.track-timer {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-ink-primary);
}

.track-lane {
  position: relative;
  height: 28px;
  background: var(--color-surface-sunken);
  border-radius: 6px;
  border: 1px solid var(--border-hairline);
  overflow: hidden;
}

.track-bar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  border-radius: 5px;
  transition: width 0.05s linear;
}

.bar-cpu {
  background: linear-gradient(90deg, #A84E1C 0%, #FF8A4C 100%);
}

.bar-gpu {
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg, #10B981 0%, #76F5A2 100%);
  box-shadow: 0 0 16px rgba(118, 245, 162, 0.4);
}

@keyframes nimSheen {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

@media (prefers-reduced-motion: no-preference) {
  .bar-gpu.is-running::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.35) 50%, transparent 100%);
    animation: nimSheen 900ms linear infinite;
  }

  body.page-hidden .bar-gpu.is-running::after {
    animation-play-state: paused;
  }
}

.track-finish-tag {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.track-finish-tag.active {
  opacity: 1;
}

.tag-cpu {
  background: var(--color-ember-cpu-tint);
  color: var(--color-ember-cpu);
  border: 1px solid var(--color-ember-cpu-border);
}

.tag-gpu {
  background: rgba(118, 245, 162, 0.2);
  color: var(--color-signal-green);
  border: 1px solid rgba(118, 245, 162, 0.5);
}

.race-timeline-controls {
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.scrub-track-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.scrub-range-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--color-surface-sunken);
  border-radius: 3px;
  cursor: ew-resize;
}

.scrub-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-signal-green);
  cursor: grab;
  border: 2px solid var(--color-canvas);
  box-shadow: 0 0 10px rgba(118, 245, 162, 0.8);
  transition: transform 0.1s ease;
}

.scrub-range-input::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.2);
}

.scrub-markers {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--color-ink-muted);
}

.race-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.btn-race-action {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  background: var(--color-surface-sunken);
  border: 1px solid var(--border-hairline);
  color: var(--color-ink-primary);
  transition: all 0.2s ease;
}

.btn-race-action:hover {
  background: var(--color-surface-elevated);
  border-color: var(--color-signal-green);
  color: var(--color-signal-green);
}

.race-speedup-badge-large {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-signal-green);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ==========================================================================
   Section 02: Benchmark Explorer & Dumbbell Chart
   ========================================================================== */
.methodology-collapse {
  background: var(--color-surface-sunken);
  border: 1px solid var(--border-hairline);
  border-radius: 8px;
  margin-bottom: 2rem;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.methodology-collapse:hover {
  border-color: rgba(118, 245, 162, 0.3);
}

.methodology-summary {
  padding: 0.85rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-ink-secondary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.methodology-summary::-webkit-details-marker {
  display: none;
}

.methodology-body {
  padding: 0 1.25rem 1.25rem 1.25rem;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--color-ink-muted);
  border-top: 1px solid var(--border-hairline);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  padding-top: 1rem;
}

.dumbbell-card {
  background: var(--color-surface);
  border: 1px solid var(--border-hairline);
  border-radius: 14px;
  padding: 2rem 1.75rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-surface);
}

@media (max-width: 640px) {
  .dumbbell-card {
    padding: 1.25rem 0.75rem;
  }
}

.dumbbell-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-ink-secondary);
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.svg-chart-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.dumbbell-svg {
  width: 100%;
  min-width: 580px;
  height: auto;
  display: block;
}

/* Dumbbell Interactive SVG Styling */
.dumbbell-axis-line {
  stroke: var(--border-hairline);
  stroke-dasharray: 2 4;
}

.dumbbell-axis-text {
  font-family: var(--font-mono);
  font-size: 11px;
  fill: var(--color-ink-muted);
  text-anchor: middle;
}

.dumbbell-row {
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.dumbbell-row:hover .dumbbell-tether {
  stroke-width: 4px;
}

.dumbbell-tether {
  stroke-width: 2.5px;
  stroke-linecap: round;
  transition: stroke-width 0.2s ease;
}

@keyframes dumbbellDraw {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .dumbbell-tether {
      transform-box: fill-box;
      transform-origin: left center;
      animation: dumbbellDraw linear both;
      animation-timeline: view();
      animation-range: entry 10% cover 35%;
    }
  }
}

.dumbbell-point-gpu {
  fill: var(--color-signal-green);
  filter: drop-shadow(0 0 6px rgba(118, 245, 162, 0.8));
  cursor: pointer;
}

.dumbbell-point-cpu {
  fill: #FF8A4C;
  filter: drop-shadow(0 0 6px rgba(255, 138, 76, 0.6));
  cursor: pointer;
}

.dumbbell-label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  fill: var(--color-ink-primary);
}

.dumbbell-sublabel {
  font-family: var(--font-mono);
  font-size: 11px;
  fill: var(--color-ink-muted);
}

.dumbbell-speedup-text {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  fill: var(--color-signal-green);
  text-anchor: end;
}

/* Telemetry Matrix Drawer */
.telemetry-drawer-container {
  background: var(--color-surface-elevated);
  border: 1px solid var(--border-hairline);
  border-radius: 14px;
  overflow: hidden;
}

.drawer-header-bar {
  width: 100%;
  border: none;
  border-bottom: 1px solid transparent;
  text-align: left;
  font: inherit;
  padding: 1.25rem 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  background: var(--color-surface-sunken);
  transition: background 0.2s ease;
}

.drawer-header-bar:hover {
  background: var(--color-surface-elevated);
}

.drawer-header-bar.open {
  border-bottom-color: var(--border-hairline);
}

.drawer-toggle-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-ink-primary);
}

.drawer-chevron {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-chevron.open {
  transform: rotate(180deg);
}

.drawer-content {
  display: none;
  padding: 1.5rem 1.75rem;
}

.drawer-content.open {
  display: block;
}

.drawer-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Strict Zero-Collision Search Input */
.table-search-wrap {
  position: relative;
  min-width: 260px;
}

.table-search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--color-ink-muted);
}

.table-search-input {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.5rem !important; /* Strict left padding to prevent overlap */
  background: var(--color-surface-sunken);
  border: 1px solid var(--border-hairline);
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--color-ink-primary);
  transition: border-color 0.2s ease;
}

.table-search-input:focus-visible {
  border-color: var(--color-signal-green);
  outline: 2px solid var(--color-signal-green);
  outline-offset: 1px;
}

.table-export-actions {
  display: flex;
  gap: 0.5rem;
}

.matrix-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-hairline);
  border-radius: 8px;
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.matrix-table th {
  background: var(--color-surface-sunken);
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-ink-secondary);
  border-bottom: 1px solid var(--border-hairline);
  white-space: nowrap;
}

.matrix-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-hairline);
  color: var(--color-ink-primary);
  font-family: var(--font-body);
}

.matrix-table tr:last-child td {
  border-bottom: none;
}

.matrix-table tr:hover td {
  background: var(--color-surface-sunken);
}

.matrix-td-mono {
  font-family: var(--font-mono) !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ==========================================================================
   Section 03: Campaign Scale Calculator
   ========================================================================== */
.calc-card {
  background: var(--color-surface);
  border: 1px solid var(--border-hairline);
  border-radius: 14px;
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow-surface);
}

.calc-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.calc-control-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.calc-control-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-ink-secondary);
  display: flex;
  justify-content: space-between;
}

.calc-control-select {
  padding: 0.6rem 0.85rem;
  background: var(--color-surface-sunken);
  border: 1px solid var(--border-hairline);
  border-radius: 6px;
  color: var(--color-ink-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
}

.calc-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.calc-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: var(--color-surface-sunken);
  border-radius: 4px;
  cursor: pointer;
}

.calc-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-signal-green);
  cursor: grab;
  border: 2px solid var(--color-canvas);
  box-shadow: 0 0 12px rgba(118, 245, 162, 0.8);
}

.calc-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
}

.calc-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.calc-chip-btn {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  background: var(--color-surface-sunken);
  border: 1px solid var(--border-hairline);
  color: var(--color-ink-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.calc-chip-btn:hover {
  border-color: var(--color-ink-primary);
  color: var(--color-ink-primary);
}

.calc-chip-btn.active {
  background: var(--color-signal-green-dim);
  color: var(--color-signal-green);
  border-color: var(--color-signal-green);
}

.calc-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.calc-kpi-card {
  background: var(--color-surface-sunken);
  border: 1px solid var(--border-hairline);
  border-radius: 8px;
  padding: 1.25rem;
}

.calc-kpi-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-ink-muted);
  margin-bottom: 0.4rem;
}

.calc-kpi-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-ink-primary);
  font-variant-numeric: tabular-nums;
}

.calc-kpi-value.highlight-green {
  color: var(--color-signal-green);
}

.calc-kpi-sub {
  font-size: 0.75rem;
  color: var(--color-ink-muted);
  margin-top: 0.25rem;
}

/* Proportional Mass Block Visualizer */
.calc-mass-visualizer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-hairline);
}

.mass-bar-container {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.mass-bar-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-ink-secondary);
}

.mass-bar-track {
  height: 24px;
  background: var(--color-surface-sunken);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-hairline);
}

.mass-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mass-bar-cpu {
  background: linear-gradient(90deg, #A84E1C 0%, #FF8A4C 100%);
}

.mass-bar-gpu {
  background: linear-gradient(90deg, #10B981 0%, #76F5A2 100%);
  box-shadow: 0 0 12px rgba(118, 245, 162, 0.4);
}
