/* =========================================================
   Camila — carte d'un bijou (parts/product-card.php)
   Photo, nom, catégorie, prix et bouton ; toute la carte est cliquable.
   Au survol, elle s'incline vers la souris (assets/js/product-card.js
   donne --tilt-x et --tilt-y, de -1 à 1) et une ombre apparaît ; ses autres
   photos défilent en fondu, avec des flèches.
   ========================================================= */

.product-card {
    --tilt-x: 0;
    --tilt-y: 0;
    --lift: 0px;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border: 1px solid #fbe1df;
    border-radius: 6px;
    background: #fff;
    /* Le côté sous la souris s'enfonce légèrement */
    transform: perspective(900px) translateY(var(--lift)) rotateX(calc(var(--tilt-y) * -5deg)) rotateY(calc(var(--tilt-x) * 5deg));
    transition: transform .6s cubic-bezier(.22, .61, .36, 1), box-shadow .35s ease;
}

/* Pendant que la souris bouge : la carte suit sans retard */
.product-card--tilt {
    transition: transform .12s ease-out, box-shadow .35s ease;
}

@media (hover: hover) {
    .product-card:hover {
        --lift: -4px;
        /* L'ombre glisse à l'opposé de la souris */
        box-shadow: calc(var(--tilt-x) * -10px) calc(16px - var(--tilt-y) * 6px) 34px rgb(206 87 65 / .18);
    }
}

/* Le lien du titre porte le focus : l'anneau entoure toute la carte */
.product-card:has(a:focus-visible) {
    outline: 2px solid var(--c-accent-ink);
    outline-offset: 3px;
}

.product-card-img {
    position: relative;
    isolation: isolate; /* les photos empilées restent sous le lien qui recouvre la carte */
    aspect-ratio: 5 / 4;
    background: var(--c-surface);
}

.product-card-img img {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Photos suivantes, ajoutées au premier survol par assets/js/product-card.js : empilées sur
   la première. La photo montrée apparaît en fondu par-dessus la précédente, qui reste
   visible dessous le temps du fondu. */
.product-card-img img + img {
    position: absolute;
    inset: 0;
}

.product-card-img--slides img {
    opacity: 0;
    transition: opacity .6s ease; /* FADE dans product-card.js */
}

.product-card-img--slides img.is-previous {
    z-index: 1;
    opacity: 1;
}

.product-card-img--slides img.is-current {
    z-index: 2;
    opacity: 1;
}

/* Flèches sur la photo, au survol : au-dessus du lien qui recouvre la carte (le reste
   de la photo mène toujours au bijou) */
.product-card-nav {
    position: absolute;
    z-index: 2;
    inset: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    aspect-ratio: 5 / 4;
    padding: 0 .5rem;
    pointer-events: none;
}

.product-card-arrow {
    display: grid;
    place-items: center;
    width: 2.1rem;
    height: 2.1rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgb(255 255 255 / .85);
    box-shadow: 0 2px 8px rgb(206 87 65 / .18);
    color: var(--c-accent-ink);
    cursor: pointer;
    opacity: 0;
    pointer-events: auto;
    transition: opacity .25s ease, background-color .2s, transform .2s;
}

.product-card:hover .product-card-arrow {
    opacity: 1;
}

.product-card-arrow:hover {
    background: #fff;
    transform: scale(1.08);
}

/* Pas encore de photo : un cœur pâle */
.product-card-img--empty {
    display: grid;
    place-items: center;
}

.product-card-img--empty::before {
    content: "";
    width: 22%;
    aspect-ratio: 1;
    background: url("../img/heart.svg") center / contain no-repeat;
    opacity: .25;
}

.product-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: .3rem;
    padding: .9rem 1rem 1rem;
    color: #000;
    font-size: 1.25rem;
}

.product-card-title {
    color: var(--c-accent-ink);
    font-family: var(--f-title);
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.25;
}

.product-card-title a {
    color: inherit;
    text-decoration: none;
}

/* Le lien recouvre toute la carte */
.product-card-title a::after {
    content: "";
    position: absolute;
    z-index: 1;
    inset: 0;
}

.product-card-title a:focus-visible {
    outline: none;
}

/* Pastilles de la couleur (ou de la finition) d'une déclinaison, devant « Pois · Rose » */
.product-card-swatch {
    display: inline-block;
    width: .8em;
    height: .8em;
    margin-right: .15em;
    border-radius: 50%;
    background: var(--swatch);
    box-shadow: inset 0 0 0 1px rgb(0 0 0 / .14);
    vertical-align: -.05em;
}

.product-card-swatch:last-of-type {
    margin-right: .4em;
}

.product-card-price {
    color: var(--c-accent-ink);
    font-family: var(--f-title);
    font-size: 1.25rem;
}

.product-card-btn {
    align-self: center;
    max-width: 100%;
    margin-top: auto;
    padding: .2rem .75rem;
    border-radius: 4px;
    background: var(--c-accent-ink);
    color: #fff;
    font-size: 1.25rem;
    text-align: center;
    transition: background-color .2s;
}

.product-card:hover .product-card-btn {
    background: var(--c-accent-dark);
}

/* Bijou en plusieurs styles : « Choisir mon style », rose pâle */
.product-card-btn--soft {
    background: #fdd0cd;
    color: var(--c-accent-dark);
}

.product-card:hover .product-card-btn--soft {
    background: #fbc0bb;
}

/* Bijou épuisé : bouton gris */
.product-card-btn--out,
.product-card:hover .product-card-btn--out {
    background: #ece7e6;
    color: var(--c-text-soft);
}

@media (prefers-reduced-motion: reduce) {
    .product-card {
        transform: none;
    }

    /* Les photos changent quand même, sans fondu */
    .product-card-img--slides img {
        transition: none;
    }
}
