@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/static/fonts/inter-latin-wght-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --ink: #0f172a;
  --muted: #5b6475;
  --line: #e5e7eb;
  --line-strong: #858d9b;
  --accent: #1d4ed8;
  --accent-ink: #ffffff;
  --badge: #0f172a;
  --badge-ink: #ffffff;
  --tint: #eef3ff;
  --shadow: rgba(15, 23, 42, .08);
  color-scheme: light dark;
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f17;
    --surface: #131a26;
    --ink: #e6e9ef;
    --muted: #9aa4b5;
    --line: #2a3445;
    --line-strong: #5d6b80;
    --accent: #6ea8ff;
    --accent-ink: #0b0f17;
    --badge: #e6e9ef;
    --badge-ink: #0b0f17;
    --tint: #16233d;
    --shadow: rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: .2em; }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }

.wrap { width: min(100%, 1280px); margin-inline: auto; padding-inline: 16px; }
@media (min-width: 768px) { .wrap { padding-inline: 24px; } }

/* Header and footer */
.site-header { background: var(--bg); box-shadow: 0 1px 0 var(--line), 0 8px 20px -14px var(--shadow); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-block: 14px; }
.brand-block { display: grid; gap: 2px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark { flex: none; color: var(--accent); }
.brand-name { font-size: 1.375rem; font-weight: 800; letter-spacing: -.025em; line-height: 1.1; }
.tagline { margin: 0; padding-left: 44px; color: var(--muted); font-size: .8125rem; line-height: 1.3; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.site-nav > a { color: var(--ink); font-size: .9375rem; font-weight: 500; text-decoration: none; }
.site-nav > a:hover, .site-nav > a[aria-current="page"] { color: var(--accent); }
.site-nav > a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.header-search { position: relative; display: flex; align-items: center; }
.header-search input { width: 220px; padding: 8px 14px 8px 38px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink); font: inherit; font-size: .9375rem; }
.header-search input::placeholder { color: var(--muted); opacity: 1; }
.header-search button { position: absolute; left: 6px; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; background: none; border: 0; border-radius: 999px; color: var(--muted); cursor: pointer; }
.header-search button:hover { color: var(--accent); }
.header-search input:focus-visible, .header-search button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (max-width: 639px) {
  .site-nav { width: 100%; }
  .header-search { flex: 1; }
  .header-search input { width: 100%; }
}
.partner-note { margin: 0; padding-block: 6px; background: var(--surface); border-bottom: 1px solid var(--line); color: var(--muted); font-size: .8125rem; }
.partner-note .wrap { display: block; }
main { padding-block: 24px 48px; }
.site-footer { background: var(--surface); border-top: 1px solid var(--line); color: var(--muted); font-size: .8125rem; }
.site-footer .wrap { padding-block: 24px; }
.site-footer p { margin: 0 0 8px; max-width: 80ch; }
.site-footer a { color: inherit; margin-right: 8px; white-space: nowrap; }

/* Feed: intro and two-column browse layout */
.intro { margin-bottom: 24px; }
.intro h1 { font-size: clamp(1.5rem, 2.5vw, 2rem); font-weight: 700; }
.intro-meta { margin: 4px 0 0; color: var(--muted); }
.browse { display: grid; gap: 24px; }
@media (min-width: 1024px) { .browse { grid-template-columns: 240px minmax(0, 1fr); align-items: start; } }

/* Filter sidebar */
.filters { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; padding: 12px 16px; }
.filters > summary { display: flex; justify-content: space-between; font-weight: 600; cursor: pointer; list-style: none; }
.filters > summary::-webkit-details-marker { display: none; }
.filters > summary::after { content: "▾"; color: var(--muted); }
.filters[open] > summary::after { content: "▴"; }
.filters[open] > summary { margin-bottom: 8px; }
@media (min-width: 1024px) { .filters > summary { display: none; } }
.filter-group { margin-top: 16px; }
.filter-group-label { margin: 0 0 4px; color: var(--muted); font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.filter-list { list-style: none; margin: 0; padding: 0; }
.filter-link { display: block; padding: 6px 10px; border-left: 3px solid transparent; border-radius: 8px; color: var(--ink); font-size: .9375rem; text-decoration: none; }
.filter-link:hover { background: var(--bg); }
.filter-link[aria-current="page"] { background: var(--tint); border-left-color: var(--accent); color: var(--accent); font-weight: 600; }

/* Results grid and tiles */
.results-head { margin-bottom: 16px; }
.results-head h2 { font-size: 1.125rem; font-weight: 600; }
.panel-note { margin: 4px 0 0; color: var(--muted); font-size: .875rem; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); list-style: none; margin: 0; padding: 0; }
@media (min-width: 768px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card { display: flex; flex-direction: column; gap: 6px; padding: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; transition: box-shadow .15s, border-color .15s; }
.card:hover { box-shadow: 0 4px 16px var(--shadow); }
@media (prefers-reduced-motion: reduce) { .card { transition: none; } }
.card-link { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; }
.card-link:hover .card-title { text-decoration: underline; }
.card-image { display: grid; place-items: center; aspect-ratio: 3 / 4; overflow: hidden; background: var(--surface); border-radius: 8px; }
.card-image img { width: 100%; height: 100%; object-fit: contain; }
.no-image { color: var(--muted); font-size: .875rem; }
.price { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.card .price { margin-top: 4px; font-size: 1.125rem; }
.card-title { display: -webkit-box; overflow: hidden; font-size: .875rem; font-weight: 500; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; }
.chip { display: inline-block; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); font-size: .75rem; font-weight: 500; }
.chip-grade { background: var(--badge); border-color: var(--badge); color: var(--badge-ink); font-weight: 600; }
.chip-psa { background: var(--surface); }
.meta, .checked { margin: 0; color: var(--muted); font-size: .8125rem; }

/* Pager, buttons, empty state */
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 32px; color: var(--muted); font-size: .875rem; }
.pager a, .button { display: inline-block; padding: 8px 16px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); font-weight: 500; text-decoration: none; }
.pager a:hover, .button:hover { border-color: var(--accent); color: var(--accent); }
.button-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button-primary:hover { color: var(--accent-ink); filter: brightness(1.08); }
.empty { padding: 48px 16px; background: var(--surface); border-radius: 12px; text-align: center; }
.empty h1 { font-size: 1.5rem; margin-bottom: 8px; }
.buy { margin: 16px 0 0; }
.commission { display: block; margin-top: 6px; color: var(--muted); font-size: .8125rem; }

