/* ==========================================================================
   ARTICLE DOCUMENTATION (single-doc.php) : hero + sommaire + 12 formats
   ========================================================================== */

.doc-single-wrapper {
    background-color: #f8fafc;
    color: #0f172a;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    padding-bottom: 5rem;
}
.doc-single-wrapper h1,
.doc-single-wrapper h2,
.doc-single-wrapper h3 {
    font-family: "Plus Jakarta Sans", "Inter", sans-serif;
}

/* Hero */
.doc-single-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #fff;
    padding: 4rem 0 3rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.doc-single-hero::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background:
        radial-gradient(500px 220px at 12% 0%, rgba(59,130,246,.22), transparent 70%),
        radial-gradient(420px 200px at 88% 100%, rgba(129,140,248,.16), transparent 70%);
}
.doc-single-hero .inar-container { position: relative; }
.doc-single-hero .inar-badge {
    background-color: rgba(59,130,246,.15); color: #60a5fa;
    border: 1px solid rgba(96,165,250,.2);
}
.doc-single-title { font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 800; margin: 0 0 1rem; color: #fff; }
.doc-single-excerpt { font-size: 1.125rem; color: #94a3b8; max-width: 640px; margin: 0 auto; }
.doc-single-meta { margin: 1.25rem 0 0; color: #94a3b8; font-size: .9rem; }
.doc-single-meta a { color: #93c5fd; font-weight: 600; }

/* Layout 2 colonnes */
.doc-single-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 1.5rem;
    padding-top: 3rem;
    align-items: start;
}
@media (max-width: 900px) {
    .doc-single-layout { grid-template-columns: 1fr; }
}

/* Sommaire sticky */
.doc-single-aside { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 1rem; }
@media (max-width: 900px) {
    .doc-single-aside { position: static; }
}
.doc-toc {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 1rem;
    padding: 1.25rem 1.25rem 1rem; font-size: .9rem;
    max-height: calc(100vh - 6rem); overflow-y: auto;
}
.doc-toc-group { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: #64748b; margin: 0 0 .375rem; }
.doc-toc-group:not(:first-child) { margin-top: 1rem; }
.doc-toc ul { list-style: none; margin: 0 0 .25rem; padding: 0; display: grid; gap: 2px; }
.doc-toc a { display: block; color: #475569; text-decoration: none; padding: .35rem .6rem; border-radius: .5rem; border-left: 2px solid transparent; }
.doc-toc a:hover { background: #f1f5f9; color: #0f172a; }
.doc-toc a.is-active { background: #eef2ff; color: #4f46e5; font-weight: 700; border-left-color: transparent; }
.doc-single-cta { text-align: center; }

/* Article */
.doc-single-article { min-width: 0; background: #fff; border: 1px solid #e2e8f0; border-radius: 1.25rem; padding: clamp(1rem, 2vw, 1.75rem); }
.doc-single-empty { color: #64748b; text-align: center; padding: 3rem 1rem; }
.doc-sec { scroll-margin-top: 1.5rem; }
.doc-sec + .doc-sec { margin-top: 2.75rem; padding-top: 2.75rem; border-top: 1px solid #f1f5f9; }
.doc-sec-title { font-size: 1.6rem; font-weight: 800; margin: 0 0 1.25rem; letter-spacing: -.01em; }
/* Pastille PRO : fonctionnalité absente de la version gratuite. */
.doc-pro {
    display: inline-block; vertical-align: 1px;
    font-size: .6rem; font-weight: 800; letter-spacing: .05em;
    color: #fff; background-image: linear-gradient(135deg, #7c3aed, #4f46e5);
    padding: .1rem .45rem; border-radius: 999px; white-space: nowrap;
}
/* Blocs rattachés : même onglet, autre format (titre éventuel en H3). */
.doc-block { margin-top: 1.75rem; }
.doc-block-title { font-size: 1.2rem; font-weight: 800; margin: 0 0 1rem; letter-spacing: -.01em; }

/* 1. Étapes numérotées */
.doc-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; counter-reset: docstep; }
.doc-step { display: flex; gap: 1rem; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 1rem; padding: 1.25rem 1.5rem; counter-increment: docstep; }
.doc-step::before { content: counter(docstep); flex: none; width: 2.25rem; height: 2.25rem; border-radius: 50%;
    background-image: linear-gradient(135deg, #2563eb, #4f46e5); color: #fff; font-weight: 800;
    display: inline-flex; align-items: center; justify-content: center; }
.doc-step h3 { margin: 0 0 .375rem; font-size: 1.05rem; }
.doc-step p { margin: 0; color: #475569; }

/* 2. Cartes */
.doc-cards { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
/* Carte unique : jamais étirée pleine largeur. */
.doc-cards-1 { max-width: 38rem; }
@media (min-width: 640px) {
    .doc-cards-2, .doc-cards-4 { grid-template-columns: repeat(2, 1fr); }
    .doc-cards-3 { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px) {
    .doc-cards-4 { grid-template-columns: repeat(4, 1fr); }
}
.doc-card-block { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 1rem; padding: 1.5rem; transition: transform .2s, box-shadow .2s, border-color .2s; }
.doc-card-block:hover { transform: translateY(-4px); border-color: #c7d2fe; box-shadow: 0 16px 30px -12px rgba(15,23,42,.15); }
.doc-card-ico { width: 2.75rem; height: 2.75rem; border-radius: .75rem; object-fit: cover; margin-bottom: .75rem; }
.doc-card-block h3 { margin: 0 0 .5rem; font-size: 1.05rem; }
.doc-card-block p { margin: 0; color: #64748b; font-size: .92rem; }
.doc-card-points { list-style: none; margin: .25rem 0 0; padding: 0; display: grid; gap: .5rem; }
.doc-card-points li { display: flex; gap: .5rem; align-items: flex-start; color: #475569; font-size: .9rem; }
.doc-card-points li::before { content: "✓"; color: #10b981; font-weight: 800; flex: none; }
.doc-card-link { display: inline-block; margin-top: .75rem; color: #4f46e5; font-weight: 700; font-size: .9rem; text-decoration: none; }

/* 3. Média + texte : image seule = légende à gauche ; alignement vertical
   réglable (option « Alignement vertical », défaut en haut). */
.doc-media { display: grid; gap: 1.75rem; align-items: start; grid-template-columns: 1fr; }
.doc-media-center { align-items: center; }
.doc-media-top { align-items: start; }
/* En haut : les deux colonnes partent exactement du même Y (ni stretch,
   ni marge haute résiduelle côté texte, quel que soit le 1er bloc WYSIWYG). */
.doc-media-top > * { align-self: start; min-width: 0; }
@media (min-width: 820px) {
    .doc-media { grid-template-columns: 1fr 1fr; }
    .doc-media-left .doc-media-fig { order: -1; }
    /* Compensation optique (cf. capture ligne rouge) : la 1re ligne de texte
       a un demi-interlignage (~0.45em avec line-height 1.7) au-dessus de ses
       capitales ; sans ce décalage le haut de l'image paraît « un peu plus
       haut » que le haut du texte. Desktop seul : en pile mobile, aucun décalage. */
    .doc-media-top .doc-media-fig { margin-top: 0.45em; }
}
.doc-media-fig { margin: 0; align-self: start; }
.doc-media-fig img { width: 100%; height: auto; border-radius: 1rem; border: 1px solid #e2e8f0; display: block; }
.doc-media-fig figcaption { font-size: .82rem; color: #94a3b8; text-align: left; margin-top: .5rem; }
.doc-video figcaption { font-size: .82rem; color: #94a3b8; text-align: center; margin-top: .5rem; }
.doc-media-txt { color: #334155; line-height: 1.7; align-self: start; min-width: 0; }
.doc-media-txt > *:first-child { margin-top: 0 !important; }

/* 4. Instructions */
.doc-ordered { margin: 0; padding-left: 1.25rem; display: grid; gap: .625rem; color: #334155; }
.doc-ordered li::marker { color: #4f46e5; font-weight: 800; }

/* 5. Encadrés */
.doc-callout { border-radius: .9rem; padding: 1rem 1.25rem; border: 1px solid; }
.doc-callout p:first-child { margin-top: 0; } .doc-callout p:last-child { margin-bottom: 0; }
.doc-callout-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.doc-callout-success { background: #ecfdf5; border-color: #6ee7b7; color: #065f46; }
.doc-callout-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.doc-callout-danger { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }

/* 6. Code */
.doc-codeblock { border: 1px solid #1e293b; border-radius: 1rem; overflow: hidden; }
.doc-codebar { display: flex; justify-content: space-between; align-items: center; background: #0f172a; color: #94a3b8; font-size: .78rem; font-weight: 700; padding: .5rem 1rem; }
.doc-copy { background: #1e293b; color: #e2e8f0; border: 1px solid #334155; border-radius: .5rem; font-size: .78rem; font-weight: 600; padding: .3rem .75rem; cursor: pointer; }
.doc-copy:hover { border-color: #4f46e5; color: #fff; }
.doc-codeblock pre { margin: 0; background: #111c33; color: #e2e8f0; padding: 1.25rem; overflow-x: auto; font-size: .88rem; line-height: 1.6; }

/* 7. FAQ */
.doc-faq { display: grid; gap: .75rem; }
.doc-faq-item { border: 1px solid #e2e8f0; border-radius: .9rem; background: #f8fafc; }
.doc-faq-item summary { cursor: pointer; font-weight: 700; padding: 1rem 1.25rem; list-style: none; display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.doc-faq-item summary::-webkit-details-marker { display: none; }
.doc-faq-item summary::after { content: "+"; color: #4f46e5; font-size: 1.3rem; font-weight: 800; flex: none; }
.doc-faq-item[open] summary::after { content: "–"; }
.doc-faq-a { padding: 0 1.25rem 1.25rem; color: #475569; }

/* 8. Vidéo */
.doc-video { margin: 0; }
.doc-video-frame { position: relative; padding-bottom: 56.25%; height: 0; border-radius: 1rem; overflow: hidden; border: 1px solid #e2e8f0; }
.doc-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.doc-video-frame video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }

/* 9. Galerie (cartes cliquables -> lightbox, navigation groupée par galerie).
   Vignettes à hauteur uniforme (crop cover) + cadre blanc passe-partout,
   1 col mobile / 2 tablette / 3 desktop. Hover = lift carte (souris uniquement). */
.doc-gallery {
    display: grid; grid-template-columns: 1fr; gap: .6rem;
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 1rem;
    padding: .75rem;
}
@media (min-width: 640px) { .doc-gallery { grid-template-columns: repeat(2, 1fr); gap: 1rem; } }
@media (min-width: 1024px) { .doc-gallery { grid-template-columns: repeat(3, 1fr); } }
.doc-gallery img {
    width: 100%; height: 10rem; object-fit: cover; display: block;
    box-sizing: border-box;
    border-radius: .9rem; border: 1px solid #e2e8f0; background: #fff;
    padding: .5rem;
    box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 10px 25px -8px rgba(15,23,42,.10);
    cursor: zoom-in;
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
@media (hover: hover) {
    .doc-gallery img:hover {
        transform: translateY(-4px);
        border-color: #c7d2fe;
        box-shadow: 0 20px 40px -12px rgba(15,23,42,.18);
    }
}
.doc-gallery img:focus-visible { outline: 3px solid rgba(79,70,229,.35); outline-offset: 2px; }
/* Légende galerie : champ « Légende » WP (caption), toujours centrée. */
.doc-gallery figure.doc-gallery-item { margin: 0; min-width: 0; }
.doc-gallery figcaption { font-size: .82rem; color: #94a3b8; text-align: center; margin: .5rem 0 0; }

/* 9b. Zoom au survol (option « Zoom au survol » par bloc, classe .has-zoom) :
   agrandit TOUTE l'image, pas une loupe. Souris uniquement, sinon sticky sur tactile. */
.doc-gallery.has-zoom img,
.doc-media-fig.has-zoom img,
.doc-rich.has-zoom img {
    transition: transform .35s ease, box-shadow .35s ease;
}
/* Le figure ne doit jamais rogner sa légende : pas d'overflow ici
   (le zoom scale l'img, comme en galerie). Le radius reste sur l'img. */
.doc-media-fig.has-zoom { overflow: visible; }
.doc-media-fig.has-zoom img { border-radius: 1rem; }
@media (hover: hover) {
    .doc-gallery.has-zoom img:hover,
    .doc-media-fig.has-zoom img:hover,
    .doc-rich.has-zoom img:hover {
        transform: scale(1.05);
        box-shadow: 0 16px 30px -12px rgba(15,23,42,.25);
        position: relative;
        z-index: 2;
    }
}

/* 10. Tableau */
.doc-table-wrap { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 1rem; }
.doc-table { width: 100%; border-collapse: collapse; min-width: 480px; background: #fff; }
.doc-table th, .doc-table td { padding: .8rem 1rem; border-bottom: 1px solid #f1f5f9; text-align: left; font-size: .92rem; }
.doc-table tr:last-child th, .doc-table tr:last-child td { border-bottom: none; }
.doc-table th { background: #eef2ff; color: #3730a3; font-weight: 800; }

/* 11. Boutons */
.doc-btns { display: flex; gap: .75rem; flex-wrap: wrap; }

/* 12. Texte libre */
.doc-rich { color: #334155; line-height: 1.7; }
.doc-rich img { max-width: 100%; height: auto; border-radius: .9rem; }
.doc-rich h3 { margin-top: 1.5rem; }

@media (max-width: 640px) {
    .doc-single-wrapper { padding-bottom: 1.5rem; }
    .doc-single-hero { padding: 2rem 0 1.5rem; }
    .doc-single-title { font-size: 1.55rem; }
    .doc-single-excerpt { font-size: .92rem; }
    .doc-single-meta { font-size: .78rem; margin-top: .9rem; }
    .doc-single-layout { padding-top: 1rem; gap: 1rem; }
    .doc-single-article { border-radius: .9rem; padding: .7rem; }
    .doc-toc { padding: .8rem; font-size: .8rem; }
    .doc-single-cta { padding: .65rem 1rem; font-size: .88rem; }
    .doc-sec-title { font-size: 1.2rem; margin-bottom: .8rem; }
    .doc-sec + .doc-sec { margin-top: 1.25rem; padding-top: 1.25rem; }
    .doc-block { margin-top: 1.1rem; }
    .doc-block-title { font-size: 1rem; margin-bottom: .7rem; }
    .doc-cards { gap: .7rem; }
    .doc-step { padding: .8rem; gap: .65rem; }
    .doc-step::before { width: 1.8rem; height: 1.8rem; font-size: .85rem; }
    .doc-step h3 { font-size: .92rem; margin-bottom: .2rem; }
    .doc-step p, .doc-card-block p { font-size: .8rem; }
    .doc-card-points { gap: .3rem; }
    .doc-card-points li { font-size: .8rem; }
    .doc-card-block { padding: .8rem; }
    .doc-card-block h3 { font-size: .92rem; margin-bottom: .3rem; }
    .doc-card-ico { width: 2.1rem; height: 2.1rem; margin-bottom: .5rem; }
    .doc-card-link { margin-top: .5rem; font-size: .83rem; }
    .doc-callout { padding: .65rem .8rem; font-size: .82rem; }
    .doc-codeblock pre { font-size: .75rem; padding: .8rem; }
    .doc-codebar { padding: .4rem .8rem; }
    .doc-faq { gap: .5rem; }
    .doc-faq-item summary { padding: .7rem .9rem; font-size: .87rem; }
    .doc-faq-a { padding: 0 .9rem .9rem; font-size: .83rem; }
    .doc-ordered { font-size: .85rem; gap: .4rem; }
    .doc-table th, .doc-table td { padding: .55rem .65rem; font-size: .8rem; }
    .doc-btns { gap: .5rem; }
    .doc-btns .inar-btn { flex: 1 1 100%; text-align: center; padding: .6rem 1rem; font-size: .85rem; }
    .doc-gallery { gap: .6rem; padding: .5rem; border-radius: .9rem; }
    .doc-gallery img { height: 7rem; padding: .4rem; }
    .doc-media { gap: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    .doc-card-block, .doc-copy, .doc-gallery img,
    .doc-gallery.has-zoom img, .doc-media-fig.has-zoom img, .doc-rich.has-zoom img { transition: none; }
    .doc-card-block:hover, .doc-gallery img:hover,
    .doc-gallery.has-zoom img:hover, .doc-media-fig.has-zoom img:hover, .doc-rich.has-zoom img:hover { transform: none; }
}
