/* =============================================================================
   Orbita Diego — PLP (Product Listing Page) styles
   plp.css: scoped to .orbita-plp body class. Loaded only on shop/taxonomy pages.
   All tokens reference custom properties from main.css (:root) — no hardcoded values.
   Mobile-first. Container queries for product grid breakpoints.
   ============================================================================= */


/* -----------------------------------------------------------------------------
   1. PLP page-header (breadcrumbs bar)
   ----------------------------------------------------------------------------- */

.plp-page-header {
  border-bottom: 1px solid var(--rule);
}

.plp-breadcrumbs {
  font-size: var(--text-sm);
}

/* WC breadcrumb links */
.plp-breadcrumbs .woocommerce-breadcrumb a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--duration-fast) var(--easing-default);
}

.plp-breadcrumbs .woocommerce-breadcrumb a:hover {
  color: var(--accent-blue-deep);
}

/* Separator */
.plp-breadcrumbs .woocommerce-breadcrumb .separator,
.plp-breadcrumbs .breadcrumbs__sep {
  color: var(--ink-mid);
  margin: 0 var(--space-2);
}


/* -----------------------------------------------------------------------------
   2. PLP two-column layout
   ----------------------------------------------------------------------------- */

.plp-layout {
  position: relative;
}

/* Stack columns on mobile by default; flex side-by-side on desktop.
   The WP Columns block handles the CSS but we supplement with explicit rules
   to ensure sidebar collapses correctly on mobile. */

.plp-columns.wp-block-columns {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-8);
}

/* Sidebar column: hidden on mobile (drawer) */
.plp-column--sidebar {
  display: none;           /* hidden on mobile — shown via drawer */
  width: 280px !important;
  flex-shrink: 0;
  flex-grow: 0;
  min-width: 0;
  position: sticky;
  top: var(--space-6);
  max-height: calc(100vh - var(--space-12));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-strong) transparent;
}

@media (min-width: 1024px) {
  .plp-column--sidebar {
    display: block;
  }
}

/* Main content column: full width on mobile, flex-grow on desktop */
.plp-column--main {
  flex: 1 1 0;
  min-width: 0;
}


/* -----------------------------------------------------------------------------
   3. Sidebar — base
   ----------------------------------------------------------------------------- */

.plp-sidebar {
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper-soft);
}

.plp-sidebar__heading {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--ink-mid);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  margin-bottom: var(--space-4);
}

.plp-sidebar__footer {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--rule-subtle);
}

/* Close button — only shown inside the mobile drawer */
.plp-sidebar__close-btn {
  display: none;
  margin-left: auto;
  color: var(--ink-mid);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  transition: color var(--duration-fast) var(--easing-default);
}

.plp-sidebar__close-btn:hover {
  color: var(--ink);
}

.plp-sidebar__close-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


/* -----------------------------------------------------------------------------
   4. Mobile drawer
   ----------------------------------------------------------------------------- */

@media (max-width: 1023px) {
  /* The sidebar becomes an off-canvas drawer on mobile */
  .plp-column--sidebar {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: min(320px, 92vw);
    height: 100dvh;
    max-height: 100dvh;
    z-index: var(--z-sidebar, 200);
    transform: translateX(-100%);
    transition: transform var(--duration-normal) var(--easing-emphasized);
    overflow-y: auto;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    border: none;
    border-right: 1px solid var(--rule-strong);
    box-shadow: var(--shadow-lg);
  }

  /* Open state — set by JS when data-open attribute present */
  .plp-column--sidebar .plp-sidebar[data-open] {
    transform: translateX(0);
  }

  /* Also open when body has the attribute (set by the JS in sidebar-filters.html) */
  body[data-drawer-open] .plp-column--sidebar {
    transform: translateX(0);
  }

  .plp-sidebar__close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-4);
  }
}

/* Backdrop */
.plp-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(14, 14, 14, 0.75);
  z-index: calc(var(--z-sidebar, 200) - 1);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration-normal) var(--easing-default);
}

@media (max-width: 1023px) {
  body[data-drawer-open] .plp-drawer-backdrop {
    display: block;
    pointer-events: auto;
    opacity: 1;
  }
}


/* -----------------------------------------------------------------------------
   5. Filter trigger button (mobile sticky bar)
   ----------------------------------------------------------------------------- */

.plp-filters-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

/* Hide on desktop */
@media (min-width: 1024px) {
  .plp-filters-btn {
    display: none;
  }
}

.plp-filters-btn__count {
  font-weight: var(--weight-semibold);
  color: var(--accent);
}


/* -----------------------------------------------------------------------------
   6. Filter group internals (WC filter blocks — woocommerce/product-filter-*)
   ----------------------------------------------------------------------------- */

/*
 * WHY these styles are here and not in a WC block stylesheet:
 *   The WC product-filter-* blocks render class names that vary per WC version.
 *   We target the WC block wrapper classes (.orbita-filter) we set in the template
 *   plus the internal WC-generated class names confirmed by DOM inspection.
 *   Selectors use low specificity (0,1,0 or 0,2,0) to avoid overrides issues.
 *
 * Confirmed WC 10.x class names (inspect DOM before changing):
 *   Wrapper:        .wc-block-filter-wrapper (or .wp-block-woocommerce-product-filter-attribute)
 *   Heading:        h3 inside the wrapper
 *   Checkbox list:  ul.wc-block-checkbox-list
 *   Label:          label inside li
 *   Count span:     span with class containing "count" (WC may rename between versions)
 *   Active chips:   .wc-block-components-product-filter-active-filters__clear-all
 */

/* Group wrapper — each filter block gets a bottom border separator */
.orbita-filter {
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--rule-subtle);
}

.orbita-filter:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Heading (h3) inside each filter group */
.orbita-filter h3,
.orbita-filter .wp-block-heading {
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--ink);
    margin-top: 0;
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--rule-subtle);
    line-height: var(--leading-snug);
}

/* Checkbox list */
.orbita-filter ul.wc-block-checkbox-list,
.orbita-filter .wc-block-components-checkbox-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

/* Each checkbox label row */
.orbita-filter ul.wc-block-checkbox-list li label,
.orbita-filter .wc-block-components-checkbox-list li label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--ink);
    cursor: pointer;
    padding: var(--space-1) 0;
    transition: color var(--duration-fast) var(--easing-default);
}

