/* Categoria: cabecera compacta, toolbar unica, panel de filtros con chips (hoja inferior en movil)
   y rejilla mas densa. Se carga DESPUES de category.css (ver CategoryPage). Fuente unica: este fichero. */

/* ---------- Cabecera compacta ---------- */
body .catalog-wrapper { padding-top: 12px; }
/* Banner: proporciones reales del arte (3:1 a 4:1 en escritorio; movil 4:1, 2.36:1 o 1.79:1).
   El alto sale de width/height del <img> (height:auto), con tope para que no domine la pagina:
   - escritorio: cover con tope de 340 px (un 4:1 de 1280 px mide 320 px y se ve entero; un 3:1 pierde
     como mucho ~20% arriba/abajo, centrado en la franja donde van los puros);
   - movil: contain con el arte movil completo y tope de 240 px, sin recorte. */
html body[class] .catalog-wrapper .catalog-brand-banner { height: auto; overflow: hidden; }
html body[class] .catalog-wrapper .catalog-brand-banner picture { display: block; width: 100%; }
html body[class] .catalog-wrapper .catalog-brand-banner img {
  display: block; width: 100% !important; height: auto !important; max-width: 100%; max-height: 340px;
  aspect-ratio: auto !important; object-fit: cover !important; object-position: 50% 45% !important;
}
body .catalog-wrapper .catalog-header,
body .catalog-wrapper .catalog-header.has-brand-banner { padding: 14px 0 14px; margin-bottom: 14px; gap: 24px; }
body .catalog-wrapper .catalog-header h1,
body .catalog-wrapper .catalog-header-title { font-size: 34px; margin: 0 0 6px; line-height: 1.1; }
body .catalog-wrapper .catalog-header .catalog-description-wrapper,
body .catalog-wrapper .catalog-header-left > p { margin-top: 8px; }
body .catalog-wrapper .catalog-header.has-brand-banner .catalog-header-left { max-width: 980px; }

