/* Self-hosted fonts. No third-party request is made, so no visitor IP address
   is disclosed to any font provider. If the .woff2 files in assets/fonts/ are
   absent the browser falls back to the system stack and the site still works.
   See assets/fonts/README.txt for how to add them. */

@font-face {
  font-family: "Overpass";
  src: url("fonts/overpass-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Overpass";
  src: url("fonts/overpass-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Overpass";
  src: url("fonts/overpass-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Overpass Mono";
  src: url("fonts/overpass-mono-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Overpass Mono";
  src: url("fonts/overpass-mono-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}

/* Kilometer-Mileage.com — light professional design system */

:root {
  --ink: #1b2733;
  --ink-mid: #55636f;
  --ink-soft: #7c8896;

  --accent: #1a5f9e;
  --accent-dark: #144a7c;
  --accent-wash: #f2f7fb;
  --accent-line: #cfe0ee;

  --page: #f7f9fb;
  --card: #ffffff;
  --rule: #e2e7ec;
  --rule-strong: #ced6de;

  --focus: #1a5f9e;

  --sans: "Overpass", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "Overpass Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --shell: 64rem;
  --gutter: 1.5rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  overflow-wrap: break-word;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- masthead ---------- */

.masthead {
  background: var(--card);
  border-bottom: 1px solid var(--rule);
}

.masthead__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.05rem 0;
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-decoration: none;
}

.wordmark span {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  font-size: 0.93rem;
}

.nav a {
  color: var(--ink-mid);
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
}

.nav a:hover { color: var(--accent); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- page structure ---------- */

main { padding: 3rem 0 4rem; }

h1 {
  font-size: clamp(1.75rem, 1.2rem + 2.1vw, 2.45rem);
  line-height: 1.15;
  letter-spacing: -0.024em;
  margin: 0;
  font-weight: 700;
  max-width: 28ch;
}

.lede {
  max-width: 46ch;
  font-size: 1.06rem;
  color: var(--ink-mid);
  margin: 0.75rem 0 2.25rem;
}

h2 {
  font-size: 1.3rem;
  letter-spacing: -0.014em;
  margin: 3rem 0 0.9rem;
  font-weight: 700;
}

h3 {
  font-size: 1.02rem;
  margin: 1.9rem 0 0.4rem;
  font-weight: 700;
}

p { max-width: 68ch; }

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-dark); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

/* answer-first fact line: the sentence an answer engine should lift */

.answer {
  max-width: 62ch;
  margin: 0 0 1.75rem;
  padding: 0.85rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--rule-strong);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 1rem;
  color: var(--ink);
}

/* ---------- the tool ---------- */

.tool {
  background: var(--card);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(27, 39, 51, 0.04);
  margin: 1.75rem 0 0;
  overflow: hidden;
}

.tool__inputs {
  display: grid;
  gap: 1px;
  background: var(--rule);
  grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr));
}

.field {
  background: var(--card);
  padding: 1.15rem 1.35rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.field > label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-mid);
}

.field input,
.field select {
  font-family: var(--mono);
  font-size: 1.2rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule-strong);
  padding: 0.25rem 0 0.35rem;
  width: 100%;
  border-radius: 0;
}

.field select {
  font-family: var(--sans);
  font-size: 1rem;
  cursor: pointer;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

.field input:focus-visible,
.field select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

/* result panel — light, quiet, still the focal point */

.readout {
  background: var(--accent-wash);
  border-top: 1px solid var(--accent-line);
  padding: 1.6rem 1.35rem;
}

.readout__row + .readout__row {
  margin-top: 1.05rem;
  padding-top: 1.05rem;
  border-top: 1px solid var(--accent-line);
}

.readout__label {
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.readout__value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.9rem, 1.25rem + 3.2vw, 2.75rem);
  line-height: 1.08;
  font-weight: 600;
  letter-spacing: -0.028em;
  color: var(--accent-dark);
  word-break: break-word;
}

.readout__value u {
  font-family: var(--sans);
  font-size: 0.4em;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink-soft);
  margin-left: 0.4rem;
  letter-spacing: 0;
}

.readout__value.is-updated { animation: settle 200ms ease-out; }

