/*
 Theme Name:   Bricks Child Theme
 Theme URI:    https://bricksbuilder.io/
 Description:  Use this child theme to extend Bricks.
 Author:       Bricks
 Author URI:   https://bricksbuilder.io/
 Template:     bricks
 Version:      1.2
 Text Domain:  bricks
*/

/* ==============================================
   Variables globales (Fase 4)
   --pn-w: ancho único de contenido. 1200px en
   escritorio y 90% del ancho cuando la pantalla
   es más angosta (cubre 991 / 767 / 478).
   ============================================== */
:root {
    --pn-w: min(1200px, 90%);
}

/* ==============================================
   ÍTEM 1a — Estandarizar ancho a 1200px
   Pisa los 1400px / 1200px fijos del CSS inline de Bricks.
   ============================================== */

/* Header: sección y contenedor (antes 1400px) */
#brx-header #brxe-ptrvbc {
    width: 100%;
    max-width: var(--pn-w);
}
#brx-header #brxe-rqdohj {
    width: 100%;
    max-width: 100%;
}

/* Hero (antes 1400px) */
#brx-content #brxe-extjcu {
    width: 100%;
    max-width: var(--pn-w);
}

/* Secciones que Bricks reduce a 90% en ≤991px: se dejan al 100%
   y el margen lo da el contenedor (evita el doble encogimiento 90% x 90%). */
#brx-content #brxe-lxmvzh,
#brx-content #brxe-eqpqjp,
#brx-content #brxe-wdxceo {
    width: 100%;
}

/* "Últimas publicaciones" y "Novedades" (antes 1200px fijos) */
#brx-content #brxe-yrpfjc,
#brx-content #brxe-slucfe {
    width: 100%;
    max-width: var(--pn-w);
}

/* Footer: contenedor principal (antes 1400px) y créditos (antes 1200px) */
#brx-footer #brxe-qwtvug,
#brx-footer #brxe-mhunch {
    width: 100%;
    max-width: var(--pn-w);
}

/* Responsive del hero: en móvil el relleno lateral de 60px del texto
   es excesivo. Altura de 600px sin tocar. */
@media (max-width: 767px) {
    #brx-content #brxe-lwdgtg .slider-content {
        padding-left: 20px;
        padding-right: 20px;
    }
}

/* ==============================================
   ÍTEM 1c — "Libros desde el desierto de Atacama"
   Más espacio arriba y abajo + divider al ancho del bloque.
   ============================================== */
#brx-content #brxe-lxmvzh {
    margin-top: 0;
    padding-top: clamp(32px, 5vw, 56px);
    padding-bottom: clamp(32px, 5vw, 56px);
}
#brx-content #brxe-jijjky {
    width: 100%;
    max-width: var(--pn-w);
    margin-top: 16px;
    margin-bottom: 0;
}
#brx-content #brxe-jijjky.horizontal .line {
    width: 100%;
}

/* ==============================================
   ÍTEM 1d — Overlay oscuro al 80% en ambas listas
   (Últimas publicaciones y Novedades), solo en Inicio.
   ============================================== */
body.home #brxe-purvmw .overlay-wrapper,
body.home .brxe-twoelw .overlay-wrapper {
    background-color: rgba(33, 33, 33, 0.8);
}
body.home .brxe-twoelw .overlay-inner {
    background-color: transparent;
}

/* ==============================================
   ÍTEM 2 — Footer: créditos y enlaces a la derecha.
   Logo y lema se quedan a la izquierda.
   Solo ≥768px: en móvil se conserva el centrado de Bricks.
   ============================================== */
@media (min-width: 768px) {
    #brx-footer #brxe-qwtvug {
        justify-content: space-between;
    }
    /* Logo + lema: izquierda */
    #brx-footer #brxe-zkmbam {
        width: auto;
        align-items: flex-start;
        text-align: left;
    }
    /* Redes + enlaces de políticas: derecha */
    #brx-footer #brxe-xzzkxu {
        width: auto;
        margin-left: auto;
        align-items: flex-end;
        text-align: right;
    }
    #brx-footer #brxe-xzzkxu .brxe-text-link {
        text-align: right;
    }
    #brx-footer #brxe-vqhucr {
        justify-content: flex-end;
    }
    /* Créditos © */
    #brx-footer #brxe-mhunch {
        align-items: flex-end;
    }
    #brx-footer #brxe-swdiop {
        align-self: flex-end;
        margin-left: auto;
        text-align: right;
    }
}

/* ==============================================
   ÍTEM 3 — Catálogo: info a la izquierda, filas
   alineadas desde arriba, botón debajo de la tarjeta.
   ============================================== */
.brxe-woocommerce-products .products.woocommerce {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 30px;
    align-items: start;                 /* filas desde arriba */
}

.brxe-woocommerce-products .products.woocommerce::before,
.brxe-woocommerce-products .products.woocommerce::after {
    display: none !important;
}

.brxe-woocommerce-products .products.woocommerce .repeater-item.product {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start;        /* contenido pegado arriba */
    align-self: start;                  /* cada tarjeta mide lo que mide su texto */
    float: none !important;
    width: auto !important;
    clear: none !important;
    text-align: left;
}

