/* ============================================================
   article.css — Modele "article" (guide editorial a sections)
   La base ne stocke que du HTML simple ; la structure (<section>,
   sommaire, hero) est construite en PHP. Flux vertical lisible.
   Reutilise les variables de style.css (valeurs de repli sinon).
   ============================================================ */

.article {
    --ar-max: var(--max-width, 1220px);
    --ar-text: 760px;
    --ar-accent: var(--color-primary, #3b82f6);
    --ar-accent-hover: var(--color-primary-dark, #2563eb);
    --ar-ink: #0f172a;
    --ar-muted: #64748b;
    --ar-line: #e6e8ee;
    --ar-bg-soft: #f6f8fc;
    color: var(--ar-ink);
    font-family: "Roboto", system-ui, sans-serif;
}

.article :where(h1, h2, h3, p, ul, ol, figure) { margin: 0; }

/* ---- Hero ---- */
.article-hero {
    max-width: var(--ar-text);
    margin: 2.5rem auto 0;
    padding: 0 var(--padding-x, 1.25rem);
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}
.article-hero-media img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 7;
    object-fit: cover;
    border-radius: 16px;
}
.article-h1 {
    font-size: clamp(1.9rem, 1.2rem + 2.6vw, 2.7rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
    max-width: 24ch;
    color: var(--color-dark, #1f2937);
}
.article-intro {
    max-width: var(--ar-text);
    font-size: 1.15rem;
    line-height: 1.7;
    color: #334155;
}
.article-intro > * + * { margin-top: 0.9rem; }
.article-intro a { color: var(--ar-accent); text-decoration: underline; text-underline-offset: 3px; }

/* ---- Sommaire (TOC) ---- */
.article-toc {
    max-width: var(--ar-text);
    margin: 2.5rem auto 0;
    padding: 1.25rem 1.5rem;
    background: var(--ar-bg-soft);
    border: 1px solid var(--ar-line);
    border-radius: 14px;
    width: calc(100% - 2 * var(--padding-x, 1.25rem));
}
.article-toc-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ar-muted);
    margin-bottom: 0.85rem;
}
.article-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.5rem 1.5rem;
    grid-template-columns: 1fr;
}
@media (min-width: 720px) { .article-toc-list { grid-template-columns: 1fr 1fr; } }
.article-toc-list a {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    text-decoration: none;
    color: #334155;
    padding: 0.3rem 0;
    transition: color 0.15s ease;
}
.article-toc-list a:hover,
.article-toc-list a.is-active { color: var(--ar-accent); }
.article-toc-list a.is-active { font-weight: 600; }
.article-toc-num {
    flex: 0 0 auto;
    min-width: 1.4rem;
    font-weight: 700;
    color: var(--ar-accent);
    font-variant-numeric: tabular-nums;
}

/* ---- Contenu : sections en flux vertical ---- */
.article-content {
    max-width: var(--ar-text);
    margin: 2.75rem auto 4.5rem;
    padding: 0 var(--padding-x, 1.25rem);
}
.article-content > section { scroll-margin-top: 90px; }
.article-content > section:not(:first-child) {
    margin-top: 3.5rem;
    padding-top: 3.5rem;
    border-top: 1px solid var(--ar-line);
}
/* Titre de section : barre d'accent a gauche (style editorial, sans numero) */
.article-content > section > h2 {
    font-size: clamp(1.4rem, 1.1rem + 1.1vw, 1.8rem);
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin: 0 0 1.1rem;
    padding-left: 0.9rem;
    border-left: 4px solid var(--ar-accent);
    color: var(--color-dark, #1f2937);
    scroll-margin-top: 90px;
}

/* Corps de texte */
.article-content p,
.article-content ul,
.article-content ol { font-size: 1.03rem; line-height: 1.78; color: #334155; }
.article-content > section > * + * { margin-top: 1rem; }
.article-content h3 {
    font-size: 1.18rem;
    line-height: 1.4;
    color: var(--ar-ink);
    margin-top: 1.9rem;
}
.article-content ul,
.article-content ol { padding-left: 1.25rem; }
.article-content li + li { margin-top: 0.4rem; }
.article-content strong { color: var(--ar-ink); }
.article-content a {
    color: var(--ar-accent);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    transition: color 0.15s ease;
}
.article-content a:hover { color: var(--ar-accent-hover); }

/* Image inline unique (figure) : ratio fixe */
.article-figure { margin: 1.75rem 0 0.5rem; }
.article-figure img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 14px;
}

/* Carte Google Maps embed (placeholder {{map:url}}) : iframe responsive */
.article-content .article-map {
    margin: 1.75rem 0 0.5rem;
    border-radius: 14px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    box-shadow: var(--shadow-sm, 0 2px 6px rgba(0,0,0,0.05));
}
.article-content .article-map iframe { width: 100%; height: 100%; border: 0; display: block; }

/* Galerie / mosaique d'images : pleine largeur, colonnes auto */
.article-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
    margin: 1.75rem 0 0.5rem;
}
.article-gallery-item { margin: 0; }
.article-gallery-item img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: var(--shadow-sm, 0 2px 6px rgba(0,0,0,0.05));
}

