/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Teacher and Me — commission calculator (static pages, generated by
   scripts/commission-calculator/plugin.ts). The page chrome (header, footer,
   buttons, tables, tokens) comes from /placement-assets/placement.css, which
   every tool page loads first; this file holds only what the calculator adds:
   the form grid, the results block and the "how we checked" box. The reading
   list's additions are in reading.css next to it; one /placement-assets/*
   header rule covers all three.
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.calc-section { margin-bottom: var(--space-8); }

.calc-form fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg, 12px);
  padding: var(--space-4) var(--space-5);
  margin: 0;
  display: grid;
  gap: var(--space-4);
  background: var(--color-surface);
}
@media (min-width: 640px) {
  .calc-form fieldset { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.calc-form legend {
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  padding: 0 var(--space-2);
}
.calc-field { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.calc-field label { font-weight: 600; }
.calc-field input,
.calc-field select {
  font: inherit;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md, 8px);
  background: var(--color-background, #fff);
  color: inherit;
  width: 100%;
  box-sizing: border-box;
}
.calc-field input:focus-visible,
.calc-field select:focus-visible { outline: 3px solid var(--color-primary); outline-offset: 1px; }
.calc-form.calc-invalid input:invalid { border-color: #c0392b; }
.calc-hint { font-size: 0.9rem; color: var(--color-text-secondary); margin: 0; }
.calc-section > .calc-hint { margin-top: var(--space-3); }

.calc-results { min-height: 20rem; }
.calc-inputs { font-size: 0.95rem; color: var(--color-text-secondary); }
.calc-trials { font-size: 0.95rem; }
.calc-table caption {
  caption-side: top;
  text-align: left;
  font-weight: 600;
  padding-bottom: var(--space-2);
}
.calc-table th[scope="row"] { font-weight: 600; white-space: normal; }
.calc-table td { text-align: right; font-variant-numeric: tabular-nums; }
.calc-table thead th { text-align: right; }
.calc-payout,
.calc-paid-in { display: block; font-weight: 400; color: var(--color-text-secondary); font-size: 0.85rem; }
.calc-sentence { font-size: 1.1rem; font-weight: 600; }
.calc-fx-note { font-size: 0.9rem; color: var(--color-text-secondary); }

.calc-method {
  border-left: 4px solid var(--color-primary);
  background: var(--color-surface);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-8);
  border-radius: 0 var(--radius-md, 8px) var(--radius-md, 8px) 0;
}
.calc-method h2 { margin-top: 0; }
.calc-method ul { padding-left: 1.2rem; }
.calc-method li { margin-bottom: var(--space-2); overflow-wrap: anywhere; }
.calc-method small { color: var(--color-text-secondary); }

.calc-cta { margin-bottom: var(--space-8); }

/* ─── The exchange-rate chart (scripts/blog/charts.ts) ────────────────────
   The figure a blog post embeds with ::chart{id}, under the sources box. These
   rules mirror the "Data charts" block of /blog-assets/blog.css (keep the two
   in step), on top of this page's reset and its plain table style. The figure
   holds two drawings, 720 and 340 units wide; its own width picks one (a
   container query), the other is display:none. */
.calc-chart { margin-bottom: var(--space-12); }
.calc-chart .chart {
  container-type: inline-size;
  max-width: 50rem;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: var(--space-4) var(--space-6);
}
.calc-chart .chart-title { font-family: var(--font-heading); font-weight: 700; font-size: clamp(1.1rem, 1rem + 0.5vw, 1.25rem); line-height: 1.3; margin-bottom: 0; max-width: none; }
.calc-chart .chart-svg { display: block; width: 100%; height: auto; margin-top: var(--space-3); overflow: visible; }
.calc-chart .chart-svg--narrow { display: none; max-width: 400px; }
@container (max-width: 599px) {
  .calc-chart .chart-svg--wide { display: none; }
  .calc-chart .chart-svg--narrow { display: block; }
}
.calc-chart .chart-legend {
  list-style: none; margin-top: var(--space-2);
  display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4);
  font-size: 0.8rem; line-height: 1.4; color: var(--color-text-secondary);
}
.calc-chart .chart-legend li { display: inline-flex; align-items: center; gap: var(--space-2); }
.calc-chart .chart-legend-heading { font-weight: 600; color: var(--color-text-primary); }
.calc-chart .chart-key { flex: none; }
.calc-chart figcaption { margin-top: var(--space-3); font-size: 0.85rem; line-height: 1.55; }
.calc-chart figcaption > * + * { margin-top: var(--space-2); }
.calc-chart figcaption p { margin-bottom: 0; max-width: none; }
.calc-chart .chart-takeaway { color: var(--color-text-primary); font-size: 0.95rem; font-weight: 600; }
.calc-chart .chart-notes { padding-left: 1.2em; }
.calc-chart .chart-notes li + li { margin-top: var(--space-1); }
.calc-chart .chart-source cite { font-style: italic; }
.calc-chart .chart-data summary { cursor: pointer; font-weight: 600; color: var(--color-primary-dark); }
/* The table scrolls sideways in its wrapper (a focusable, named region); the
   caption keeps to the visible width and stays put while the table scrolls.
   Unlike blog.css's Data charts block, the table undoes placement.css's global
   `table { min-width: 560px; overflow: hidden }`: clipped, the table would be
   the sticky caption's scroll container and the caption would scroll away
   with it, and the 560px floor would push the calculated columns out of view. */
.calc-chart .chart-data .table-wrap {
  overflow-x: auto; container-type: inline-size; margin-top: var(--space-3);
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
}
.calc-chart .chart-data table { width: 100%; min-width: 0; overflow: visible; border-collapse: collapse; border-radius: 0; box-shadow: none; color: var(--color-text-primary); }
.calc-chart .chart-data caption {
  position: sticky; left: 0; max-width: 100cqi;
  caption-side: top; text-align: left; padding: var(--space-2) var(--space-3); font-weight: 600; color: var(--color-text-primary); background: var(--color-surface);
}
.calc-chart .chart-data th, .calc-chart .chart-data td { font-size: 0.85rem; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-border); }
.calc-chart .chart-data tbody th { font-family: var(--font-body); font-weight: 600; }
.calc-chart .chart-data tbody tr { border-top: 0; }
.calc-chart .chart-data tbody tr:last-child th, .calc-chart .chart-data tbody tr:last-child td { border-bottom: 0; }
.calc-chart .chart-data th[scope="rowgroup"] { font-weight: 700; background: var(--color-cloud); }
.calc-chart .chart-data tbody:has(th[scope="rowgroup"]) th[scope="row"] { font-weight: 400; hyphens: auto; }
.calc-chart .chart-data tbody + tbody th[scope="rowgroup"] { border-top: 1px solid var(--color-border); }
.calc-chart .chart-data .num { text-align: right; }
.calc-chart .chart-data td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
@container (max-width: 480px) {
  .calc-chart .chart-data th, .calc-chart .chart-data td { padding-left: var(--space-2); padding-right: var(--space-2); }
}
@media (max-width: 640px) {
  .calc-chart .chart { padding: var(--space-3); }
}

/* The static line under the results (scripts/commission-calculator/template.ts):
   outside the live region, so a recompute never re-announces it. */
.calc-handoff {
  margin-top: var(--space-4); padding: var(--space-4) var(--space-5);
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.calc-handoff a { font-weight: 700; }
