/* Anekam Units — "measuring tape on a drafting table" */
@font-face { font-family: 'Barlow'; font-weight: 400; font-display: swap; src: url(/assets/fonts/barlow-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 500; font-display: swap; src: url(/assets/fonts/barlow-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 600; font-display: swap; src: url(/assets/fonts/barlow-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 500; font-display: swap; src: url(/assets/fonts/barlow-semi-condensed-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 600; font-display: swap; src: url(/assets/fonts/barlow-semi-condensed-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 700; font-display: swap; src: url(/assets/fonts/barlow-semi-condensed-latin-700-normal.woff2) format('woff2'); }

:root {
  --paper: #F3F5F4;
  --surface: #FFFFFF;
  --ink: #16202A;
  --steel: #56616C;
  --rule: #D2D8D6;
  --rule-strong: #B6BFBC;
  --tape: #F2C230;
  --tape-ink: #16202A;
  --tape-tint: #FCF1C9;
  --blue: #1C5DAA;
  --blue-soft: #E4EDF8;
  --danger: #B3261E;
  --f-body: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-head: 'Barlow Semi Condensed', 'Barlow', system-ui, sans-serif;
  --r: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0F141A; --surface: #171E26; --ink: #E5EAED; --steel: #9AA5AF; --rule: #29323C; --rule-strong: #3A4552;
    --tape-tint: #3A3214; --blue: #86B6F0; --blue-soft: #1B2A3C; --danger: #FF8A80; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0F141A; --surface: #171E26; --ink: #E5EAED; --steel: #9AA5AF; --rule: #29323C; --rule-strong: #3A4552;
  --tape-tint: #3A3214; --blue: #86B6F0; --blue-soft: #1B2A3C; --danger: #FF8A80; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 17px/1.55 var(--f-body);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3 { font-family: var(--f-head); line-height: 1.12; margin: 0 0 .5em; letter-spacing: -0.005em; }
h1 { font-size: clamp(32px, 5.2vw, 50px); font-weight: 700; }
h2 { font-size: clamp(22px, 2.6vw, 27px); font-weight: 600; }
h3 { font-size: 19px; font-weight: 600; }
p { margin: 0 0 .8em; }
code, kbd { font-family: var(--f-head); font-weight: 600; font-size: 1em; }
kbd { background: var(--blue-soft); border-radius: 4px; padding: 0 5px; }
.muted { color: var(--steel); }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }

/* ── Header ───────────────────────────── */
.site-head { border-bottom: 1px solid var(--rule); background: var(--surface); }
.head-row { display: flex; align-items: center; gap: 16px; min-height: 64px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font: 500 21px/1 var(--f-head); }
.brand b, .foot-brand b { font-weight: 700; }
.brand svg { width: 30px; height: 30px; }
.theme-btn { margin-left: auto; background: none; border: 1px solid var(--rule); color: var(--ink); width: 40px; height: 40px; border-radius: var(--r); display: grid; place-items: center; cursor: pointer; }
.theme-btn svg { width: 20px; height: 20px; }
.site-head .search { order: 3; flex: 1 0 100%; }
@media (min-width: 760px) {
  .site-head .search { order: 0; flex: 0 1 460px; margin-left: auto; }
  .site-head .search + .theme-btn { margin-left: 0; }
}

/* ── Search ───────────────────────────── */
.search { position: relative; }
.search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--steel); pointer-events: none; }
.search-ico svg { width: 20px; height: 20px; display: block; }
.q {
  width: 100%; font: 400 16px/1.2 var(--f-body); color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule-strong); border-radius: var(--r); padding: 11px 12px 11px 40px;
}
.q::placeholder { color: var(--steel); }
.q:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.q-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 60; list-style: none; margin: 0; padding: 6px;
  background: var(--surface); border: 1px solid var(--rule-strong); border-radius: var(--r);
  box-shadow: 0 14px 34px -12px rgba(10, 20, 30, .35); max-height: 70vh; overflow: auto;
}
.q-results a { display: flex; flex-direction: column; padding: 9px 10px; border-radius: 6px; text-decoration: none; color: var(--ink); }
.q-results [aria-selected="true"] a, .q-results a:hover { background: var(--blue-soft); }
.q-main { font-weight: 500; }
.q-sub { font-size: 14px; color: var(--steel); }
.q-hit .q-main { font: 700 20px/1.2 var(--f-head); }
.q-empty { padding: 10px; color: var(--steel); font-size: 15px; }

/* ── Breadcrumbs ───────────────────────── */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 14px 0 0; font-size: 14.5px; color: var(--steel); }
.crumbs li + li::before { content: '/'; margin-right: 4px; color: var(--rule-strong); }
.crumbs a { color: var(--steel); }

