/* =====================
   FICHE OUTIL — /outils/<slug>/
   $pageStylesheets = ['fiche', 'outil-detail'] : le châssis partagé par les
   trois fiches est dans fiche.css, la carte de colonne latérale et les chips
   dans style.css. Ne reste ici que ce qui est propre à la fiche outil.
   Points de rupture : 480 / 768 / 992 (échelle commune du site).
   ===================== */

/* =====================
   HERO
   ===================== */

.outil-hero-content {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: var(--space-8);
    align-items: center;
}

.outil-hero-logo img {
    width: 90px;
    height: 90px;
    object-fit: contain;
    background: var(--background);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.hero-badge-promo {
    background: var(--chip-green-bg);
    color: var(--chip-green-fg);
}

.outil-hero h1 {
    margin: 0 0 var(--space-3);
    font-size: var(--fs-h1);
    letter-spacing: -0.03em;
    line-height: 1.15;
}

/* Résumé de l'outil, sous le titre : c'est la réponse à « qu'est-ce que
   c'est ? », elle n'attend pas la première section. Le <p> porte aussi
   `.hero-description` (style.css), le sous-titre de hero sombre du site : elle
   donne taille, interligne et couleur. Ne reste ici que la largeur de lecture
   et l'annulation de son `margin: 0 auto`, qui centrerait le résumé sous un
   titre aligné à gauche (le centrage revient sous 992 px, avec le hero). */
.outil-hero-lede {
    max-width: 70ch;
    margin: 0;
}

.outil-hero-actions {
    flex-shrink: 0;
}

/* =====================
   PARCOURS DE LECTURE
   Chaque section du contenu est une ancre du sommaire : elle se place sous le
   header collé quand on y saute, au clavier comme à la souris. 100 px, le
   décalage d'ancre déjà employé ailleurs sur le site (style.css,
   `.category-section` et `.article-sidebar`) : un seul nombre pour le même
   header.
   ===================== */

.outil-main .outil-card {
    scroll-margin-top: 100px;
}

/* Fiche sans aucune section : la colonne de décision occupe la largeur
   plutôt que de laisser un vide à côté d'elle. */
.outil-grid-seule {
    grid-template-columns: 1fr;
}

/* Contenu long d'une section (contenu généré, via iaSectionBody()). La marge
   se fond avec celle du titre de section quand il le précède directement. */
.ia-article-content {
    max-width: 800px;
    margin-top: var(--space-6);
    line-height: 1.6;
    color: var(--text-medium);
}

.ia-article-content h3 {
    margin: var(--space-8) 0 var(--space-4);
    padding-bottom: var(--space-2);
    font-size: var(--fs-lg);
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-color);
}

/* Le titre d'ouverture du contenu généré est retiré en amont : le premier
   bloc qui reste ne porte pas la marge d'un titre intermédiaire. */
.ia-article-content > :first-child {
    margin-top: 0;
}

.ia-article-content h4 {
    margin: var(--space-6) 0 var(--space-3);
    font-size: var(--fs-base);
    color: var(--text-dark);
}

.ia-article-content p {
    margin-bottom: var(--space-4);
}

.ia-article-content p:last-child {
    margin-bottom: 0;
}

.ia-article-content a {
    color: var(--primary-color);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ia-article-content a:hover {
    color: var(--primary-dark);
}

.ia-article-content strong {
    color: var(--text-dark);
}

.expert-review {
    padding: var(--space-6);
    background: var(--background-light);
    border-left: 2px solid var(--primary-color);
    border-radius: var(--radius-md);
}

.expert-review-content {
    color: var(--text-dark);
    line-height: 1.6;
}

.expert-review-signature {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-light);
}

.expert-review-avatars {
    display: flex;
    align-items: center;
}

.expert-review-avatars img {
    width: 28px;
    height: 28px;
    margin-left: -10px;
    object-fit: cover;
    border-radius: var(--radius-full);
    border: 2px solid var(--background);
    box-shadow: var(--shadow-sm);
}

.expert-review-avatars img:first-child {
    margin-left: 0;
}

.expert-review-label {
    font-size: var(--fs-xs);
    color: var(--text-light);
}

/* =====================
   COLONNE LATÉRALE
   Prix, action et sommaire restent à l'écran pendant toute la lecture : ils
   sont collés en haut de colonne tant que celle-ci défile. Même décalage que
   les ancres (100 px) pour passer sous le header.
   ===================== */

/* Borné à la hauteur de la fenêtre : sur une fiche à huit sections, carte de
   décision + sommaire dépassent un écran de portable, et un bloc collé sans
   défilement interne rogne ses dernières entrées sans jamais les rendre. */
.outil-aside-stick {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 100px - var(--space-6));
    overflow-y: auto;
}

.sidebar-card-pricing {
    border-top: 2px solid var(--primary-color);
}

