/* ============================================================
   cogent-archive.css
   Product archive restyle — Shop + product category/tag pages.
   Scoped to body.cogent-archive. CSS-only chrome (header, toolbar,
   pagination). Grid + card markup handled in next step via a
   content-product.php override. Does NOT touch archive-product.php.
   Design tokens (--cg-*) come from cogent-child style.css.
   ============================================================ */

body.cogent-archive #page,
body.cogent-archive .site,
body.cogent-archive #content,
body.cogent-archive .site-content,
body.cogent-archive #primary,
body.cogent-archive .content-area,
body.cogent-archive #main,
body.cogent-archive .site-main,
body.cogent-archive article,
body.cogent-archive .hentry,
body.cogent-archive .entry-content,
body.cogent-archive .page-content {
    background: transparent !important;
}

/* ---- Container width (match home inner) ---- */
.cogent-archive .col-full { max-width: 1280px; }

/* ---- Kill Storefront's full-width-content padding + margin on archive header ----
   When sidebar-1 has no widgets, Storefront adds .storefront-full-width-content
   to <body> and applies padding: 0 0 5.9968em (~96px) to .woocommerce-products-header.
   Additionally, an external margin-bottom contributes ~100px residual gap.
   The .woocommerce-notices-wrapper empty div is collapsed to prevent phantom height. */
body.cogent-archive .woocommerce-products-header {
    padding: 0 0 1.5rem !important;
    margin-bottom: 0 !important;
    text-align: left !important;
}
body.cogent-archive .woocommerce-notices-wrapper:empty {
    display: none;
}

/* ---- Page header ---- */
.cogent-archive .woocommerce-breadcrumb {
    margin: 0 0 1rem; padding: 0;
    font-size: 0.8125rem; color: var(--cg-muted);
}
.cogent-archive .woocommerce-breadcrumb a { color: var(--cg-muted); text-decoration: none; }
.cogent-archive .woocommerce-breadcrumb a:hover { color: var(--cg-accent); }

.cogent-archive .woocommerce-products-header { margin: 0 0 1.5rem; text-align: left; }
.cogent-archive .woocommerce-products-header__title,
.cogent-archive .page-title {
    margin: 0 0 0.5rem; text-align: left;
    font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2;
    color: var(--cg-text);
}
.cogent-archive .term-description {
    max-width: 65ch; margin: 0;
    font-size: 0.9375rem; line-height: 1.6; color: var(--cg-muted);
}
.cogent-archive .term-description p:last-child { margin-bottom: 0; }

/* ---- Toolbar: result count + ordering ----
   Storefront wraps these in .storefront-sorting. If the toolbar
   doesn't pick up the styling on render, report the actual wrapper
   class so we adjust the selector. */
.cogent-archive .storefront-sorting {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    margin: 0 0 1.75rem; padding: 0.75rem 0;
    border-top: 1px solid var(--cg-border); border-bottom: 1px solid var(--cg-border);
}
.cogent-archive .woocommerce-result-count {
    margin: 0; font-size: 0.875rem; color: var(--cg-muted);
}
.cogent-archive .woocommerce-ordering { margin: 0; }
.cogent-archive .woocommerce-ordering select.orderby,
.cogent-archive select.orderby {
    appearance: none; -webkit-appearance: none;
    min-height: 44px; padding: 0.5rem 2.25rem 0.5rem 0.85rem;
    font-size: 0.875rem; line-height: 1.4; color: var(--cg-text);
    background-color: #fff; border: 1px solid var(--cg-border);
    border-radius: var(--cg-radius, 8px); cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.7rem center; background-size: 12px;
}
.cogent-archive .woocommerce-ordering select.orderby:focus { outline: none; border-color: var(--cg-text); }

/* ---- Toolbar split: top = count + sort only / bottom = pagination only ----
   Both toolbars share .storefront-sorting with no distinguishing class.
   The bottom toolbar immediately follows ul.products → use adjacent sibling (+). */
