/* Vignettes produits Affiliate Pilot (idees cadeaux CN)
   Design calque sur les ProductTile de Geek Planet, valeurs exactes du front GP
   (globals.css + ProductTile.tsx) : police Inter, card blanche rounded-12,
   image carree, titre 14px bold 2 lignes, prix 20px black italic + euro en
   exposant, bouton pilule verte "Voir l'offre" 16px bold italic, chevrons nus
   scale au survol. Sliders volontairement DETACHES du systeme legacy
   (winamaz/slider.css) : classes cn-ap-* uniquement + init owl dediee
   (cn-ap-cards.js). Prefixe .cn-ap- safeliste dans le RUCSS WP Rocket. */

/* Inter AUTO-HEBERGEE (variable 100-900, latin) : le lien Google Fonts restait
   "unloaded" sur le site (woff2 jamais telecharges) -> les chiffres tombaient en
   Segoe UI faux-gras oblique, plus gros et rond que l'Inter (source du
   "l'icone amazon est trop au-dessus"). GP auto-heberge aussi (next/font). */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/wp-content/uploads/cn-ap-fonts/inter-latin.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: italic;
    font-weight: 100 900;
    font-display: swap;
    src: url('/wp-content/uploads/cn-ap-fonts/inter-italic-latin.woff2') format('woff2');
}

/* Contexte clair (decision Arnaud : pas de fond sombre sur CN). La bande est
   un conteneur neutre LARGEUR CONTRAINTE : 3 cards entieres + gouttieres
   chevrons, centre dans la colonne (le slider debordait a droite sinon). */
.cn-ap-band {
    background: transparent;
    padding: 0;
    margin: 12px auto 20px;
    max-width: 1000px;
}

.cn-ap-band,
.cn-ap-band * {
    box-sizing: border-box;
}

/* Grille de vignettes : 4 colonnes desktop, cap 8 produits cote PHP (grille
   4x2), SANS slider (retire le 11/07 - plus de fleches ni de reperes ; le
   survol des controles declenchait l'estompage des cards, et 8 vignettes
   visibles d'un coup valent mieux qu'un carrousel). */
.cn-ap-slider {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 0 16px;
}

@media (max-width: 1024px) {
    .cn-ap-slider {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 760px) {
    .cn-ap-slider {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 0 12px;
    }
}

.cn-ap-item {
    display: flex;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* ---------------------------------------------------------------- card --- */

/* Tile GP (bg-white rounded-xl py-4 gap-2) adaptee au fond blanc de CN :
   bordure fine + ombre douce pour le relief que GP obtient par son fond sombre. */
.cn-ap-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding: 16px;
    text-align: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .07);
    transition: box-shadow .3s ease;
}

.cn-ap-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, .12);
}

/* !important obligatoire : le theme pose des font-family via des selecteurs
   a ID (#...) qui battent n'importe quelle classe - les chiffres du prix
   partaient dans la police display du site (ronde, plus grande que l'Inter,
   d'ou "l'icone amazon trop au-dessus" : c'etaient les chiffres qui debordaient). */
.cn-ap-card,
.cn-ap-card * {
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif !important;
}

/* Effet signature GP : au survol du slider, les cards soeurs s'estompent VERS LE
   BLANC (voile ::after) et non vers la transparence -> on ne voit plus le fond de
   la page a travers la vignette, elle garde un fond blanc plein (demande Arnaud). */
.cn-ap-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #fff;
    opacity: 0;
    border-radius: inherit;
    transition: opacity .5s ease;
    pointer-events: none;
    z-index: 4;
}

/* L'estompage ne se declenche QUE lorsqu'une vignette est reellement survolee
   (:has) : survoler le conteneur, un espace entre cards ou d'anciens controles
   ne doit rien estomper (demande Arnaud 11/07). */
@media (hover: hover) {
    .cn-ap-slider:has(.cn-ap-card:hover) .cn-ap-card::after {
        opacity: .6;
    }

    /* Meme prefixe :has() que la regle d'estompage : sans lui, la specificite
       du :has (celle de son argument) ferait estomper AUSSI la card survolee. */
    .cn-ap-slider:has(.cn-ap-card:hover) .cn-ap-card:hover::after {
        opacity: 0;
    }
}

