/* ===== T7 catalog =====
   All colors via tokens.css variables. Zero hardcoded colors.
   Consumes: --c-*, --font-serif, --font-mono, --d-*, --radius*, --border-w */

/* ============================================================
   Controls row: search input + category select + sort toggle
   ============================================================ */

.cat-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.cat-search {
  flex: 1 1 200px;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  font-family: var(--font-serif);
  font-size: 14px;
  color: rgb(var(--c-fg));
  background: rgb(var(--c-surface));
  border: var(--border-w) solid rgb(var(--c-border));
  border-radius: var(--radius-sm);
  outline: none;
}

.cat-search:focus {
  border-color: rgb(var(--c-accent));
  box-shadow: 0 0 0 2px rgb(var(--c-accent) / 0.14);
}

.cat-search::placeholder {
  color: rgb(var(--c-faint));
}

.cat-select {
  height: 36px;
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgb(var(--c-fg));
  background: rgb(var(--c-surface));
  border: var(--border-w) solid rgb(var(--c-border));
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
}

.cat-select:focus {
  border-color: rgb(var(--c-accent));
}

.cat-sort-btn {
  height: 36px;
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgb(var(--c-muted));
  background: rgb(var(--c-surface));
  border: var(--border-w) solid rgb(var(--c-border));
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s ease, color 0.1s ease;
}

.cat-sort-btn:hover {
  background: rgb(var(--c-surface-2));
  color: rgb(var(--c-fg));
}

/* ============================================================
   Progress note (loading) + status line ("Showing N of M")
   ============================================================ */

.cat-progress {
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgb(var(--c-faint));
  margin: 8px 0 0;
  line-height: 1.4;
}

.cat-status {
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgb(var(--c-muted));
  margin: 4px 0 8px;
  line-height: 1.4;
}

/* ============================================================
   Table wrapper -- horizontal scroll on narrow viewports
   ============================================================ */

.cat-table-wrap {
  overflow-x: auto;
  border: var(--border-w) solid rgb(var(--c-border));
  border-radius: var(--radius);
  background: rgb(var(--c-surface));
}

.cat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

/* ============================================================
   Table header
   ============================================================ */

.cat-th {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgb(var(--c-faint));
  padding: 10px 14px;
  text-align: left;
  border-bottom: var(--border-w) solid rgb(var(--c-border));
  white-space: nowrap;
  background: rgb(var(--c-surface));
}

.cat-th-price {
  text-align: right;
}

.cat-th-link {
  text-align: right;
  width: 36px;
}

/* ============================================================
   Table rows
   ============================================================ */

.cat-row {
  border-bottom: var(--border-w) solid rgb(var(--c-surface-2));
}

.cat-row:last-child {
  border-bottom: none;
}

.cat-row:hover {
  background: rgb(var(--c-bg));
}

/* ============================================================
   Table cells
   ============================================================ */

.cat-col-name,
.cat-col-category,
.cat-col-price,
.cat-col-avail,
.cat-col-link {
  padding: var(--d-qrow-y) 14px;
  vertical-align: middle;
  line-height: 1.35;
}

/* Name: serif, ink weight */
.cat-col-name {
  font-family: var(--font-serif);
  font-size: 14px;
  color: rgb(var(--c-fg));
  min-width: 200px;
}

/* Category: mono chip */
.cat-col-category {
  white-space: nowrap;
}

.cat-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgb(var(--c-muted));
  background: rgb(var(--c-surface-2));
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
}

/* Price: mono, right-aligned, tabular nums */
.cat-col-price {
  font-family: var(--font-mono);
  font-size: 13px;
  color: rgb(var(--c-fg));
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Availability */
.cat-col-avail {
  white-space: nowrap;
}

/* Link icon */
.cat-col-link {
  text-align: right;
  width: 36px;
  padding-right: 14px;
}

/* ============================================================
   Availability badges -- semantic tokens ONLY (design rule 5)
   in_stock=ok  out_of_stock=danger-lite  preorder=warn  unknown=muted
   ============================================================ */

.cat-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  border-radius: 4px;
  padding: 2px 7px;
}

.cat-badge--ok {
  color: rgb(var(--c-ok));
  background: rgb(var(--c-ok) / 0.12);
}

.cat-badge--danger {
  /* "danger-lite": very faint background, muted text -- out of stock is normal state */
  color: rgb(var(--c-muted));
  background: rgb(var(--c-danger) / 0.07);
}

.cat-badge--warn {
  color: rgb(var(--c-warn));
  background: rgb(var(--c-warn) / 0.12);
}

.cat-badge--muted {
  color: rgb(var(--c-faint));
  background: rgb(var(--c-surface-2));
}

/* ============================================================
   External link icon
   ============================================================ */

.cat-ext-link {
  display: inline-flex;
  align-items: center;
  color: rgb(var(--c-faint));
  text-decoration: none;
  transition: color 0.1s ease;
}

.cat-ext-link:hover {
  color: rgb(var(--c-accent));
  text-decoration: none;
}

/* ============================================================
   Data actions section (Download XLSX + Google Sheets)
   ============================================================ */

.cat-data-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* ============================================================
   Button component: primary (accent fill) + secondary (outline)
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  border: var(--border-w) solid transparent;
  transition: background 0.1s ease, color 0.1s ease, opacity 0.1s ease;
  white-space: nowrap;
  line-height: 1;
}

/* Primary: near-ink accent fill + white text */
.btn--primary {
  background: rgb(var(--c-accent));
  color: rgb(var(--c-accent-fg));
  border-color: rgb(var(--c-accent));
}

.btn--primary:hover {
  background: rgb(var(--c-fg));
  border-color: rgb(var(--c-fg));
  color: rgb(var(--c-accent-fg));
  text-decoration: none;
}

/* Secondary: surface + border */
.btn--secondary {
  background: rgb(var(--c-surface));
  color: rgb(var(--c-muted));
  border-color: rgb(var(--c-border));
}

.btn--secondary:hover:not(:disabled) {
  background: rgb(var(--c-surface-2));
  color: rgb(var(--c-fg));
  text-decoration: none;
}

.btn--secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================
   Responsive: <900px -- hide Category column, tighten controls
   ============================================================ */

@media (max-width: 899px) {

  .cat-col-category,
  .cat-th-category {
    display: none;
  }

  .cat-controls {
    gap: 8px;
  }

  .cat-search {
    flex: 1 1 140px;
  }

  .cat-col-name {
    min-width: 0;
  }

}

/* Very narrow (390px): compact cells */
@media (max-width: 479px) {

  .cat-col-name,
  .cat-col-category,
  .cat-col-price,
  .cat-col-avail,
  .cat-col-link {
    padding: 10px 10px;
  }

  .cat-col-price {
    font-size: 12px;
  }

}

/* ===== end T7 catalog ===== */
