/*
 * cars.xjk.yt catalog surface.
 * Split from a single sheet to stay under the shared module ceiling; load
 * order is foundation -> launch -> showroom controls -> catalog -> catalog dialog -> responsive.
 */

/* ---------- Cars ---------- */

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.section-kicker {
  color: var(--text-dim);
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-head h2 {
  margin-top: 3px;
  font-size: 18px;
  font-weight: 500;
}

.section-note {
  max-width: 62ch;
  color: var(--text-muted);
  font-size: 13.5px;
}

/* Compact 3D tiles leave contracts, traits, and release pins to the modal. */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  align-items: stretch;
  gap: clamp(9px, 1vw, 14px);
}

.catalog-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  background: color-mix(in srgb, var(--bg-panel), black 12%);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
  scroll-margin-block: 24px;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.catalog-card::before {
  position: absolute;
  z-index: 4;
  top: 0;
  right: 28%;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  content: "";
  opacity: 0.7;
}

.catalog-card:hover,
.catalog-card:focus-within,
.catalog-card.is-search-target {
  border-color: color-mix(in srgb, var(--accent), white 12%);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.32),
    0 0 0 1px rgba(249, 115, 22, 0.12);
  transform: translateY(-2px);
}

.catalog-card-trigger {
  display: grid;
  grid-template-rows: auto auto;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.catalog-card-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

.catalog-card.is-search-target {
  animation: catalog-search-target 760ms ease-out 1;
}

@keyframes catalog-search-target {
  0% {
    transform: translateY(0) scale(0.985);
  }

  48% {
    transform: translateY(-3px) scale(1.008);
  }

  100% {
    transform: translateY(0) scale(1);
  }
}

.catalog-preview {
  position: relative;
  isolation: isolate;
  aspect-ratio: 16 / 10;
  min-width: 0;
  overflow: hidden;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background:
    radial-gradient(ellipse at 55% 58%, rgba(249, 115, 22, 0.12), transparent 46%),
    linear-gradient(145deg, #182025, #080b0e 72%);
}

.catalog-preview::after {
  position: absolute;
  z-index: 0;
  right: 8%;
  bottom: 13%;
  left: 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(249, 115, 22, 0.54), transparent);
  box-shadow: 0 0 14px rgba(249, 115, 22, 0.26);
  content: "";
}

.catalog-preview-canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
}

.catalog-preview-fallback,
.catalog-preview-status {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: min(82%, 220px);
  margin: 0;
  color: var(--text-dim);
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 8.5px;
  letter-spacing: 0.04em;
  line-height: 1.45;
  text-align: center;
  text-transform: uppercase;
  transform: translate(-50%, -50%);
}

.catalog-preview-fallback[hidden],
.catalog-preview-status[hidden] {
  display: none;
}

.catalog-card-compact-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 11px 11px;
}

.catalog-card-title {
  min-width: 0;
  overflow: hidden;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-card-subtitle,
.catalog-card-open {
  color: var(--text-dim);
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.catalog-card-subtitle {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-card-open {
  color: color-mix(in srgb, var(--accent), white 10%);
  white-space: nowrap;
}

.empty-state {
  padding: 22px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  color: var(--text-muted);
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 13px;
  text-align: center;
}