/* ---- Desktop : image unique laterale, alternee gauche / droite ---- */
@media (min-width: 900px) {
    .article-content > section.article-sec--media {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 340px;
        column-gap: 2.6rem;
        align-items: start;
    }
    .article-content > section.article-sec--media > :not(.article-figure) {
        grid-column: 1;
        min-width: 0;
    }
    .article-content > section.article-sec--media > .article-figure {
        grid-column: 2;
        grid-row: 1 / span 50;
        align-self: start;
        margin: 0;
    }
    .article-content > section.article-sec--media:nth-of-type(even) {
        grid-template-columns: 340px minmax(0, 1fr);
    }
    .article-content > section.article-sec--media:nth-of-type(even) > :not(.article-figure) { grid-column: 2; }
    .article-content > section.article-sec--media:nth-of-type(even) > .article-figure { grid-column: 1; }
    .article-content > section:not(.article-sec--media) { max-width: var(--ar-text); }
}

/* ---- Tableau d'activites : lignes entierement cliquables ---- */
.article-act-table { display: flex; flex-direction: column; gap: 0.6rem; margin: 1.5rem 0; max-width: var(--ar-text); }
.article-content .article-act-row {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.9rem;
    padding: 0.5rem 0.9rem 0.5rem 0.5rem;
    background: #fff;
    border: 1px solid var(--ar-line);
    border-radius: 14px;
    text-decoration: none;
    color: var(--ar-ink);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.article-content .article-act-row:hover {
    border-color: var(--ar-accent);
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.16);
}
.article-act-img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; display: block; }
.article-content .article-act-row picture { display: block; line-height: 0; }
.article-act-main { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.article-act-name { font-weight: 600; line-height: 1.25; }
.article-act-tag {
    align-self: flex-start;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--ar-accent);
    background: #eaf1ff;
    padding: 0.13rem 0.5rem;
    border-radius: 6px;
    margin-bottom: 0.15rem;
    line-height: 1.3;
}
.article-act-meta { font-size: 0.85rem; color: var(--ar-muted); }
.article-act-price { font-weight: 700; color: var(--ar-accent); white-space: nowrap; font-size: 1.05rem; }

/* ---- Conclusion ---- */
.article-conclusion {
    max-width: var(--ar-text);
    margin: 3.5rem auto 4rem;
    padding: 1.75rem 1.9rem;
    background: var(--ar-bg-soft);
    border: 1px solid var(--ar-line);
    border-left: 4px solid var(--ar-accent);
    border-radius: 14px;
    font-size: 1.05rem;
    line-height: 1.75;
    color: #334155;
}
.article-conclusion > * + * { margin-top: 1rem; }
.article-conclusion a { color: var(--ar-accent); text-decoration: underline; text-underline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

/* ---- Lightbox galerie : plein ecran blanc, image plein format centree ---- */
.article-gallery-item img { cursor: zoom-in; }

.article-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #fff;                 /* ecran blanc */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5vmin;
}
.article-lightbox[hidden] { display: none; }   /* surcharge le display:flex quand ferme */

.article-lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: var(--shadow-lg, 0 10px 30px rgba(0,0,0,0.18));
}

.article-lightbox-close,
.article-lightbox-nav {
    position: fixed;
    border: none;
    background: transparent;
    color: var(--ar-ink, #0f172a);
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.article-lightbox-close[hidden],
.article-lightbox-nav[hidden] { display: none; }

.article-lightbox-close {
    top: 0.75rem;
    right: 1rem;
    width: 3rem;
    height: 3rem;
    font-size: 2.6rem;
    border-radius: 50%;
}
.article-lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
    width: 3.5rem;
    height: 3.5rem;
    font-size: 3rem;
}
.article-lightbox-prev { left: 0.75rem; }
.article-lightbox-next { right: 0.75rem; }

.article-lightbox-close:hover,
.article-lightbox-nav:hover { color: var(--ar-accent, #3b82f6); }
.article-lightbox-prev:hover { transform: translateY(-50%) scale(1.12); }
.article-lightbox-next:hover { transform: translateY(-50%) scale(1.12); }

@media (max-width: 600px) {
    .article-lightbox-nav { width: 2.75rem; height: 2.75rem; font-size: 2.4rem; }
    .article-lightbox-img { max-width: 96vw; }
}

/* ---- Encart "focus" : met en avant une phrase cle ({{focus}}...{{/focus}}) ---- */
.article-content aside.article-focus {
    position: relative;
    margin: 1.9rem 0;
    padding: 1.25rem 1.5rem 1.35rem;
    background: linear-gradient(135deg, var(--color-primary-light, #eff6ff) 0%, var(--ar-bg-soft, #f6f8fc) 78%);
    border: 1px solid #c8dbff;
    border-left: 4px solid var(--ar-accent);
    border-radius: 12px;
    font-size: 1.06rem;
    line-height: 1.7;
    color: var(--ar-ink);
    box-shadow: var(--shadow-sm, 0 2px 6px rgba(0,0,0,0.05));
}
.article-content aside.article-focus::before {
    content: "\1F4A1  " attr(data-label);   /* ampoule + libelle localise (data-label) */
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--ar-accent);
}
.article-content aside.article-focus a {
    color: var(--ar-accent);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}
.article-content aside.article-focus a:hover { color: var(--ar-accent-hover); }
