/* ============================================================================
   Frontier Exchange — Inventory page styles
   ----------------------------------------------------------------------------
   This stylesheet is loaded only on /inventory.html. It uses the design
   tokens defined in shared.css (--cream, --terra, --linen, --serif,
   --sans, etc.) and adds page-specific patterns: hero, toolbar, grid,
   cards, pagination, skeletons, and noscript fallback.

   Single-column on phones (≤480px), expanding to 5-column at 4K (≥3440px).
   ============================================================================ */

/* ─── 1. Hero ───────────────────────────────────────────────────────── */

.inv-hero {
  padding: clamp(48px, 8vw, 96px) 0 clamp(32px, 5vw, 56px);
  border-bottom: 1px solid var(--linen);
}
.inv-hero h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(40px, 6.5vw, 76px);
  line-height: 1.05;
  color: var(--black);
  letter-spacing: -.03em;
  margin-bottom: clamp(16px, 2.5vw, 24px);
}
.inv-hero h1 em {
  font-style: italic;
  color: var(--terra);
}
.inv-hero__lede {
  /* Span the full container width — matches the toolbar and table below */
  max-width: none;
  font-size: clamp(16px, 1.5vw, 19px);
  line-height: 1.7;
  color: var(--graphite);
  margin-bottom: clamp(20px, 3vw, 32px);
}
.inv-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px clamp(20px, 3vw, 36px);
  font-size: 15px;
  color: var(--stone);
}
.inv-hero__meta strong {
  color: var(--black);
  font-weight: 600;
}
.inv-hero__meta a {
  color: var(--black);
  text-decoration-color: var(--terra);
}


/* ─── 2. Toolbar ────────────────────────────────────────────────────── */

.inv-toolbar-section {
  padding: clamp(24px, 4vw, 40px) 0 clamp(8px, 2vw, 16px);
}
.inv-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 768px) {
  .inv-toolbar {
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
  }
}

.inv-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.inv-field__label {
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--stone);
  font-weight: 600;
}
.inv-field__input,
.inv-field__select {
  font: inherit;
  font-family: var(--sans);
  font-size: 16px;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--border-input);
  color: var(--black);
  min-height: 44px;            /* WCAG 2.5.5 touch target */
  border-radius: 0;            /* match site convention — flat / editorial */
}
.inv-field__select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--stone) 50%),
    linear-gradient(135deg, var(--stone) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
  cursor: pointer;
}
.inv-field__input:focus-visible,
.inv-field__select:focus-visible {
  border-color: var(--terra);
  outline: 2px solid var(--terra);
  outline-offset: 2px;
}


/* ─── 3. Results bar ────────────────────────────────────────────────── */

.inv-results-section {
  padding: clamp(20px, 3vw, 32px) 0 clamp(48px, 8vw, 96px);
}
.inv-results-bar {
  padding-block: 12px clamp(16px, 2vw, 24px);
  border-bottom: 1px solid var(--linen);
  margin-bottom: clamp(16px, 2vw, 24px);
}
.inv-count {
  font-size: 14px;
  color: var(--stone);
  margin: 0;
}
.inv-count strong {
  color: var(--black);
  font-weight: 600;
}


/* ─── 4. Inventory table ────────────────────────────────────────────── */

.inv-table-wrap {
  background: var(--white);
  border: 1px solid var(--linen);
  /* horizontal scroll on narrow screens IF table is forced wide; mobile
     CSS below collapses the table to stacked rows so this rarely fires */
  overflow-x: auto;
}

.inv-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--black);
}

.inv-table thead {
  background: var(--cream);
  border-bottom: 1px solid var(--linen);
}
.inv-table th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--stone);
  padding: 16px 20px;
  white-space: nowrap;
}
.inv-th-stock,
.inv-th-price { text-align: right; }

.inv-table tbody tr {
  border-bottom: 1px solid var(--linen);
  transition: background .15s var(--ease-out);
}
.inv-table tbody tr:last-child { border-bottom: 0; }
.inv-table tbody tr:hover     { background: var(--terra-faint); }

