/* ==========================================================================
   Storefront catalog - machined editorial identity
   Coded header, blueprint toolbar, category rail with counts, editorial
   product cards (situ crossfade on hover), machined pagination.
   Entrance animations run once on load; no scroll engines.
   ========================================================================== */

.catalog {
  padding-block: 26px clamp(56px, 8vw, 96px);
  color: var(--ds-text);
  font-family: var(--font-body);
  background: var(--ds-bg);
  min-height: calc(100svh - var(--luann-h, 0px) - var(--mnav-row1, 64px));
}

.catalog-inner {
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: var(--container-pad, 24px);
}

/* ---------- header ---------- */

.catalog-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  animation: catUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
}

.catalog-titles { display: grid; gap: 9px; }

.catalog-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ds-primary);
}

.catalog-eyebrow::before {
  content: "";
  width: 24px;
  height: 2px;
  background: var(--ds-primary);
  border-radius: 2px;
}

.catalog-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(30px, 4.4vw, 46px);
  font-weight: 700;
  line-height: 1.02;
}

.catalog-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ds-text-muted);
  border: 1px solid var(--ds-border);
  border-radius: 999px;
  padding: 7px 14px;
  background: var(--ds-surface);
  white-space: nowrap;
}

/* ---------- toolbar: expanding search + sort + guide panel ---------- */

.catalog-toolbar {
  display: grid;
  gap: 0;
  margin-bottom: 16px;
  animation: catUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.catalog-searchform {
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--ds-border);
  background: var(--ds-surface);
  box-shadow: var(--shadow-1);
  transition: border-color 220ms ease, box-shadow 220ms ease;
}

/* the search box grows and owns the whole bar while the user is in it */
.catalog-searchform.is-searching {
  border-color: color-mix(in srgb, var(--ds-primary) 55%, var(--ds-border));
  box-shadow: 0 0 0 3px var(--ds-primary-soft), var(--shadow-2);
}

.catalog-search {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  transition: flex-basis 0.42s cubic-bezier(0.16, 1, 0.3, 1);
}

.catalog-search > svg {
  position: absolute;
  inset-inline-start: 14px;
  color: var(--ds-text-muted);
  pointer-events: none;
  transition: color 200ms ease;
}

.catalog-searchform.is-searching .catalog-search > svg { color: var(--ds-primary); }

.catalog-search-input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border-radius: 12px;
  border: 1px solid var(--ds-border);
  background: var(--ds-bg);
  color: var(--ds-text);
  font-size: 13px;
  font-family: var(--font-body);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

[dir="rtl"] .catalog-search-input { padding: 12px 40px 12px 14px; }

.catalog-search-input::placeholder { color: var(--ds-text-muted); }

.catalog-search-input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--ds-primary) 55%, var(--ds-border));
  box-shadow: 0 0 0 3px var(--ds-primary-soft);
}

.catalog-go {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-inline-start: 8px;
  padding: 0 16px;
  border-radius: 10px;
  border: none;
  background: var(--ds-primary);
  color: var(--ds-primary-text);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  overflow: hidden;
  transition: background-color 150ms ease, opacity 0.3s ease,
    flex-basis 0.42s cubic-bezier(0.16, 1, 0.3, 1),
    padding 0.42s cubic-bezier(0.16, 1, 0.3, 1),
    margin 0.42s cubic-bezier(0.16, 1, 0.3, 1);
}

.catalog-go:hover { background: var(--ds-primary-hover); }

/* while searching, the submit button folds away and the sort stays visible */
.catalog-searchform.is-searching .catalog-go {
  flex-basis: 0;
  opacity: 0;
  padding-inline: 0;
  margin-inline-start: -8px;
  pointer-events: none;
}

.catalog-sort {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding-inline: 4px 2px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ds-text-muted);
}

.catalog-sort-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 11px 34px 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--ds-border);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23617767' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center,
    var(--ds-bg);
  color: var(--ds-text);
  font-size: 12.5px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: border-color 150ms ease;
}

[dir="rtl"] .catalog-sort-select {
  padding: 11px 14px 11px 34px;
  background-position: left 12px center;
}

.catalog-sort-select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--ds-primary) 55%, var(--ds-border));
}

/* ---------- guidance panel: colored, clearly instructional ---------- */

.catalog-guide { display: none; }

.catalog-guide.is-open {
  display: block;
  margin: 8px 12px 12px;
  animation: catUp 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* scope row: search in this category or the whole catalog */
.catalog-scope {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 2px 0 12px;
  margin-bottom: 12px;
  border-bottom: 1px dashed color-mix(in srgb, var(--ds-primary) 30%, var(--ds-border));
}

.catalog-scope-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ds-text-muted);
  margin-inline-end: 6px;
}

