/* =============================================================================
   UnitLab — styles.css
   Aesthetic: "instrument". Cool measured paper, a cobalt action color, and a
   single warm amber signal reserved for the live readout — like the amber
   needle on a physical gauge. Numbers are set in a tabular monospace so the
   data reads as precise instrumentation, not decoration.
   ========================================================================== */

/* ------------------------------------------------------------------ tokens */
:root {
  --paper:        #f5f7fa;
  --surface:      #ffffff;
  --surface-2:    #fbfcfe;
  --ink:          #101828;
  --ink-2:        #29344a;
  --muted:        #667085;
  --line:         #e4e8ef;
  --line-strong:  #d3d9e3;
  --accent:       #1d4ed8;
  --accent-ink:   #ffffff;
  --accent-soft:  rgba(29, 78, 216, 0.09);
  --readout:      #ad4f08;   /* the one warm signal (4.8:1 on its tinted panel) */
  --readout-soft: rgba(180, 83, 9, 0.08);
  --good:         #0f9d6b;
  --grid:         rgba(16, 24, 40, 0.028);
  --shadow:       0 1px 2px rgba(16,24,40,.05), 0 12px 28px -18px rgba(16,24,40,.28);
  --shadow-sm:    0 1px 2px rgba(16,24,40,.06);

  --font-ui:   system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;

  --sidebar-w: 264px;
  --header-h: 62px;

  /* Tell the browser which theme native controls (select lists, scrollbars,
     date pickers …) should use, so their pop-ups match the page. */
  color-scheme: light;
}

[data-theme="dark"] {
  color-scheme: dark;
  --paper:        #0b111c;
  --surface:      #121a28;
  --surface-2:    #0f1826;
  --ink:          #e8ecf4;
  --ink-2:        #c3cbda;
  --muted:        #8a94a6;
  --line:         #232c3d;
  --line-strong:  #2f3a50;
  --accent:       #5b86f5;
  --accent-ink:   #0b111c;
  --accent-soft:  rgba(91, 134, 245, 0.14);
  --readout:      #f5b544;
  --readout-soft: rgba(245, 181, 68, 0.10);
  --good:         #34d399;
  --grid:         rgba(255, 255, 255, 0.03);
  --shadow:       0 1px 2px rgba(0,0,0,.3), 0 18px 40px -22px rgba(0,0,0,.7);
  --shadow-sm:    0 1px 2px rgba(0,0,0,.3);
}

/* -------------------------------------------------------------------- base */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}

.ic { width: 20px; height: 20px; display: inline-block; vertical-align: middle; flex: 0 0 auto; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
/* Links inside running text are underlined, so they don't rely on colour alone. */
.seo-block p a, .legal a { text-decoration: underline; text-underline-offset: 2px; }

/* Numbers everywhere in the app carry tabular monospace. */
.num-input, .readout, .unit-val, .formula, .ro-from, .ro-to {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

button { font-family: inherit; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ------------------------------------------------------------------ header */
.header {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
/* ruler-tick baseline: the signature motif, quiet under the header */
.header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 6px;
  background-image: repeating-linear-gradient(90deg,
    var(--line-strong) 0, var(--line-strong) 1px, transparent 1px, transparent 12px);
  opacity: .5; pointer-events: none;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.02em; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--ink); color: var(--paper);
  font-family: var(--font-mono); font-size: 15px; font-weight: 700;
}
.brand b { font-size: 17px; }
.brand span { color: var(--muted); font-weight: 500; font-size: 12px; }

.header-spacer { flex: 1; }

.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; color: var(--ink-2);
  transition: border-color .15s, color .15s, background .15s;
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--ink); }

.menu-btn { display: none; }

/* -------------------------------------------------------------------- shell */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  max-width: 1280px; margin: 0 auto;
  min-height: calc(100vh - var(--header-h));
}

/* ------------------------------------------------------------------ sidebar */
.sidebar {
  border-right: 1px solid var(--line);
  padding: 16px 12px;
  position: sticky; top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
}
.side-search {
  position: relative; margin-bottom: 12px;
}
.side-search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
#category-search {
  width: 100%; height: 40px; padding: 0 12px 0 34px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font-size: 14px;
}
#category-search::placeholder { color: var(--muted); }

.cat-list { display: flex; flex-direction: column; gap: 2px; }
.cat-list[data-empty="true"]::after {
  content: "No matching units."; display: block; padding: 16px 12px;
  color: var(--muted); font-size: 13px;
}