.inv-table td {
  padding: 18px 20px;
  vertical-align: middle;
  line-height: 1.4;
}

/* Item name — sans (Outfit), matching the nav menu */
.inv-cell-item {
  font-family: var(--sans);
  font-weight: 400;
  font-size: clamp(15px, 1.3vw, 17px);
  color: var(--black);
  letter-spacing: 0;
}

/* Category as a subtle uppercase tag */
.inv-cell-cat {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--terra-dark);
  font-weight: 600;
  white-space: nowrap;
}
.inv-cell-cat--empty { color: var(--pebble); font-weight: 400; }

/* Stock — right-aligned, tabular numerals */
.inv-cell-stock {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--graphite);
  white-space: nowrap;
}
.inv-cell-stock strong {
  color: var(--black);
  font-weight: 600;
}
.inv-cell-stock--multi strong { color: var(--terra-dark); }

/* Price — right-aligned, sans, tabular numerals */
.inv-cell-price {
  text-align: right;
  font-family: var(--sans);
  font-weight: 400;
  font-size: clamp(15px, 1.3vw, 17px);
  color: var(--black);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  white-space: nowrap;
}


/* ─── 5. Skeleton loading state ────────────────────────────────────── */

.inv-skel-row td { padding: 14px 20px; }
.inv-skeleton-bar {
  display: block;
  height: 22px;
  background: linear-gradient(90deg,
    var(--linen) 0%, var(--milk) 50%, var(--linen) 100%);
  background-size: 200% 100%;
  animation: invSkeleton 1.4s linear infinite;
}
@keyframes invSkeleton {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .inv-skeleton-bar { animation: none; }
}


/* ─── 6. Empty / error states ──────────────────────────────────────── */

.inv-state-row td {
  padding: clamp(48px, 8vw, 96px) 24px;
  text-align: center;
}
.inv-state__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(28px, 3.5vw, 40px);
  color: var(--black);
  margin: 0 0 14px;
}
.inv-state__body {
  max-width: 50ch;
  margin: 0 auto 24px;
  color: var(--stone);
  line-height: 1.7;
}


/* ─── 7. Mobile: collapse table rows into stacked blocks ───────────── */
/* Below 640px the 4-column layout becomes cramped. Use the data-label
   pseudo-content pattern to relabel each cell inline, so the table stays
   semantically a table for screen readers while visually stacking. */

@media (max-width: 640px) {
  .inv-table-wrap { border-left: 0; border-right: 0; }

  .inv-table thead {
    /* Keep headers in DOM but visually hidden — sr-only equivalent */
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
  }

  .inv-table, .inv-table tbody, .inv-table tr, .inv-table td {
    display: block;
    width: 100%;
  }

  .inv-table tbody tr {
    padding: 16px 20px;
    border-bottom: 1px solid var(--linen);
  }
  .inv-table tbody tr:hover { background: transparent; }

  .inv-table td {
    padding: 4px 0;
    text-align: left;
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 12px;
    align-items: baseline;
  }
  .inv-table td::before {
    content: attr(data-label);
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--stone);
    font-weight: 600;
  }

  /* The item cell is the headline — full width, no label, larger */
  .inv-table td.inv-cell-item {
    display: block;
    margin-bottom: 8px;
    font-size: 18px;
  }
  .inv-table td.inv-cell-item::before { display: none; }

  /* On mobile, price + stock right-align inside the second grid column */
  .inv-cell-stock,
  .inv-cell-price { text-align: left; }
}


/* ─── 8. Pagination ─────────────────────────────────────────────────── */

.inv-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-block: clamp(40px, 5vw, 64px) 0;
  border-top: 1px solid var(--linen);
  margin-top: clamp(24px, 3vw, 40px);
  padding-top: clamp(32px, 4vw, 48px);
}

