/* Thermodynamics lab — PV diagrams, Carnot, Maxwell–Boltzmann, phase diagrams */

.thermo-lab {
  --thermo-accent: var(--chip-physics);
  --thermo-accent2: #5ba8b0;
  --thermo-muted: var(--color-text-muted);
  --thermo-hot: #e05252;
  --thermo-cold: #4a9eff;
  --thermo-ok: #4caf50;
  max-width: 920px;
  font-family: var(--font-body);
}

/* ── header ─────────────────────────────────────────────── */

.thermo-lab__header { margin-bottom: var(--space-6); }

.thermo-lab__eyebrow {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--thermo-accent);
  margin-bottom: var(--space-2);
}

.thermo-lab__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: var(--space-3);
}

.thermo-lab__intro {
  font-size: var(--text-sm);
  color: var(--thermo-muted);
  line-height: 1.65;
  max-width: 62ch;
}

/* ── tabs ────────────────────────────────────────────────── */

.thermo-lab__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.thermo-lab__tab {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: oklch(from var(--color-text) l c h / 0.04);
  color: var(--thermo-muted);
  cursor: pointer;
  transition: background var(--transition-interactive),
    color var(--transition-interactive),
    border-color var(--transition-interactive),
    box-shadow var(--transition-interactive);
}

.thermo-lab__tab:hover {
  color: var(--color-text);
  border-color: oklch(from var(--thermo-accent) l c h / 0.45);
}

.thermo-lab__tab[aria-selected="true"] {
  color: var(--color-bg);
  background: linear-gradient(125deg, oklch(from var(--thermo-accent) l c h / 0.88), var(--thermo-accent2));
  border-color: transparent;
  box-shadow: 0 0 18px oklch(from var(--thermo-accent) l c h / 0.2);
}

.thermo-lab__tab:focus-visible {
  outline: 2px solid var(--thermo-accent);
  outline-offset: 2px;
}

/* ── panels ──────────────────────────────────────────────── */

.thermo-lab__panel {
  display: none;
  animation: thermo-lab-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.thermo-lab__panel.is-active { display: block; }

@keyframes thermo-lab-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .thermo-lab__panel { animation: none; }
}

.thermo-lab__section-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-faint);
  margin-bottom: var(--space-4);
}

/* ── canvas stage ────────────────────────────────────────── */

.thermo-lab__canvas-wrap {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: var(--space-5);
  background:
    radial-gradient(ellipse at 50% 60%, oklch(from var(--thermo-accent) l c h / 0.1), transparent 70%),
    var(--color-surface);
  border: 1px solid var(--color-divider);
  box-shadow: 0 0 32px oklch(from var(--thermo-accent) l c h / 0.08);
}

.thermo-lab__canvas {
  display: block;
  width: 100%;
  height: auto;
}

/* ── controls ────────────────────────────────────────────── */

.thermo-lab__controls {
  padding: var(--space-5);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-divider);
  margin-bottom: var(--space-5);
  background: oklch(from var(--color-text) l c h / 0.03);
}

.thermo-lab__controls label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
  display: block;
  margin-top: var(--space-3);
  margin-bottom: var(--space-2);
}
.thermo-lab__controls label:first-of-type { margin-top: 0; }

.thermo-lab__slider { width: 100%; max-width: 22rem; }

.thermo-lab__readout {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  margin-top: var(--space-4);
  color: var(--color-text);
  line-height: 1.7;
}
.thermo-lab__readout strong { color: var(--thermo-accent); }
.thermo-lab__readout--lg { font-size: var(--text-base); }

/* ── process type buttons (PV diagram) ───────────────────── */

.thermo-lab__process-btns {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.thermo-lab__proc-btn {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--thermo-muted);
  cursor: pointer;
  transition: all var(--transition-interactive);
}
.thermo-lab__proc-btn:hover { border-color: oklch(from var(--thermo-accent) l c h / 0.5); color: var(--color-text); }

.thermo-lab__proc-btn[data-proc="isothermal"].is-active { border-color: #82c6ff; background: rgba(130,198,255,0.14); color: #82c6ff; }
.thermo-lab__proc-btn[data-proc="isobaric"].is-active   { border-color: #4caf50; background: rgba(76,175,80,0.14);   color: #4caf50; }
.thermo-lab__proc-btn[data-proc="isochoric"].is-active  { border-color: #ff9800; background: rgba(255,152,0,0.14);  color: #ff9800; }
.thermo-lab__proc-btn[data-proc="adiabatic"].is-active  { border-color: #e05252; background: rgba(224,82,82,0.14);  color: #e05252; }

/* ── buttons ─────────────────────────────────────────────── */

.thermo-lab__btn {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition-interactive);
}
.thermo-lab__btn:hover { border-color: oklch(from var(--thermo-accent) l c h / 0.5); }

.thermo-lab__btn--primary {
  background: oklch(from var(--thermo-accent) l c h / 0.18);
  border-color: var(--thermo-accent);
}

.thermo-lab__btn:focus-visible {
  outline: 2px solid var(--thermo-accent);
  outline-offset: 2px;
}

.thermo-lab__btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-4);
}

/* ── feedback & score ────────────────────────────────────── */

.thermo-lab__feedback {
  font-size: var(--text-sm);
  color: var(--thermo-muted);
  line-height: 1.55;
  min-height: 2rem;
  margin-bottom: var(--space-3);
}
.thermo-lab__feedback--ok { color: var(--thermo-ok); }
.thermo-lab__feedback--no { color: var(--thermo-hot); }

.thermo-lab__score {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--thermo-muted);
}
.thermo-lab__score strong { color: var(--thermo-accent); }

/* ── fine print ──────────────────────────────────────────── */

.thermo-lab__fine {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-6);
  line-height: 1.5;
  max-width: 68ch;
}