.price-main {
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--primary-color);
}

.sidebar-card-pricing .price-main {
    margin-bottom: var(--space-4);
}

/* Note et ce qu'elle vaut, sous l'action : une note éditoriale n'est pas une
   moyenne d'avis, et ça se dit là où on décide. Le sélecteur est en enfant
   direct — `.rating-label` nomme aussi le libellé interne de la pastille. */
.sidebar-card-pricing .rating {
    margin-top: var(--space-5);
}

.sidebar-card-pricing > .rating-label {
    display: block;
    margin-top: var(--space-2);
    font-size: var(--fs-xs);
    font-weight: 400;
    line-height: 1.5;
    color: var(--text-light);
}

/* Sommaire : l'ordre de lecture, et le repère de l'endroit où l'on est. */
.outil-toc {
    margin-bottom: var(--space-6);
}

.outil-toc ol {
    list-style: none;
}

.outil-toc a {
    display: block;
    padding: var(--space-2) var(--space-3);
    border-left: 2px solid var(--border-color);
    font-size: var(--fs-sm);
    color: var(--text-light);
    text-decoration: none;
    transition: var(--transition);
}

.outil-toc a:hover {
    background: var(--background-light);
    color: var(--text-dark);
}

.outil-toc a[aria-current] {
    border-left-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

/* Codes promo de l'outil */
.sidebar-card-promo {
    background: var(--chip-green-bg);
    border-color: var(--chip-green-line);
}

.sidebar-card-promo h2 {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Vert foncé et non le vert plein : blanc sur #10b981 ne fait que 2.54:1. */
.promo-count {
    background: var(--chip-green-fg);
    border-color: var(--chip-green-fg);
    color: var(--on-dark);
    border-radius: var(--radius-full);
}

.promo-list-compact {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    list-style: none;
}

.promo-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--background);
    border: 1px solid var(--chip-green-line);
    border-radius: var(--radius-sm);
}

.promo-item-main {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    gap: var(--space-2);
}

.promo-item-info {
    overflow: hidden;
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.promo-item-createur {
    display: block;
    font-size: var(--fs-xs);
    font-weight: 400;
    color: var(--text-light);
}

.promo-empty-message {
    margin-bottom: var(--space-2);
    font-size: var(--fs-sm);
    color: var(--text-light);
}

.promo-empty-link {
    font-size: var(--fs-xs);
    color: var(--primary-color);
    text-decoration: none;
}

.promo-empty-link:hover {
    text-decoration: underline;
}

/* Le bouton de la ligne est le `.btn btn-small btn-primary` du site : son
   vert plein portait du blanc à 2.54:1, et l'indigo est le seul accent de
   bouton du contrat. Ne reste que l'interdiction de se comprimer. */
.promo-list-item .btn {
    flex-shrink: 0;
}

/* =====================
   MODALE CODE PROMO
   Contenu injecté par le script du gabarit (openPromoModal).
   ===================== */

.promo-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: var(--z-fixed);
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    background: var(--scrim);
}

.promo-modal.active {
    display: flex;
}

.promo-modal-dialog {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--background);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: modalFadeIn 0.2s ease;
}

/* Seule animation conservée du gabarit : l'ouverture d'une modale est un
   retour d'action, pas une décoration. Elle joue une fois et reste
   neutralisée par le bloc prefers-reduced-motion de style.css. */
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.promo-modal-close {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--background-alt);
    border: none;
    border-radius: var(--radius-full);
    font-size: var(--fs-lg);
    color: var(--text-medium);
    cursor: pointer;
    transition: var(--transition);
}

.promo-modal-close:hover {
    background: var(--border-color);
    color: var(--text-dark);
}

.promo-modal-body {
    padding: var(--space-6);
}

.promo-modal-header {
    margin-bottom: var(--space-4);
}

/* Trois pastilles, trois familles du contrat : vert promo, ambre créateur,
   indigo lien. Elles étaient pleines avec du texte blanc dessus — 2.54:1 pour
   le vert, 2.15:1 pour l'ambre. */
.promo-modal-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    background: var(--chip-green-bg);
    border: 1px solid var(--chip-green-line);
    color: var(--chip-green-fg);
    border-radius: var(--radius-full);
    font-size: var(--fs-xs);
    font-weight: 600;
}

.promo-modal-badge-createur {
    background: var(--warning-light);
    border-color: var(--accent-warm);
    color: var(--accent-warm-fg);
}