/* Numbered buttons — square, restrained, editorial */
.inv-pagination__btn {
  background: var(--white);
  border: 1px solid var(--linen);
  color: var(--black);
  height: 48px;
  min-width: 48px;
  padding: 0 14px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .5px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color .2s, background .2s, color .2s;
}
.inv-pagination__btn:hover:not(:disabled):not([aria-current="page"]) {
  border-color: var(--black);
  color: var(--terra-dark);
}
.inv-pagination__btn[aria-current="page"] {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
  cursor: default;
}
.inv-pagination__btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

/* Prev / Next — visually distinct from the numbered set; uppercase like
   the site's other CTAs, subtle horizontal padding so the arrows breathe */
.inv-pagination__btn--prev,
.inv-pagination__btn--next {
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-size: 12px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.inv-pagination__btn--prev { margin-right: 4px; }
.inv-pagination__btn--next { margin-left:  4px; }
.inv-pagination__btn--prev .inv-arrow,
.inv-pagination__btn--next .inv-arrow {
  font-size: 16px;
  line-height: 1;
  transition: transform .2s;
}
.inv-pagination__btn--prev:hover:not(:disabled) .inv-arrow { transform: translateX(-2px); }
.inv-pagination__btn--next:hover:not(:disabled) .inv-arrow { transform: translateX(2px); }

.inv-pagination__ellipsis {
  color: var(--stone);
  padding: 0 4px;
  font-size: 14px;
  user-select: none;
}

/* Mobile — keep buttons at the same size; just allow wrapping */
@media (max-width: 480px) {
  .inv-pagination {
    gap: 4px;
  }
  .inv-pagination__btn--prev,
  .inv-pagination__btn--next {
    /* On phones the labels can be lengthy; allow Prev/Next to take full
       row above the numbers if needed, matching how the site's CTAs wrap */
    flex-basis: 100%;
    justify-content: center;
    margin: 0 0 8px;
  }
  .inv-pagination__btn--next { margin-top: 8px; margin-bottom: 0; }
}


/* ─── 9. Scroll anchor offset for sticky header ─────────────────────── */
/* The site header is position:sticky at 64px tall. When pagination
   scrolls back to the top of results, the target must clear the header
   or the column titles end up hidden behind it. */

.inv-results-bar,
.inv-table-wrap {
  scroll-margin-top: 80px;
}


/* ─── 7. CTA band override (already in shared.css — page may reuse) ──── */
/* The site convention's .cta-band is in shared.css. If those styles are
   not present (in this v2 the heading lives in expectations / about
   sections inline), provide a safe inline fallback so this page still
   looks right whether or not shared.css defines it explicitly. */

main .cta-band {
  background: var(--terra-dark);
  color: var(--white);
  padding: clamp(56px, 8vw, 96px) 0;
  text-align: center;
}
main .cta-band h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(32px, 4.5vw, 52px);
  line-height: 1.1;
  letter-spacing: -.02em;
  margin: 0 0 20px;
}
main .cta-band p {
  max-width: 60ch;
  margin: 0 auto 24px;
  color: rgba(255, 255, 255, .85);
  font-size: 17px;
  line-height: 1.7;
}
main .cta-band p a {
  color: var(--white);
  text-decoration-color: var(--white);
}
main .cta-band .btn-primary {
  background: var(--white);
  color: var(--black);
  border: 1px solid var(--white);
}
main .cta-band .btn-primary:hover {
  background: transparent;
  color: var(--white);
}


/* ─── 8. NoScript fallback ──────────────────────────────────────────── */

.inv-noscript {
  background: var(--terra-faint);
  border-bottom: 1px solid var(--linen);
  padding: clamp(40px, 6vw, 72px) 0;
}
.inv-noscript .section-heading {
  margin-top: 8px;
}


/* ─── 9. Tightened touch targets in toolbar (mobile) ─────────────────── */

@media (max-width: 480px) {
  .inv-hero__meta {
    flex-direction: column;
    gap: 6px;
  }
}


/* ─── 10. 4K-tier sizing ─────────────────────────────────────────────── */

@media (min-width: 3440px) {
  .inv-results-section { padding-block: 80px 160px; }
  .inv-table { font-size: 17px; }
  .inv-table td { padding: 22px 28px; }
}