.cn-ap-card-top {
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
}

.cn-ap-card-imgwrap {
    aspect-ratio: 1 / 1;
    max-height: 240px; /* borne la hauteur des vignettes (couvertures portrait) */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    transition: padding .5s ease;
}

.cn-ap-card:hover .cn-ap-card-imgwrap {
    padding: 0;
}

.cn-ap-card-imgwrap {
    overflow: hidden; /* rien ne depasse de la boite image, quoi qu il arrive */
}

.cn-ap-card-imgwrap img {
    width: auto;
    height: auto;
    max-width: 100% !important;
    max-height: 100% !important; /* blinde contre les height:auto du theme */
    object-fit: contain;
    margin: 0;
    border: 0;
    box-shadow: none;
}

.cn-ap-card-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 3em;
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    font-style: normal;
    line-height: 1.5;
    color: #111827;
}

/* ------------------------------------------------------------- prix --- */

/* Metriques EXACTES de la ligne prix GP (mesurees sur le site) :
   fonte 20px dans une boite de ligne 28px (text-xl Tailwind) qui enveloppe
   l'icone 24px, euro en vertical-align:sub. Pas de hacks de nudge. */
.cn-ap-card-price {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 8px 0 0;
    font-size: 20px;
    font-weight: 900;
    font-style: italic;
    line-height: 28px;
    color: #111827;
}

.cn-ap-card-price .cn-ap-amazon {
    /* GP etire son asset 24x23 en 25x25 carre (attrs width/height 25).
       translateY(6px) : reglage optique demande par Arnaud (11/07). */
    width: 25px;
    height: 25px;
    margin: 0;
    border: 0;
    transform: translateY(6px);
}

/* Euro : reproduction EXACTE du rendu GP = preflight Tailwind sur sup
   (line-height:0; position:relative; top:-0.5em) + leur classe align-sub.
   Sans le preflight, le sub seul coulait le symbole sous la ligne.
   L'italique est herite du parent comme chez GP (font-normal = graisse seule). */
.cn-ap-card-price sup {
    font-weight: 400;
    font-size: .8em;
    color: #4b5563;
    line-height: 0;
    position: relative;
    top: -.5em;
    vertical-align: sub;
    margin-left: 2px;
}

/* ----------------------------------------------------------- bouton --- */

/* Bouton pleine largeur comme sur GP (le flex-col des tiles etire le bouton). */
.cn-ap-buy {
    display: block;
    width: 100%;
    cursor: pointer;
    margin: 4px 0 0;
    padding: 4px 16px;
    font-size: 16px;
    font-weight: 700;
    font-style: italic;
    line-height: 1.5;
    color: #fff;
    text-align: center;
    background: #4ade80;
    background: oklch(78.71% .1616 153.72);
    border: 1px solid rgba(0, 0, 0, .05);
    border-radius: 9999px;
    transition: all .3s ease;
    -webkit-user-select: none;
    user-select: none;
}

.cn-ap-buy:hover {
    background: #15803d;
    background: oklch(56.71% .1629 148.3);
    box-shadow: 0 0 0 4px rgba(21, 128, 61, .2);
    color: #fff;
}

.cn-ap-buy svg {
    width: .8em;
    height: .8em;
    margin-left: 8px;
    display: inline-block;
    vertical-align: -.05em;
    fill: currentColor;
}

/* (Le slider Owl - chevrons, dots, stage - a ete retire le 11/07 : grille pure,
   cap 8 vignettes. cn-ap-cards.js est un stub conserve pour le cache-busting.) */

/* Lien "guide complet" vers la fiche dediee (pages thematiques), place APRES le
   texte et AVANT le slider, aligne a gauche. Lien editorial epure : vert nature,
   soulignement qui se DEPLOIE de gauche a droite au survol (background-size
   anime, plus fluide qu'un border-bottom) + fleche qui glisse. Pas de pilule. */
.cn-ap-guide {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 2px 0 20px;
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    color: #1f7a37 !important; /* !important : le theme force la couleur des liens */
    text-decoration: none;
    transition: color .25s ease;
}

