/* =========================================================
   Camila Builder — composants affichés sur le site
   S'appuie sur base.css du thème (variables, titres, classe .btn).
   ========================================================= */

.cb {
    --cb-gap: clamp(2rem, 1.5rem + 1.5vw, 2.75rem);
}

/* Couleurs des composants. Inversées dans une section à fond foncé (voir « Section ») ;
   l'encadré, toujours sur fond rose pâle, reprend celles-ci. */
:is(.cb, .cb-box) {
    --cb-ink: #000;                           /* texte */
    --cb-title: var(--c-accent);              /* titres, grands liens */
    --cb-title-hover: var(--c-accent-dark);
    --cb-subtitle: var(--c-accent-ink);       /* sous-titres (H3) */
    --cb-link: var(--c-accent-ink);           /* liens dans les textes */
    --cb-link-hover: var(--c-accent-dark);
    --cb-line: #f3c7bd;                       /* filets */
}

/* Espacement vertical, dans la page, une section ou le contenu d'un bloc image + texte :
   serré sous un titre, large autour des titres, des encadrés et des blocs image + texte */
:is(.cb, .cb-section__inner, .cb-media__content) > * + * {
    margin-top: 1rem;
}

:is(.cb, .cb-section__inner) > * + .cb-heading,
:is(.cb, .cb-section__inner) > * + :is(.cb-box, .cb-media, .cb-cards),
:is(.cb, .cb-section__inner) > :is(.cb-box, .cb-media, .cb-cards) + * {
    margin-top: var(--cb-gap);
}

:is(.cb, .cb-section__inner, .cb-media__content) > * + .cb-button {
    margin-top: 2rem;
}

/* ---------- Titre ---------- */

.cb h2.cb-heading {
    color: var(--cb-title);
    font-size: clamp(1.5rem, 1.25rem + 1vw, 1.875rem);
}

.cb h3.cb-heading {
    color: var(--cb-subtitle);
    font-family: var(--f-title);
    font-size: clamp(1.25rem, 1.15rem + .5vw, 1.5rem);
    font-weight: 400;
    line-height: 1.2;
}

/* Surtitre : petit texte en capitales, collé au titre qui suit */
.cb-kicker {
    color: var(--cb-subtitle);
    font-size: .9375rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
}

:is(.cb, .cb-section__inner, .cb-media__content) > .cb-kicker + .cb-heading {
    margin-top: .35rem;
}

/* ---------- Texte ---------- */

/* Maquette : noir, police légère, 20px */
.cb-text,
.cb-box__text {
    color: var(--cb-ink);
    font-weight: 300;
}

:is(.cb-text, .cb-box__text) a {
    color: var(--cb-link);
}

:is(.cb-text, .cb-box__text) a:hover {
    color: var(--cb-link-hover);
}

/* Le gras par défaut (« bolder ») ne monterait qu'à 400 depuis une police légère */
.cb-text strong,
.cb-box__text strong {
    font-weight: 700;
}

.cb-text {
    font-size: 1.25rem;
}

.cb-text > * + *,
.cb-box__text > * + * {
    margin-top: .9em;
}

.cb-text ul,
.cb-text ol,
.cb-box__text ul,
.cb-box__text ol {
    padding-left: 1.4em;
}

.cb-text li + li,
.cb-box__text li + li {
    margin-top: .3em;
}

/* ---------- Encadré ---------- */

.cb-box {
    max-width: 760px;
    margin-inline: auto;
    padding: clamp(1.5rem, 1rem + 2vw, 2.25rem) clamp(1.25rem, .5rem + 3vw, 3rem);
    border: 1px solid #eba597;
    border-radius: 14px;
    background: var(--c-surface);
    text-align: center;
}

.cb .cb-box__title {
    margin-bottom: .6rem;
    color: var(--cb-title);
    font-size: clamp(1.375rem, 1.2rem + .75vw, 1.625rem);
}

/* Un cran au-dessus du texte courant, comme sur la maquette */
.cb-box__text {
    font-size: 1.375rem;
    line-height: 1.5;
}

/* ---------- Bouton ---------- */

/* Bouton .btn du thème : styles et animation (goutte au survol, onde au clic) dans
   base.css et assets/js/button.js du thème. */

.cb-button--center {
    text-align: center;
}

.cb-button--right {
    text-align: right;
}

/* ---------- Image et texte ---------- */

/* Deux colonnes, contenu centré verticalement face à l'image (≈ 5/11 et 6/11) */
.cb-media {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: clamp(2rem, 1rem + 6vw, 7.5rem);
    align-items: center;
}

.cb-media--left {
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
}