.orbita-filter ul.wc-block-checkbox-list li label:hover,
.orbita-filter .wc-block-components-checkbox-list li label:hover {
    color: var(--accent-blue-deep);
}

/* Native checkbox — visually hidden but accessible (NOT display:none — breaks focus) */
.orbita-filter ul.wc-block-checkbox-list li label input[type="checkbox"],
.orbita-filter .wc-block-components-checkbox-list li label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Custom checkbox visual span (WC renders a <span> next to the hidden input) */
.orbita-filter .wc-block-components-checkbox__mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    border: 1.5px solid var(--rule-strong);
    border-radius: var(--radius-sm);
    background: var(--paper);
    transition: background var(--duration-fast) var(--easing-default),
                border-color var(--duration-fast) var(--easing-default);
}

/* Checked state — input is hidden, WC adds [aria-checked=true] or :checked on input */
.orbita-filter input[type="checkbox"]:checked + .wc-block-components-checkbox__mark,
.orbita-filter input[type="checkbox"][aria-checked="true"] + .wc-block-components-checkbox__mark {
    background: var(--accent);
    border-color: var(--accent);
}

/* Focus visible ring on the checkbox span */
.orbita-filter input[type="checkbox"]:focus-visible + .wc-block-components-checkbox__mark {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Count badge — right-aligned mono number */
.orbita-filter .wc-block-components-filter-element-label__count,
.orbita-filter [class*="count"] {
    margin-left: auto;
    font-size: var(--text-xs);
    color: var(--ink-light);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* Active chips area (woocommerce/product-filter-active block) */
.orbita-filter--active .wc-block-product-filter-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

/* "Limpiar" / "Clear all" link in active filters block */
.orbita-filter--active .wc-block-components-product-filter-active-filters__clear-all,
.orbita-filter--active [class*="clear"] {
    font-size: var(--text-xs);
    color: var(--accent-blue);
    text-decoration: underline;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    transition: color var(--duration-fast) var(--easing-default);
}

.orbita-filter--active .wc-block-components-product-filter-active-filters__clear-all:hover,
.orbita-filter--active [class*="clear"]:hover {
    color: var(--accent-blue-deep);
}


/* -----------------------------------------------------------------------------
   6b. Results header (sort + count)
   ----------------------------------------------------------------------------- */

.plp-results-header {
  border-bottom: 1px solid var(--rule-subtle);
  /* space-6 dejaba ~127px de aire entre los controles y la grilla (el conteo
     "Mostrando 1–16…" ya es redundante con "N productos" del header). */
  margin-bottom: var(--space-4);
}

.plp-results-header__title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  color: var(--ink);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  margin: 0;
}

/* WC injects a <p> for result count */
.plp-results-header__count,
.plp-results-header .woocommerce-result-count {
  font-size: var(--text-sm);
  color: var(--ink-mid);
  margin: 0;
}

/* Sort form */
.plp-sort {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.plp-sort__select {
  font-size: var(--text-sm);
  color: var(--ink);
  background-color: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: var(--space-2) calc(var(--space-4) + 24px) var(--space-2) var(--space-3);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23A6A29A' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 16px;
  min-width: 180px;
  transition: border-color var(--duration-fast) var(--easing-default);
}

.plp-sort__select:hover {
  border-color: var(--rule-strong);
}

.plp-sort__select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(207, 162, 42, 0.15);
}


/* -----------------------------------------------------------------------------
   7. Active filter pills
   ----------------------------------------------------------------------------- */

.plp-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  min-height: 0;
}

.plp-active-filters:empty {
  display: none;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: rgba(207, 162, 42, 0.12);
  border: 1px solid rgba(207, 162, 42, 0.3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--accent);
  line-height: 1;
}

.filter-pill__label {
  font-weight: var(--weight-medium);
}

.filter-pill__remove {
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  padding: 1px;
  transition: color var(--duration-fast) var(--easing-default);
  text-decoration: none;
}

.filter-pill__remove:hover {
  color: var(--ink);
}

.filter-pill__remove:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


/* -----------------------------------------------------------------------------
   8. Filter groups (details/summary)
   ----------------------------------------------------------------------------- */

.filter-group {
  border-bottom: 1px solid var(--rule-subtle);
  margin-bottom: 0;
}

.filter-group:last-of-type {
  border-bottom: none;
}

.filter-group__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--ink);
  transition: color var(--duration-fast) var(--easing-default);
}

/* Hide default <details> marker (cross-browser) */
.filter-group__header::-webkit-details-marker {
  display: none;
}

.filter-group__header::marker {
  display: none;
}

.filter-group__header:hover {
  color: var(--accent);
}

.filter-group__chevron {
  flex-shrink: 0;
  color: var(--ink-mid);
  transition: transform var(--duration-fast) var(--easing-default),
              color var(--duration-fast) var(--easing-default);
}

/* Rotate chevron when group is open */
details[open] > .filter-group__header .filter-group__chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.filter-group__content {
  padding-bottom: var(--space-4);
}

.filter-group__title {
  flex: 1;
}

/* Toggle group (En stock) — no arrow needed */
.filter-group--toggle {
  border-bottom: 1px solid var(--rule-subtle);
  padding: var(--space-4) 0;
}


/* -----------------------------------------------------------------------------
   9. Filter checkbox (card style)
   ----------------------------------------------------------------------------- */

.filter-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Category list links */
.filter-list--categories .filter-list__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  text-decoration: none;
  color: var(--ink);
  font-size: var(--text-sm);
  transition: background var(--duration-fast) var(--easing-default),
              border-color var(--duration-fast) var(--easing-default),
              color var(--duration-fast) var(--easing-default);
}

.filter-list--categories .filter-list__link:hover {
  background: var(--paper-card);
  border-color: var(--rule);
}

.filter-list--categories .filter-list__link--active {
  background: rgba(207, 162, 42, 0.1);
  border-color: rgba(207, 162, 42, 0.3);
  color: var(--accent);
  font-weight: var(--weight-semibold);
}

.filter-list--categories .filter-list__count {
  font-size: var(--text-xs);
  color: var(--ink-light);
  font-variant-numeric: tabular-nums;
}

/* Checkbox items */
.filter-checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--paper-card);
  background: var(--paper-card);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--easing-default),
              background var(--duration-fast) var(--easing-default);
}