.cn-ap-guide-txt {
    background-image: linear-gradient(currentColor, currentColor);
    background-position: 0 100%;
    background-repeat: no-repeat;
    background-size: 0 2px;
    padding-bottom: 2px;
    transition: background-size .3s ease;
}

.cn-ap-guide:hover,
.cn-ap-guide:focus {
    color: #14532d !important;
    text-decoration: none;
}

.cn-ap-guide:hover .cn-ap-guide-txt,
.cn-ap-guide:focus .cn-ap-guide-txt {
    background-size: 100% 2px;
}

.cn-ap-guide svg {
    width: 13px;
    height: 13px;
    fill: currentColor;
    flex: 0 0 auto;
    transition: transform .25s ease;
}

.cn-ap-guide:hover svg,
.cn-ap-guide:focus svg {
    transform: translateX(4px);
}

/* Vignette marchand Nature & Decouvertes (produits du flux CN melanges au
   carousel). Nom marchand vert au-dessus du prix ; hauteur de la zone prix
   normalisee pour aligner les boutons "Voir l'offre" avec les vignettes Amazon. */
.cn-ap-card-price {
    min-height: 42px;
}

/* Logo N&D inline a cote du prix, comme l'icone Amazon (meme disposition). */
.cn-ap-card-price .cn-ap-nd-icon {
    width: 24px;
    height: 24px;
    margin: 0;
    border: 0;
    border-radius: 3px;
    flex: 0 0 auto;
}

/* ---------------------------------------------- comparatif editorial --- */
/* Chaque produit = une carte "review" moderne. Les selecteurs .cn-ap-cmp *
   passent en !important la ou le theme (#content-plante-article h3/h4/p/ul...)
   l'emporterait par la specificite de son id. Prefixe .cn-ap- safeliste RUCSS. */
.cn-ap-cmp {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 16px;
    padding: 26px 30px 24px;
    margin: 0 0 26px !important;
    box-shadow: 0 2px 12px rgba(17, 24, 39, .05);
}

.cn-ap-cmp-head {
    display: flex;
    gap: 26px;
    align-items: center;
    padding-bottom: 22px;
    margin-bottom: 22px;
    border-bottom: 1px solid #f0f1f3;
}

.cn-ap-cmp-media {
    position: relative;
    flex: 0 0 auto;
}

.cn-ap-cmp-rank {
    position: absolute;
    top: -11px;
    left: -11px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #4ade80;
    background: oklch(78.71% .1616 153.72);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    font-style: normal;
    line-height: 34px;
    text-align: center;
    box-shadow: 0 2px 7px rgba(21, 128, 61, .4);
    z-index: 2;
}

.cn-ap-cmp-img {
    display: block;
    width: 168px;
    height: 168px;
    object-fit: contain;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 14px;
    padding: 10px;
    cursor: pointer;
}

.cn-ap-cmp-meta {
    flex: 1 1 auto;
    min-width: 0;
}

.cn-ap-cmp-title {
    margin: 0 0 16px !important;
    padding: 0 !important;
    border: 0 !important;
    font-size: 21px !important;
    font-weight: 800 !important;
    line-height: 1.3 !important;
    color: #111827 !important;
    text-transform: none !important;
}

