/* =========================================================================
   models.css — the model catalog page
   Big search bar, provider filter rail, live count, responsive card grid.
   Cards are double-bezel frosted tiles. All rendering done client-side from
   data/models-catalog.json (54KB, no keys).
   ========================================================================= */

.models-hero {
  padding-top: clamp(7rem, 16vw, 9rem);
  padding-bottom: clamp(1.5rem, 4vw, 2.5rem);
  text-align: center;
}
.models-hero h1 { font-size: var(--step-hero); margin-bottom: 0.5rem; }
.models-hero p { color: var(--ink-soft); max-width: 52ch; margin-inline: auto; font-size: 1.08rem; }

/* the control bar: search + count + sort */
.model-controls {
  position: sticky;
  top: 5.6rem;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 0.9rem;
  margin-bottom: 1.6rem;
  background: var(--panel);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-pill);
  box-shadow: 0 10px 28px rgba(157, 170, 242, 0.16);
}
.model-search {
  flex: 1 1 240px;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-pill);
  padding: 0.5em 1em;
}
.model-search:focus-within {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(255, 143, 171, 0.22);
}
.model-search svg { width: 16px; height: 16px; color: var(--ink-soft); flex-shrink: 0; }
.model-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.98rem;
  color: var(--ink);
  outline: none;
}
.model-search input::placeholder { color: var(--ink-soft); }

.model-count {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--ink-soft);
  white-space: nowrap;
}
.model-count strong { color: var(--ink); }

.model-sort {
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-pill);
  padding: 0.5em 0.8em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--ink);
  cursor: pointer;
}

/* layout: provider rail + grid */
.models-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2rem);
  align-items: start;
  padding-bottom: var(--space-section);
}

.filter-rail {
  position: sticky;
  top: 11rem;
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-card);
  padding: 1rem 0.8rem;
  box-shadow: 0 12px 30px rgba(157, 170, 242, 0.14);
  max-height: calc(100vh - 13rem);
  overflow-y: auto;
}
.filter-rail h2 {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rose-deep);
  margin: 0.4rem 0.6rem 0.7rem;
}
.filter-rail button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.5em;
  padding: 0.5em 0.7em;
  border: none;
  background: transparent;
  border-radius: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
  transition: background var(--dur-fast) var(--ease-gentle), color var(--dur-fast);
}
.filter-rail button:hover { background: rgba(255, 143, 171, 0.12); color: var(--ink); }
.filter-rail button[aria-pressed="true"] {
  background: rgba(255, 143, 171, 0.2);
  color: var(--rose-deep);
}
.filter-rail button .n {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.74rem;
  color: var(--ink-soft);
  opacity: 0.8;
}

/* the card grid */
.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: clamp(0.7rem, 2vw, 1rem);
}
.model-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.1rem 1.2rem;
  background: var(--panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-card);
  box-shadow: 0 10px 26px rgba(157, 170, 242, 0.14);
  transition: transform var(--dur) var(--ease-soft), box-shadow var(--dur) var(--ease-soft);
  animation: card-in var(--dur-slow) var(--ease-soft) both;
}
.model-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 38px rgba(255, 143, 171, 0.22);
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.model-card .name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  word-break: break-all;
  line-height: 1.35;
}
.model-card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
}
.model-card .tag {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.7rem;
  padding: 0.25em 0.6em;
  border-radius: var(--radius-pill);
  background: rgba(255, 143, 171, 0.14);
  color: var(--rose-deep);
}
.model-card .tag.targets {
  background: rgba(157, 170, 242, 0.18);
  color: #5a4a8a;
}
.model-card .tag.stream {
  background: rgba(126, 201, 126, 0.2);
  color: #3a7a3a;
}

/* empty state */
.model-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1rem;
  color: var(--ink-soft);
  font-family: var(--font-display);
}
.model-empty p { margin-inline: auto; }

/* loading skeleton */
.model-skeleton {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--ink-soft);
  font-family: var(--font-display);
}

@media (max-width: 880px) {
  .models-layout { grid-template-columns: 1fr; }
  .filter-rail {
    position: static;
    max-height: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding: 0.7rem;
  }
  .filter-rail h2 { width: 100%; margin: 0 0 0.2rem; }
  .filter-rail button { width: auto; }
}