.filter-checkbox:hover {
  background: var(--paper-soft);
  border-color: var(--rule-strong);
}

.filter-checkbox__input {
  /* Visually hidden but accessible */
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Custom checkbox mark */
.filter-checkbox__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--rule-strong);
  background: var(--paper);
  transition: background var(--duration-fast) var(--easing-default),
              border-color var(--duration-fast) var(--easing-default);
}

/* Checked state */
.filter-checkbox__input:checked + .filter-checkbox__mark {
  background: var(--accent);
  border-color: var(--accent);
}

/* Checkmark SVG via pseudo-element */
.filter-checkbox__input:checked + .filter-checkbox__mark::after {
  content: '';
  display: block;
  width: 9px;
  height: 5px;
  border-left: 2px solid var(--paper);
  border-bottom: 2px solid var(--paper);
  transform: rotate(-45deg) translateY(-1px);
}

.filter-checkbox__label {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--ink);
  line-height: var(--leading-snug);
}

.filter-checkbox__count {
  font-size: var(--text-xs);
  color: var(--ink-light);
  font-variant-numeric: tabular-nums;
}

/* Focus ring on the label (wraps the hidden input) */
.filter-checkbox:has(.filter-checkbox__input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


/* -----------------------------------------------------------------------------
   10. Price range slider
   ----------------------------------------------------------------------------- */

.filter-price {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.filter-price__slider-wrap {
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
}

.filter-price__track {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  height: 4px;
  background: var(--rule-strong);
  border-radius: var(--radius-full);
  pointer-events: none;
}

.filter-price__range {
  position: absolute;
  top: 0;
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  pointer-events: none;
}

.filter-price__thumb {
  position: absolute;
  width: 100%;
  height: 4px;
  background: transparent;
  border: none;
  outline: none;
  pointer-events: all;
  appearance: none;
  cursor: pointer;
}

/* Custom range thumb — golden */
.filter-price__thumb::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--paper);
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: background var(--duration-fast) var(--easing-default),
              transform var(--duration-fast) var(--easing-default);
}

.filter-price__thumb::-webkit-slider-thumb:hover {
  background: var(--accent-warm);
  transform: scale(1.15);
}

.filter-price__thumb::-webkit-slider-thumb:active {
  cursor: grabbing;
}

.filter-price__thumb::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--paper);
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: background var(--duration-fast) var(--easing-default);
}

.filter-price__thumb:focus-visible::-webkit-slider-thumb {
  outline: 2px solid var(--accent-warm);
  outline-offset: 2px;
}

.filter-price__inputs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.filter-price__input-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
}

.filter-price__label {
  font-size: var(--text-xs);
  color: var(--ink-mid);
  font-weight: var(--weight-medium);
}

.filter-price__input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--ink);
  transition: border-color var(--duration-fast) var(--easing-default);
}

.filter-price__input:hover {
  border-color: var(--rule-strong);
}

.filter-price__input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(207, 162, 42, 0.15);
}

.filter-price__separator {
  color: var(--ink-mid);
  font-size: var(--text-sm);
  padding-top: var(--space-6); /* align with input, offset by label height */
  flex-shrink: 0;
}


/* -----------------------------------------------------------------------------
   11. Toggle switch (En stock)
   ----------------------------------------------------------------------------- */

.filter-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  user-select: none;
}

.filter-toggle__track {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.filter-toggle__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.filter-toggle__slider {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-full);
  background: var(--rule-strong);
  transition: background var(--duration-fast) var(--easing-default);
  cursor: pointer;
}

/* The circular knob */
.filter-toggle__slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform var(--duration-fast) var(--easing-default),
              background var(--duration-fast) var(--easing-default);
  box-shadow: var(--shadow-sm);
}

.filter-toggle__input:checked + .filter-toggle__slider {
  background: var(--accent);
}

.filter-toggle__input:checked + .filter-toggle__slider::after {
  transform: translateX(16px);
  background: var(--paper);
}

.filter-toggle:has(.filter-toggle__input:focus-visible) .filter-toggle__slider {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.filter-toggle__label {
  font-size: var(--text-sm);
  color: var(--ink);
}


/* -----------------------------------------------------------------------------
   12. Product grid
   ----------------------------------------------------------------------------- */

/* Container query context — the grid container queries off its own width */
.plp-grid-wrap {
  container-type: inline-size;
  container-name: plp-grid;
}

/* The product-collection outer div is just a wrapper — the actual list is a
   <ul.wc-block-product-template> child. We need the grid layout on the UL,
   not on the wrapper (otherwise the UL gets the full row and renders as 1
   stacked column regardless of how many columns the parent declares). */
.plp-product-grid .wc-block-product-template {
  display: grid;
  /* mobile = 2 col: estándar de e-commerce (ML/Amazon/Rappi) para catálogo
     grande (~3k repuestos). Más densidad de escaneo, menos scroll que 1-col.
     Revierte el "1 col per Joaquín feedback" previo → ver DECISIONS D084. */
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 1fr;               /* todas las filas misma altura → cards uniformes */
  gap: var(--space-3);               /* gap compacto en mobile 2-col */
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
}

/* tablet — ~640px container: sigue 2 col pero con más aire */
@container plp-grid (min-width: 640px) {
  .plp-product-grid .wc-block-product-template {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-6);
  }
}

/* 3 cols on desktop — ~960px container width */
@container plp-grid (min-width: 960px) {
  .plp-product-grid .wc-block-product-template {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* The <li> wrappers inherit the grid item slot — neutralise WC's float
   fallback. Specificity (0,3,0) beats WC defaults (0,1,0), no !important. */
.plp-product-grid .wc-block-product-template .wc-block-product {
  float: none;
  width: 100%;
  height: 100%;   /* el <li> llena la fila del grid (grid-auto-rows:1fr) */
  margin: 0;
}


/* -----------------------------------------------------------------------------
   13. Product card — Grid variant
   ----------------------------------------------------------------------------- */

.product-card--grid {
  display: flex;
  flex-direction: column;
  height: 100%;   /* el <article> llena el <li> → todas las cards iguales */
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--duration-fast) var(--easing-default),
              border-color var(--duration-fast) var(--easing-default),
              box-shadow var(--duration-fast) var(--easing-default);
  will-change: transform;
}

/* Hover: lift 4px + border-strong + shadow-md */
.product-card--grid:hover {
  transform: translateY(-4px);
  border-color: var(--rule-strong);
  box-shadow: var(--shadow-md);
}

/* Focus-within: keyboard navigation to any child element */
.product-card--grid:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Image area */
.product-card__img-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--paper-soft);
}