@keyframes settle {
  from { opacity: 0.4; transform: translateY(-2px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .readout__value.is-updated { animation: none; }
}

.readout__note {
  font-family: var(--sans);
  font-size: 0.87rem;
  color: var(--ink-mid);
  margin: 1.1rem 0 0;
  max-width: 54ch;
}

.tool__actions {
  display: flex;
  gap: 0.6rem;
  padding: 0.95rem 1.35rem;
  border-top: 1px solid var(--rule);
  background: var(--card);
  flex-wrap: wrap;
}

.btn {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  background: var(--card);
  color: var(--accent);
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  cursor: pointer;
}

.btn:hover { background: var(--accent-wash); border-color: var(--accent-line); }

/* ---------- tiles ---------- */

.tiles {
  display: grid;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  overflow: hidden;
  grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr));
  margin-top: 1.25rem;
}

.tile {
  background: var(--card);
  padding: 1.25rem 1.35rem 1.4rem;
  text-decoration: none;
  color: var(--ink);
  display: block;
}

.tile:hover { background: var(--accent-wash); }
.tile:hover strong { color: var(--accent); }

.tile strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.3rem;
}

.tile span {
  display: block;
  font-size: 0.89rem;
  color: var(--ink-mid);
  line-height: 1.5;
}

/* ---------- tables ---------- */

.conv {
  border-collapse: collapse;
  width: 100%;
  max-width: 34rem;
  margin-top: 0.85rem;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.94rem;
  background: var(--card);
  border: 1px solid var(--rule-strong);
}

.conv caption {
  text-align: left;
  font-family: var(--sans);
  font-size: 0.86rem;
  color: var(--ink-mid);
  padding-bottom: 0.5rem;
}

.conv th, .conv td {
  border-bottom: 1px solid var(--rule);
  padding: 0.55rem 0.9rem;
  text-align: right;
}

.conv tbody tr:last-child td { border-bottom: 0; }

.conv th {
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--ink-mid);
  background: #fbfcfd;
  font-weight: 600;
  border-bottom-color: var(--rule-strong);
}

.conv td:first-child, .conv th:first-child { text-align: left; }
.conv tbody tr:hover { background: var(--accent-wash); }

/* ---------- formula & callout ---------- */

.formula {
  font-family: var(--mono);
  font-size: 0.97rem;
  line-height: 1.9;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--rule-strong);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 0.95rem 1.15rem;
  margin: 1.15rem 0;
  max-width: 46rem;
  overflow-x: auto;
}

.callout {
  background: var(--card);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  padding: 1.15rem 1.35rem;
  margin: 1.6rem 0;
  max-width: 46rem;
}

.callout p { margin: 0; }
.callout p + p { margin-top: 0.65rem; }

/* ---------- prose ---------- */

.prose ul { max-width: 66ch; padding-left: 1.2rem; }
.prose li { margin-bottom: 0.4rem; }



/* ---------- breadcrumbs ---------- */

.crumbs { margin: 0 0 0.9rem; font-size: 0.88rem; }

.crumbs ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.crumbs li { display: flex; align-items: center; gap: 0.5rem; color: var(--ink-soft); }

.crumbs li + li::before {
  content: "";
  width: 5px; height: 5px;
  border-right: 1px solid var(--rule-strong);
  border-top: 1px solid var(--rule-strong);
  transform: rotate(45deg);
  display: block;
}

.crumbs a { color: var(--ink-mid); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- related links ---------- */

.related {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  max-width: 46rem;
  border-top: 1px solid var(--rule);
}

.related li { border-bottom: 1px solid var(--rule); }

.related a {
  display: block;
  padding: 0.85rem 0.2rem;
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
}

.related a:hover { color: var(--accent-dark); background: var(--accent-wash); }

/* ---------- FAQ ---------- */

.faq {
  margin: 1rem 0 0;
  max-width: 46rem;
  border-top: 1px solid var(--rule);
}

.faq dt {
  font-weight: 700;
  font-size: 1rem;
  margin: 0;
  padding: 1.05rem 0 0.3rem;
}

.faq dd {
  margin: 0 0 1.05rem;
  padding-bottom: 1.05rem;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-mid);
  max-width: 66ch;
}

/* ---------- footer ---------- */

.foot {
  border-top: 1px solid var(--rule);
  background: var(--card);
  padding: 2.5rem 0 3rem;
  font-size: 0.91rem;
  color: var(--ink-mid);
}

.foot__cols {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}

.foot h2 {
  font-size: 0.86rem;
  margin: 0 0 0.65rem;
  color: var(--ink);
  letter-spacing: 0;
  font-weight: 700;
}

.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { margin-bottom: 0.35rem; }
.foot a { color: var(--ink-mid); text-decoration: none; }
.foot a:hover { color: var(--accent); text-decoration: underline; }

