/* =========================================================
   CORATTO PET — IMÁGENES DEL CATÁLOGO
   Archivo separado del catalogo.css.

   Objetivo:
   - no deformar fotografías;
   - alimentos siempre 1:1;
   - en no-alimentos, adaptar la altura visual por fila;
   - la imagen conserva su proporción real;
   - las imágenes más bajas dejan bordes/fondo para mantener
     textos y botones alineados;
   - las imágenes muy largas se contienen dentro de un límite
     máximo, sin agrandar la card indefinidamente.
   ========================================================= */

/* ---------------------------------------------------------
   CARD / ÁREA DE FOTOGRAFÍA
   --------------------------------------------------------- */

.catalog-page .card-image {
    position: relative;
    display: grid;
    width: 100%;
    place-items: center;
    overflow: hidden;

    border-bottom: 1px solid rgb(189 125 49 / 15%);
    background:
        radial-gradient(circle at 50% 45%, rgb(255 255 255 / 34%), transparent 70%),
        linear-gradient(145deg, #f8ead7, #edd2af);
}

/* Alimentos: se mantienen siempre cuadrados. */
.catalog-page .catalog-card--alimentos .card-image {
    aspect-ratio: 1 / 1;
}

/* No-alimentos: el JS calcula una altura común para cada fila. */
.catalog-page .catalog-card:not(.catalog-card--alimentos) .card-image {
    height: var(--catalog-image-row-height, auto);
    min-height: 0;
}

/* Imagen principal: nunca se estira ni se deforma. */
.catalog-page .card-image > img {
    display: block;
    width: 100%;
    height: 100%;

    padding: 0;
    border: 0;
    border-radius: 0;

    object-fit: contain;
    object-position: center;

    background: transparent;
    box-shadow: none;

    transition: none;
}

/* Mientras el JS calcula la fila evitamos saltos gigantes. */
.catalog-page .catalog-card:not(.catalog-card--alimentos)
.card-image:not(.is-image-measured) {
    aspect-ratio: 4 / 5;
}

/* Una vez medida, manda la altura calculada por fila. */
.catalog-page .catalog-card:not(.catalog-card--alimentos)
.card-image.is-image-measured {
    aspect-ratio: auto;
}

/* Clases informativas que deja el JS según la proporción real. */
.catalog-page .card-image.is-image-landscape > img,
.catalog-page .card-image.is-image-square > img,
.catalog-page .card-image.is-image-portrait > img,
.catalog-page .card-image.is-image-extra-tall > img {
    object-fit: contain;
}

/* La grilla estira las cards de una misma fila de forma uniforme. */
.catalog-page .catalog-grid {
    align-items: stretch;
}


/* ---------------------------------------------------------
   PLACEHOLDER SIN IMAGEN
   --------------------------------------------------------- */

.catalog-page .image-placeholder {
    display: grid;

    width: 100%;
    height: 100%;

    place-items: center;
    align-content: center;

    gap: .55rem;

    padding: 1.5rem;

    color: #75533a;

    background:
        radial-gradient(circle at center,
            rgb(255 255 255 / 60%),
            transparent 8rem),
        linear-gradient(145deg,
            #f8ead8,
            #efd6b6);

    font-family: var(--sans);
    font-size: .62rem;
    font-weight: 750;

    text-align: center;
}


.catalog-page .image-placeholder::before {
    content: "CORATTO";

    display: grid;

    width: 4.5rem;
    height: 4.5rem;

    place-items: center;
    justify-self: center;

    border: 1px solid rgb(189 125 49 / 24%);
    border-radius: 50%;

    color: #a66a2c;

    background:
        radial-gradient(circle at 38% 32%,
            #fffdf8,
            #f2dfc4);

    font-family: var(--serif);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .08em;
}


.catalog-page .image-placeholder small {
    display: block;

    color: #8b7360;

    font-size: .7rem;
    font-weight: 600;
    line-height: 1.3;
}


/* ---------------------------------------------------------
   BADGE FRACCIONABLE SOBRE LA FOTO
   --------------------------------------------------------- */

.catalog-page .fraction-badge {
    position: absolute !important;

    top: .75rem !important;
    left: .75rem !important;
    right: auto !important;
    bottom: auto !important;

    z-index: 3;

    display: inline-flex !important;

    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;

    align-items: center;
    justify-content: center;

    padding: .36rem .58rem !important;

    border: 1px solid rgb(255 255 255 / 48%);
    border-radius: 999px !important;

    color: #fffaf4;

    background: rgb(82 53 36 / 90%);

    font-size: .65rem;
    font-weight: 850;
    line-height: 1;

    box-shadow: 0 .28rem .7rem rgb(49 31 21 / 16%);

    transform: none !important;
}

@media (max-width: 699px) {
    .catalog-page .fraction-badge {
        top: .48rem !important;
        left: .48rem !important;
        padding: .3rem .45rem !important;
        font-size: .6rem;
    }
}

@media (max-width: 599px) {
    .catalog-page .fraction-badge {
        top: .46rem !important;
        left: .46rem !important;
        padding: .28rem .42rem !important;
        font-size: .56rem;
    }
}


/* ---------------------------------------------------------
   FICHA / IMAGEN PRINCIPAL Y GALERÍA
   --------------------------------------------------------- */

.catalog-page .detail-image {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;

    border: 1px solid rgb(189 130 56 / 22%);
    border-radius: 1.3rem;

    background: linear-gradient(145deg, #fffaf2, #e8d1b4);
}

.catalog-page .detail-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    padding: clamp(14px, 2vw, 26px);
}

.catalog-page .product-gallery__viewport,
.catalog-page .product-gallery__slide {
    width: 100%;
    height: 100%;
}

.catalog-page .product-gallery__slide {
    position: absolute;
    inset: 0;

    margin: 0;

    opacity: 0;
    visibility: hidden;

    transition: opacity .42s ease, visibility .42s ease;
}

.catalog-page .product-gallery__slide.is-active {
    position: relative;
    opacity: 1;
    visibility: visible;
}

.catalog-page .product-gallery__arrow {
    position: absolute;
    z-index: 3;
    top: 50%;

    display: grid;
    width: 2.85rem;
    height: 2.85rem;

    place-items: center;

    padding: 0;

    transform: translateY(-50%);

    border: 1px solid rgb(84 58 42 / 16%);
    border-radius: 50%;

    color: var(--catalog-brown);
    background: rgb(255 253 248 / 92%);

    box-shadow: 0 .55rem 1.4rem rgb(84 58 42 / 16%);

    cursor: pointer;

    transition:
        transform .2s ease,
        background-color .2s ease,
        box-shadow .2s ease;
}

.catalog-page .product-gallery__arrow:hover,
.catalog-page .product-gallery__arrow:focus-visible {
    background: #fff;
    box-shadow: 0 .7rem 1.6rem rgb(84 58 42 / 22%);
}

.catalog-page .product-gallery__arrow:hover {
    transform: translateY(-50%) scale(1.06);
}

.catalog-page .product-gallery__arrow:focus-visible {
    outline: 3px solid rgb(189 130 56 / 28%);
    outline-offset: 2px;
}

.catalog-page .product-gallery__arrow span {
    display: block;
    margin-top: -.13rem;

    font-family: Georgia, serif;
    font-size: 2rem;
    font-weight: 400;
    line-height: 1;
}

.catalog-page .product-gallery__arrow--prev {
    left: .9rem;
}

.catalog-page .product-gallery__arrow--next {
    right: .9rem;
}

.catalog-page .product-gallery__footer {
    position: absolute;
    z-index: 3;
    right: .85rem;
    bottom: .8rem;
    left: .85rem;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: .7rem;

    pointer-events: none;
}

.catalog-page .product-gallery__dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .38rem;

    padding: .42rem .55rem;

    border: 1px solid rgb(84 58 42 / 10%);
    border-radius: 999px;

    background: rgb(255 253 248 / 88%);

    box-shadow: 0 .35rem 1rem rgb(84 58 42 / 10%);

    backdrop-filter: blur(6px);
    pointer-events: auto;
}

.catalog-page .product-gallery__dot {
    width: .48rem;
    height: .48rem;

    padding: 0;

    border: 0;
    border-radius: 50%;

    background: rgb(84 58 42 / 28%);

    cursor: pointer;

    transition: width .2s ease, background-color .2s ease;
}

.catalog-page .product-gallery__dot.is-active {
    width: 1.25rem;
    border-radius: 999px;
    background: #bd8238;
}

.catalog-page .product-gallery__dot:focus-visible {
    outline: 2px solid #bd8238;
    outline-offset: 2px;
}

.catalog-page .product-gallery__counter {
    min-width: 2.8rem;

    padding: .4rem .55rem;

    border: 1px solid rgb(84 58 42 / 10%);
    border-radius: 999px;

    color: #704b25;
    background: rgb(255 253 248 / 88%);

    box-shadow: 0 .35rem 1rem rgb(84 58 42 / 10%);

    font-size: .76rem;
    font-weight: 800;
    line-height: 1;
    text-align: center;

    backdrop-filter: blur(6px);
}

@media (min-width: 851px) and (max-width: 1099px) {
    .catalog-page .detail-image {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }
}

@media (max-width: 699px) {
    .catalog-page .detail-image {
        width: 100%;
        max-width: 18rem;
        aspect-ratio: 1 / 1;

        margin-inline: auto;

        border-radius: .9rem;
    }

    .catalog-page .detail-image img {
        padding: .35rem;
    }

    .catalog-page .product-gallery__arrow {
        width: 2.35rem;
        height: 2.35rem;
    }

    .catalog-page .product-gallery__arrow--prev {
        left: .55rem;
    }

    .catalog-page .product-gallery__arrow--next {
        right: .55rem;
    }

    .catalog-page .product-gallery__footer {
        right: .55rem;
        bottom: .5rem;
        left: .55rem;
    }

    .catalog-page .product-gallery__counter {
        font-size: .7rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .catalog-page .product-gallery__slide,
    .catalog-page .product-gallery__arrow,
    .catalog-page .product-gallery__dot {
        transition: none;
    }
}


/* ---------------------------------------------------------
   DESCUENTOS SOBRE FOTOGRAFÍA
   --------------------------------------------------------- */

/* =========================================================
   DESCUENTO VISUAL SOBRE FOTOGRAFÍA
   Ícono Coratto + porcentaje dinámico
   ========================================================= */

.catalog-page .card-image,
.catalog-page .detail-image {
    position: relative;
}

.catalog-page .catalog-discount-icon {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 8;

    display: flex;
    width: 88px;
    align-items: center;
    flex-direction: column;

    pointer-events: none;
}

.catalog-page .catalog-discount-icon img {
    position: relative;
    padding: 0;
    border-radius: 0;
    display: block;
    width: 78px;
    height: 78px;

    object-fit: contain;

    filter: drop-shadow(0 5px 9px rgba(74, 47, 27, .17));
}


/* Badge clásico inmediatamente debajo del sello. */
.catalog-page .catalog-discount-icon strong {
    position: relative;
    z-index: 2;

    min-width: 58px;

    margin-top: -7px;
    padding: 6px 10px;

    border: 2px solid rgba(255, 250, 244, .9);
    border-radius: 999px;

    color: #fff;
    background: #A63D32;

    font-size: .78rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: .01em;
    text-align: center;

    box-shadow:
        0 5px 12px rgba(166, 61, 50, .24),
        0 1px 3px rgba(76, 42, 27, .12);
}


/* En ficha el llamado puede ser todavía más protagonista. */
.catalog-page .catalog-discount-icon--detail {
    top: 20px;
    right: 20px;

    width: 108px;
}

.catalog-page .catalog-discount-icon--detail img {
    width: 96px;
    height: 96px;
}

.catalog-page .catalog-discount-icon--detail strong {
    min-width: 68px;

    margin-top: -8px;
    padding: 7px 12px;

    font-size: .88rem;
}


/* Tablet */
@media (min-width: 769px) and (max-width: 1099px) {
    .catalog-page .catalog-discount-icon {
        width: 80px;
    }

    .catalog-page .catalog-discount-icon img {
        width: 70px;
        height: 70px;
    }

    .catalog-page .catalog-discount-icon strong {
        min-width: 54px;
        padding: 5px 9px;
        font-size: .72rem;
    }

    .catalog-page .catalog-discount-icon--detail {
        width: 94px;
    }

    .catalog-page .catalog-discount-icon--detail img {
        width: 84px;
        height: 84px;
    }
}


/* Móvil */
@media (max-width: 768px) {
    .catalog-page .catalog-discount-icon {
        top: 8px;
        right: 8px;

        width: 68px;
    }

    .catalog-page .catalog-discount-icon img {
        width: 60px;
        height: 60px;
    }

    .catalog-page .catalog-discount-icon strong {
        min-width: 46px;

        margin-top: -5px;
        padding: 4px 7px;

        border-width: 1px;

        font-size: .64rem;
    }

    .catalog-page .catalog-discount-icon--detail {
        top: 12px;
        right: 12px;

        width: 82px;
    }

    .catalog-page .catalog-discount-icon--detail img {
        width: 74px;
        height: 74px;
    }

    .catalog-page .catalog-discount-icon--detail strong {
        min-width: 54px;

        margin-top: -6px;
        padding: 5px 8px;

        font-size: .7rem;
    }
}
