/* Unit Converter: only what is specific to this tool. Shared look lives in ui.css. */

/* category chips (toggle buttons) */
.cats { margin-bottom: var(--space-4); }
.cats .chip { min-height: 40px; font-family: var(--font-sans); font-size: 0.92rem; }
.cats .chip[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: var(--on-blue); }

.conv .window-body > * + * { margin-top: var(--space-4); }

/* From / swap / To */
.pair { display: grid; grid-template-columns: 1fr; gap: var(--space-2); align-items: end; }
.swap {
  justify-self: center; display: inline-grid; place-items: center; width: 44px; height: 44px; margin: 0;
  color: var(--text); background: var(--surface-2); border: 1.5px solid var(--border-strong); border-radius: 50%; cursor: pointer;
  transition: transform 0.25s, background 0.2s;
}
.swap:hover { background: var(--bg); transform: rotate(180deg); }
@media (min-width: 560px) {
  .pair { grid-template-columns: 1fr auto 1fr; gap: var(--space-3); }
  .swap { margin-bottom: 2px; }
  .swap svg { transform: rotate(90deg); }
}

/* result readout */
.result { padding: var(--space-4); background: var(--bg); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.result p { margin: 0; max-width: none; }
.res-line { font: 600 1rem var(--font-mono); color: var(--muted); overflow-wrap: anywhere; }
.res-eq { color: var(--teal); margin-left: var(--space-1); }
.res-main { margin-top: var(--space-1) !important; }
.res-to { font: 800 clamp(1.6rem, 6vw, 2.2rem) var(--font-mono); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.res-alt { margin-top: var(--space-2) !important; font: 700 0.95rem var(--font-mono); color: var(--teal); }
.res-alt::before { content: "≈ "; }
.res-rate { margin-top: var(--space-2) !important; font: 0.82rem var(--font-mono); color: var(--muted); }
.result.invalid .res-to { color: var(--danger); font-size: 1.1rem; }
.res-actions { display: flex; }
.res-actions .btn { min-height: 44px; }

details.more > .label-row { margin-top: var(--space-4); }
details.more > .label-row:first-of-type { margin-top: var(--space-3); }

/* explore: all units / table */
.explore { margin-top: var(--space-6); }
.explore-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.explore-title { margin: 0; font: 700 0.9rem var(--font-mono); color: var(--muted); }
.explore-title::before { content: "// "; color: var(--teal); }
.seg-sm { width: auto; }
.seg-sm span { min-height: 34px; padding: 0 var(--space-4); font-size: 0.85rem; white-space: nowrap; }

.unit-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: var(--space-2); list-style: none; padding: 0; margin: 0; }
.unit-list li { margin: 0; max-width: none; }
.unit-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); width: 100%; min-height: 48px;
  padding: var(--space-2) var(--space-3); text-align: left; color: var(--text); font: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
}
.unit-row:hover { border-color: var(--blue); }
.unit-row[aria-current="true"] { border-color: var(--teal); box-shadow: inset 3px 0 0 var(--teal); }
.u-name { font-size: 0.9rem; color: var(--muted); min-width: 0; }
.u-val { font: 700 0.95rem var(--font-mono); text-align: right; overflow-wrap: anywhere; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.conv-table { width: 100%; border-collapse: collapse; font: 0.92rem var(--font-mono); margin: 0; }
.conv-table th, .conv-table td { padding: var(--space-2) var(--space-4); text-align: right; border: 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
.conv-table th { background: var(--surface-2); color: var(--muted); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: none; position: sticky; top: 0; }
.conv-table th:first-child, .conv-table td:first-child { text-align: left; }
.conv-table tr:last-child td { border-bottom: 0; }
.conv-table td:last-child { font-weight: 700; }
.conv-table tr.is-current td { background: color-mix(in srgb, var(--teal) 10%, transparent); }

.learn { margin-top: var(--space-7); }
.learn-title { font: 700 0.85rem var(--font-mono); letter-spacing: 0.02em; color: var(--muted); margin: 0 0 var(--space-2); }
.learn-title::before { content: "// "; color: var(--teal); }
.noscript { color: var(--muted); }