.cn-ap-cmp-offer {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.cn-ap-cmp-price {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 26px;
    font-weight: 900;
    font-style: italic;
    line-height: 30px;
    color: #111827;
}

.cn-ap-cmp-price .cn-ap-amazon {
    width: 27px;
    height: 27px;
    margin: 0;
    border: 0;
    transform: translateY(6px);
}

.cn-ap-cmp-price sup {
    font-size: .55em;
    font-weight: 400;
    font-style: normal;
    color: #6b7280;
    line-height: 0;
    position: relative;
    top: -.55em;
    vertical-align: sub;
    margin-left: 2px;
}

/* CTA IDENTIQUE aux vignettes verticales (.cn-ap-buy) : meme balise span, meme
   style (16px italique, padding 4px 16px, pilule verte). On ne touche QUE la
   largeur (pas 100% dans l'en-tete horizontal) via une largeur mini confortable. */
.cn-ap-cmp-cta {
    width: auto !important;
    min-width: 200px;
    margin: 0 !important;
}

.cn-ap-cmp-sec {
    margin: 0 0 20px;
}

.cn-ap-cmp-sec:last-child {
    margin-bottom: 0;
}

.cn-ap-cmp h4 {
    margin: 0 0 9px !important;
    padding: 0 !important;
    border: 0 !important;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    letter-spacing: .05em;
    text-transform: uppercase !important;
    text-decoration: none !important;
    color: #3f8a5c !important;
}

.cn-ap-cmp p {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 15.5px !important;
    line-height: 1.75 !important;
    color: #374151 !important;
}

/* Points forts / faibles : deux panneaux colores a icones (fini le tableau). */
.cn-ap-cmp-pc {
    display: flex;
    gap: 16px;
    margin: 0 0 20px;
    flex-wrap: wrap;
}

.cn-ap-cmp-pc-col {
    flex: 1 1 240px;
    border-radius: 12px;
    padding: 15px 18px 16px;
}

.cn-ap-cmp-pros {
    background: #f0fdf4;
    border: 1px solid #c6f0d4;
}

.cn-ap-cmp-cons {
    background: #fff8f1;
    border: 1px solid #fadcbe;
}

.cn-ap-cmp-pc-h {
    margin: 0 0 10px;
    font-size: 12.5px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.cn-ap-cmp-pros .cn-ap-cmp-pc-h {
    color: #15803d;
}

.cn-ap-cmp-cons .cn-ap-cmp-pc-h {
    color: #c2410c;
}

.cn-ap-cmp-pc-col ul {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.cn-ap-cmp-pc-col li {
    position: relative;
    margin: 0 0 8px !important;
    padding: 0 0 0 25px !important;
    font-size: 14.5px !important;
    line-height: 1.5 !important;
    color: #374151 !important;
    list-style: none !important;
}

.cn-ap-cmp-pc-col li:last-child {
    margin-bottom: 0 !important;
}

.cn-ap-cmp-pc-col li::before {
    position: absolute;
    left: 0;
    top: -1px;
    font-size: 15px;
    font-weight: 700;
}

.cn-ap-cmp-pros li::before {
    content: "\2713";
    color: #16a34a;
}

.cn-ap-cmp-cons li::before {
    content: "\2013";
    color: #ea580c;
}

/* Avis de la redaction : encadre accentue. */
.cn-ap-cmp-verdict {
    background: #f8faf9;
    border: 1px solid #e6efe9;
    border-left: 4px solid #4ade80;
    border-left-color: oklch(78.71% .1616 153.72);
    border-radius: 0 12px 12px 0;
    padding: 16px 20px;
}

@media (max-width: 640px) {
    .cn-ap-cmp {
        padding: 20px 18px 18px;
    }

    .cn-ap-cmp-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 18px;
    }

    .cn-ap-cmp-img {
        width: 148px;
        height: 148px;
    }

    .cn-ap-cmp-title {
        font-size: 19px !important;
    }

    .cn-ap-cmp-pc {
        flex-direction: column;
        gap: 12px;
    }
}

/* ----------------------------------------- chips thematiques (sous H1) --- */
/* Centrees sous le H1 (lui-meme centre), largeur contenue, respiration
   avant/apres pour detacher le bloc du titre et du contenu. */
.cn-ap-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 9px 10px;
    max-width: 820px;
    margin: 28px auto 34px;
    padding: 0 16px;
}

.cn-ap-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 15px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: #374151;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    text-decoration: none !important;
    box-shadow: none !important;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.cn-ap-chip:hover,
.cn-ap-chip:focus {
    background: #4ade80;
    background: oklch(78.71% .1616 153.72);
    border-color: transparent;
    color: #fff !important;
}

.cn-ap-chip.is-active {
    background: #4ade80;
    background: oklch(78.71% .1616 153.72);
    border-color: transparent;
    color: #fff !important;
    font-weight: 700;
}

@media (max-width: 600px) {
    .cn-ap-chips {
        gap: 7px;
    }

    .cn-ap-chip {
        padding: 5px 13px;
        font-size: 13px;
    }
}

/* ---- Chips : bloc croppe a 3 lignes + bouton voir plus (12/07) ---- */
.cn-ap-chips--crop {
    max-height: 116px; /* 3 lignes de chips (32px) + 2 gaps (9px) + marge */
    overflow: hidden;
}
.cn-ap-chips--crop.is-open {
    max-height: none;
}
.cn-ap-chips-more {
    display: none;
    text-align: center;
    margin: -22px auto 34px;
}
.cn-ap-chips-more.is-visible {
    display: block;
}
.cn-ap-chips-more button {
    background: none;
    border: none;
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    text-decoration: underline;
    cursor: pointer;
}
.cn-ap-chips-more button:hover {
    color: #111827;
}
.cn-ap-chips-title {
    text-align: center;
    margin: 34px 0 6px;
}
.cn-ap-related {
    margin-top: 26px;
}
@media (max-width: 760px) {
    .cn-ap-chips--crop {
        max-height: 104px;
    }
}

/* ============ BATCH1 mobile slider + gradient chips (12/07) ============ */
/* Slider horizontal visible sur mobile : grandes vignettes, peek de la suivante,
   scroll-snap + scrollbar stylee (on VOIT que c'est un slider). */
@media (max-width: 760px) {
    .cn-ap-slider {
        display: flex !important;
        grid-template-columns: none !important;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 14px;
        padding: 2px 2px 14px;
        scrollbar-width: thin;
        scrollbar-color: #9ca3af #eceef1;
    }
    .cn-ap-slider > .cn-ap-item {
        flex: 0 0 78%;
        max-width: 78%;
        scroll-snap-align: center;
    }
    .cn-ap-slider::-webkit-scrollbar {
        height: 6px;
    }
    .cn-ap-slider::-webkit-scrollbar-track {
        background: #eceef1;
        border-radius: 6px;
    }
    .cn-ap-slider::-webkit-scrollbar-thumb {
        background: #9ca3af;
        border-radius: 6px;
    }
    /* grandes images produit sur mobile : boite bornee, ratio preserve */
    .cn-ap-slider .cn-ap-card-imgwrap {
        max-height: 260px;
    }
}
/* Gradient blanc de disparition en bas des chips croppees (avant "Voir plus") */
.cn-ap-chips--crop {
    position: relative;
}
.cn-ap-chips--crop.has-more::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 48px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #ffffff 92%);
    pointer-events: none;
}
.cn-ap-chips--crop.is-open::after {
    display: none;
}