/* Listing page */
.back { margin: 0 0 16px; font-size: .875rem; }
.listing-top { display: grid; gap: 24px; }
@media (min-width: 1024px) { .listing-top { grid-template-columns: minmax(0, 55fr) minmax(0, 45fr); gap: 40px; align-items: start; } }
.gallery-main { display: grid; place-items: center; width: 100%; aspect-ratio: 3 / 4; max-height: min(70vh, 640px); overflow: hidden; background: var(--surface); border-radius: 12px; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.thumbnails { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.thumbnails a { width: 64px; height: 64px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.thumbnails img { width: 100%; height: 100%; object-fit: cover; }
.thumbnails a[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.gallery-open { display: block; width: 100%; height: 100%; cursor: zoom-in; }
.gallery-open img { width: 100%; height: 100%; object-fit: contain; }

/* Full-screen photo viewer (listing page) */
.lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 16px; border: 0; background: transparent; color: #fff; }
.lightbox::backdrop { background: rgba(0, 0, 0, .88); }
.lightbox[open] { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.lightbox-img { grid-column: 2; width: 100%; height: calc(100vh - 96px); object-fit: contain; }
.lightbox-prev { grid-column: 1; }
.lightbox-next { grid-column: 3; }
.lightbox-close { position: fixed; top: 16px; right: 16px; }
.lightbox-count { position: fixed; right: 0; bottom: 16px; left: 0; margin: 0; font-size: .875rem; text-align: center; }
.lightbox button { width: 44px; height: 44px; padding: 0; background: rgba(255, 255, 255, .16); border: 0; border-radius: 999px; color: #fff; font: inherit; font-size: 1.5rem; line-height: 1; cursor: pointer; }
.lightbox button:hover { background: rgba(255, 255, 255, .28); }
.lightbox button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lightbox button[hidden] { display: none; }
.source { display: flex; flex-wrap: wrap; gap: 0 12px; color: var(--muted); font-size: .8125rem; }
.source p { margin: 0; }
.summary h1 { margin-top: 8px; font-size: clamp(1.25rem, 2vw, 1.625rem); font-weight: 600; }
.summary .price { margin-top: 12px; font-size: 2rem; }
.grade-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.summary .button-primary { display: block; padding: 12px 16px; font-size: 1rem; text-align: center; }
.summary .meta { margin-top: 8px; font-size: .875rem; }
.short-description { margin: 16px 0 0; }
.listing section { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.listing section h2 { margin-bottom: 12px; font-size: 1.125rem; font-weight: 600; }
.specifics { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); margin: 0; overflow: hidden; background: var(--surface); border-radius: 12px; font-size: .9375rem; }
.specifics dt, .specifics dd { margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.specifics dt { color: var(--muted); }
.specifics dt:last-of-type, .specifics dd:last-of-type { border-bottom: 0; }
.plain { margin: 0; padding-left: 1.2em; }

/* Prose pages (disclosure, privacy) */
.prose { max-width: 720px; }
.prose h1 { margin-bottom: 16px; font-size: 1.75rem; }
.prose h2 { margin: 24px 0 8px; font-size: 1.25rem; }

/* Pokémon: search, counts, A–Z, listing links */
.pokemon-search { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 8px; }
.pokemon-search label { width: 100%; color: var(--muted); font-size: .8125rem; }
.pokemon-search input { flex: 1; min-width: 0; padding: 6px 10px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); font: inherit; font-size: .9375rem; }
.pokemon-search button { padding: 6px 12px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); font: inherit; font-size: .875rem; font-weight: 500; cursor: pointer; }
.pokemon-search input:focus-visible, .pokemon-search button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.intro .pokemon-search { max-width: 420px; margin-top: 16px; }
.count { color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.az { display: grid; gap: 24px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.az-group h2 { margin-bottom: 8px; font-size: 1.125rem; font-weight: 700; }
.az-list { list-style: none; margin: 0; padding: 0; }
.az-list li { padding: 3px 0; }
.pokemon-links { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; margin: 10px 0 0; font-size: .875rem; }
.pokemon-links span { color: var(--muted); }
