@font-face { font-family: "Plex"; src: url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex"; src: url("fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex"; src: url("fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Serif"; src: url("fonts/source-serif-4-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Serif"; src: url("fonts/source-serif-4-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  color-scheme: light;
  --paper: #F7F4EE;
  --raised: #FFFDF8;
  --ink: #1C1A17;
  --muted: #655F56;
  --line: #DCD6CA;
  --line-strong: #1C1A17;
  --accent: #1A6548;
  --skeleton: #E8E3D8;

  --s1: 0.25rem; --s2: 0.5rem; --s3: 0.75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem;
  --r: 2px;
  --sans: "Plex", system-ui, sans-serif;
  --serif: "Serif", Georgia, serif;
  --columns: minmax(0, 1fr) 5rem 4rem 7.5rem 1.25rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #171513; --raised: #1F1C19; --ink: #EDE8DF; --muted: #A69E92;
    --line: #322E29; --line-strong: #EDE8DF; --accent: #82D3AA; --skeleton: #27241F;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #171513; --raised: #1F1C19; --ink: #EDE8DF; --muted: #A69E92;
  --line: #322E29; --line-strong: #EDE8DF; --accent: #82D3AA; --skeleton: #27241F;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 0.9375rem/1.45 var(--sans); }
h1, h2, p, ul, fieldset, legend { margin: 0; padding: 0; }
fieldset { border: 0; min-width: 0; }
ul { list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wrap { width: 100%; max-width: 62rem; margin-inline: auto; padding-inline: var(--s4); }
.skip { position: absolute; left: var(--s4); top: -3rem; background: var(--ink); color: var(--paper); padding: var(--s2) var(--s3); z-index: 10; }
.skip:focus { top: var(--s2); }
[hidden] { display: none !important; }

/* Masthead */
.masthead { border-bottom: 1px solid var(--line-strong); }
.masthead-row { display: flex; align-items: center; gap: var(--s5); padding-block: var(--s4) var(--s3); }
.wordmark { font: 600 1.375rem/1 var(--serif); color: var(--ink); text-decoration: none; letter-spacing: -0.01em; white-space: nowrap; }
.wordmark span { font: 500 0.6875rem/1 var(--sans); letter-spacing: 0.08em; vertical-align: 0.3em; margin-left: 1px; }
.search { flex: 1; display: flex; align-items: center; gap: var(--s2); border-bottom: 1px solid var(--line); padding-block: var(--s1); }
.search:focus-within { border-bottom-color: var(--ink); }
.search svg { width: 1rem; height: 1rem; fill: none; stroke: var(--muted); stroke-width: 1.4; flex: none; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; padding: 0; }
.search input::placeholder { color: var(--muted); opacity: 1; }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd { font: 400 0.75rem var(--sans); color: var(--muted); border: 1px solid var(--line); border-radius: var(--r); padding: 0 var(--s1); }
.tools { display: flex; align-items: center; gap: var(--s3); }
.tool { font-size: 0.8125rem; font-weight: 500; color: var(--ink); min-width: 1.5rem; min-height: 1.5rem; }
.tool:hover { text-decoration: underline; text-underline-offset: 2px; }
#theme-toggle svg { width: 1.125rem; height: 1.125rem; display: block; fill: none; stroke: currentColor; stroke-width: 1.3; }
#theme-toggle .fill { fill: currentColor; stroke: none; }

.tabs { display: flex; gap: var(--s5); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { color: var(--muted); text-decoration: none; padding-block: var(--s2); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a small { font-size: 0.75rem; margin-left: var(--s1); font-variant-numeric: tabular-nums; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
.tabs a[aria-current="page"] small { font-weight: 400; color: var(--muted); }

/* Controls */
.controls { display: flex; align-items: end; gap: var(--s4); padding-block: var(--s4) var(--s3); }
#filters { display: flex; align-items: end; gap: var(--s4); flex: 1; min-width: 0; position: static; inset: auto; width: auto; max-width: none; max-height: none; padding: 0; margin: 0; border: 0; background: none; color: inherit; flex-wrap: wrap; }
.sheet-head, .sheet-only, .filters-button { display: none; }
.field { display: flex; flex-direction: column; gap: var(--s1); }
.field > span, .field > legend { font-size: 0.75rem; color: var(--muted); }
select { background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 0; height: 1.75rem; max-width: 11rem; cursor: pointer; }
select option { background: var(--raised); color: var(--ink); }
select:hover { border-bottom-color: var(--ink); }
.segments { display: flex; }
.segments button { height: 1.75rem; padding: 0 var(--s2); border: 1px solid var(--line); margin-left: -1px; font-size: 0.8125rem; font-weight: 500; }
.segments button:first-child { margin-left: 0; border-radius: var(--r) 0 0 var(--r); }
.segments button:last-child { border-radius: 0 var(--r) var(--r) 0; }
.segments button:hover { border-color: var(--ink); position: relative; }
.segments button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); position: relative; }
.check { display: flex; align-items: center; gap: var(--s2); cursor: pointer; height: 1.75rem; white-space: nowrap; }
.check input { accent-color: var(--ink); width: 0.9375rem; height: 0.9375rem; margin: 0; }
.sort { margin-left: auto; }

.active-filters { display: flex; flex-wrap: wrap; gap: var(--s2); }
.active-filters:not(:empty) { padding-bottom: var(--s3); }
.chip { display: inline-flex; align-items: center; gap: var(--s1); font-size: 0.8125rem; border: 1px solid var(--line); border-radius: var(--r); padding: 0 var(--s2); }
.chip:hover { border-color: var(--ink); }
.chip svg { width: 0.625rem; height: 0.625rem; stroke: currentColor; stroke-width: 1.5; fill: none; }
.chip.clear { border-color: transparent; text-decoration: underline; text-underline-offset: 2px; padding-inline: var(--s1); }

.summary { font-size: 0.8125rem; color: var(--muted); padding-bottom: var(--s2); }
.notice { font-size: 0.8125rem; padding: var(--s2) 0; border-top: 1px solid var(--line); }

/* Ledger */
.ledger-head, .row-head { display: grid; grid-template-columns: var(--columns); align-items: center; column-gap: var(--s3); }
.ledger-head { border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); padding-block: var(--s1); font-size: 0.75rem; color: var(--muted); }
.ledger-head span:nth-child(3), .ledger-head span:nth-child(4) { text-align: right; }
.ledger { outline: none; }
.row { border-bottom: 1px solid var(--line); }
.row-head { width: 100%; text-align: left; padding-block: var(--s3); }
.row-head:hover .name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.row-head:focus-visible { outline-offset: -2px; }
.product { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.thumb { flex: none; width: 2.75rem; height: 2.75rem; border-radius: var(--r); background: #fff; border: 1px solid var(--line); object-fit: contain; display: grid; place-items: center; font: 500 1rem var(--serif); color: #655F56; overflow: hidden; }
.text { min-width: 0; }
.title { display: block; line-height: 1.3; overflow-wrap: anywhere; }
.name { font: 600 1.0625rem/1.3 var(--serif); }
.kind { font-size: 0.875rem; color: var(--ink); margin-left: var(--s1); }
.meta { display: block; font-size: 0.8125rem; color: var(--muted); }
.meta .mobile { display: none; }
.badge { justify-self: start; font-size: 0.75rem; font-weight: 500; letter-spacing: 0.03em; border: 1px solid var(--line); border-radius: var(--r); padding: 0 var(--s1); white-space: nowrap; }
.badge sup, .assumed-mark { font-size: 0.6875rem; line-height: 0; }
.count, .price { text-align: right; font-variant-numeric: tabular-nums; }
.count { color: var(--muted); }
.price { font-weight: 600; font-size: 1.0625rem; white-space: nowrap; }
.trend { display: block; font-size: 0.6875rem; font-weight: 500; color: var(--muted); letter-spacing: 0.02em; }

/* Price history */
.history:not(:empty) { padding-bottom: var(--s3); }
.history-title { font: 600 0.8125rem var(--sans); margin: 0; }
.history-note { font-size: 0.8125rem; color: var(--muted); padding: var(--s1) 0 var(--s2); }
.history-note strong { color: var(--ink); font-weight: 600; }
.chart { position: relative; }
.chart svg { display: block; overflow: visible; }
.chart svg:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-label { fill: var(--muted); font: 400 11px var(--sans); font-variant-numeric: tabular-nums; }
.chart-line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: var(--ink); opacity: 0.08; }
.chart-dot { fill: var(--ink); stroke: var(--raised); stroke-width: 2; }
.chart-cross { stroke: var(--muted); stroke-width: 1; }
.chart-readout { font-size: 0.8125rem; color: var(--muted); padding-bottom: var(--s1); min-height: 1.25rem; }
.chart-readout strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.history-table { padding-top: var(--s2); font-size: 0.8125rem; }
.history-table summary { cursor: pointer; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; width: max-content; }
.history-table table { margin-top: var(--s2); }

.price.none { font-weight: 400; font-size: 0.8125rem; color: var(--muted); }
.chevron { width: 0.75rem; height: 0.75rem; fill: none; stroke: var(--muted); stroke-width: 1.5; justify-self: end; }
[aria-expanded="true"] .chevron { transform: rotate(180deg); }

/* Expanded comparison */
.detail { background: var(--raised); border-top: 1px solid var(--line); padding: var(--s3) var(--s4) var(--s4); }
.detail-note { font-size: 0.8125rem; color: var(--muted); padding-bottom: var(--s2); }
.detail-note strong { color: var(--ink); font-weight: 600; }
.offers { width: 100%; border-collapse: collapse; }
.offers th { font-size: 0.75rem; font-weight: 400; color: var(--muted); text-align: left; padding-bottom: var(--s1); border-bottom: 1px solid var(--line); }
.offers td { padding-block: var(--s2); border-bottom: 1px solid var(--line); vertical-align: top; }
.offers tr:last-child td { border-bottom: 0; }
.offers .num { text-align: right; }
.offers .shop { font-weight: 500; }
.offers .listed { display: block; font-size: 0.75rem; color: var(--muted); overflow-wrap: anywhere; font-weight: 400; }
.offers .amount { font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; display: block; }
.offers .best .amount { color: var(--accent); font-weight: 600; }
.best-label { display: block; color: var(--accent); font-size: 0.75rem; white-space: nowrap; }
.offers .status { font-size: 0.8125rem; white-space: nowrap; }
.offers .sold td { color: var(--muted); }
.offers .sold .shop { color: var(--muted); }
.visit { white-space: nowrap; font-size: 0.8125rem; }
.detail-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s2) var(--s4); padding-top: var(--s2); font-size: 0.75rem; color: var(--muted); }
.detail-foot button { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* States */
.more { padding-block: var(--s4); text-align: center; }
.outline { border: 1px solid var(--ink); border-radius: var(--r); padding: var(--s1) var(--s4); font-weight: 500; }
.outline:hover { background: var(--ink); color: var(--paper); }
.primary { background: var(--ink); color: var(--paper); border-radius: var(--r); padding: var(--s2) var(--s4); font-weight: 500; }
.empty { padding-block: var(--s7); text-align: center; border-bottom: 1px solid var(--line); }
.empty h2 { font: 600 1.25rem var(--serif); margin-bottom: var(--s1); }
.empty p { color: var(--muted); margin-bottom: var(--s4); }
.skeleton-row { display: grid; grid-template-columns: var(--columns); column-gap: var(--s3); align-items: center; padding-block: var(--s3); border-bottom: 1px solid var(--line); }
.bar { display: block; height: 0.75rem; background: var(--skeleton); border-radius: var(--r); }
.bar.tall { height: 2.75rem; width: 2.75rem; flex: none; }
.bar.wide { width: 60%; }
.sold-label { display: none; font-size: 0.75rem; white-space: nowrap; }
.detail-legend { font-size: 0.75rem; color: var(--muted); padding-top: var(--s2); }
@media (prefers-reduced-motion: no-preference) { .skeleton-row { animation: pulse 1.4s ease-in-out infinite; } }
@keyframes pulse { 50% { opacity: 0.55; } }

/* Shops page and footer */
.page-title { font: 600 1.625rem/1.2 var(--serif); padding-top: var(--s5); }
.lede { color: var(--muted); max-width: 40rem; padding-block: var(--s2) var(--s4); }
.table-scroll { overflow-x: auto; }
.shops { width: 100%; border-collapse: collapse; border-top: 1px solid var(--line-strong); }
.shops th { text-align: left; font-size: 0.75rem; font-weight: 400; color: var(--muted); padding-block: var(--s2); border-bottom: 1px solid var(--line); white-space: nowrap; padding-right: var(--s4); }
.shops td { padding-block: var(--s2); border-bottom: 1px solid var(--line); padding-right: var(--s4); white-space: nowrap; }
.shops .num { text-align: right; font-variant-numeric: tabular-nums; }
.colophon { padding-block: var(--s6); font-size: 0.8125rem; color: var(--muted); display: grid; gap: var(--s2); }
.colophon p { max-width: 44rem; }
.colophon nav { display: flex; gap: var(--s4); flex-wrap: wrap; }

@media (max-width: 47.99rem) {
  :root { --columns: minmax(0, 1fr) auto 0.75rem; }
  .masthead-row { flex-wrap: wrap; gap: var(--s2) var(--s4); justify-content: space-between; }
  .search { order: 3; flex-basis: 100%; }
  .search kbd { display: none; }
  .ledger-head, .row-head > .badge, .row-head > .count, .skeleton-row > .desktop { display: none; }
  .row-head, .skeleton-row { column-gap: var(--s2); }
  .meta .mobile { display: inline; }
  .price { font-size: 1rem; }
  .ledger { border-top: 1px solid var(--line-strong); }
  .controls { align-items: center; justify-content: space-between; }
  .filters-button { display: inline-block; border: 1px solid var(--ink); border-radius: var(--r); padding: var(--s1) var(--s3); font-weight: 500; }
  .sort { flex-direction: row; align-items: center; gap: var(--s2); }

  #filters { display: none; }
  #filters[open] {
    display: flex; flex-direction: column; align-items: stretch; gap: var(--s4);
    position: fixed; inset: auto 0 0 0; width: 100%; max-height: 85dvh; overflow-y: auto;
    background: var(--raised); border-top: 1px solid var(--line-strong); padding: var(--s4); flex-wrap: nowrap;
  }
  #filters::backdrop { background: rgb(0 0 0 / 0.45); }
  .sheet-head { display: flex; justify-content: space-between; align-items: center; }
  .sheet-head h2 { font: 600 1.25rem var(--serif); }
  .sheet-only { display: block; width: 100%; }
  #filters select { max-width: none; padding-block: var(--s2); }
  .segments { flex-wrap: wrap; }

  .detail { padding-inline: var(--s3); }
  .offers .hide-sm { display: none; }
  .sold-label { display: block; }
  .offers td:last-child { padding-left: var(--s3); }
  .segments button { height: auto; padding: var(--s1) var(--s3); }
}