.catalog-scope-btn {
  appearance: none;
  -webkit-appearance: none;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--ds-border);
  background: var(--ds-bg);
  color: var(--ds-text-muted);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.catalog-scope-btn:hover {
  border-color: color-mix(in srgb, var(--ds-primary) 45%, var(--ds-border));
  color: var(--ds-text);
}

.catalog-scope-btn.is-active {
  border-color: var(--ds-primary);
  background: var(--ds-primary);
  color: var(--ds-primary-text);
}

.catalog-scope-btn + .livesearch-share { margin-inline-start: auto; }

/* copy-link button (appears with results) */
.livesearch-share {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--ds-primary) 35%, var(--ds-border));
  background: var(--ds-bg);
  color: var(--ds-primary);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.livesearch-share:hover {
  border-color: var(--ds-primary);
  background: var(--ds-primary-tint);
}

.livesearch-share.is-copied {
  border-color: var(--lu-success);
  background: color-mix(in srgb, var(--lu-success) 12%, var(--ds-bg));
  color: var(--lu-success);
}

.catalog-guide .livesearch-status {
  border: 0;
  padding: 2px 0 0;
  margin-bottom: 0;
  border-inline-start: 3px solid var(--lu-info);
  background: color-mix(in srgb, var(--lu-info) 8%, var(--ds-surface));
  color: var(--ds-text);
}

.catalog-guide .livesearch-status.is-ok {
  border-inline-start-color: var(--lu-success);
  background: transparent;
  color: var(--ds-text);
}

.catalog-guide.is-busy .livesearch-status {
  border-inline-start-color: var(--lu-warning);
  background: transparent;
  animation: livesearchPulse 1.1s ease-in-out infinite;
}

@keyframes livesearchPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.72; }
}

.livesearch-hint {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--lu-info) 32%, transparent);
  background: color-mix(in srgb, var(--lu-info) 10%, transparent);
  color: var(--ds-text-muted);
  font-size: 10.5px;
}

/* ---------- category rail ---------- */

.catalog-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  animation: catUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

.catalog-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--ds-border);
  background: var(--ds-surface);
  color: var(--ds-text-muted);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.catalog-pill-n {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ds-text-muted);
  border-left: 1px solid var(--ds-border);
  padding-inline-start: 8px;
}

.catalog-pill:hover {
  color: var(--ds-text);
  border-color: color-mix(in srgb, var(--ds-primary) 40%, var(--ds-border));
}

.catalog-pill.is-active {
  color: var(--ds-primary);
  border-color: color-mix(in srgb, var(--ds-primary) 55%, transparent);
  background: var(--ds-primary-soft);
}

.catalog-pill.is-active .catalog-pill-n {
  color: var(--ds-primary);
  border-left-color: color-mix(in srgb, var(--ds-primary) 30%, transparent);
}


/* ---------- empty state ---------- */

.catalog-empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 64px 20px;
  border-radius: var(--radius-lg);
  border: 1px dashed color-mix(in srgb, var(--ds-primary) 34%, var(--ds-border));
  background: var(--ds-primary-tint);
  text-align: center;
  animation: catUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.18s both;
}

.catalog-empty-code {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ds-primary);
}

.catalog-empty p {
  margin: 0;
  font-size: 13.5px;
  color: var(--ds-text-muted);
}

.catalog-empty-btn {
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--ds-primary);
  color: var(--ds-primary-text);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color 150ms ease;
}

.catalog-empty-btn:hover {
  background: var(--ds-primary-hover);
  color: var(--ds-primary-text);
}

/* ---------- pagination ---------- */

.catpag {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 34px;
  animation: catUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.catpag-num,
.catpag-arrow,
.catpag-dots {
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  border: 1px solid var(--ds-border);
  background: var(--ds-surface);
  color: var(--ds-text-muted);
  padding-inline: 8px;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.catpag-num:hover,
.catpag-arrow:hover {
  color: var(--ds-primary);
  border-color: color-mix(in srgb, var(--ds-primary) 45%, var(--ds-border));
}

.catpag-num.is-active {
  color: var(--ds-primary-text);
  background: var(--ds-primary);
  border-color: var(--ds-primary);
}

.catpag-dots {
  border: none;
  background: none;
}

/* ---------- responsive ---------- */

@media (max-width: 1000px) {
  .catalog-grid { grid-template-columns: repeat(2, 1fr); }
}

.catalog-grid .catalog-empty { grid-column: 1 / -1; }

@media (max-width: 620px) {
  .catalog { padding-block: 18px 56px; }
  .catalog-grid { grid-template-columns: 1fr; gap: 14px; }
  .catalog-searchform { padding: 11px; }
  .catalog-guide.is-open { margin: 0 11px 11px; }
  .catalog-sort { display: none; }
  .catalog-go { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .catalog-head,
  .catalog-toolbar,
  .catalog-rail,
  .catalog-empty,
  .catpag { animation: none; }
}

/* ---------- entrance ---------- */

@keyframes catUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