/* ── Page structure ───────────────────── */
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; padding-top: 18px; padding-bottom: 56px; }
@media (min-width: 980px) { .page-grid { grid-template-columns: minmax(0, 1fr) 290px; gap: 52px; } }
.primary { min-width: 0; }
.page-head { margin-bottom: 18px; max-width: 760px; }
.kicker { margin: 0 0 6px; font-size: 15px; }
.kicker a { color: var(--steel); }
.lede { font-size: 18.5px; color: var(--steel); margin: 0; }
.sym-pill { font: 600 .95em/1 var(--f-head); background: var(--tape-tint); color: var(--ink); padding: 2px 7px 3px; border-radius: 4px; white-space: nowrap; }
.block { margin-top: 44px; }
.block > h2 { padding-bottom: 8px; border-bottom: 2px solid var(--ink); }

/* ── Converter ────────────────────────── */
.converter { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; }
.cv-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 18px 18px 14px; align-items: end; }
@media (min-width: 720px) { .cv-grid { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 14px; padding: 22px 22px 18px; } }
.cv-field label { display: block; font-size: 15px; color: var(--steel); margin-bottom: 5px; }
.cv-pair { display: flex; border: 1px solid var(--rule-strong); border-radius: var(--r); background: var(--paper); overflow: hidden; }
.cv-pair:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.cv-num {
  flex: 1 1 56%; min-width: 0; border: 0; background: transparent; color: var(--ink);
  font: 600 clamp(22px, 2.5vw, 28px)/1.1 var(--f-head); padding: 12px 12px; font-variant-numeric: tabular-nums;
}
.cv-num:focus { outline: none; }
.cv-num[aria-invalid="true"] { color: var(--danger); }
.cv-unit {
  flex: 0 1 44%; min-width: 0; border: 0; border-left: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  font: 500 16px/1.2 var(--f-body); padding: 0 30px 0 12px; appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 15px center, right 10px center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  text-overflow: ellipsis;
}
.cv-unit:focus { outline: none; }
.cv-msg { color: var(--danger); font-size: 14.5px; margin: 6px 0 0; }
.cv-swap {
  justify-self: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink);
  display: grid; place-items: center; cursor: pointer; margin: 6px 0 2px;
}
.cv-swap svg { width: 22px; height: 22px; }
.cv-swap:hover { border-color: var(--ink); }
@media (min-width: 720px) { .cv-swap { margin: 0 0 6px; } .cv-swap svg { transform: rotate(90deg); } }

/* The tape: the one loud element */
.tape {
  position: relative; background: var(--tape); color: var(--tape-ink);
  padding: 30px 22px 16px;
  background-image:
    repeating-linear-gradient(90deg, rgba(22, 32, 42, .9) 0 1.5px, transparent 1.5px 50px),
    repeating-linear-gradient(90deg, rgba(22, 32, 42, .75) 0 1px, transparent 1px 10px),
    repeating-linear-gradient(90deg, rgba(22, 32, 42, .5) 0 1px, transparent 1px 5px);
  background-size: 100% 16px, 100% 10px, 100% 6px;
  background-repeat: no-repeat;
  background-position: 21px 0, 21px 0, 21px 0;
}
.tape-eq { margin: 0; font: 700 clamp(23px, 3.6vw, 34px)/1.18 var(--f-head); overflow-wrap: anywhere; }
.eq-op { font-weight: 500; padding: 0 .1em; }
.eq-l { font-weight: 600; }
.cv-info { padding: 14px 22px 4px; border-bottom: 1px solid var(--rule); }
.cv-info p { margin: 0 0 8px; }
.lbl { color: var(--steel); font-size: 15px; margin-right: 6px; }
.extras p { margin: 0 0 8px; }
.cv-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; padding: 14px 22px; }
.btn {
  font: 500 15.5px/1 var(--f-body); color: var(--ink); background: var(--surface); border: 1px solid var(--rule-strong);
  border-radius: var(--r); padding: 10px 14px; cursor: pointer; min-height: 40px;
}
.btn:hover { border-color: var(--ink); }
.opts { flex: 1 1 220px; }
.opts summary { cursor: pointer; padding: 10px 2px; color: var(--steel); font-size: 15.5px; list-style-position: inside; }
.opts-body { display: flex; flex-wrap: wrap; gap: 12px 20px; padding: 6px 0 4px; }
.opts label { display: flex; flex-direction: column; font-size: 14.5px; color: var(--steel); gap: 4px; }
.opts select { font: 400 15.5px var(--f-body); color: var(--ink); background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 6px; padding: 7px 8px; }
.cv-hint { margin: 0; padding: 0 22px 16px; font-size: 14.5px; color: var(--steel); }