.product-card__img-wrap img,
.product-card__img-wrap .wp-block-woocommerce-product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform var(--duration-slow) var(--easing-default);
}

.product-card--grid:hover .product-card__img-wrap img {
  transform: scale(1.04);
}

/* WC product image block inner wrapper */
.product-card__img-wrap .woocommerce-product-gallery__image,
.product-card__img-wrap .wp-block-woocommerce-product-image {
  height: 100%;
}

/* Out-of-stock: dim card */
.product-card--grid.is-out-of-stock {
  opacity: 0.6;
}

/* Card body */
.product-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
  padding: var(--space-4);
}

/* SKU — mono xs ink-mid */
.product-card__sku,
.product-card--grid .wp-block-woocommerce-product-sku {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
  color: var(--ink-mid);
  margin: 0;
  line-height: var(--leading-normal);
}

/* Title — Inter semibold sm, 2-line clamp */
.product-card__title a,
.product-card--grid .wp-block-post-title a {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--ink);
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: var(--leading-snug);
  transition: color var(--duration-fast) var(--easing-default);
}

.product-card--grid:hover .product-card__title a,
.product-card--grid:hover .wp-block-post-title a {
  color: var(--accent-blue);
}

/* Price — JetBrains Mono semibold xl */
.product-card__price .woocommerce-Price-amount,
.product-card--grid .wp-block-woocommerce-product-price .woocommerce-Price-amount {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--ink);
}

/* Sale price */
.product-card--grid .wp-block-woocommerce-product-price ins .woocommerce-Price-amount {
  color: var(--critical);
  text-decoration: none;
}

.product-card--grid .wp-block-woocommerce-product-price del .woocommerce-Price-amount {
  font-size: var(--text-sm);
  color: var(--ink-light);
}

/* Add to cart — full width, primary, sm */
.product-card__add-to-cart.btn--sm,
.product-card--grid .wp-block-woocommerce-product-button .wp-block-button__link {
  display: block;
  width: 100%;
  /* `height:auto` overrides the inline `.wp-block-button__link { height:100% }`
     rule (theme.json/WC). Without this, after add-to-cart WC injects a sibling
     "Ver carrito" link into the same button wrapper; the wrapper grows and the
     button (height:100%) stretches with it — ballooning to ~80px (the "botón
     gigante" reported in the 2026-05-25 grilling, item 3). Pinning to content
     height keeps the button at a stable size in both the initial and the
     post-add ("N en el carrito") states. */
  height: auto;
  text-align: center;
  margin-top: auto;
  background: var(--accent);
  color: var(--paper);
  border: none;
  border-radius: var(--radius-md);
  /* Mobile 2-col: card ~145-165px → "Añadir al carrito" no entra en una línea a
     text-sm. Compacto (text-xs + padding chico) lo deja en 1 línea y va con la
     preferencia de Diego por CTAs compactos en grillas densas. A ≥640px (cards
     anchas) se restaura el tamaño normal abajo. */
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  cursor: pointer;
  transition: background var(--duration-fast) var(--easing-default),
              box-shadow var(--duration-fast) var(--easing-default);
  text-decoration: none;
}

/* Cards anchas (tablet/desktop): CTA tamaño normal. */
@container plp-grid (min-width: 640px) {
  .product-card--grid .wp-block-woocommerce-product-button .wp-block-button__link {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
  }
}

.product-card__add-to-cart.btn--sm:hover,
.product-card--grid .wp-block-woocommerce-product-button .wp-block-button__link:hover {
  background: var(--accent-deep);
  box-shadow: var(--shadow-glow-accent);
}

.product-card__add-to-cart.btn--sm:focus-visible,
.product-card--grid .wp-block-woocommerce-product-button .wp-block-button__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Post-add "Ver carrito" link — Opción A (QA ronda 4, ítem 5, decidida por Joaquín).
   WC inyecta <a class="added_to_cart"> dentro del wrapper del product-button y lo
   muestra vía Interactivity API removiendo [hidden]. Renderizado como botón outline
   para jerarquía clara: primario (dorado) = agregar, secundario (outline) = ver carrito.
   Extiende el patrón existente en pdp.css a las cards de PLP. */
.product-card--grid .wp-block-woocommerce-product-button .added_to_cart,
.wp-block-woocommerce-product-button .added_to_cart,
.woocommerce .added_to_cart {
  display: none;  /* oculto por defecto — solo visible via :not([hidden]) abajo */
  margin-top: var(--space-2);
  text-align: center;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  /* Outline button — borde sutil, sin fondo dorado, texto legible */
  color: var(--ink);
  background-color: transparent;
  border: 1.5px solid var(--rule-strong);
  border-radius: var(--radius-md);
  text-decoration: none;
  padding: calc(var(--space-3) - 1px) var(--space-4);
  min-height: 44px;
  width: 100%;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    border-color var(--duration-fast) var(--easing-default),
    color var(--duration-fast) var(--easing-default);
}

/* Solo mostrar "Ver carrito" cuando el producto YA está en el carrito.
   WC pone [hidden] en el link mientras no lo está (Interactivity API). */
.product-card--grid .wp-block-woocommerce-product-button .added_to_cart:not([hidden]),
.wp-block-woocommerce-product-button .added_to_cart:not([hidden]),
.woocommerce .added_to_cart:not([hidden]) {
  display: inline-flex;
}

.product-card--grid .wp-block-woocommerce-product-button .added_to_cart:hover,
.wp-block-woocommerce-product-button .added_to_cart:hover,
.woocommerce .added_to_cart:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.product-card--grid .wp-block-woocommerce-product-button .added_to_cart:focus,
.product-card--grid .wp-block-woocommerce-product-button .added_to_cart:focus-visible,
.wp-block-woocommerce-product-button .added_to_cart:focus-visible,
.woocommerce .added_to_cart:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Lazy load: products outside the fold get loading="lazy" via WC.
   Ensure the image-wrap has a defined background colour so the placeholder
   doesn't cause a white flash (which would break the dark theme). */
