/* Catálogo con filtros. Usa los tokens de styles.css. Pantalla de tarea: familiar, densa y sin adornos. */

[hidden] { display: none !important; }
body.no-scroll { overflow: hidden; }

.cat { padding-bottom: 40px; }
.cat-top { padding-top: 14px; }
.cat-crumbs { display: flex; align-items: center; gap: 4px; font-size: .8125rem; color: var(--ink-2); }
.cat-crumbs a:hover { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.cat-crumbs .ic { width: 14px; height: 14px; color: var(--ink-3); }
.cat-crumbs [aria-current] { color: var(--ink); font-weight: 600; }
.cat-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; }
.cat-head h1 { font-family: var(--font-d); font-weight: var(--d-weight); letter-spacing: var(--d-track); font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.125rem); line-height: 1.1; }
.cat-count { color: var(--ink-2); font-size: .9375rem; }

.cat-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.btn-filtrar { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 12px; border: 1.5px solid var(--line-2); border-radius: 999px; background: var(--surface); font-weight: 700; font-size: .9375rem; }
.btn-filtrar .ic { width: 18px; height: 18px; }
.f-badge { min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center; border-radius: 999px; background: var(--hdr); color: #fff; font-size: .75rem; font-weight: 800; }
.cat-active { display: flex; flex-wrap: wrap; gap: 6px; order: 3; flex-basis: 100%; }
.cat-active:empty { display: none; }
.a-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px 0 12px; border: 0; border-radius: 999px; background: #E3E8F5; color: var(--chip-bu-fg); font-weight: 700; font-size: .8125rem; }
.a-chip .ic { width: 14px; height: 14px; stroke-width: 2.4; }
.a-chip:hover { background: var(--line); }
.a-clear { height: 32px; padding: 0 6px; border: 0; background: none; color: var(--link); font-weight: 700; font-size: .8125rem; }
.a-clear:hover { text-decoration: underline; text-underline-offset: 3px; }
.cat-sort { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: .875rem; color: var(--ink-2); }
.cat-sort select { height: 40px; padding: 0 34px 0 12px; border: 1.5px solid var(--line-2); border-radius: 999px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%230E1630' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; font: 600 .875rem var(--font-b); color: var(--ink); appearance: none; cursor: pointer; }
.cat-sort select:focus-visible { outline: 3px solid var(--acc); outline-offset: 2px; }

.cat-layout { display: block; margin-top: 16px; }
.cat-grid { margin-top: 0; }
.cat-empty { padding: 36px 20px; text-align: center; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-1); }
.cat-empty h2 { font-family: var(--font-d); font-weight: var(--d-weight); letter-spacing: var(--d-track); font-size: 1.25rem; }
.cat-empty p { margin: 8px auto 0; max-width: 44ch; color: var(--ink-2); }
.cat-empty-ctas { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }

/* ---------- Panel de filtros (celular: hoja desde abajo) ---------- */
.filters { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; max-height: 86vh; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r) var(--r) 0 0; box-shadow: 0 -12px 40px -12px rgba(0, 0, 0, .35); transform: translateY(105%); transition: transform .3s var(--ease); }
.filters.open { transform: none; }
.f-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(14, 22, 48, .45); }
.f-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.f-head h2 { font-family: var(--font-d); font-weight: var(--d-weight); letter-spacing: var(--d-track); font-size: 1.125rem; }
.f-close { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--well); }
.f-body { overflow-y: auto; padding: 4px 16px 12px; }
.f-foot { display: grid; grid-template-columns: auto 1fr; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.f-clear.btn { background: var(--surface); border-color: var(--line-2); color: var(--ink); }

.f-group { margin: 0; padding: 14px 0; border: 0; border-bottom: 1px solid var(--line); min-width: 0; }
.f-group:last-child { border-bottom: 0; }
.f-group legend { float: left; width: 100%; margin-bottom: 8px; padding: 0; font-weight: 800; font-size: .9375rem; }
.f-group legend + * { clear: both; }
.f-opt { position: relative; display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 10px; padding: 7px 0; cursor: pointer; font-size: .9375rem; }
.f-opt input { position: absolute; opacity: 0; pointer-events: none; }
.f-box { width: 20px; height: 20px; border: 2px solid var(--line-2); border-radius: 5px; display: grid; place-items: center; transition: background .15s var(--ease), border-color .15s var(--ease); }
.f-opt input:checked + .f-box { background: var(--hdr); border-color: var(--hdr); }
.f-opt input:checked + .f-box::after { content: ""; width: 10px; height: 6px; border: 2.5px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.f-opt input:focus-visible + .f-box { outline: 3px solid var(--acc); outline-offset: 2px; }
.f-opt:hover .f-label { color: var(--link); }
.f-n { font-size: .8125rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.f-opt.vacio { opacity: .45; }
.f-switch { padding-top: 10px; }
.f-price { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; clear: both; }
.f-price input { width: 100%; height: 40px; padding: 0 12px; border: 1.5px solid var(--line-2); border-radius: 10px; font: 500 .9375rem var(--font-b); color: var(--ink); background: var(--surface); }
.f-price input:focus-visible { outline: none; border-color: var(--hdr); }
.f-price span { color: var(--ink-3); }

/* ---------- Escritorio: barra lateral fija ---------- */
@media (min-width: 960px) {
  .cat-top { padding-top: 18px; }
  .btn-filtrar { display: none; }
  .cat-active { order: 0; flex-basis: auto; flex: 1; }
  .cat-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; }
  .filters { position: sticky; top: calc(var(--hdr-h, 88px) + 16px); left: auto; right: auto; bottom: auto; z-index: 1; max-height: calc(100vh - var(--hdr-h, 88px) - 32px); transform: none; border-radius: var(--r); box-shadow: var(--shadow-1); transition: none; }
  .f-head { padding: 14px 16px 8px; }
  .f-close, .f-foot { display: none; }
  .f-scrim { display: none !important; }
  .cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
  .cat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .filters { transition: none; }
}

/* En la grilla del catálogo las tarjetas son angostas: la línea de cuotas va corta */
@media (max-width: 1599px) {
  .cat .card .long { display: none; }
}
@media (max-width: 959px) {
  .cat-bar { flex-wrap: nowrap; }
  .cat-active { flex-wrap: wrap; }
  .cat-bar { flex-wrap: wrap; }
  .cat-sort-l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .cat-sort select { max-width: 190px; }
}