.cat-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 9px 11px; text-align: left;
  background: transparent; border: 1px solid transparent; border-radius: 10px;
  color: var(--ink-2); font-size: 14px;
  transition: background .13s, color .13s;
}
.cat-item[hidden] { display: none; }
.cat-item:hover { background: var(--accent-soft); color: var(--ink); }
.cat-item.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.cat-item .cat-ic { color: var(--muted); display: inline-flex; }
.cat-item:hover .cat-ic,
.cat-item.is-active .cat-ic { color: var(--accent); }
.cat-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-count {
  font-family: var(--font-mono); font-size: 11px; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 20px; min-width: 22px; text-align: center;
}
.cat-item.is-active .cat-count { border-color: transparent; color: var(--accent); background: transparent; }

/* --------------------------------------------------------------------- main */
.panel { padding: 26px clamp(16px, 4vw, 40px) 60px; min-width: 0; }

.panel-head { margin-bottom: 22px; }
.eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 6px;
}
#cat-title {
  font-size: clamp(24px, 3.4vw, 34px); letter-spacing: -.025em;
  margin: 0 0 8px; font-weight: 700;
}
#cat-blurb { color: var(--muted); max-width: 62ch; margin: 0; font-size: 15px; }

/* ---------------------------------------------------------------- converter */
.converter {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.convert-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px; align-items: end;
}
.field-label {
  display: block; font-size: 12px; font-weight: 600; letter-spacing: .02em;
  color: var(--muted); margin-bottom: 7px;
}
.field-row { display: flex; flex-direction: column; gap: 8px; }
.num-input {
  width: 100%; height: 58px; padding: 0 14px;
  font-size: 24px; font-weight: 600;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--surface-2); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.num-input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.select-wrap { position: relative; }
.select-wrap::after {
  content: ""; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-65%) rotate(45deg); pointer-events: none;
}
.select-wrap select {
  width: 100%; height: 44px; padding: 0 34px 0 12px;
  -webkit-appearance: none; appearance: none;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 500;
  cursor: pointer;
}
.select-wrap select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.swap-btn {
  width: 44px; height: 58px; display: grid; place-items: center;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--surface); color: var(--ink-2);
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), border-color .15s, color .15s;
}
.swap-btn:hover { border-color: var(--accent); color: var(--accent); transform: rotate(180deg); }

/* binary / decimal segmented control (Digital Storage) */
.mode-switch {
  display: inline-flex; margin-top: 18px;
  padding: 3px; gap: 3px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px;
}
.mode-btn {
  display: inline-flex; flex-direction: column; align-items: flex-start;
  gap: 1px; padding: 7px 14px; border-radius: 9px;
  border: 1px solid transparent; background: transparent;
  color: var(--muted); font-size: 13px; font-weight: 600; line-height: 1.2;
  cursor: pointer; transition: background .13s, color .13s, border-color .13s;
}
.mode-btn small { font-size: 11px; font-weight: 500; font-family: var(--font-mono); opacity: .85; }
.mode-btn:hover { color: var(--ink-2); }
.mode-btn.is-on {
  background: var(--surface); border-color: var(--line-strong);
  color: var(--accent); box-shadow: 0 1px 2px rgba(16,24,40,.05);
}
@media (max-width: 560px) { .mode-switch { display: flex; width: 100%; } .mode-btn { flex: 1; } }

/* the amber hero readout */
.readout {
  margin-top: 20px; padding: 18px 20px;
  background: var(--readout-soft); border: 1px solid color-mix(in srgb, var(--readout) 25%, transparent);
  border-radius: var(--r);
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px 14px;
  font-size: clamp(18px, 3.2vw, 26px); font-weight: 600;
}
.ro-from { color: var(--ink); }
.ro-from em, .ro-to em { font-style: normal; font-size: .62em; color: var(--muted); font-weight: 600; margin-left: 2px; }
.ro-eq { color: var(--muted); font-family: var(--font-mono); }
.ro-to { color: var(--readout); letter-spacing: -.01em; }
.ro-to em { color: color-mix(in srgb, var(--readout) 70%, var(--muted)); }