.product-card__img-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--paper-soft);
  z-index: 0;
}

.product-card__img-wrap img {
  position: relative;
  z-index: 1;
}


/* -----------------------------------------------------------------------------
   14. Pagination
   Covers two contexts with the same visual language:
   a) .woocommerce-pagination — category pages (WC function, markup: ul > li > a/span)
   b) .wp-block-query-pagination — CUALQUIER bloque wp:query-pagination del sitio
                                (/tienda/, búsqueda, archivos…). Markup plano:
                                a.page-numbers, span.page-numbers.current/.dots,
                                a.wp-block-query-pagination-previous/next.

   ESCALABILIDAD: se estila el bloque GENÉRICO, no una clase ad-hoc por página.
   Cualquier paginador que use wp:query-pagination sale formateado solo. La clase
   `plp-pagination` del pattern de /tienda/ quedó legacy (ya no hace falta para el estilo).

   Strategy: shared item styles via multi-selector where markup is equivalent.
   Container and prev/next handled separately due to structural differences.
   Numbers use --font-mono (JetBrains Mono) — consistent with SKUs and prices.
   ----------------------------------------------------------------------------- */

/* --- Wrapper spacing --- */

.woocommerce-pagination {
  margin-top: var(--space-10);
}

.wp-block-query-pagination {
  margin-top: var(--space-10);
}

/* --- Container: card strip centered --- */

.woocommerce-pagination .page-numbers {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  padding: var(--space-2);
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  margin: 0;
}

/* wp:query-pagination block has no inner <ul> — style the block element itself */
.wp-block-query-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2);
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
}

/* --- Shared item base: number links and spans --- */

/* WC: items are li > a or li > span */
.woocommerce-pagination .page-numbers > li > a,
.woocommerce-pagination .page-numbers > li > span,
/* Block: items are direct children a.page-numbers and span.page-numbers */
.wp-block-query-pagination a.page-numbers,
.wp-block-query-pagination span.page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--ink);
  border-radius: var(--radius-sm);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background var(--duration-fast) var(--easing-default),
              border-color var(--duration-fast) var(--easing-default);
}

/* --- Hover: numbered page links --- */

.woocommerce-pagination .page-numbers > li > a:hover,
.wp-block-query-pagination a.page-numbers:hover {
  background: var(--paper-soft);
  border-color: var(--rule-strong);
}

/* --- Current page — accent border-bottom 2px --- */

.woocommerce-pagination .page-numbers > li > span.current,
.wp-block-query-pagination span.page-numbers.current {
  border-color: var(--rule);
  border-bottom-color: var(--accent);
  border-bottom-width: 2px;
  font-weight: var(--weight-semibold);
  color: var(--accent);
  background: var(--paper-soft);
}

/* --- Focus visible: all interactive items --- */

.woocommerce-pagination .page-numbers > li > a:focus-visible,
.wp-block-query-pagination a.page-numbers:focus-visible,
.wp-block-query-pagination .wp-block-query-pagination-previous:focus-visible,
.wp-block-query-pagination .wp-block-query-pagination-next:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- Dots (ellipsis) --- */

.woocommerce-pagination .page-numbers > li > span.dots,
.wp-block-query-pagination span.page-numbers.dots {
  color: var(--ink-light);
  border: none;
  cursor: default;
}

/* --- Prev / Next (WC category pages) --- */
/* Uses anchor class .prev/.next inside the <li> */

.woocommerce-pagination .page-numbers > li > a.prev,
.woocommerce-pagination .page-numbers > li > a.next {
  color: var(--accent-blue);
  font-family: var(--font-sans);
}

/* --- Prev / Next (wp:query-pagination block — /tienda/) --- */
/* These are direct children of .wp-block-query-pagination, not wrapped in <li>.
   Block outputs them as <a> with their own BEM class.
   Font set to sans (they render as arrow + word, not a numeral). */

.wp-block-query-pagination .wp-block-query-pagination-previous,
.wp-block-query-pagination .wp-block-query-pagination-next {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--accent-blue);
  text-decoration: none;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background var(--duration-fast) var(--easing-default),
              border-color var(--duration-fast) var(--easing-default),
              color var(--duration-fast) var(--easing-default);
}

.wp-block-query-pagination .wp-block-query-pagination-previous:hover,
.wp-block-query-pagination .wp-block-query-pagination-next:hover {
  background: var(--paper-soft);
  border-color: var(--rule-strong);
  color: var(--accent-blue-deep);
}

/* --- Mobile refinement (375px) ---
   On very small viewports the container wraps naturally due to flex-wrap.
   Reduce horizontal padding on items so more numbers fit per row. */

@media (max-width: 479px) {
  .woocommerce-pagination .page-numbers > li > a,
  .woocommerce-pagination .page-numbers > li > span,
  .wp-block-query-pagination a.page-numbers,
  .wp-block-query-pagination span.page-numbers {
    min-width: 32px;
    height: 32px;
    padding: 0 var(--space-2);
  }

  .wp-block-query-pagination .wp-block-query-pagination-previous,
  .wp-block-query-pagination .wp-block-query-pagination-next {
    height: 32px;
    padding: 0 var(--space-2);
  }
}


/* -----------------------------------------------------------------------------
   15. Empty state (plp-no-results) — D-QA-03
   CTAs stacked on mobile, inline on tablet+. No inline styles on the pattern
   PHP — all layout controlled here.
   ----------------------------------------------------------------------------- */

/* Container */
.plp-empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-6);
  max-width: 560px;
  margin: 0 auto;
}

/* Icon wrap */
.plp-empty-state .empty-state__icon-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-6);
}

.plp-empty-state .empty-state__icon {
  color: var(--ink-light);
  width: 64px;
  height: 64px;
  display: block;
}

/* Heading */
.plp-empty-state .empty-state__heading {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  color: var(--ink);
  margin: 0 0 var(--space-3);
  line-height: var(--leading-tight);
}

/* Description */
.plp-empty-state .empty-state__message {
  font-size: var(--text-base);
  color: var(--ink-mid);
  line-height: var(--leading-relaxed);
  margin: 0 auto var(--space-6);
  max-width: 440px;
}

/* CTAs wrapper — column on mobile (D-QA-03) */
.plp-empty-state .empty-state__ctas {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: stretch;
  max-width: 320px;
  margin: 0 auto;
}