.cb-media--left .cb-media__image {
    order: -1;
}

.cb-media__image img {
    width: 100%;
    border-radius: 8px;
}

/* Contenu avec des petits encadrés : il prend plus de place que l'image (écrans larges) */
@media (min-width: 768px) {
    .cb-media:has(> .cb-media__content > .cb-cards) {
        grid-template-columns: minmax(0, 6fr) minmax(0, 4fr);
        gap: clamp(2rem, 1rem + 4vw, 4.5rem);
    }

    .cb-media--left:has(> .cb-media__content > .cb-cards) {
        grid-template-columns: minmax(0, 4fr) minmax(0, 6fr);
    }
}

/* Pas d'image : le contenu prend toute la largeur */
.cb-media.cb-media--text {
    grid-template-columns: minmax(0, 1fr);
}

/* Image pas encore choisie, pour une personne connectée (voir media.php et swap.php) */
.cb-placeholder {
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 5;
    padding: 1rem;
    border: 2px dashed #f3c7bd;
    border-radius: 8px;
    background: var(--c-surface);
    color: var(--c-accent-ink);
    font-size: .875rem;
    text-align: center;
}

/* Petite image posée devant la grande, à gauche (maquette « À propos ») */
.cb-media__image--duo {
    position: relative;
    width: min(100%, 440px);
    margin-left: auto;
    padding-left: 14%;
}

.cb-media__image--duo > img:first-child {
    border-radius: 16px;
}

.cb-media__image .cb-media__small {
    position: absolute;
    top: 20%;
    left: 0;
    width: 56%;
    aspect-ratio: 5 / 6;
    object-fit: cover;
    border: 5px solid #fff;
    border-radius: 12px;
    box-shadow: 0 18px 40px rgb(150 59 41 / .18);
}

/* Mobile : une colonne, l'image au-dessus du contenu */
@media (max-width: 767px) {
    .cb-media,
    .cb-media--left {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.75rem;
    }

    .cb-media__image {
        order: -1;
    }

    .cb-media__image--duo {
        margin-inline: auto;
    }
}

/* ---------- Bulles A + B = C ---------- */

.cb-bubbles {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .6rem;
    padding: 1rem 1.1rem;
    border-radius: 12px;
    background: var(--c-surface);
    font-size: 1.0625rem;
    line-height: 1.3;
}

.cb-bubbles__item {
    padding: .3em .8em;
    border-radius: 999px;
    background: #fff;
    color: #000;
}

/* « = » reste avec la dernière bulle quand la ligne se coupe */
.cb-bubbles__result {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.cb-bubbles b {
    color: var(--c-accent);
    font-family: var(--f-title);
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1;
}

/* ---------- Petits encadrés ---------- */

.cb-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 1.25rem;
    padding: 0;
    list-style: none;
}

.cb-media__content > * + .cb-cards {
    margin-top: 1.75rem;
}

.cb-card {
    padding: 1.25rem 1.4rem 1.4rem;
    border-radius: 12px;
    background: var(--c-surface);
}

/* Sur un fond de section, les encadrés passent en blanc */
.cb-section .cb-card {
    background: #fff;
}

/* Titre précédé d'un petit cœur */
.cb-card__title {
    display: flex;
    align-items: center;
    gap: .4em;
    color: var(--c-accent-ink);
    font-family: var(--f-title);
    font-size: clamp(1.25rem, 1.15rem + .4vw, 1.4rem);
    font-weight: 400;
    line-height: 1.2;
}

.cb-card__title::before {
    content: "";
    flex: none;
    width: 1.3em;
    aspect-ratio: 1;
    background: url("../img/heart.svg") center / contain no-repeat;
}

.cb-card__text {
    margin-top: .5rem;
    color: #000;
    font-size: 1.0625rem;
    font-weight: 300;
}

.cb-card__text > * + * {
    margin-top: .6em;
}

.cb-card__text strong {
    font-weight: 700;
}

/* ---------- Liens et images ---------- */

/* Grands liens séparés par un filet, flèche qui glisse au survol */
.cb-media__content > .cb-swap__item + .cb-swap__item {
    margin-top: 0;
}

/* Nom (et sa pastille), description dessous, flèche à droite */
.cb-swap__link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 1rem;
    padding: .45em 0;
    border-bottom: 1px solid var(--cb-line);
    color: var(--cb-title);
    font-family: var(--f-title);
    font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.25rem);
    line-height: 1.15;
    text-decoration: none;
    transition: color .25s;
}

/* Filet du haut sur le premier lien d'une série */
.cb-swap__item:not(.cb-swap__item + .cb-swap__item) .cb-swap__link {
    border-top: 1px solid var(--cb-line);
}