/* tool chips row */
.tools { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 13px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink-2); font-size: 13px; font-weight: 500;
  transition: border-color .13s, color .13s, background .13s;
}
.chip .ic { width: 15px; height: 15px; }
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip.is-on { color: var(--readout); border-color: color-mix(in srgb, var(--readout) 40%, transparent); background: var(--readout-soft); }
.chip.precision { gap: 8px; color: var(--muted); padding-right: 6px; }
.chip.precision select {
  height: 26px; border: none; background: var(--surface-2); border-radius: 6px;
  color: var(--ink); font-family: var(--font-mono); font-size: 12px; padding: 0 6px; cursor: pointer;
}
.chip.precision select:focus { outline: none; box-shadow: 0 0 0 2px var(--accent-soft); }

/* formula panel */
.formula {
  margin-top: 16px; padding: 16px 18px;
  background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--r);
  font-size: 15px; color: var(--ink-2);
}
.formula-eq { font-size: 16px; }
.formula-worked { margin-top: 8px; color: var(--muted); font-size: 13.5px; }
.formula-worked strong { color: var(--readout); }

/* currency live/offline note */
.currency-note {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--muted); margin-bottom: 16px;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2);
}
.currency-note .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.currency-note.is-live { color: var(--good); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.currency-note.is-live .dot { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 20%, transparent); }
.currency-note.is-cached .dot { background: var(--readout); }
.currency-note.is-offline { color: var(--muted); }

/* --------------------------------------------------------------- all units */
.all-units {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 20px 20px 8px; margin-bottom: 24px; box-shadow: var(--shadow-sm);
}
.all-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.all-head h2 { font-size: 15px; font-weight: 600; margin: 0; color: var(--ink-2); }
.all-hint { font-size: 12px; color: var(--muted); }

.unit-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px;
  padding-bottom: 12px;
}
.unit-row {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px;
  padding: 11px 13px; text-align: left;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--ink); transition: border-color .12s, background .12s;
  position: relative; overflow: hidden;
}
.unit-row:hover { border-color: var(--accent); }
.unit-row.is-source { border-color: var(--line-strong); background: var(--surface); }
.unit-row.is-target { border-color: color-mix(in srgb, var(--readout) 45%, transparent); background: var(--readout-soft); }
.unit-meta { display: flex; flex-direction: column; min-width: 0; }
.unit-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit-sym { font-size: 11px; color: var(--muted); font-family: var(--font-mono); }
.unit-val { font-size: 14px; font-weight: 600; text-align: right; }
.unit-row.is-target .unit-val { color: var(--readout); }
.unit-copy { color: var(--muted); opacity: 0; transition: opacity .12s; }
.unit-row:hover .unit-copy { opacity: 1; }
.unit-copy .ic { width: 15px; height: 15px; }
.unit-row.flash { border-color: var(--good); }
.unit-row.flash::after {
  content: "Copied"; position: absolute; inset: 0; display: grid; place-items: center;
  background: var(--good); color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .03em;
  animation: fade 0.5s ease forwards;
}
@keyframes fade { from { opacity: 1; } to { opacity: 0; } }

/* --------------------------------------------------------------- seo blocks */
.seo { display: grid; gap: 18px; }
.seo-block {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px;
}
.seo-block h3 { margin: 0 0 12px; font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.seo-block p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.quick-links { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-link {
  display: inline-flex; flex-direction: column; gap: 1px;
  padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); font-size: 13px; font-weight: 500;
  transition: border-color .12s, color .12s;
}
.quick-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.quick-link small { color: var(--muted); font-size: 10.5px; font-weight: 500; }

/* ------------------------------------------------------------------ footer */
.footer {
  border-top: 1px solid var(--line); padding: 28px 20px; text-align: center;
  color: var(--muted); font-size: 13px; max-width: 1280px; margin: 0 auto;
}
.footer a { color: var(--muted); text-decoration: underline; }

/* ------------------------------------------------------------------- toast */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--paper); padding: 11px 18px; border-radius: 999px;
  font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow); z-index: 80;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* -------------------------------------------------------------- responsive */
@media (max-width: 860px) {
  .menu-btn { display: grid; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: var(--header-h); left: 0; bottom: 0; width: 82%; max-width: 320px;
    background: var(--surface); z-index: 45; transform: translateX(-102%);
    transition: transform .25s ease; box-shadow: var(--shadow);
  }
  .shell.nav-open .sidebar { transform: translateX(0); }
  .shell.nav-open::before {
    content: ""; position: fixed; inset: var(--header-h) 0 0 0; background: rgba(0,0,0,.4); z-index: 44;
  }
}
@media (max-width: 560px) {
  .convert-grid { grid-template-columns: 1fr; }
  .swap-btn { width: 100%; height: 42px; transform: none; }
  .swap-btn:hover { transform: none; }
  .swap-btn .ic { transform: rotate(90deg); }
  .num-input { height: 52px; font-size: 20px; }
  .brand span { display: none; }
  .unit-grid { grid-template-columns: 1fr; }
}

