/* =====================================================================
   used car prices, take two — a report in the voice of katsuma.ca:
   a plain document, one column, one family, quiet links, section names
   as small ruled labels. light and dark follow the system. prints clean.
   ===================================================================== */

:root {
  --bg: #FFFFFF;
  --ink: #1A1A1A;
  --ink-2: #6E6E6E;
  --rule: #E4E4E4;
  --link: #1A56A0;
  --wash: #F5F5F4;
  --good: #006300;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --ink: #E6E6E4;
    --ink-2: #9A9A98;
    --rule: #2B2B2B;
    --link: #85ACDF;
    --wash: #1B1B1B;
    --good: #0ca30c;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  padding: 28px 22px 40px;
  /* the whole site displays lowercase, the owner's quirk. do not "fix". */
  text-transform: lowercase;
}
.page { max-width: 46rem; width: 100%; margin: 0 auto; }

/* ------------------------------------------------------------ header */
.top {
  max-width: 46rem;
  margin: 0 auto 34px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 18px;
}
.top .name { font-weight: 700; color: var(--ink); text-decoration: none; margin-right: auto; }
.top nav { display: flex; flex-wrap: wrap; gap: 14px; }
.top nav a { color: var(--ink-2); text-decoration: none; }
.top nav a:hover, .top nav a:focus-visible { color: var(--ink); text-decoration: underline; }

/* -------------------------------------------------------------- type */
h1 { font-size: 1.7rem; line-height: 1.25; font-weight: 700; margin: 0 0 0.7rem; letter-spacing: -0.01em; }
h2 {
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.09em;
  color: var(--ink-2);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 7px; margin: 2.8rem 0 0.9rem;
}
h3 { font-size: 1rem; font-weight: 600; margin: 1.5rem 0 0.4rem; }
p { margin: 0 0 0.9rem; }
a { color: var(--link); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 3px; }
.lead { margin-bottom: 1.1rem; }
.meta { color: var(--ink-2); font-size: 0.875rem; }
ul, ol { margin: 0 0 1rem; padding-left: 1.2rem; }
li { margin-bottom: 0.35rem; }
strong { font-weight: 600; }
code, pre {
  font: 0.85em/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: none;
}
pre {
  background: var(--wash);
  border-radius: 6px;
  padding: 12px 14px;
  overflow-x: auto;
  margin: 0 0 1rem;
}

/* --------------------------------------------------------- stat tiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 10px;
  margin: 1.4rem 0 0.6rem;
}
.tile {
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 12px 14px 10px;
}
.tile .t-label { color: var(--ink-2); font-size: 0.8rem; }
.tile .t-value { font-size: 1.45rem; font-weight: 600; line-height: 1.3; }
.tile .t-note { color: var(--ink-2); font-size: 0.8rem; }
.tile .t-note.up { color: var(--good); }

/* ------------------------------------------------------------ figures */
figure { margin: 1.2rem 0 1.6rem; }
figure img { max-width: 100%; height: auto; display: block; margin: 0 auto; }
figcaption { color: var(--ink-2); font-size: 0.875rem; margin-top: 0.55rem; }

/* ------------------------------------------------------------- tables */
.tbl-wrap { overflow-x: auto; margin: 0 0 1.2rem; }
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
  line-height: 1.5;
}
th {
  text-align: left;
  font-weight: 600;
  color: var(--ink-2);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--rule);
  padding: 6px 14px 6px 0;
}
td { border-bottom: 1px solid var(--rule); padding: 6px 14px 6px 0; vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.hl td { font-weight: 600; }
.tbl-note { color: var(--ink-2); font-size: 0.8rem; margin-top: -0.6rem; }

/* --------------------------------------------------------------- misc */
.toc { columns: 2; column-gap: 24px; font-size: 0.9rem; margin: 0 0 1rem; padding-left: 1.2rem; }
.toc li { break-inside: avoid; }
@media (max-width: 540px) { .toc { columns: 1; } }
.callout {
  border-left: 3px solid var(--rule);
  padding: 2px 0 2px 14px;
  color: var(--ink-2);
  margin: 0 0 1rem;
}
footer { margin-top: 3.2rem; padding-top: 14px; border-top: 1px solid var(--rule); color: var(--ink-2); font-size: 0.875rem; }
footer p { margin: 0 0 0.3rem; }

@media print {
  /* print on paper is light regardless of the screen theme; the figures'
     <picture> elements carry a media="print" light source to match */
  :root {
    --bg: #FFFFFF;
    --ink: #1A1A1A;
    --ink-2: #6E6E6E;
    --rule: #E4E4E4;
    --link: #1A56A0;
    --wash: #F5F5F4;
    --good: #006300;
  }
  body { padding: 0; background: #FFFFFF; color: #1A1A1A; }
  .top nav { display: none; }
}