/* CTAs wrapper — row on tablet+ */
@media (min-width: 640px) {
  .plp-empty-state .empty-state__ctas {
    flex-direction: row;
    justify-content: center;
    align-items: center;
    max-width: none;
  }
}

/* Catalog CTA — secondary style */
.plp-empty-state .empty-state__cta-catalog {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: var(--space-3) var(--space-6);
  background: transparent;
  border: 2px solid var(--rule-strong);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--ink);
  text-decoration: none;
  transition: border-color var(--duration-fast) var(--easing-default),
              background var(--duration-fast) var(--easing-default);
}

.plp-empty-state .empty-state__cta-catalog:hover {
  border-color: var(--ink);
  background: var(--paper-card);
}

.plp-empty-state .empty-state__cta-catalog:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* WhatsApp CTA */
.plp-empty-state .empty-state__cta-whatsapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: var(--space-3) var(--space-6);
  background: var(--whatsapp, #25D366);
  color: var(--ink-on-accent);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  transition: background var(--duration-fast) var(--easing-default);
}

/* Icon inside WhatsApp CTA — must not shrink when text wraps */
.plp-empty-state .empty-state__cta-whatsapp-icon {
  flex-shrink: 0;
}

.plp-empty-state .empty-state__cta-whatsapp:hover {
  background: var(--whatsapp-deep, #1DA851);
}

.plp-empty-state .empty-state__cta-whatsapp:focus-visible {
  outline: 2px solid var(--whatsapp-deep, #1DA851);
  outline-offset: 2px;
}

/* Suggested categories section */
.plp-empty-state .empty-state__suggestions {
  margin-top: var(--space-8);
}

.plp-empty-state .empty-state__suggestions-label {
  color: var(--ink-mid);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  margin-bottom: var(--space-3);
}

.plp-empty-state .empty-state__category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
}

/* Individual category chip */
.plp-empty-state .chip--suggestion {
  display: inline-block;
  padding: var(--space-1) var(--space-4);
  border: 1px solid var(--rule);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  color: var(--ink);
  text-decoration: none;
  transition: border-color var(--duration-fast) var(--easing-default),
              background var(--duration-fast) var(--easing-default),
              color var(--duration-fast) var(--easing-default);
}

.plp-empty-state .chip--suggestion:hover {
  border-color: var(--accent);
  background: rgba(207, 162, 42, 0.08);
  color: var(--accent);
}

.plp-empty-state .chip--suggestion:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


/* -----------------------------------------------------------------------------
   16. WC breadcrumbs override (used in PLP page header)

   Two rendering paths share the same visual spec:
     a) woocommerce_breadcrumb() PHP function → .woocommerce-breadcrumb (used by
        orbita/plp-header on /tienda/ — styled via .orbita-plp__breadcrumb above).
     b) wp:woocommerce/breadcrumbs block → .wc-block-breadcrumbs (used by
        taxonomy-product_cat.html inside .plp-page-header + single-product.html).

   Both paths must render identically: xs text, ink-mid base, accent-blue links,
   ink-light separators. The block version uses <a> links and plain text nodes
   separated by " / " — no explicit separator element.
   ----------------------------------------------------------------------------- */

/* Block breadcrumb wrapper — reset WC defaults */
.wc-block-breadcrumbs {
  font-size: var(--text-xs);
  color: var(--ink-mid);
  background: transparent;
  padding: 0;
  margin: 0;
  line-height: var(--leading-normal);
}

/* Links inside the block breadcrumb */
.wc-block-breadcrumbs a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--duration-fast) var(--easing-default);
}

.wc-block-breadcrumbs a:hover {
  color: var(--accent-blue-deep);
}

.wc-block-breadcrumbs a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Current / last crumb (not a link) — slightly lighter */
.wc-block-breadcrumbs .wc-block-breadcrumbs__item:last-child {
  color: var(--ink-mid);
}

/* Legacy PHP path (.woocommerce-breadcrumb) inside .plp-page-header
   (already handled by .orbita-plp__breadcrumb but add a fallback here
   in case plp-page-header is used without the BEM wrapper) */
.plp-breadcrumbs .woocommerce-breadcrumb {
  font-size: var(--text-xs);
  color: var(--ink-mid);
  background: transparent;
  padding: 0;
  margin: 0;
}


/* -----------------------------------------------------------------------------
   17. Responsive refinements
   ----------------------------------------------------------------------------- */

/* On very small screens (375px) force single column product grid */
@media (max-width: 479px) {
  .plp-product-grid.wp-block-woocommerce-product-collection {
    grid-template-columns: 1fr;
  }
}

/* Hide sort label text on small mobile, keep the select */
@media (max-width: 479px) {
  .plp-results-header__title {
    font-size: var(--text-xl);
  }
}

/* Tablet: 2-column layout for results header */
@media (min-width: 640px) {
  .plp-results-header.wp-block-group {
    flex-wrap: nowrap;
  }
}


/* =============================================================================
   orbita/plp-header block — BEM classes (D053, design doc §3.1)
   The block is server-rendered and placed at the top of archive-product.html.
   ============================================================================= */

/* Skip-link rules live in main.css so they apply on every page,
   not only when plp.css is loaded. */


/* -- PLP header wrapper ---------------------------------------------------- */

.orbita-plp__header.wp-block-orbita-plp-header {
  /* Full-bleed band (background + bottom border) but with the inner content
     centered to the same 1280px column as .plp-layout below, so the
     breadcrumb / title / search align with the product grid instead of
     hugging the viewport's left edge. The padding-inline formula keeps a
     minimum --space-6 gutter on narrow screens and matches the grid's
     gutter on wide ones (same wideSize). */
  padding-block: var(--space-8) var(--space-6);
  padding-inline: max(var(--space-6), calc((100% - 1280px) / 2));
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  container-type: inline-size;
}


/* -- Breadcrumb ------------------------------------------------------------ */

.orbita-plp__breadcrumb {
  font-size: var(--text-xs);
  color: var(--ink-mid);
  margin-bottom: var(--space-3);
}

.orbita-plp__breadcrumb a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--duration-fast) var(--easing-default);
}

.orbita-plp__breadcrumb a:hover {
  color: var(--accent-blue-deep);
}

.orbita-plp__breadcrumb-sep {
  color: var(--ink-light);
  margin: 0 var(--space-1);
}

