/* 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;
  /* A value and its unit share one field (.tool-field-pair), so the column
     count no longer has to encode the pairing. */
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  align-items: start;
}

/* Tools whose fields carry long labels read better two-up than 3+1. */
.tool-fields[data-columns="2"] {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.tool-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

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

/* Value plus its unit, as one control with identical 52px height */
.tool-field-pair .pair {
  display: flex;
  gap: 8px;
  min-width: 0;
  height: 52px;
  align-items: stretch;
}

.tool-field-pair .pair input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
}

.tool-field-pair .pair select {
  flex: 0 0 auto;
  width: auto;
  min-width: 5.5rem;
  height: 100%;
  font-variation-settings: "wdth" 96, "wght" 620;
}

.tool-field input,
.tool-field select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 52px;
  min-height: 52px;
  max-height: 52px;
  padding: 0 14px;
  font: inherit;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  background: var(--surface-inset);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  box-sizing: border-box;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  transition: border-color 180ms var(--ease-instrument);
}

.tool-field input[type="number"] {
  -moz-appearance: textfield;
}

.tool-field input[type="number"]::-webkit-outer-spin-button,
.tool-field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.tool-field select {
  padding-inline-end: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a9b6c6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px 14px;
  cursor: pointer;
}

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

.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;
  }
}