/* ---------- Toolbar unica ---------- */
.cco-tb {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px;
  padding: 10px 0; margin: 0 0 12px;
  border-top: 1px solid var(--hairline, #E4DBCD); border-bottom: 1px solid var(--hairline, #E4DBCD);
}
.cco-tb-filters {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px;
  border: 1px solid var(--ink, #16273E); border-radius: 999px; background: #fff; color: var(--ink, #16273E);
  font: 600 13px/1 var(--cco-font-b, 'Jost', sans-serif); letter-spacing: .04em; cursor: pointer;
  transition: background .2s, color .2s;
}
.cco-tb-filters svg { width: 16px; height: 16px; }
.cco-tb-filters:hover, .cco-tb-filters[aria-expanded="true"] { background: var(--ink, #16273E); color: #fff; }
.cco-tb-filters:focus-visible, .cco-chip:focus-visible, .cco-ach-chip:focus-visible, .cco-tb select:focus-visible,
.cco-fp button:focus-visible, .cco-range input:focus-visible + * { outline: 2px solid var(--gold, #B89968); outline-offset: 2px; }
.cco-tb-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center;
  background: var(--gold, #B89968); color: var(--ink, #16273E); font-size: 11px; font-weight: 700;
}
.cco-tb-count { margin: 0 auto 0 0; font-size: 13px; color: #6B6257; letter-spacing: .02em; }
.cco-tb-count strong { color: var(--ink, #16273E); font-weight: 600; }
body .catalog-wrapper .cco-tb-view { display: inline-flex; gap: 3px; padding: 3px; background: #F3EFE8; border: 1px solid #E4DBCD; border-radius: 9px; }
body .catalog-wrapper .cco-tb-view .catalog-view-btn { height: 32px; padding: 0 12px; }
.cco-tb-sort { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.cco-tb-sort-l { font-size: 13px; color: #6B6257; white-space: nowrap; }
.cco-tb-sort select {
  height: 40px; margin: 0; padding: 0 34px 0 14px; border: 1px solid #D9CDB4; border-radius: 999px; background-color: #fff;
  color: var(--ink, #16273E); font: 500 13px/1 var(--cco-font-b, 'Jost', sans-serif); width: auto; min-width: 170px;
}

/* ---------- Filtros activos ---------- */
.cco-ach { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; }
.cco-ach-chip, .cco-ach-clear {
  display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 12px; border-radius: 999px;
  font: 500 12.5px/1 var(--cco-font-b, 'Jost', sans-serif); cursor: pointer; margin: 0;
}
.cco-ach-chip { border: 1px solid var(--ink, #16273E); background: var(--ink, #16273E); color: #fff; }
.cco-ach-chip span { font-size: 16px; line-height: 1; opacity: .85; }
.cco-ach-chip:hover { background: #324862; }
.cco-ach-clear { border: 0; background: none; color: var(--ink, #16273E); text-decoration: underline; text-underline-offset: 3px; padding: 0 6px; }
.cco-ach-clear:hover { color: var(--gold-deep, #93721b); }

/* ---------- Panel de filtros ---------- */
.cco-fp-backdrop { display: none; }
.cco-fp { display: none; background: #fff; border: 1px solid var(--hairline, #E4DBCD); border-radius: 6px; margin: 0 0 16px; }
.cco-fp.is-open { display: block; }
.cco-fp-head { display: none; }
.cco-fp-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px 32px; padding: 20px 22px 6px; }
.cco-fp-group { border: 0; margin: 0; padding: 0; min-width: 0; }
.cco-fp-group legend {
  padding: 0; margin: 0 0 10px; font: 600 12px/1.2 var(--cco-font-b, 'Jost', sans-serif);
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink, #16273E);
}
.cco-fp-hint { margin-left: 10px; font-weight: 400; letter-spacing: .02em; text-transform: none; color: #6B6257; font-size: 12px; }
.cco-fp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cco-fp-brands, .cco-fp-ring { grid-column: 1 / -1; }
.cco-fp-ring { max-width: 420px; }
.cco-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 13px; margin: 0;
  border: 1px solid #D9CDB4; border-radius: 999px; background: #fff; color: var(--ink, #16273E);
  font: 500 13px/1 var(--cco-font-b, 'Jost', sans-serif); cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.cco-chip:hover:not(:disabled) { border-color: var(--ink, #16273E); }
.cco-chip-n { font-size: 11.5px; color: #6B6257; font-variant-numeric: tabular-nums; }
.cco-chip.is-on { background: var(--ink, #16273E); border-color: var(--ink, #16273E); color: #fff; }
.cco-chip.is-on .cco-chip-n { color: var(--gold, #B89968); }
.cco-chip.is-dead { opacity: .4; cursor: not-allowed; background: #F7F4EE; }
.cco-fp-loading { grid-column: 1 / -1; margin: 0; color: #6B6257; font-size: 13px; }
.cco-fp-foot { display: flex; justify-content: flex-end; align-items: center; gap: 14px; padding: 6px 22px 16px; }
.cco-fp-clear { border: 0; background: none; color: var(--ink, #16273E); text-decoration: underline; text-underline-offset: 3px; font: 500 13px/1 var(--cco-font-b, 'Jost', sans-serif); cursor: pointer; padding: 8px; }
.cco-fp-clear:disabled { opacity: .4; cursor: default; }
.cco-fp-show { display: none; }

/* Slider doble de ring gauge */
.cco-range { position: relative; height: 32px; margin: 4px 8px 0; }
.cco-range-track { position: absolute; left: 0; right: 0; top: 14px; height: 4px; border-radius: 2px; background: #E4DBCD; }
.cco-range-track::after { content: ''; position: absolute; top: 0; bottom: 0; left: var(--lo); right: calc(100% - var(--hi)); background: var(--ink, #16273E); border-radius: 2px; }
.cco-range input[type=range] {
  position: absolute; left: -8px; right: -8px; width: calc(100% + 16px); top: 0; height: 32px; margin: 0;
  background: none; pointer-events: none; -webkit-appearance: none; appearance: none;
}
.cco-range input[type=range]::-webkit-slider-runnable-track { background: none; height: 32px; }
.cco-range input[type=range]::-moz-range-track { background: none; height: 32px; }
.cco-range input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; pointer-events: auto; width: 22px; height: 22px; margin-top: 5px; border-radius: 50%;
  background: #fff; border: 2px solid var(--ink, #16273E); cursor: grab;
}
.cco-range input[type=range]::-moz-range-thumb { pointer-events: auto; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--ink, #16273E); cursor: grab; }

/* ---------- Estados de la rejilla ---------- */
.catalog-products.is-pending { opacity: .45; transition: opacity .2s; pointer-events: none; }
body .catalog-wrapper .catalog-no-products { grid-column: 1 / -1; font-style: normal; }
body .catalog-wrapper .catalog-no-products p { margin: 0 0 12px; }
body .catalog-wrapper .catalog-price-original, body .catalog-wrapper .cco-rv { text-transform: capitalize; }
body .catalog-wrapper .catalog-add-to-cart.is-view { background: transparent; color: var(--ink, #16273E); border: 1px solid var(--ink, #16273E); }

/* ---------- Rejilla mas densa (escritorio) ---------- */
@media (min-width: 769px) {
  /* auto-fit: con pocos productos las pistas vacias se colapsan y las fichas reparten el ancho. */
  body .catalog-wrapper .catalog-products.view-grid { grid-template-columns: repeat(auto-fit, minmax(212px, 1fr)); }
  body .catalog-wrapper .catalog-products.view-grid .catalog-product-item { padding-bottom: 14px; }
  body .catalog-wrapper .catalog-products.view-grid .catalog-product-image img { padding: 16px 16px 10px; }
  body .catalog-wrapper .catalog-products.view-grid .catalog-product-info { gap: 6px; }
}
@media (min-width: 1100px) {
  /* Densidad de 6 columnas con muchos productos: el minimo es 1/6 del ancho (menos 1 px de redondeo). */
  body .catalog-wrapper .catalog-products.view-grid { grid-template-columns: repeat(auto-fit, minmax(max(190px, calc(100% / 6 - 1px)), 1fr)); }
  body .catalog-wrapper .catalog-products.view-grid .catalog-product-name { font-size: 15px; }
}

/* ---------- Movil ---------- */
@media (max-width: 768px) {
  body .catalog-wrapper { padding-top: 8px; }
  html body[class] .catalog-wrapper .catalog-brand-banner img {
    max-height: 240px; object-fit: contain !important; object-position: 50% 50% !important;
  }
  body .catalog-wrapper .catalog-header,
  body .catalog-wrapper .catalog-header.has-brand-banner { padding: 10px 0 12px; margin-bottom: 10px; gap: 12px; }
  body .catalog-wrapper .catalog-header h1,
  body .catalog-wrapper .catalog-header-title { font-size: 26px; }

  .cco-tb { gap: 8px 10px; padding: 8px 0; }
  .cco-tb-filters { order: 1; flex: 1 1 0; justify-content: center; height: 44px; }
  .cco-tb-view { order: 2; }
  .cco-tb-count { order: 3; flex: 1 1 auto; margin: 0; }
  .cco-tb-sort { order: 4; }
  .cco-tb-sort-l { display: none; }
  .cco-tb-sort select { height: 40px; min-width: 0; max-width: 190px; }
  body .catalog-wrapper .cco-tb-view .catalog-view-btn { height: 36px; padding: 0 10px; flex: none; }
  body .catalog-wrapper .cco-tb-view .catalog-view-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

  .cco-ach { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .cco-ach::-webkit-scrollbar { display: none; }
  .cco-ach-chip, .cco-ach-clear { flex: none; min-height: 36px; }

  /* Hoja inferior */
  .cco-fp-backdrop {
    display: block; position: fixed; inset: 0; z-index: 99990; background: rgba(22, 39, 62, .5);
    opacity: 0; pointer-events: none; transition: opacity .25s;
  }
  .cco-fp-backdrop.is-open { opacity: 1; pointer-events: auto; }
  .cco-fp {
    display: flex; flex-direction: column; position: fixed; left: 0; right: 0; bottom: 0; z-index: 99991; margin: 0;
    max-height: 86vh; max-height: 86dvh; border: 0; border-radius: 16px 16px 0 0; box-shadow: 0 -12px 40px rgba(22, 39, 62, .25);
    transform: translateY(100%); visibility: hidden; transition: transform .28s ease, visibility 0s linear .28s;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .cco-fp.is-open { display: flex; transform: none; visibility: visible; transition: transform .28s ease; }
  .cco-fp-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 8px; flex: none; }
  .cco-fp-head h2 { margin: 0; font: 500 24px/1 'Cormorant Garamond', Georgia, serif; color: var(--ink, #16273E); }
  .cco-fp-head::before { content: ''; position: absolute; top: 7px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 2px; background: #D9CDB4; }
  .cco-fp-x { width: 44px; height: 44px; border: 0; background: none; font-size: 30px; line-height: 1; color: var(--ink, #16273E); cursor: pointer; margin: -6px -10px 0 0; }
  .cco-fp-body { display: block; overflow-y: auto; flex: 1 1 auto; min-height: 0; padding: 4px 18px 12px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .cco-fp-group { margin-bottom: 20px; }
  .cco-chip { min-height: 44px; padding: 0 16px; font-size: 14px; }
  .cco-fp-brands .cco-fp-chips { max-height: 190px; overflow-y: auto; }
  .cco-fp-ring { max-width: none; }
  .cco-fp-foot { flex: none; justify-content: space-between; padding: 12px 18px 14px; border-top: 1px solid var(--hairline, #E4DBCD); background: #fff; }
  .cco-fp-show {
    display: inline-flex; align-items: center; justify-content: center; flex: 1; height: 48px; margin: 0; border: 0; border-radius: 999px;
    background: var(--ink, #16273E); color: #fff; font: 600 14px/1 var(--cco-font-b, 'Jost', sans-serif); letter-spacing: .04em; cursor: pointer;
  }
  html.cco-sheet-open, body.cco-sheet-open { overflow: hidden; overscroll-behavior: none; }
  body.cco-sheet-open { position: fixed; left: 0; right: 0; width: 100%; top: var(--cco-sheet-top, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .cco-fp, .cco-fp-backdrop, .catalog-products.is-pending { transition: none !important; }
}
