/* ============================================================
   PhyCircuit — Φ Thermo tool styles
   Pairs with prototype/css/calc.css for the shared input chrome.
   ============================================================ */

.thermo-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: var(--space-6);
  align-items: start;
}
@media (max-width: 980px) { .thermo-grid { grid-template-columns: 1fr; } }

/* ----- controls ----- */
.thermo-controls fieldset {
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-4);
}
.thermo-controls legend { padding: 0 var(--space-2); color: var(--fg-2); font-size: var(--fs-14); }
.thermo-controls .field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3) var(--space-4); }
.thermo-controls .field-grid label {
  display: grid; gap: 0.2rem;
  font-size: var(--fs-14); color: var(--fg-1);
}
.thermo-controls .field-grid input,
.thermo-controls .field-grid select {
  background: var(--bg-1); color: var(--fg-0);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: 0.45rem 0.55rem;
  font: inherit;
}
.thermo-controls .field-grid input:focus,
.thermo-controls .field-grid select:focus { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }

.thermo-presets {
  display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center;
  margin-bottom: var(--space-3);
}
.thermo-presets .chip { margin-right: var(--space-2); }
.btn--sm { padding: 0.35rem 0.7rem; font-size: var(--fs-14); }

/* ----- components table ----- */
.comp-table { width: 100%; border-collapse: collapse; font-size: var(--fs-12); margin-bottom: var(--space-2); }
.comp-table th { color: var(--fg-2); font-weight: 500; text-align: left; padding: 0 0.25rem 0.25rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.05em; }
.comp-table td { padding: 2px; }
.comp-table input {
  width: 100%;
  background: var(--bg-1); color: var(--fg-0);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  padding: 0.3rem 0.4rem;
  font: inherit;
  font-family: var(--font-mono);
  font-size: var(--fs-12);
}
.comp-table input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.comp-del {
  background: transparent; border: 1px solid var(--line);
  color: var(--fg-2); border-radius: var(--r-1);
  width: 24px; height: 24px;
  cursor: pointer;
  font-size: 14px; line-height: 1;
}
.comp-del:hover { border-color: var(--accent); color: var(--accent); }
.comp-del:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ----- stage / heatmap ----- */
.thermo-stage {
  position: relative;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  max-width: 100%;
}
#hmap { display: block; width: 100%; height: 100%; }
#overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.thermo-cbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-3) 0 0;
  color: var(--fg-2);
  font-size: var(--fs-12);
}
.thermo-cbar canvas { width: 100%; height: 10px; border-radius: var(--r-1); }

.thermo-warn { color: var(--fg-2); font-size: var(--fs-14); margin: var(--space-2) 0 0; min-height: 1.4em; }
.thermo-warn--on { color: #F0BE5B; }

/* ----- stats grid ----- */
.thermo-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-5);
}
.stat-card { padding: var(--space-4); }
.stat-card h4 { margin: 0 0 var(--space-2); font-size: var(--fs-16); }
.stat-card__row {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 0.3rem 0; border-top: 1px solid var(--line);
  font-size: var(--fs-14); color: var(--fg-1);
}
.stat-card__row:first-of-type { border-top: 0; }
.stat-card__row strong { color: var(--fg-0); }

.ct-table { width: 100%; border-collapse: collapse; font-size: var(--fs-14); }
.ct-table th, .ct-table td { padding: 0.25rem 0.4rem; border-bottom: 1px solid var(--line); text-align: left; }
.ct-table th { color: var(--fg-2); font-size: var(--fs-12); text-transform: uppercase; letter-spacing: 0.04em; }
.ct-table td:nth-child(2), .ct-table td:nth-child(3) { text-align: right; }

/* ----- method section ----- */
.thermo-method__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}
@media (max-width: 880px) { .thermo-method__grid { grid-template-columns: 1fr; } }
.thermo-method__grid .card { padding: var(--space-4); }
.thermo-method__grid h3 { margin: 0 0 var(--space-2); font-size: var(--fs-18); }
.thermo-method__grid p, .thermo-method__grid li { color: var(--fg-1); font-size: var(--fs-14); line-height: 1.55; }
.thermo-method__grid ul { margin: 0; padding-left: 1.1rem; }