/* WC breadcrumb overrides */
.orbita-plp__breadcrumb .woocommerce-breadcrumb {
  background: transparent;
  padding: 0;
  margin: 0;
  font-size: var(--text-xs);
  color: var(--ink-mid);
}


/* -- Title row ------------------------------------------------------------- */

.orbita-plp__title-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-5);
}

@media (min-width: 640px) {
  .orbita-plp__title-row {
    flex-direction: row;
    align-items: baseline;
    gap: var(--space-4);
  }
}

.orbita-plp__title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  color: var(--ink);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  margin: 0;
}

@media (min-width: 1024px) {
  .orbita-plp__title {
    font-size: var(--text-3xl);
  }
}

.orbita-plp__count {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--ink-mid);
  margin: 0;
  white-space: nowrap;
}


/* -- Active filter chips --------------------------------------------------- */

.orbita-plp-filter__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.orbita-plp-filter__chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: rgba(207, 162, 42, 0.12);
  border: 1px solid rgba(207, 162, 42, 0.3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--accent);
  text-decoration: none;
  transition: background var(--duration-fast) var(--easing-default),
              border-color var(--duration-fast) var(--easing-default);
  line-height: 1;
}

.orbita-plp-filter__chip:hover {
  background: rgba(207, 162, 42, 0.2);
  border-color: var(--accent);
}

.orbita-plp-filter__chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.orbita-plp-filter__chip--clear {
  background: transparent;
  border-color: var(--rule-strong);
  color: var(--ink-mid);
}

.orbita-plp-filter__chip--clear:hover {
  border-color: var(--ink-mid);
  color: var(--ink);
  background: transparent;
}

.orbita-plp-filter__chip-label {
  font-weight: var(--weight-medium);
}

.orbita-plp-filter__chip-remove {
  color: currentColor;
  font-size: var(--text-base);
  line-height: 1;
}


/* -- Controls bar: search + sort ------------------------------------------ */

.orbita-plp__controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

@media (min-width: 640px) {
  .orbita-plp__controls {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
  }
}


/* -- Search input ---------------------------------------------------------- */

/* QA ronda 4 ítem 6: ancho completo + placeholder visible (ink-mid, AA 4.5:1 sobre paper-card) */
.orbita-plp__search {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}

@media (min-width: 640px) {
  .orbita-plp__search {
    max-width: 420px;
    flex: 1;
  }
}

.orbita-plp__search form {
  display: flex;
  align-items: center;
  width: 100%;
  position: relative;
}

.orbita-plp__search-input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  /* padding-right: space-10 (40px) = espacio libre para el ícono de búsqueda */
  padding: var(--space-3) var(--space-10) var(--space-3) var(--space-4);
  background: var(--paper-card);
  border: 1.5px solid var(--rule-strong);
  border-radius: var(--radius-md);
  /* 16px mínimo para evitar iOS zoom en focus */
  font-size: 1rem;
  font-family: var(--font-sans);
  font-weight: var(--weight-regular);
  line-height: 1.4;
  color: var(--ink);
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--duration-fast) var(--easing-default),
              box-shadow var(--duration-fast) var(--easing-default);
}

/* Placeholder: ink-mid = #5C5348 sobre paper-card #E2DDD4 → ratio 4.5:1 (AA exacto) */
.orbita-plp__search-input::placeholder {
  color: var(--ink-mid);
  opacity: 1;   /* normalización Firefox */
  font-style: normal;
}

.orbita-plp__search-input:hover {
  border-color: var(--rule-strong);
}

.orbita-plp__search-input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(207, 162, 42, 0.15);
}

/* Remove default search clear button in WebKit */
.orbita-plp__search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.orbita-plp__search-btn {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-mid);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  transition: color var(--duration-fast) var(--easing-default);
}

.orbita-plp__search-btn:hover {
  color: var(--ink);
}

.orbita-plp__search-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


/* -- Sort select ------------------------------------------------------------ */

.orbita-plp__sort {
  flex-shrink: 0;
}

.orbita-plp__sort form {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.orbita-plp__sort-label {
  font-size: var(--text-sm);
  color: var(--ink-mid);
  white-space: nowrap;
}

.orbita-plp__sort-select {
  font-size: var(--text-sm);
  color: var(--ink);
  background-color: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  padding: var(--space-2) calc(var(--space-4) + 24px) var(--space-2) var(--space-3);
  min-height: 36px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23A6A29A' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 16px;
  min-width: 160px;
  transition: border-color var(--duration-fast) var(--easing-default);
}

.orbita-plp__sort-select:hover {
  border-color: var(--rule-strong);
}

.orbita-plp__sort-select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(207, 162, 42, 0.15);
}


/* =============================================================================
   Product card — orbita-plp-card BEM classes (design doc §3.3)
   Targeting WC product-collection inner card output with BEM overrides.
   ============================================================================= */

/* Card: article wrapper */
.orbita-plp-card {
  display: flex;
  flex-direction: column;
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--duration-fast) var(--easing-default),
              border-color var(--duration-fast) var(--easing-default),
              box-shadow var(--duration-fast) var(--easing-default);
  will-change: transform;
}

.orbita-plp-card:hover {
  transform: translateY(-2px);
  border-color: var(--rule-strong);
  box-shadow: var(--shadow-md);
}

/* The full-card link wrapper */
.orbita-plp-card__link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  height: 100%;
}

.orbita-plp-card__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Image wrap with 4:3 aspect ratio */
.orbita-plp-card__image-wrap {
  position: relative;
  aspect-ratio: var(--plp-card-image-ratio, 4 / 3);
  overflow: hidden;
  background: var(--paper-soft);
}

.orbita-plp-card__image-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--paper-soft);
  z-index: 0;
}

.orbita-plp-card__image {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform var(--duration-slow) var(--easing-default);
}

.orbita-plp-card:hover .orbita-plp-card__image {
  transform: scale(1.04);
}

/* Category badge — overlaid on bottom-left of image */
.orbita-plp-card__category {
  position: absolute;
  bottom: var(--space-2);
  left: var(--space-2);
  z-index: 2;
  background-color: rgba(14, 14, 14, 0.75);
  color: var(--ink-mid);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
}

/* Card body */
.orbita-plp-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  flex: 1;
  border-top: 1px solid var(--rule);
}