/* ---- Carte produit contenu (shim ex-winamaz) ---- */
.cn-ap-hcard {
    display: flex;
    align-items: center;
    gap: 18px;
    max-width: 640px;
    margin: 18px auto;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}
.cn-ap-hcard-img {
    flex: 0 0 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 150px;
    overflow: hidden;
}
.cn-ap-hcard-img img {
    max-width: 100% !important;
    max-height: 150px !important;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0;
    border: 0;
    box-shadow: none;
}
.cn-ap-hcard-body {
    flex: 1;
    min-width: 0;
}
.cn-ap-hcard-title {
    font-weight: 600;
    font-size: 15px;
    line-height: 1.4;
    margin: 0 0 10px;
}
.cn-ap-hcard-offer {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.cn-ap-hcard-cta {
    width: auto !important;
    min-width: 170px;
}
.cn-ap-hcard--vertical {
    flex-direction: column;
    text-align: center;
    max-width: 320px;
}
.cn-ap-hcard--vertical .cn-ap-hcard-offer {
    justify-content: center;
}
@media (max-width: 600px) {
    .cn-ap-hcard {
        flex-direction: column;
        text-align: center;
    }
    .cn-ap-hcard-offer {
        justify-content: center;
    }
}

/* cn-hcard-designfix-20260712 : design vignettes horizontales super-aliments */
.cn-ap-hcard { max-width: none; margin-left: 0; margin-right: 0; }
.cn-ap-hcard-img { border: 0 !important; }
.cn-ap-hcard-img img { margin: 0 !important; }
.cn-ap-hcard-cta, .cn-ap-hcard .cn-ap-buy { border-bottom: 1px solid rgba(0,0,0,.05) !important; }