.promo-modal-badge-link {
    background: var(--primary-soft);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.promo-modal-reduction {
    margin-bottom: var(--space-4);
    font-size: var(--fs-xl);
    font-weight: 700;
    color: var(--chip-green-fg);
}

/* `<button>` et non un `<div>` cliquable : la copie du code se faisait à la
   souris seule, le bloc n'étant ni focusable ni annoncé. */
.promo-modal-code {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    margin-bottom: var(--space-4);
    padding: var(--space-4);
    background: var(--chip-green-bg);
    border: 1px dashed var(--success);
    border-radius: var(--radius);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
}

.promo-modal-code:hover {
    background: var(--success-light);
    border-style: solid;
}

.promo-modal-label {
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--chip-green-fg);
}

.promo-modal-value {
    flex: 1;
    min-width: 0;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--chip-green-fg);
}

/* Pas d'`opacity` : à 0.6 le libellé tombait à 2.82:1, et il n'apparaissait
   qu'au survol — c'est-à-dire jamais sur un écran tactile. */
.promo-modal-copy {
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--chip-green-fg);
}

.promo-modal-link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 44px;
    margin-bottom: var(--space-4);
    padding: var(--space-3) var(--space-6);
    background: var(--primary-color);
    border-radius: var(--radius);
    color: var(--on-dark);
    font-size: var(--fs-sm);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.promo-modal-link-btn:hover {
    background: var(--primary-dark);
}

.promo-modal-desc {
    margin-bottom: var(--space-4);
    padding: var(--space-3);
    background: var(--background-light);
    border-radius: var(--radius-sm);
    font-size: var(--fs-sm);
    line-height: 1.6;
    color: var(--text-light);
}

.promo-modal-createur {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    font-size: var(--fs-sm);
    color: var(--text-light);
}

.promo-modal-avatar {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: var(--radius-full);
}

.promo-modal-createur a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

.promo-modal-createur a:hover {
    text-decoration: underline;
}

.promo-modal-source,
.promo-modal-expiration {
    margin-bottom: var(--space-3);
    font-size: var(--fs-xs);
    color: var(--text-light);
}

.promo-modal-expiration .expiration-warning {
    color: var(--error-fg);
    font-weight: 600;
}

/* =====================
   RAPPEL DE DÉCISION (SOUS 992 PX)
   La colonne latérale passe alors au-dessus du contenu : elle quitte l'écran
   dès qu'on lit. Le rappel garde sa place dans le flux (`sticky`, pas
   `fixed`) : il ne recouvre pas le pied de page. Le bandeau de consentement,
   lui, est `fixed` au même bord et passe au-dessus : la barre n'est pas rendue
   tant que le bandeau l'est (condition serveur, outils/detail.php).
   ===================== */

.outil-action-bar {
    display: none;
}

/* =====================
   FIN DE PAGE — SECOND PLAN
   Liens annexes, partage, revendication : utiles, mais ils ne servent pas la
   décision. Trois cartes de colonne latérale en moins.
   ===================== */

.outil-end {
    padding: var(--space-12) 0;
    background: var(--background-light);
    border-top: 1px solid var(--border-color);
}

.outil-end-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-8);
}

/* Sur la bande claire, les lignes de liens gardent le fond blanc des cartes :
   sans ça leur filet et leur survol disparaissent dans le fond. */
.outil-end .links-list-modern a,
.outil-end .share-btn {
    background: var(--background);
}

.outil-end .links-list-modern a:hover,
.outil-end .share-btn:hover {
    background: var(--background-alt);
}

.claim-text {
    margin-bottom: var(--space-1);
    font-size: var(--fs-sm);
    color: var(--text-medium);
}

.claim-text strong {
    color: var(--text-dark);
    font-weight: 600;
}

.claim-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
}

.claim-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* =====================
   RESPONSIVE
   ===================== */

@media (max-width: 992px) {
    .outil-hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .outil-hero-logo {
        justify-self: center;
    }

    .outil-hero-lede {
        margin-left: auto;
        margin-right: auto;
    }

    .outil-hero-badges {
        justify-content: center;
    }

    .outil-hero-actions {
        justify-self: center;
    }

    /* La colonne n'est plus à côté du texte : rien à coller, donc rien à
       borner — elle ne doit pas défiler à l'intérieur d'elle-même. */
    .outil-aside-stick {
        position: static;
        max-height: none;
        overflow: visible;
    }

    .outil-action-bar {
        position: sticky;
        bottom: 0;
        z-index: var(--z-sticky);
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-4);
        padding: var(--space-3) var(--gutter);
        background: var(--background);
        border-top: 1px solid var(--border-color);
        box-shadow: var(--shadow-md);
    }

    .outil-end-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Empêche le bouton hero de passer en pleine largeur */
    .outil-hero-actions .btn {
        width: auto;
        max-width: none;
    }

    /* Cible tactile : 44 px, comme toute entrée de navigation. */
    .outil-toc a {
        display: flex;
        align-items: center;
        min-height: 44px;
    }

    .outil-end-grid {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }
}

@media (max-width: 480px) {
    .outil-hero-logo img {
        width: 70px;
        height: 70px;
    }
}
