/* Partabúðin: an invented car-parts shop. The point of this template is the
   parts list: filters beside the grid, every one of them a plain link. */
:root {
  --color-bg: #f4f5f7;
  --color-ink: #14171c;
  --color-accent: #e8590c;
  --color-surface: #ffffff;
  --color-muted: #5b616b;
  --color-line: #dfe2e7;
  --color-ok: #2b7a3d;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 8px;
  --width: 78rem;

  --kp-accent: var(--color-accent);
  --kp-accent-ink: #fff;
  --kp-surface: var(--color-surface);
  --kp-ink: var(--color-ink);
  --kp-radius: 6px;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--color-bg); color: var(--color-ink); font: 16px/1.55 var(--font-body); }
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2 { font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 0.6em; }
h1 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); }
h2 { font-size: 1.35rem; }

.site-header { background: var(--color-ink); color: #fff; --kp-ink: #fff; }
.header-inner { max-width: var(--width); margin: 0 auto; padding: 0.9rem 1.5rem; display: flex; align-items: center; gap: 2rem; flex-wrap: wrap; }
.brand { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; text-decoration: none; }
.brand::before { content: ""; display: inline-block; width: 0.7em; height: 0.7em; margin-right: 0.45em; background: var(--color-accent); border-radius: 2px; transform: rotate(45deg); }
.site-nav { display: flex; gap: 1.4rem; flex: 1; }
.site-nav a { text-decoration: none; opacity: 0.75; }
.site-nav a:hover, .site-nav a.current { opacity: 1; }
.site-tools { display: flex; align-items: center; gap: 0.75rem; }
.site-tools .kp-search-results, .site-tools .kp-cart-panel { color: var(--color-ink); }

.section, .product { max-width: var(--width); margin: 0 auto; padding: 2.25rem 1.5rem; }
.section-head { margin-bottom: 1rem; }
.section-head h2 { margin: 0; }
.lead { font-size: 1.1rem; max-width: 36rem; margin: 0 0 1.5rem; opacity: 0.8; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.78rem; font-weight: 700; color: var(--color-accent); margin: 0 0 0.75rem; }
.empty { color: var(--color-muted); grid-column: 1 / -1; }
.crumbs { font-size: 0.9rem; margin: 0 0 1rem; }
.crumbs a { color: var(--color-muted); text-decoration: none; }
.button { display: inline-block; background: var(--color-accent); color: #fff; font-weight: 600; text-decoration: none; padding: 0.7rem 1.3rem; border-radius: var(--radius); }
.button:hover { filter: brightness(1.08); }

.hero { background: var(--color-ink); color: #fff; }
.hero-inner { max-width: var(--width); margin: 0 auto; padding: 3rem 1.5rem 3.5rem; }

.makes { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.75rem; }
.make { display: grid; gap: 0.1rem; padding: 0.9rem 1rem; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius); text-decoration: none; }
.make:hover { border-color: var(--color-accent); }
.make-name { font-weight: 700; }
.make-count { font-size: 0.82rem; color: var(--color-muted); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.75rem; }
.tile { display: grid; grid-template-columns: 4rem 1fr; gap: 0 1rem; align-items: center; padding: 0.75rem; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius); text-decoration: none; }
.tile:hover { border-color: var(--color-accent); }
.tile img { grid-row: span 2; width: 4rem; height: 4rem; border-radius: 6px; }
.tile-name { font-weight: 700; align-self: end; }
.tile-text { font-size: 0.85rem; color: var(--color-muted); align-self: start; }

/* The parts list */
.shop-layout { display: grid; gap: 2rem; }
.filters h2 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--color-muted); margin: 0 0 0.5rem; }
.filters ul { list-style: none; margin: 0 0 1.5rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.filters a { display: flex; align-items: baseline; gap: 0.5rem; justify-content: space-between; padding: 0.3rem 0.7rem; border: 1px solid var(--color-line); border-radius: 6px; background: var(--color-surface); text-decoration: none; font-size: 0.92rem; }
.filters a small { color: var(--color-muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.filters a.on { background: var(--color-ink); border-color: var(--color-ink); color: #fff; }
.filters a.on small { color: inherit; opacity: 0.7; }
.filters .clear a { color: var(--color-accent); font-size: 0.9rem; }
.results-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 2rem; margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--color-line); }
.results-head .count { margin: 0; font-weight: 600; }
.sorts { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin: 0; font-size: 0.9rem; }
.sorts span { color: var(--color-muted); }
.sorts a { text-decoration: none; color: var(--color-muted); }
.sorts a.on, .sorts a:hover { color: var(--color-ink); text-decoration: underline; text-underline-offset: 0.3em; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 1rem; }
.pager { display: flex; justify-content: center; gap: 0.4rem; margin: 2rem 0 0; }
.pager a { min-width: 2.2rem; padding: 0.3rem 0.6rem; text-align: center; text-decoration: none; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: 6px; }
.pager a.on { background: var(--color-ink); border-color: var(--color-ink); color: #fff; }
@media (min-width: 52rem) {
  .shop-layout { grid-template-columns: 14rem 1fr; gap: 2.5rem; align-items: start; }
  .filters { position: sticky; top: 1rem; }
  .filters ul { flex-direction: column; gap: 0.1rem; }
  .filters a { border: 0; background: none; padding: 0.28rem 0.6rem; margin-left: -0.6rem; }
  .filters a:hover { background: var(--color-line); }
  .filters a.on:hover { background: var(--color-ink); }
}

.part { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.75rem; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius); }
.part-image { display: block; aspect-ratio: 4 / 3; border-radius: 5px; overflow: hidden; margin-bottom: 0.5rem; }
.part-image img { width: 100%; height: 100%; object-fit: cover; }
.part.is-sold .part-image img { opacity: 0.5; }
.part-meta { display: flex; justify-content: space-between; gap: 0.5rem; margin: 0; font-size: 0.78rem; color: var(--color-muted); }
.part-number { font-family: var(--font-mono); }
.part-name { font-weight: 700; line-height: 1.3; text-decoration: none; }
.part-name:hover { color: var(--color-accent); }
.part-fits { margin: 0; font-size: 0.82rem; color: var(--color-muted); flex: 1; }
.part-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin-top: 0.5rem; }
.part-price { font-size: 1.1rem; font-weight: 700; }
.stock { font-size: 0.8rem; color: var(--color-ok); margin: 0; }
.stock::before { content: "● "; }
.stock.out { color: var(--color-muted); }
.part-buy { margin-top: 0.5rem; }
.part-buy .kp-add, .part-buy button { width: 100%; }

.product { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: start; }
.product-image { width: 100%; border-radius: var(--radius); border: 1px solid var(--color-line); }
.product-price { font-size: 1.6rem; font-weight: 700; margin: 0 0 0.25rem; }
.product-buy { margin: 1rem 0 1.5rem; }
.prose p { margin: 0 0 1em; }
.product-props { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.25rem; margin: 1.5rem 0 0; padding-top: 1.25rem; border-top: 1px solid var(--color-line); }
.product-props dt { color: var(--color-muted); }
.product-props dd { margin: 0; }

.cart-section { max-width: 42rem; }
.cart-section .kp-cart { margin: 0 0 1.5rem; }

.site-footer { margin-top: 3rem; background: var(--color-ink); color: #fff; }
.footer-inner { max-width: var(--width); margin: 0 auto; padding: 2rem 1.5rem; }
.footer-inner p { margin: 0 0 0.3rem; opacity: 0.75; max-width: 34rem; }
.footer-inner .footer-name { font-weight: 800; font-size: 1.15rem; opacity: 1; }
.footer-inner .footer-small { font-size: 0.85rem; margin-top: 1rem; opacity: 0.55; }

@media (max-width: 760px) {
  .product { grid-template-columns: 1fr; gap: 1.5rem; }
  .site-nav { order: 3; flex-basis: 100%; }
}

/* The search box is put in by theme.js. */
.list-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 2rem; margin-bottom: 1.25rem; }
.list-top h1 { margin: 0; }
.list-search, .search-form, .site-search { display: flex; gap: 0.4rem; }
.list-search input, .search-form input, .site-search input { font: inherit; padding: 0.55rem 0.8rem; border: 1px solid var(--color-line); border-radius: var(--radius); background: var(--color-surface); color: var(--color-ink); min-width: 0; }
.list-search input { width: min(20rem, 60vw); }
.list-search input:focus, .search-form input:focus, .site-search input:focus { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.list-search button, .search-form button, .site-search button { font: inherit; font-weight: 600; padding: 0.55rem 1rem; border: 0; border-radius: var(--radius); background: var(--color-ink); color: #fff; cursor: pointer; }
.site-search input { width: 15rem; padding: 0.45rem 0.7rem; border-color: transparent; }
.site-search button { background: rgba(255, 255, 255, 0.14); padding: 0.45rem 0.8rem; }
.searched { font-weight: 400; color: var(--color-muted); }
[data-live].is-loading [data-swap] { opacity: 0.55; transition: opacity 0.15s 0.1s; }

/* The search page: what was found, grouped by category, one row per part. */
.search-page { max-width: 60rem; }
.search-form { margin: 0 0 1.5rem; }
.search-form input { flex: 1; font-size: 1.15rem; padding: 0.8rem 1rem; }
.search-form button { background: var(--color-accent); padding: 0.8rem 1.5rem; }
.search-summary { margin: 0 0 1rem; color: var(--color-muted); }
.search-summary strong { color: var(--color-ink); }
.search-summary a, .group-head a { color: var(--color-accent); text-decoration: none; }
.suggest { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.suggest a { padding: 0.35rem 0.9rem; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: 999px; text-decoration: none; }
.suggest a:hover { border-color: var(--color-accent); }
.group-head { display: flex; align-items: baseline; gap: 0.6rem; margin: 1.75rem 0 0.5rem; font-size: 1.05rem; }
.group-head a { color: inherit; }
.group-head small { font-weight: 400; color: var(--color-muted); font-size: 0.85rem; }
.rows { list-style: none; margin: 0; padding: 0; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius); }
.row { display: grid; grid-template-columns: 3.5rem 1fr auto 9.5rem; gap: 1rem; align-items: center; padding: 0.6rem 0.9rem; }
.row + .row { border-top: 1px solid var(--color-line); }
.row-image img { width: 3.5rem; height: 3.5rem; object-fit: cover; border-radius: 5px; }
.row .part-meta { justify-content: flex-start; gap: 0.9rem; }
.row.is-sold .row-image img { opacity: 0.5; }
.row-buy { text-align: right; }
@media (max-width: 40rem) {
  .row { grid-template-columns: 3.5rem 1fr; }
  .row .part-price, .row-buy { grid-column: 2; text-align: left; }
  .site-search input { width: 9rem; }
}