.brxe-woocommerce-products .products.woocommerce .repeater-item.product .dynamic {
    text-align: left;
}

/* Miniatura: sin margin-top:auto, alineada a la izquierda */
.brxe-woocommerce-products .products.woocommerce .repeater-item.product .dynamic:first-child {
    margin-top: 0 !important;
    overflow: hidden;
}
.brxe-woocommerce-products .products.woocommerce .repeater-item.product .dynamic:first-child img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    transition: transform 0.35s ease, filter 0.35s ease;
}
.brxe-woocommerce-products .products.woocommerce .repeater-item.product:hover .dynamic:first-child img {
    transform: scale(1.06);
    filter: brightness(1.05);
}

/* Botón: último elemento, justo debajo del precio, alineado a la izquierda */
.brxe-woocommerce-products .products.woocommerce .repeater-item.product .dynamic:last-child {
    margin-top: 12px !important;
    display: flex !important;
    justify-content: flex-start !important;
}

/* Botón estilo oscuro */
.brxe-woocommerce-products .products.woocommerce .add_to_cart_button {
    background-color: #1a1a1a !important;
    color: #ffffff !important;
    border: none !important;
    padding: 10px 20px;
    border-radius: 4px;
    text-align: center;
    display: inline-block;
    transition: background-color 0.2s ease;
}
.brxe-woocommerce-products .products.woocommerce .add_to_cart_button:hover {
    background-color: #333333 !important;
    color: #ffffff !important;
}
.brxe-woocommerce-products .products.woocommerce .button {
    text-align: center;
    display: inline-block;
}

/* ==============================================
   ÍTEM 4 / Fase 5 — Caluga reutilizable .book-card
   ============================================== */

.book-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
    gap: 30px;
    align-items: start;
}
.book-grid__item {
    margin: 0;
    padding: 0;
    list-style: none;
}

.book-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin: 0;
    padding: 0;
    text-align: left;
}

.book-card__media {
    display: block;
    overflow: hidden;
    line-height: 0;
}
.book-card__media img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    transition: transform 0.35s ease, filter 0.35s ease;
}
.book-card:hover .book-card__media img,
.book-card:focus-within .book-card__media img {
    transform: scale(1.06);
    filter: brightness(1.05);
}

.book-card__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 12px;
}
.book-card__title {
    margin: 0;
    font-size: 16px;
    line-height: 1.3;
    font-weight: 600;
}
.book-card__title a {
    color: inherit;
    text-decoration: none;
}
.book-card__title a:hover,
.book-card__title a:focus-visible {
    text-decoration: underline;
}
.book-card__author {
    margin: 0;
    font-size: 14px;
    line-height: 1.3;
    color: #636363;
}
.book-card__author a {
    color: inherit;
    text-decoration: none;
}
.book-card__author a:hover,
.book-card__author a:focus-visible {
    text-decoration: underline;
}
.book-card__price {
    margin: 4px 0 0;
    font-size: 15px;
    font-weight: 600;
    color: #212121;
}

.book-card__action {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin-top: 12px;
}
.book-card .button {
    background-color: #1a1a1a;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    text-align: center;
    display: inline-block;
    transition: background-color 0.2s ease;
}
.book-card .button:hover,
.book-card .button:focus-visible {
    background-color: #333333;
    color: #ffffff;
}
.book-card .added_to_cart {
    font-size: 14px;
}

/* --- Sección "Productos relacionados" (ítem 4) --- */
.book-related {
    clear: both;
    width: 100%;
    margin: 60px 0 0;
}
.book-related__title {
    margin: 0 0 24px;
    font-size: 20px;
    text-transform: uppercase;
}

/* --- Variante .book-card--hover-info (Fase 5) --- */
@media (hover: hover) and (min-width: 768px) {
    .book-card--hover-info {
        display: grid;
        grid-template-columns: 1fr;
    }
    .book-card--hover-info .book-card__media,
    .book-card--hover-info .book-card__body {
        grid-area: 1 / 1;
    }
    .book-card--hover-info .book-card__body {
        align-self: end;
        margin-top: 0;
        padding: 16px;
        background-color: rgba(33, 33, 33, 0.8);
        color: #e0e0e0;
        opacity: 0;
        transform: translateY(12px);
        transition: opacity 0.3s ease, transform 0.3s ease;
        pointer-events: none;
        z-index: 1;
    }
    .book-card--hover-info:hover .book-card__body,
    .book-card--hover-info:focus-within .book-card__body {
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }
    .book-card--hover-info .book-card__title,
    .book-card--hover-info .book-card__author,
    .book-card--hover-info .book-card__price {
        color: #f5f5f5;
        text-transform: uppercase;
        font-size: 14px;
    }
    .book-card--hover-info .book-card__action {
        grid-area: 2 / 1;
    }
}

/* Accesibilidad: sin animaciones si el usuario lo pide */
@media (prefers-reduced-motion: reduce) {
    .book-card__media img,
    .brxe-woocommerce-products .products.woocommerce .repeater-item.product .dynamic:first-child img,
    .book-card--hover-info .book-card__body {
        transition: none;
    }
    .book-card:hover .book-card__media img,
    .brxe-woocommerce-products .products.woocommerce .repeater-item.product:hover .dynamic:first-child img {
        transform: none;
    }
}