/* ── Tables ───────────────────────────── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ut { width: 100%; border-collapse: collapse; font-size: 16px; }
.ut th, .ut td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.ut thead th { font: 600 15px var(--f-head); color: var(--steel); border-bottom: 1px solid var(--rule-strong); white-space: nowrap; }
.ut tbody th { font-weight: 500; }
.ut .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ut td.num { font-family: var(--f-head); font-weight: 600; font-size: 17px; }
.ut .sym { color: var(--steel); white-space: nowrap; }
.ut tr.is-from { background: var(--tape-tint); }
.ut tbody tr:hover { background: color-mix(in srgb, var(--blue-soft) 60%, transparent); }
.ut tr.is-from:hover { background: var(--tape-tint); }
.ref-d { display: block; font-weight: 400; font-size: 14.5px; color: var(--steel); max-width: 52ch; margin-top: 2px; }
.ref td.num { font-size: 15.5px; white-space: normal; }
@media (max-width: 600px) { .ref th:nth-child(3), .ref td:nth-child(3) { display: none; } .ref td.num { min-width: 110px; } }
.twin { display: grid; gap: 24px; }
@media (min-width: 640px) { .twin { grid-template-columns: 1fr 1fr; } }
.conv-t td { text-align: right; }

/* ── About / facts ────────────────────── */
.about > p { max-width: 70ch; }
.note { border-left: 4px solid var(--tape); padding: 6px 0 6px 14px; background: var(--tape-tint); border-radius: 0 6px 6px 0; max-width: 70ch; }
.facts { display: flex; flex-wrap: wrap; gap: 10px 36px; margin: 18px 0 22px; }
.facts dt { font-size: 14.5px; color: var(--steel); }
.facts dd { margin: 0; font: 600 19px/1.3 var(--f-head); }
.uses { padding-left: 1.2em; margin: 0; columns: 2 260px; column-gap: 32px; }
.uses li { margin-bottom: 4px; break-inside: avoid; }
.formula code { display: inline-block; font-size: 20px; background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--tape); padding: 8px 14px; border-radius: 6px; }
.unit-cards { display: grid; gap: 18px; }
@media (min-width: 640px) { .unit-cards { grid-template-columns: 1fr 1fr; } }
.unit-card { border-top: 2px solid var(--rule-strong); padding-top: 12px; }
.unit-card p { font-size: 16px; }
.faq details { border-bottom: 1px solid var(--rule); padding: 4px 0; }
.faq summary { cursor: pointer; padding: 10px 0; font-weight: 500; }
.faq details p { color: var(--steel); }

/* ── Chips & side ─────────────────────── */
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; }
.chips a {
  display: inline-block; text-decoration: none; color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule-strong); border-radius: 6px; padding: 6px 10px; font: 500 15.5px/1.2 var(--f-head);
}
.chips a:hover { border-color: var(--ink); background: var(--tape-tint); }
.side { min-width: 0; }
.side-box { margin-bottom: 34px; }
.side-box h2 { font-size: 19px; padding-bottom: 6px; border-bottom: 2px solid var(--ink); margin-bottom: 12px; }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li { border-bottom: 1px solid var(--rule); }
.side-list a { display: block; padding: 8px 0; color: var(--ink); text-decoration: none; }
.side-list a:hover { color: var(--blue); }
.ad { margin: 28px 0; min-height: 90px; }

