/* Compact working surfaces shared by the research tools. Keep controls readable;
   let larger forms grow naturally rather than clipping or adding nested scrollbars. */
.tool-header { min-height: 4rem; }
main { min-height: 0; padding-block: 1rem 2rem; }
.tool-heading { align-items: center; }
.tool-heading h1 { width: auto; margin-bottom: .5rem; padding-bottom: .5rem; font-size: 2rem; line-height: 1.3; }
.tool-heading .page-intro { margin: 0; font-size: 1rem; line-height: 1.5; }
.tool-heading .privacy-note { margin: 0; }
.equation-workspace, .palette-workspace, .figure-workspace,
.calculator-workspace, .gnuplot-workspace { margin-top: 1rem; align-items: start; }
.tool-panel, .palette-panel, .editor-panel, .preview-panel { padding: 1.15rem; }
.panel-heading { margin-bottom: .75rem; }
.tool-help, .palette-help, .figure-help, .calculator-help, .gnuplot-help { margin-top: 1.75rem; }
.tool-help > h2, .palette-help > h2, .figure-help > h2,
.calculator-help > h2, .gnuplot-help > h2 { margin-top: 0; }
.control-grid, .settings-grid, .palette-controls { gap: .75rem; }
@media (max-width: 800px) {
  .tool-heading { display: block; }
  .tool-heading .privacy-note { margin-top: .65rem; }
}
@media (max-width: 600px) {
  .tool-heading h1 { font-size: 1.75rem; }
}

/* Equation: give the equation and export actions priority over format notes. */
.page-equation-tool #latex-input { min-height: 8rem; }
.page-equation-tool .input-hint { margin-bottom: .85rem; }
.page-equation-tool .preview-stage { min-height: clamp(12rem, 31vh, 18rem); }
.page-equation-tool .export-format-info { margin-top: .9rem; font-size: .875rem; color: var(--color-muted); }
.page-equation-tool .export-format-info summary { cursor: pointer; }
.page-equation-tool .export-details { margin: .75rem 0 0; padding-top: 0; }
.page-equation-tool .preview-panel { position: sticky; top: 1rem; }

/* Palette: keep previews useful while leaving room for swatches and copying. */
.page-palette-tool .palette-preview { padding: 1rem; }
.page-palette-tool .gradient-bar { min-height: 3rem; }
.page-palette-tool .plot-preview { height: 4.5rem; margin-top: .75rem; }
.page-palette-tool .swatch-colour { min-height: 2rem; }
.page-palette-tool .swatch-label { font-size: .75rem; padding-block: .3rem; }
.page-palette-tool .swatch-grid { margin-top: .75rem; }
.page-palette-tool .palette-guidance { margin-top: 1rem; padding: .75rem; }

/* Gnuplot: keep the copy action beside the output label. Settings may scroll. */
.page-gnuplot-tool .plot-preview { padding: .5rem; }
.page-gnuplot-tool .plot-preview svg { height: clamp(9rem, 24vh, 12rem); }
.page-gnuplot-tool .command-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: .65rem 0 .65rem; }
.page-gnuplot-tool .command-label { margin: 0; }
.page-gnuplot-tool #command-output { display: block; min-height: 8rem; height: 8rem; padding: .75rem; }
.page-gnuplot-tool .settings-grid { gap: .75rem; }

/* Dimensionless: expose result copying before the long list of groups. */
.page-dimensionless-tool .result-actions { margin: 0 0 .85rem; }
.page-dimensionless-tool .panel-intro { margin-bottom: .75rem; }

/* Figure: on laptops, source, settings and result belong on the same row. */
@media (min-width: 1100px) {
  .page-figure-tool .figure-workspace { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
  .page-figure-tool .tool-panel { grid-column: auto; }
  .page-figure-tool .upload-zone { min-height: 4.5rem; padding: .7rem; }
  .page-figure-tool .image-preview { min-height: 7rem; height: clamp(7rem, 18vh, 10rem); margin-top: .75rem; padding: .5rem; }
  .page-figure-tool .image-preview img { max-height: calc(clamp(7rem, 18vh, 10rem) - 1rem); }
  .page-figure-tool .original-details { margin-top: .75rem; gap: .4rem; }
  .page-figure-tool .original-details div { padding: .45rem; }
  .page-figure-tool .result-details { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: .75rem; gap: .5rem; }
  .page-figure-tool .result-details div { padding: .6rem; }
  .page-figure-tool .resolution-status { padding: .75rem; }
  .page-figure-tool .settings-note, .page-figure-tool .download-note { margin-top: .75rem; }
}
@media (max-width: 900px) {
  .page-equation-tool .preview-panel { position: static; }
}
@media (max-width: 600px) {
  .page-gnuplot-tool .command-heading { flex-wrap: wrap; }
}

.page-palette-tool .result-panel .panel-heading { flex-wrap: wrap; }
.page-palette-tool .result-panel .panel-heading h2 { margin-right: auto; }