/* =============================================================================
   PHP multipage additions — header, footer, page layout, cards, pills, tables
   ========================================================================== */

.skip-link { position: absolute; left: -9999px; top: 0; background: var(--accent); color: #fff;
  padding: 8px 14px; border-radius: 0 0 8px 0; z-index: 100; }
.skip-link:focus { left: 0; }

.site-header {
  position: sticky; top: 0; z-index: 40;
  box-sizing: border-box; height: var(--header-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px; background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
.brand-mark {
  /* The UnitLab logo (same navy and symbol as the app icon). */
  width: 30px; height: 30px; border-radius: 8px; display: block; flex: 0 0 auto;
}
.brand-name { font-size: 17px; }
.brand-sub { color: var(--muted); font-weight: 500; font-size: 12px; }
.site-header .icon-btn:last-child { margin-left: auto; }
.menu-only { display: none; }

.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); gap: 0; max-width: 1280px; margin: 0 auto; align-items: start; min-height: 0; }
.sidebar { position: sticky; top: var(--header-h); align-self: start; max-height: calc(100vh - var(--header-h));
  overflow-y: auto; overscroll-behavior: contain; padding: 18px 14px; border-right: 1px solid var(--line); }
.main { padding: 28px 32px 60px; min-width: 0; }

/* breadcrumbs */
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 14px; display: flex; gap: 7px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs span[aria-current] { color: var(--ink-2); }

/* page head */
.page-head { margin-bottom: 22px; }
.eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.page-head h1 { font-size: 30px; letter-spacing: -.02em; margin: 0 0 8px; }
.lede { color: var(--ink-2); font-size: 15px; max-width: 62ch; margin: 0; }
.lede strong { color: var(--readout); font-family: var(--font-mono); }

/* category cards (home / 404) */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.cat-card {
  display: flex; align-items: center; gap: 13px; padding: 15px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  text-decoration: none; color: var(--ink); transition: border-color .13s, transform .13s, box-shadow .13s;
}
.cat-card:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(16,24,40,.06); }
.cat-card-ic { color: var(--accent); display: inline-flex; }
.cat-card-ic .ic { width: 26px; height: 26px; }
.cat-card-body { display: flex; flex-direction: column; }
.cat-card-name { font-weight: 600; }
.cat-card-count { font-size: 12px; color: var(--muted); font-family: var(--font-mono); }

/* pill rows (popular / related) */
.popular-block, .related, .table-block, .seo-block, .all-units { margin-top: 34px; }
.popular-block h2, .related h2, .table-block h2, .seo-block h2, .all-units h2 { font-size: 17px; margin: 0 0 14px; letter-spacing: -.01em; }
.pill-row { display: flex; flex-wrap: wrap; gap: 9px; }
.pill {
  display: inline-flex; align-items: center; padding: 8px 13px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  font-size: 13px; color: var(--ink-2); text-decoration: none; transition: border-color .13s, color .13s, background .13s;
}
.pill:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* conversion table */
.conv-table { width: 100%; border-collapse: collapse; font-size: 14px; max-width: 460px; }
.conv-table th, .conv-table td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.conv-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.conv-table td { font-family: var(--font-mono); color: var(--ink); }
.conv-table td:first-child { color: var(--ink-2); }