/* ── Home ─────────────────────────────── */
.hero { background: var(--surface); border-bottom: 1px solid var(--rule); }
.hero .wrap { padding-top: clamp(34px, 6vw, 72px); padding-bottom: 30px; }
.hero h1 { max-width: 19ch; font-size: clamp(38px, 6.6vw, 68px); line-height: 1.0; letter-spacing: -0.015em; }
.hero .lede { max-width: 60ch; margin-bottom: 24px; }
.search-hero { max-width: 640px; }
.search-hero .q { font-size: 18px; padding: 16px 14px 16px 46px; background: var(--paper); }
.search-hero .search-ico { left: 15px; }
.tape-hero {
  height: 46px; padding: 0; background-position: 20px 0, 20px 0, 20px 0;
  background-size: 100% 26px, 100% 15px, 100% 8px;
}
.home-body { padding-top: 26px; padding-bottom: 60px; }
.quick { margin-bottom: 40px; }
.recent { margin-top: 22px; }
.recent h2 { font-size: 18px; color: var(--steel); font-weight: 500; }
.directory { display: grid; gap: 44px 56px; }
@media (min-width: 820px) { .directory { grid-template-columns: 1fr 1fr; } }
.dir-group > h2 { padding-bottom: 8px; border-bottom: 2px solid var(--ink); margin-bottom: 8px; }
.dir-group > .muted { font-size: 15.5px; margin-bottom: 12px; }
.dir { list-style: none; margin: 0; padding: 0; }
.dir li { padding: 7px 0 6px; border-bottom: 1px solid var(--rule); }
.dir a { display: flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--ink); }
.dir-name { font: 600 19px/1.25 var(--f-head); }
.dir a:hover .dir-name { color: var(--blue); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.dir-lead { flex: 1; border-bottom: 2px dotted var(--rule-strong); transform: translateY(-4px); min-width: 20px; }
.dir-n { font: 600 16px var(--f-head); color: var(--steel); }
.dir-eg { display: block; font-size: 14.5px; color: var(--steel); word-spacing: .3em; }

.pairs-dir { margin: 0; }
.pairs-dir > div { display: grid; gap: 2px 16px; padding: 9px 0; border-bottom: 1px solid var(--rule); }
@media (min-width: 640px) { .pairs-dir > div { grid-template-columns: 190px 1fr; } }
.pairs-dir dt { font-weight: 500; }
.pairs-dir dd { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font: 500 16px var(--f-head); }

/* ── Prose pages ──────────────────────── */
.prose { max-width: 760px; padding-top: 24px; padding-bottom: 64px; }
.prose h2 { margin-top: 1.6em; }

/* ── Footer ───────────────────────────── */
.site-foot { border-top: 1px solid var(--rule); background: var(--surface); padding: 36px 0 22px; font-size: 15.5px; }
.foot-grid { display: grid; gap: 26px; }
@media (min-width: 760px) { .foot-grid { grid-template-columns: 1.3fr 1fr 1fr; } }
.foot-brand { display: flex; align-items: center; gap: 8px; font: 500 19px var(--f-head); }
.foot-brand svg { width: 26px; height: 26px; }
.foot-h { font: 600 16px var(--f-head); margin-bottom: 6px; }
.site-foot ul { list-style: none; margin: 0; padding: 0; }
.site-foot li { margin-bottom: 6px; }
.site-foot p { color: var(--steel); }
.foot-note { margin-top: 18px; font-size: 14px; }

@media (max-width: 480px) {
  body { font-size: 16.5px; }
  .wrap { padding-left: 16px; padding-right: 16px; }
  .cv-pair { flex-direction: column; }
  .cv-num { flex: none; }
  .cv-unit { flex: none; width: 100%; border-left: 0; border-top: 1px solid var(--rule); padding-top: 11px; padding-bottom: 11px; }
  .cv-grid { padding: 16px 14px 12px; }
  .cv-info, .cv-tools { padding-left: 16px; padding-right: 16px; }
  .cv-hint { padding: 0 16px 14px; }
  .tape { padding: 28px 16px 14px; background-position: 15px 0, 15px 0, 15px 0; }
  .cv-unit { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
@media print {
  .site-head, .site-foot, .side, .cv-tools, .cv-hint, .ad { display: none; }
  .tape { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
