/* ==========================================================================
   inventory.css — the yard's own parts catalog (inventory.html, part.html).

   One idea carries both pages: every result is drawn as a stock ticket, the
   paper tag that physically hangs on each part in the yard. Punched hole,
   the part name in the display face, the stock number as the tag's identity,
   a grade stamp, the photo. Everything else stays quiet so the tags read.
   Extends global.css tokens; no new colours beyond what the site already has.
   ========================================================================== */

/* ---- Search hero -------------------------------------------------------- */
.inv-hero {
  padding: clamp(1.6rem, 4vw, 3rem) 0 clamp(1.2rem, 3vw, 2rem);
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.inv-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.3rem + 3vw, 3.4rem);
  line-height: 1;
  letter-spacing: .01em;
  margin: .25rem 0 .5rem;
}
.inv-hero__sub {
  max-width: 62ch;
  color: var(--ink-2);
  margin: 0 0 1.3rem;
}
.inv-hero__sub [data-inv-updated]:not(:empty)::before { content: " "; }
.inv-hero__sub [data-inv-updated] { color: var(--ink-3); }

.inv-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .6rem;
  max-width: 860px;
}
.inv-search input[type="search"] {
  width: 100%;
  font: 500 var(--step-1) / 1.2 var(--font-body);
  color: var(--paper-ink);
  background: var(--paper-2);
  border: 1px solid transparent;
  border-radius: 14px;
  padding: .95rem 1.1rem;
  min-height: 3.4rem;
  appearance: none;
  -webkit-appearance: none;
}
.inv-search input[type="search"]::placeholder { color: var(--paper-ink-2); }
.inv-search input[type="search"]:focus-visible {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.inv-search .btn { min-height: 3.4rem; padding-inline: 1.4rem; }

/* Filter rail: one horizontal row of controls, scrolls on small screens. */
.inv-rail {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin-top: .9rem;
  align-items: center;
}
.inv-rail select,
.inv-rail .inv-toggle {
  font: 500 var(--step--1) / 1.2 var(--font-body);
  color: var(--ink);
  background: var(--bg-4);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: .55rem 2.1rem .55rem .95rem;
  min-height: 2.5rem;
  max-width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.inv-rail select.is-set { border-color: var(--accent-300); color: var(--ink); background-color: var(--accent-soft); }
.inv-rail select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.inv-rail .inv-toggle {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding-right: .95rem;
  background-image: none;
  user-select: none;
}
.inv-rail .inv-toggle input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.inv-rail .inv-toggle:has(input:checked) { border-color: var(--accent-300); background-color: var(--accent-soft); }
.inv-clear {
  font: 500 var(--step--1) / 1 var(--font-body);
  color: var(--ink-2);
  background: none;
  border: 0;
  padding: .55rem .4rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.inv-clear:hover { color: var(--accent-300); }

/* ---- Results ------------------------------------------------------------ */
.inv-results { padding-top: clamp(1.2rem, 3vw, 2rem); }
.inv-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}
.inv-count { margin: 0; color: var(--ink-2); font-size: var(--step-0); }
.inv-count b { color: var(--ink); font-weight: 600; }
.inv-bar label { display: inline-flex; align-items: center; gap: .5rem; color: var(--ink-2); font-size: var(--step--1); }
.inv-bar select {
  font: 500 var(--step--1) / 1.2 var(--font-body);
  color: var(--ink);
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: .45rem .7rem;
}

.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.1rem;
}
@media (min-width: 1100px) { .inv-grid { grid-template-columns: repeat(4, 1fr); } }

/* The stock ticket ------------------------------------------------------- */
.tag {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--paper-2);
  color: var(--paper-ink);
  border-radius: 8px 8px 14px 14px;
  overflow: hidden;
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .35);
  transition: transform .18s ease, box-shadow .18s ease;
  isolation: isolate;
}
.tag:hover, .tag:focus-visible { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(0, 0, 0, .45); }
.tag:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
/* The punched hole: shows the dark page through the paper. */
.tag__hole {
  position: absolute;
  z-index: 2;
  top: 10px;
  left: 12px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .55), 0 0 0 2px rgba(0, 0, 0, .06);
}
.tag__media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--paper);
  overflow: hidden;
}
.tag__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tag__nophoto {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--paper-ink-2);
  font: 500 var(--step--1) / 1.3 var(--font-body);
  background:
    linear-gradient(135deg, transparent 49.5%, var(--paper-line) 49.5%, var(--paper-line) 50.5%, transparent 50.5%),
    var(--paper);
}
.tag__count {
  position: absolute; right: 8px; bottom: 8px;
  font: 600 .72rem / 1 var(--font-body);
  color: #fff;
  background: rgba(18, 24, 28, .72);
  padding: .3rem .5rem;
  border-radius: 999px;
}
.tag__body { display: grid; gap: .2rem; padding: .85rem .95rem 1rem; }
.tag__part {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.12rem;
  line-height: 1.1;
  letter-spacing: .005em;
}
.tag__vehicle { font-weight: 500; color: var(--paper-ink); }
.tag__meta {
  color: var(--paper-ink-2);
  font-size: var(--step--1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tag__foot {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin-top: .45rem;
  padding-top: .6rem;
  border-top: 1px dashed var(--paper-line);
}
.tag__price {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--accent-600);
  margin-right: auto;
}
.tag__price.is-call { font-size: .9rem; font-family: var(--font-body); font-weight: 600; color: var(--paper-ink-2); }
.tag__grade {
  width: 1.65rem; height: 1.65rem;
  display: grid; place-items: center;
  font: 700 .9rem / 1 var(--font-display);
  color: var(--paper-ink);
  border: 2px solid var(--paper-ink);
  border-radius: 4px;
}
.tag__stock {
  font: 600 .78rem / 1 var(--font-body);
  letter-spacing: .04em;
  color: var(--paper-ink-2);
}

/* Loading skeletons (same footprint as a tag) */
.tag--skeleton { pointer-events: none; }
.tag--skeleton .tag__media, .tag--skeleton .sk { background: linear-gradient(90deg, var(--paper) 25%, #e9eaec 37%, var(--paper) 63%); background-size: 400% 100%; animation: inv-shimmer 1.4s ease infinite; }
.tag--skeleton .sk { height: .9rem; border-radius: 4px; }
.tag--skeleton .sk.w60 { width: 60%; } .tag--skeleton .sk.w40 { width: 40%; } .tag--skeleton .sk.w80 { width: 80%; }
@keyframes inv-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  .tag, .tag--skeleton .tag__media, .tag--skeleton .sk { transition: none; animation: none; }
  .tag:hover { transform: none; }
}

/* Empty / error: direction, not mood */
.inv-empty, .inv-error {
  max-width: 560px;
  margin: 2rem auto;
  padding: 1.6rem 1.4rem;
  text-align: center;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.inv-empty h3, .inv-error h3 { margin: 0 0 .4rem; font-family: var(--font-display); font-size: 1.35rem; }
.inv-empty p, .inv-error p { color: var(--ink-2); margin: 0 0 1rem; }
.inv-empty .btns, .inv-error .btns { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }

.inv-pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 1.8rem 0 .6rem;
}
.inv-pager button {
  font: 600 var(--step--1) / 1 var(--font-body);
  color: var(--ink);
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: .7rem 1rem;
  cursor: pointer;
}
.inv-pager button:disabled { opacity: .4; cursor: default; }
.inv-pager span { color: var(--ink-2); font-size: var(--step--1); }

.inv-fit {
  margin: 2rem auto 0;
  max-width: 62ch;
  text-align: center;
  color: var(--ink-2);
  font-size: var(--step--1);
}
.inv-fit a { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---- Part detail -------------------------------------------------------- */
.pd { padding-top: clamp(1rem, 3vw, 2rem); }
.pd-layout {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(300px, 4fr);
  gap: clamp(1.2rem, 3vw, 2.4rem);
  align-items: start;
  margin-top: 1rem;
}
@media (max-width: 900px) { .pd-layout { grid-template-columns: 1fr; } }

.pd-gallery { display: grid; gap: .7rem; }
.pd-stage {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--paper-2);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .35);
}
.pd-stage img { width: 100%; height: 100%; object-fit: contain; display: block; background: var(--paper-2); }
.pd-stage .tag__nophoto { font-size: var(--step-0); }
.pd-thumbs { display: flex; gap: .55rem; flex-wrap: wrap; }
.pd-thumbs button {
  width: 84px; height: 64px;
  padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden;
  background: var(--paper-2); cursor: pointer;
}
.pd-thumbs button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pd-thumbs button[aria-current="true"] { border-color: var(--accent); }
.pd-thumbs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The detail tag: same paper, same hole, now carrying the specs. */
.pd-tag {
  position: relative;
  background: var(--paper-2);
  color: var(--paper-ink);
  border-radius: 8px 8px 16px 16px;
  padding: 1.5rem 1.4rem 1.4rem;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .35);
}
.pd-tag .tag__hole { top: 12px; left: 14px; }
.pd-part {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem);
  line-height: 1.05;
  margin: .6rem 0 .25rem;
  color: var(--paper-ink);
}
.pd-vehicle { margin: 0 0 .9rem; font-weight: 500; color: var(--paper-ink-2); }
.pd-price {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.1rem;
  line-height: 1;
  color: var(--accent-600);
  margin: 0 0 1rem;
}
.pd-price.is-call { font-size: 1.05rem; font-family: var(--font-body); font-weight: 600; color: var(--paper-ink-2); }
.pd-specs {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .45rem 1rem;
  margin: 0 0 1.2rem;
  padding-top: .9rem;
  border-top: 1px dashed var(--paper-line);
  font-size: var(--step--1);
}
.pd-specs dt { color: var(--paper-ink-2); }
.pd-specs dd { margin: 0; color: var(--paper-ink); font-weight: 500; }
.pd-specs dd .tag__grade { display: inline-grid; vertical-align: middle; }
.pd-ctas { display: grid; gap: .55rem; }
.pd-ctas .btn { justify-content: center; }
.pd-stock { margin: .9rem 0 0; font-size: var(--step--1); color: var(--paper-ink-2); }
.pd-stock b { color: var(--paper-ink); letter-spacing: .04em; }

.pd-related { margin-top: clamp(2rem, 5vw, 3.5rem); }
.pd-related h2 { font-family: var(--font-display); font-size: var(--step-2); margin: 0 0 1rem; }
.pd-related[hidden] { display: none; }

.pd-missing {
  max-width: 560px; margin: 3rem auto; text-align: center;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 14px; padding: 1.8rem 1.4rem;
}
.pd-missing h1 { font-family: var(--font-display); font-size: var(--step-2); margin: 0 0 .4rem; }
.pd-missing p { color: var(--ink-2); margin: 0 0 1rem; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
