/* Re-fingerprinted 2026-07-30 after a cache-poisoning incident: with no
   404.html, Cloudflare Pages answered a missing /assets/* path with the home
   page at HTTP 200, and _headers stamped that response immutable for a year.
   src/404.njk fixes the cause; new filenames escape the pinned entries. */
/* Tool panels. Loaded alongside article.css on /tools/ routes only.
   A tool is an instrument, not a form: the result is the largest thing on the
   panel and the inputs sit under it. Tokens come from site.css. */

.tool-panel {
  margin-block-start: clamp(24px, 3.5vw, 36px);
  padding: clamp(22px, 3.5vw, 32px);
  border: 1px solid var(--border-seeded);
  border-radius: var(--radius-feature);
  background: var(--surface-panel);
  box-shadow: var(--shadow-panel);
}

.tool-result {
  display: grid;
  gap: 6px;
  padding-block-end: clamp(20px, 3vw, 26px);
  margin-block-end: clamp(20px, 3vw, 26px);
  border-block-end: 1px solid var(--border-subtle);
}

.tool-result-value {
  font-size: clamp(2.6rem, 2rem + 4vw, 4rem);
  line-height: 1;
  letter-spacing: -0.03em;
  font-variation-settings: "wdth" var(--seed-wdth-display), "wght" var(--seed-wght-display);
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.tool-result-value sup {
  font-size: 0.42em;
  vertical-align: super;
  margin-inline-start: 0.08em;
  color: var(--seed-accent);
  transition: color 620ms var(--ease-instrument);
}

.tool-result-note {
  color: var(--text-secondary);
  font-size: 0.98rem;
  font-variant-numeric: tabular-nums;
}

.tool-result-band {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-variation-settings: "wdth" 88, "wght" 680;
  color: var(--seed-harmony);
  transition: color 620ms var(--ease-instrument);
}

/* ---------- Controls ---------- */

.tool-fields {
  display: grid;
  gap: 18px;
  /* 240px yields two columns in the 74ch panel, so a four-field tool pairs each
     value with its own unit. At 190px it made three columns and stranded the
     unit select on a second row, under the wrong value. */
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-items: end;
}

/* min-width: 0 is load-bearing. A grid item defaults to min-width: auto, and an
   input[type=number] reports a min-content width that scales with its font size
   and includes the spinner — so at large text or high zoom the control renders
   wider than its track and slides under the next field's label. */
.tool-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.tool-field label {
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-variation-settings: "wdth" 90, "wght" 660;
  color: var(--text-tertiary);
}

.tool-field input,
.tool-field select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  font: inherit;
  font-size: 1.1rem;
  /* An input inherits the body line-height while a select resolves `normal`,
     which left the two controls 3px apart and their labels visibly off-baseline
     under `align-items: end`. Stating it once makes both boxes exactly 52px. */
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  background: var(--surface-inset);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  transition: border-color 180ms var(--ease-instrument);
}

.tool-field input:focus-visible,
.tool-field select:focus-visible {
  border-color: var(--seed-harmony);
}

.tool-field .field-hint {
  color: var(--text-tertiary);
  font-size: 0.84rem;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-block-start: 20px;
}

.tool-button {
  min-height: 44px;
  padding: 11px 18px;
  font: inherit;
  font-variation-settings: "wdth" 96, "wght" 640;
  color: var(--text-primary);
  background: var(--surface-panel-high);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: background 180ms var(--ease-instrument), border-color 180ms var(--ease-instrument);
}

.tool-button:hover {
  background: var(--surface-inset);
  border-color: var(--border-seeded);
}

.tool-button[data-state="done"] {
  border-color: var(--seed-harmony);
  color: var(--seed-harmony);
}

/* ---------- Live reading ----------
   Progressive enhancement only: hidden until a reading actually arrives, so a
   blocked or failed request leaves no trace and the typed input still works. */

.live-temp {
  display: none;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-block-start: 18px;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
  background: var(--surface-inset);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.live-temp[data-ready] {
  display: flex;
}

.live-temp strong {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.live-temp .live-source {
  color: var(--text-tertiary);
  font-size: 0.82rem;
}

.live-temp button {
  min-height: 36px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.86rem;
  color: var(--seed-harmony);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  cursor: pointer;
}

/* ---------- Copy grid, for the degree symbol tool ---------- */

.copy-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.copy-grid button {
  display: grid;
  gap: 4px;
  padding: 18px 12px;
  font: inherit;
  color: var(--text-primary);
  background: var(--surface-inset);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: border-color 180ms var(--ease-instrument);
}

.copy-grid button:hover {
  border-color: var(--seed-harmony);
}

.copy-grid .glyph {
  font-size: 1.9rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.copy-grid .glyph-name {
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

@media (max-width: 720px) {
  .tool-fields {
    grid-template-columns: 1fr;
  }
}