/* Title — 2-line clamp */
.orbita-plp-card__title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--ink);
  line-height: var(--leading-snug);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  transition: color var(--duration-fast) var(--easing-default);
}

.orbita-plp-card:hover .orbita-plp-card__title {
  color: var(--accent-blue);
}

/* Fitment line — mono, ink-mid, 2-line clamp */
.orbita-plp-card__fitment {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-mid);
  line-height: var(--leading-snug);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}

/* SKU — mono xs, ink-mid (D046: use --ink-mid not --ink-light for WCAG AA) */
.orbita-plp-card__sku {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-mid);   /* 5.8:1 contrast vs --paper-card — WCAG AA (D046) */
  margin: 0;
  line-height: var(--leading-normal);
}

/* CTA text — decorative (aria-hidden), accent-blue */
.orbita-plp-card__cta {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--accent-blue);
  margin-top: auto;
  padding-top: var(--space-2);
  transition: color var(--duration-fast) var(--easing-default);
}

.orbita-plp-card:hover .orbita-plp-card__cta {
  color: var(--accent-blue-deep);
  text-decoration: underline;
}


/* =============================================================================
   WhatsApp CTA strip (design doc §3.10, pattern plp-whatsapp-cta.php)
   ============================================================================= */

.orbita-plp__whatsapp-strip {
  background: var(--paper-soft);
  border-left: 4px solid var(--whatsapp);
  padding: var(--space-6);
  margin-top: var(--space-8);
}

.orbita-plp__whatsapp-strip-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-width: 1280px;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .orbita-plp__whatsapp-strip-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.orbita-plp__whatsapp-strip-heading {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--ink);
  margin: 0 0 var(--space-1);
}

.orbita-plp__whatsapp-strip-sub {
  font-size: var(--text-sm);
  color: var(--ink-mid);
  margin: 0;
}

.orbita-plp__whatsapp-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  background-color: var(--whatsapp);
  color: var(--ink-on-accent);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color var(--duration-fast) var(--easing-default);
  min-height: 44px; /* WCAG touch target */
}

@media (max-width: 767px) {
  .orbita-plp__whatsapp-btn {
    width: 100%;
    justify-content: center;
  }
}

.orbita-plp__whatsapp-btn:hover {
  background-color: var(--whatsapp-deep);
}

.orbita-plp__whatsapp-btn:focus-visible {
  outline: 2px solid var(--whatsapp-deep);
  outline-offset: 2px;
}


/* =============================================================================
   18. WC catalog-sorting block — on-brand select
   (wp:woocommerce/catalog-sorting → .wc-block-catalog-sorting > select.orderby)

   Used in taxonomy-product_cat.html inside .plp-page-header.
   Visual target: identical to .orbita-plp__sort-select (tienda /tienda/).
   Strategy: appearance:none on the native <select> + custom SVG chevron via
   background-image (same SVG already used in .orbita-plp__sort-select).
   The wrapper .wc-block-catalog-sorting becomes the flex row that aligns
   a synthetic label ("Ordenar:") with the styled select.

   WHY CSS-only (not structural unification):
   The taxonomy-product_cat template already has a .plp-page-header band with
   breadcrumb + sort. Replacing wc-block-catalog-sorting with orbita/plp-header
   would pull in server-rendered PHP that resolves product count, active filter
   chips, and a search input — all things the category template does not need
   (the sidebar handles filters; the count is in results-header; there is no
   search bar in the category context). CSS is the correct scope here.
   ============================================================================= */

/* Wrapper: flex row to align the label pseudo-element area with the select */
.wc-block-catalog-sorting {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Prepend "Ordenar:" label via pseudo-element on the wrapper.
   This matches the visible "Ordenar:" label in the orbita/plp-header sort.
   Screen readers read the <select>'s own <label> (WC renders one internally);
   the pseudo-element is decorative (aria-hidden via CSS-generated content). */
.wc-block-catalog-sorting::before {
  content: "Ordenar:";
  font-size: var(--text-sm);
  color: var(--ink-mid);
  white-space: nowrap;
  flex-shrink: 0;
}

/* The native <select> — reset appearance, apply brand tokens */
.wc-block-catalog-sorting select.orderby {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--ink);
  background-color: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);

  /* Right padding: space-3 gutter + 16px icon + space-3 gap = ~40px.
     Left padding: space-3 for text breathing room. */
  padding: var(--space-2) calc(var(--space-3) + 24px) var(--space-2) var(--space-3);
  min-height: 36px;
  min-width: 180px;

  /* Hide native arrow; replace with inline SVG chevron (same as .orbita-plp__sort-select).
     Stroke color %23A6A29A = #A6A29A (ink-light, 3.1:1 on paper-card — decorative, AA-exempt). */
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23A6A29A' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 16px;

  cursor: pointer;
  transition: border-color var(--duration-fast) var(--easing-default);

  /* Prevent overflow on 375px — shrink if container is tight */
  max-width: 100%;
  box-sizing: border-box;
}

.wc-block-catalog-sorting select.orderby:hover {
  border-color: var(--rule-strong);
}

/* Focus ring — matches the accent-gold focus used across all form controls.
   outline:none removes UA default; box-shadow provides the visible ring
   (WCAG 2.1 AA: 3px at 0.15 alpha passes 3:1 against paper-card background).
   The :focus selector covers browsers that don't support :focus-visible. */
.wc-block-catalog-sorting select.orderby:focus,
.wc-block-catalog-sorting select.orderby:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(207, 162, 42, 0.15);
}

/* Mobile refinement at 375px:
   - The label "Ordenar:" is hidden to save horizontal space; the select
     still has its own accessible <label> from WC (screen-reader-text class).
   - min-width relaxed to fill available space without overflowing.
   - min-height raised to 44px to meet WCAG 2.5.5 touch target on mobile. */
@media (max-width: 479px) {
  .wc-block-catalog-sorting::before {
    display: none;
  }

  .wc-block-catalog-sorting select.orderby {
    min-width: 0;
    width: 100%;
    min-height: 44px;
  }
}


/* =============================================================================
   Reduced motion overrides (design doc §6.6)
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
  .orbita-plp-card,
  .orbita-plp-card__image,
  .orbita-plp-filter__body,
  .orbita-plp__drawer {
    transition: none;
  }
}