/* seo block */
.seo-block { padding: 20px 22px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
.seo-block p { color: var(--ink-2); font-size: 14px; line-height: 1.7; margin: 0; }

/* all-units heading row */
.all-head { display: flex; align-items: baseline; justify-content: space-between; }

/* footer */
.site-footer { max-width: 1280px; margin: 0 auto; padding: 28px 32px 48px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 13.5px; }
.site-footer p { margin: 0 0 6px; }
.site-footer .muted { color: var(--muted); }
.site-footer a { color: var(--accent); text-decoration: none; }

/* select styling inside converter */
.unit-select {
  width: 100%; margin-top: 8px; padding: 10px 12px; font-size: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; color: var(--ink);
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.unit-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.chip-select { gap: 8px; color: var(--muted); }
.chip-select select { border: none; background: transparent; font: inherit; color: var(--ink); cursor: pointer; }
.chip-select select:focus { outline: none; }
/* The select itself is transparent (it sits inside a chip), so give its
   drop-down list the page's own colours in both themes. */
select option { background-color: var(--surface); color: var(--ink); }
select option:checked { background-color: var(--accent); color: var(--accent-ink); }
.chip-go { cursor: pointer; }

/* mode switch as links */
.mode-switch a.mode-btn { text-decoration: none; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 10px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 60; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* responsive */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .menu-only { display: inline-flex; }
  .sidebar {
    position: fixed; top: 55px; left: 0; z-index: 45; width: 280px; height: calc(100vh - 55px);
    background: var(--paper); transform: translateX(-102%); transition: transform .22s ease; border-right: 1px solid var(--line);
  }
  .shell.nav-open .sidebar { transform: translateX(0); box-shadow: 0 10px 40px rgba(0,0,0,.2); }
  .main { padding: 22px 18px 50px; }
  .page-head h1 { font-size: 25px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* "colder than absolute zero" note (temperature) */
.temp-warning { margin: 12px 0 0; padding: 10px 14px; border-radius: 10px; font-size: 14px; line-height: 1.45;
  color: var(--ink); background: var(--readout-soft); border: 1px solid var(--readout); }
.temp-warning[hidden] { display: none; }

/* leap-year checkbox (time category) */
.leap-toggle { display: inline-flex; align-items: flex-start; gap: 10px; margin-top: 16px; cursor: pointer; user-select: none; }
.leap-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.leap-box { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 1px; border: 1.5px solid var(--line-strong);
  border-radius: 6px; background: var(--surface); color: transparent; display: grid; place-items: center; transition: background .13s, border-color .13s, color .13s; }
.leap-box .ic { width: 14px; height: 14px; }
.leap-toggle input:checked + .leap-box { background: var(--accent); border-color: var(--accent); color: #fff; }
.leap-toggle input:focus-visible + .leap-box { box-shadow: 0 0 0 3px var(--accent-soft); }
.leap-toggle:hover .leap-box { border-color: var(--accent); }
.leap-text { font-size: 14px; color: var(--ink); display: flex; flex-direction: column; line-height: 1.35; }
.leap-text small { color: var(--muted); font-size: 12px; }

/* three-way theme switch (header): system · dark · light, side by side */
.theme-switch { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; padding: 3px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.theme-opt { display: inline-grid; place-items: center; width: 32px; height: 28px; padding: 0;
  border: none; background: transparent; color: var(--muted); border-radius: 999px; cursor: pointer;
  transition: background .13s, color .13s; }
.theme-opt .ic { width: 17px; height: 17px; }
.theme-opt:hover { color: var(--ink); }
.theme-opt.is-on { background: var(--accent-soft); color: var(--accent); }
.theme-opt:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

/* =============================================================================
   Converter from/to layout — side-by-side boxes with a horizontal arrow
   (the PHP markup uses .conv-grid / .field, which the base sheet didn't style)
   ========================================================================== */
.conv-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: start;
}
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field .num-input,
.field .unit-select { width: 100%; }

/* the swap control sits between the two number boxes, aligned to them */
.conv-grid .swap-btn {
  align-self: start;
  margin-top: 26px;           /* label height + gap → lines up with the inputs */
  cursor: pointer;
}
.conv-grid .swap-btn .ic { transform: rotate(90deg); transition: transform .3s cubic-bezier(.34,1.56,.64,1); }

/* stack vertically on narrow screens; the arrow returns to vertical (points down) */
@media (max-width: 640px) {
  .conv-grid { grid-template-columns: 1fr; gap: 12px; }
  .conv-grid .swap-btn { margin-top: 0; width: 100%; height: 44px; justify-self: stretch; transform: none; }
  .conv-grid .swap-btn:hover { transform: none; }
  .conv-grid .swap-btn .ic { transform: none; }
}

/* Privacy policy and other legal text */
.seo-block.legal h2 { font-size: 16px; margin: 22px 0 6px; letter-spacing: -.01em; }
.seo-block.legal h2:first-child { margin-top: 0; }
.seo-block.legal p { margin: 0 0 4px; color: var(--ink); }
.seo-block.legal code { font-size: 13px; }
.seo-block.legal ul { margin: 0 0 4px; padding-left: 20px; }
.seo-block.legal li { color: var(--ink); font-size: 14px; line-height: 1.7; }