.cb-swap__label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .25rem .75rem;
}

/* Pastille : « Bientôt », « dès 8 € »… */
.cb-swap__badge {
    padding: .2em .75em;
    border-radius: 999px;
    background: #fed1d1;
    color: var(--c-accent-dark);
    font-family: var(--f-text);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
}

.cb-swap__text {
    grid-column: 1;
    margin-top: .25rem;
    color: var(--cb-ink);
    font-family: var(--f-text);
    font-size: 1.0625rem;
    font-weight: 300;
    line-height: 1.4;
}

.cb-swap__arrow {
    grid-area: 1 / 2 / 3 / 3;
    font-size: .8em;
    opacity: 0;
    transform: translateX(-.6em);
    transition: opacity .25s, transform .25s;
}

a.cb-swap__link:is(:hover, :focus-visible, .is-active) {
    color: var(--cb-title-hover);
}

a.cb-swap__link:is(:hover, :focus-visible, .is-active) .cb-swap__arrow {
    opacity: 1;
    transform: none;
}

/* Images empilées dans un cadre au format de la première (--ratio, voir swap.php), fondu entre elles */
.cb-swap__images {
    position: relative;
    aspect-ratio: var(--ratio, 4 / 5);
}

.cb-swap__frame {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: 8px;
}

.cb-swap__frame .cb-placeholder {
    height: 100%;
    aspect-ratio: auto;
}

.cb-swap__images img {
    position: absolute;
    inset: 0;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.03);
    transition: opacity .5s ease, transform .8s ease;
}

.cb-swap__images img.is-active {
    opacity: 1;
    transform: none;
}

/* ---------- Décorations (champ « Décoration » d'Image et texte, Liens et images) ---------- */

/* Cœur de la maquette, coupé au bord gauche de l'écran, à mi-hauteur du bloc (écrans larges).
   50cqw : demi-largeur de la page si elle est un conteneur (.page-main du thème), sinon de l'écran. */
.cb-decor--heart-edge {
    position: relative;
    isolation: isolate;
}

.cb-decor--heart-edge::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: 50%;
    left: calc(50% - 50cqw);
    height: clamp(300px, 26vw, 420px);
    aspect-ratio: 269 / 465;
    background: url("../img/coeur-gauche.svg") left center / contain no-repeat;
    transform: translateY(-50%);
    pointer-events: none;
}

/* Cœur pâle qui dépasse à gauche du bas de l'image */
.cb-decor--heart-image .cb-media__image {
    position: relative;
    isolation: isolate;
}

.cb-decor-heart {
    position: absolute;
    z-index: -1;
    bottom: 4%;
    left: -85px;
    width: clamp(110px, 12vw, 170px);
    aspect-ratio: 1;
    background: url("../img/heart.svg") center / contain no-repeat;
    opacity: .3;
    transform: rotate(-14deg);
    pointer-events: none;
}

@media (max-width: 1279px) {
    .cb-decor--heart-edge::before {
        display: none;
    }
}

@media (max-width: 767px) {
    .cb-decor-heart {
        display: none;
    }
}

/* ---------- Section ---------- */

/* Fond sur toute la largeur de l'écran (--cb-section-bg, voir section.php), contenu dans
   la colonne de la page. L'ombre prolonge le fond sur les côtés sans élargir la page
   (pas de défilement horizontal) ; clip-path la coupe en haut et en bas. */
.cb-section {
    padding-block: clamp(3rem, 2rem + 4vw, 5.5rem);
    background: var(--cb-section-bg, transparent);
    box-shadow: 0 0 0 100vmax var(--cb-section-bg, transparent);
    clip-path: inset(0 -100vmax);
}

.cb > * + .cb-section,
.cb > .cb-section + * {
    margin-top: var(--cb-gap);
}

/* Deux sections qui se suivent : leurs fonds se touchent */
.cb > .cb-section + .cb-section {
    margin-top: 0;
}

/* Fond foncé : texte, titres, liens et filets en blanc, bouton inversé */
.cb-section--dark {
    --cb-ink: #fff;
    --cb-title: #fff;
    --cb-title-hover: #fff;
    --cb-subtitle: #fff;
    --cb-link: #fff;
    --cb-link-hover: #fff;
    --cb-line: rgba(255, 255, 255, .4);
}

.cb-section--dark .cb-button .btn {
    --btn-wave: var(--c-accent-ink);
    background: #fff;
    color: var(--c-accent-ink);
}

@media (hover: hover) {
    .cb-section--dark .cb-button .btn:hover {
        background: #fff;
    }
}