.foot__base {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.86rem;
  color: var(--ink-soft);
  max-width: none;
}

.skip { position: absolute; left: -9999px; }

.skip:focus {
  left: 1rem;
  top: 0.5rem;
  z-index: 10;
  background: var(--card);
  padding: 0.5rem 0.9rem;
  border: 2px solid var(--focus);
}

/* ============================================================
   Responsive layers
   ============================================================ */

/* --- Tablet and below: nav moves to its own scrollable row --- */
@media (max-width: 1024px) {
  .masthead__bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.8rem var(--gutter) 0;
  }

  .wordmark { padding-bottom: 0.7rem; }

  .nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 1.35rem;
    margin: 0 calc(var(--gutter) * -1);
    padding: 0 var(--gutter);
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
  }

  .nav::-webkit-scrollbar { display: none; }

  .nav a {
    white-space: nowrap;
    display: flex;
    align-items: center;
    min-height: 44px;
    padding-bottom: 0;
    border-bottom-width: 3px;
  }

  /* 44px minimum touch targets */
  .field input,
  .field select { min-height: 44px; }


  .btn { min-height: 44px; }

  .foot a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0.15rem 0;
  }

  .crumbs a,
  .crumbs li > span {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
  }

  .crumbs { margin-bottom: 0.35rem; }

  main { padding: 2.5rem 0 3.5rem; }
  h2 { margin-top: 2.5rem; }
}

/* --- Tablet portrait --- */
@media (min-width: 641px) and (max-width: 1024px) {
  .tool__inputs { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .foot__cols { grid-template-columns: repeat(2, 1fr); gap: 1.75rem 2rem; }
}

/* --- Phones --- */
@media (max-width: 640px) {
  :root { --gutter: 1.15rem; }

  body { font-size: 16px; }

  main { padding: 1.75rem 0 2.75rem; }

  h1 { max-width: none; }
  .lede { max-width: none; margin-bottom: 1.75rem; }
  h2 { font-size: 1.2rem; margin-top: 2.25rem; }

  .tool { margin-top: 1.35rem; border-radius: 5px; }
  .tool__inputs { grid-template-columns: 1fr; }
  .field { padding: 0.95rem 1.1rem 1.05rem; }
  .readout { padding: 1.3rem 1.1rem; }
  .readout__row + .readout__row { margin-top: 0.9rem; padding-top: 0.9rem; }
  .tool__actions { padding: 0.85rem 1.1rem; }
  .btn { width: 100%; justify-content: center; }

  .tiles { grid-template-columns: 1fr; }
  .tile { padding: 1.05rem 1.1rem 1.15rem; }

  /* tables scroll inside their own box rather than stretching the page */
  .conv-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .conv { font-size: 0.92rem; }
  .conv th, .conv td { padding: 0.5rem 0.7rem; }

  .formula { font-size: 0.9rem; line-height: 1.8; padding: 0.85rem 1rem; }
  .callout { padding: 1rem 1.1rem; }

  .foot { padding: 2rem 0 2.5rem; }
  .foot__cols { grid-template-columns: repeat(2, 1fr); gap: 1.5rem 1.5rem; }
  .foot__base { margin-top: 1.6rem; }
}

/* --- Small phones (iPhone SE and similar) --- */
@media (max-width: 380px) {
  :root { --gutter: 1rem; }
  body { font-size: 15.5px; }
  .readout__value { font-size: 1.85rem; }
  .foot__cols { grid-template-columns: 1fr; }
  .nav { gap: 1.1rem; font-size: 0.9rem; }
}

/* --- Landscape phone: claw back vertical space --- */
@media (max-height: 480px) and (orientation: landscape) {
  main { padding: 1.5rem 0 2rem; }
  .lede { margin-bottom: 1.25rem; }
  .readout__value { font-size: 1.75rem; }
}

/* --- Wide desktop --- */
@media (min-width: 1400px) {
  :root { --shell: 68rem; }
}

/* --- Any touch device, regardless of width --- */
@media (pointer: coarse) {
  .field input,
  .field select,
  .btn { min-height: 44px; }

  .nav a { min-height: 44px; display: flex; align-items: center; }

  .foot a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0.15rem 0;
  }

  .crumbs a,
  .crumbs li > span {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
  }
}

@media print {
  .masthead, .foot, .tool__actions, .skip { display: none; }
  body { background: #fff; font-size: 12pt; }
  .tool, .readout, .conv, .formula, .callout { border-color: #999; background: #fff; }
}