/* Top toolbar: hide pagination */
.cogent-archive .storefront-sorting .woocommerce-pagination {
    display: none;
}
/* Bottom toolbar: show pagination, hide count + sort */
.cogent-archive ul.products + .storefront-sorting .woocommerce-pagination {
    display: block;
}
.cogent-archive ul.products + .storefront-sorting .woocommerce-result-count,
.cogent-archive ul.products + .storefront-sorting .woocommerce-ordering {
    display: none;
}
/* Bottom toolbar: remove flex + borders (pagination-only, centered) */
.cogent-archive ul.products + .storefront-sorting {
    display: block;
    border-top: none;
    border-bottom: none;
    padding: 0;
    margin-bottom: 0;
}

/* ---- Pagination ---- */
.cogent-archive .woocommerce-pagination { margin-top: 2.5rem; text-align: center; }
.cogent-archive .woocommerce-pagination ul.page-numbers {
    display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem;
    margin: 0; padding: 0; border: none;
}
.cogent-archive .woocommerce-pagination ul.page-numbers li { margin: 0; border: none; }
.cogent-archive .woocommerce-pagination .page-numbers {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 40px; height: 40px; padding: 0 0.6rem;
    font-size: 0.875rem; color: var(--cg-text) !important; text-decoration: none;
    background: #fff !important; border: 1px solid var(--cg-border) !important;
    border-radius: var(--cg-radius, 8px);
    transition: border-color 0.15s ease;
}
.cogent-archive .woocommerce-pagination .page-numbers:hover { border-color: var(--cg-text) !important; }
.cogent-archive .woocommerce-pagination .page-numbers.current {
    color: var(--cg-cta-text, #fafaf7) !important;
    background: var(--cg-cta-bg, #1a1a1a) !important;
    border-color: var(--cg-cta-bg, #1a1a1a) !important;
}
.cogent-archive .woocommerce-pagination .page-numbers.dots {
    background: transparent !important; border-color: transparent !important;
}

/* ---- Product grid — mobile-first ---- */
.cogent-archive ul.products {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important; /* phone: 2 col */
    gap: 0.75rem;
    margin: 0 0 1rem; padding: 0; list-style: none;
}
@media (min-width: 768px) {
    .cogent-archive ul.products {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important; /* tablet: 3 col */
        gap: 1.25rem;
    }
}
@media (min-width: 1024px) {
    .cogent-archive ul.products {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important; /* desktop: 4 col */
        gap: 1.5rem;
    }
}
.cogent-archive ul.products::before,
.cogent-archive ul.products::after { content: none; display: none; }
.cogent-archive ul.products li.product {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    margin: 0 !important;
    padding: 0;
    float: none !important;
    clear: none;
}
.cogent-archive .cogent-card { width: 100%; }

/* ---- Card ---- */
.cogent-archive .cogent-card {
    display: flex; flex-direction: column;
    background: #FAFAF7;
    border-radius: var(--cg-radius, 8px); overflow: hidden;
}
.cogent-archive .cogent-card__media {
    position: relative; display: block;
    aspect-ratio: 4 / 3; background: #FAFAF7;
}
.cogent-archive .cogent-card__img { width: 100%; height: 100%; object-fit: contain; display: block; }
.cogent-archive .cogent-card__img-ph {
    position: absolute; inset: 0; display: none;
    align-items: center; justify-content: center;
    color: #c7c7bf; background: #FAFAF7;
}
.cogent-archive .cogent-card__badge {
    position: absolute; top: 0.6rem; left: 0.6rem; z-index: 2;
    padding: 0.2rem 0.5rem; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em;
    color: var(--cg-cta-text, #fafaf7); background: var(--cg-cta-bg, #1a1a1a); border-radius: 4px;
}
.cogent-archive .cogent-card__body {
    display: flex; flex-direction: column; gap: 0.5rem;
    padding: 0.65rem 0.7rem 0.85rem; flex: 1; /* tighter on mobile */
}
@media (min-width: 768px) {
    .cogent-archive .cogent-card__body {
        padding: 0.85rem 0.9rem 1rem;
    }
}
.cogent-archive .cogent-card__name {
    font-size: 0.8125rem; font-weight: 600; line-height: 1.35;
    color: var(--cg-text); text-decoration: none;
    /* No mid-word breaks — whole words only */
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: none;
}
@media (min-width: 768px) {
    .cogent-archive .cogent-card__name { font-size: 0.9375rem; }
}
.cogent-archive .cogent-card__name:hover { color: var(--cg-accent); }
.cogent-archive .cogent-card__price {
    font-size: 0.8125rem; color: var(--cg-orange); margin-top: auto;
    /* Price range ($X – $Y): let it wrap between amounts, not inside them */
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
}
@media (min-width: 768px) {
    .cogent-archive .cogent-card__price { font-size: 0.9375rem; }
}
.cogent-archive .cogent-card__price del { color: var(--cg-muted); font-weight: 400; margin-right: 0.35rem; }
.cogent-archive .cogent-card__price ins { text-decoration: none; font-weight: 600; color: var(--cg-orange); }
.cogent-archive .cogent-card__action { margin-top: 0.25rem; }

/* Add-to-cart button (WC loop button) */
.cogent-archive .cogent-card .button {
    display: inline-flex; align-items: center; justify-content: center;
    width: 100%; min-height: 44px; padding: 0.5rem 1rem;
    font-size: 0.875rem; font-weight: 600; line-height: 1.2;
    text-align: center; text-decoration: none;
    border-radius: var(--cg-radius, 8px); cursor: pointer;
    transition: opacity 0.15s ease, border-color 0.15s ease;
}
/* Simple product -> solid black CTA */
.cogent-archive .cogent-card .button.add_to_cart_button {
    color: var(--cg-cta-text, #fafaf7); background: var(--cg-cta-bg, #1a1a1a);
    border: 1px solid var(--cg-cta-bg, #1a1a1a);
}
.cogent-archive .cogent-card .button.add_to_cart_button:hover { opacity: 0.88; }
/* Variable / grouped / external -> outline "Select options" */
.cogent-archive .cogent-card .button.product_type_variable,
.cogent-archive .cogent-card .button.product_type_grouped,
.cogent-archive .cogent-card .button.product_type_external {
    color: var(--cg-text); background: #fff; border: 1px solid var(--cg-border);
}
.cogent-archive .cogent-card .button.product_type_variable:hover { border-color: var(--cg-text); }
/* "View cart" link after AJAX add */
.cogent-archive .cogent-card a.added_to_cart {
    width: auto; min-height: 0; margin-top: 0.4rem; padding: 0;
    color: var(--cg-accent); background: transparent; border: none; text-decoration: underline; font-weight: 500;
}

/* ============================================================
   CART PAGE LAYOUT
   Goal: cart items (left) + cart totals sidebar (right) always
   visible above the fold; cross-sells full-width strip below.

   How it works:
   - .woocommerce (WC shortcode wrapper) → flex container
   - form.woocommerce-cart-form → flex: 1 (takes remaining width)
   - .cart-collaterals → 320 px fixed sidebar (totals only,
     cross-sells were moved out via hook in functions.php)
   - .cogent-cross-sells → flex: 0 0 100% below
   ============================================================ */

/* Stack everything on mobile; side-by-side on desktop */
.woocommerce-cart .woocommerce {
    display: flex;
    flex-wrap: wrap;
}

/* All direct WC children default to full width */
.woocommerce-cart .woocommerce > .woocommerce-notices-wrapper,
.woocommerce-cart .woocommerce > form.woocommerce-cart-form,
.woocommerce-cart .woocommerce > .cart-collaterals,
.woocommerce-cart .woocommerce > .cogent-cross-sells {
    flex: 0 0 100%;
    float: none !important; /* cancel any Storefront/WC floats */
    width: 100% !important;
}

/* Desktop ≥ 960 px: cart form + totals sidebar side by side */
@media (min-width: 960px) {
    .woocommerce-cart .woocommerce {
        gap: 2rem;
        align-items: flex-start;
    }
    .woocommerce-cart .woocommerce > form.woocommerce-cart-form {
        flex: 1 1 0 !important;
        min-width: 0;
        width: auto !important;
    }
    .woocommerce-cart .woocommerce > .cart-collaterals {
        flex: 0 0 320px !important;
        width: 320px !important;
    }
}

/* Cart totals: full width inside its sidebar column.
   Overrides Storefront's .cart_totals { float:right; width:48% } */
.woocommerce-cart .cart-collaterals .cart_totals {
    float: none !important;
    width: 100% !important;
    padding: 0 !important;
}
/* Remove the h2 default margin inside cart totals */
.woocommerce-cart .cart_totals > h2 {
    margin-top: 0;
}

/* ============================================================
   Cross-sells section (below the side-by-side block)
   ============================================================ */

.cogent-cross-sells {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--cg-border, #E5E5E0);
}

.cogent-cross-sells__title {
    font-family: var(--cg-font, 'Inter', system-ui, sans-serif);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--cg-text, #1A1A1A);
    margin: 0 0 1rem;
}

/* 3-col max (override archive's 4-col desktop rule) */
@media (min-width: 1024px) {
    .cogent-cross-sells ul.products {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

/* ── Compact card overrides for cross-sells ──────────────────
   Same markup, smaller presentation — secondary upsell strip. */

/* Shorter image area (archive = 4/3, cross-sells = 3/2) */
.cogent-cross-sells .cogent-card__media {
    aspect-ratio: 3 / 2;
}

/* Tighter body padding and less gap */
.cogent-cross-sells .cogent-card__body {
    padding: 0.45rem 0.6rem 0.6rem !important;
    gap: 0.2rem !important;
}

/* Smaller text */
.cogent-cross-sells .cogent-card__name {
    font-size: 0.75rem !important;
    line-height: 1.3 !important;
}
.cogent-cross-sells .cogent-card__price {
    font-size: 0.75rem !important;
}

/* Compact button */
.cogent-cross-sells .cogent-card .button {
    min-height: 34px !important;
    padding: 0.35rem 0.65rem !important;
    font-size: 0.78rem !important;
    line-height: 1.2 !important;
}


/* ============================================================
   ARCHIVES SOBRE EL LIENZO OSCURO
   ------------------------------------------------------------
   El lienzo #1A1A1A, las curvas y la elevacion de #page los
   pone style.css via body.cogent-dark. Aqui solo se invierte
   lo que va DIRECTAMENTE sobre el negro. Las tarjetas
   .cogent-card conservan su fondo #FAFAF7, el select de orden
   y la paginacion son controles blancos: su interior no se toca.

   OJO: esta hoja tambien se carga en el carrito, que NO es
   oscuro. Por eso todo va prefijado con .cogent-archive, clase
   que solo existe en shop y taxonomias de producto.
   ============================================================ */

/* ---- Cabecera sobre el negro ---- */
body.cogent-archive .woocommerce-breadcrumb,
body.cogent-archive .woocommerce-breadcrumb a {
    color: rgba(255, 255, 255, 0.72);
}

body.cogent-archive .woocommerce-breadcrumb a:hover {
    color: #FFFFFF;
}

body.cogent-archive .woocommerce-products-header__title,
body.cogent-archive .page-title {
    color: #FFFFFF;
}

body.cogent-archive .term-description {
    color: rgba(255, 255, 255, 0.72);
}

/* ---- Toolbar de ordenacion ---- */
body.cogent-archive .storefront-sorting {
    border-top-color: rgba(255, 255, 255, 0.10);
    border-bottom-color: rgba(255, 255, 255, 0.10);
}

body.cogent-archive .woocommerce-result-count {
    color: rgba(255, 255, 255, 0.72);
}
