/*
 * blog.css — design éditorial du blog public « Le Journal de l'atelier »
 *
 * Chargé dans actus.html / category_detail.html / article_detail.html via
 * {% block extra_head %}, APRÈS expertises.css (dont on réutilise les
 * composants partagés : .hero-rail, .ticker, .live-dot, .marquee-strip,
 * .hero-blob-soft).
 *
 * Aligne le blog sur le design system Codemaster (home / expertises /
 * realisations) : fond paper-grid, marques d'imprimerie, glyphe filigrane,
 * cartes éditoriales, chapitrage, lecture premium.
 *
 * Tokens : primary-700 #5a1224 (bordeaux) · secondary-900 #13234f (marine) ·
 *          accent-600 #556954 (sauge) · cream-50 #fbf9f3 · cream-100 #f5efe0 ·
 *          cream-200 #ece5d6 · ink-950 #0c0f1a · ink-800 #1b1e2a ·
 *          muted-600 #6b6557 · saumon #e2a8a0
 */


/* ============================================================
 * REVEAL — entrée au scroll (dégradation gracieuse)
 * État masqué appliqué UNIQUEMENT si JS a posé .js-reveal sur <html>.
 * Sans JS → contenu visible par défaut (aucun risque de page blanche).
 * ============================================================ */
.js-reveal .reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}
.js-reveal .reveal.is-visible {
    opacity: 1;
    transform: none;
}
/* Stagger : décalage progressif des enfants .reveal d'un conteneur */
.js-reveal .reveal-stagger > .reveal:nth-child(1) { transition-delay: 0.04s; }
.js-reveal .reveal-stagger > .reveal:nth-child(2) { transition-delay: 0.10s; }
.js-reveal .reveal-stagger > .reveal:nth-child(3) { transition-delay: 0.16s; }
.js-reveal .reveal-stagger > .reveal:nth-child(4) { transition-delay: 0.22s; }
.js-reveal .reveal-stagger > .reveal:nth-child(5) { transition-delay: 0.28s; }
.js-reveal .reveal-stagger > .reveal:nth-child(6) { transition-delay: 0.34s; }

@media (prefers-reduced-motion: reduce) {
    .js-reveal .reveal {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}


/* ============================================================
 * READING PROGRESS — barre de progression de lecture (article)
 * Fixée tout en haut, sous la navbar. Largeur pilotée en JS (--p).
 * ============================================================ */
.reading-progress {
    position: fixed;
    top: var(--navbar-h, 72px);
    left: 0;
    height: 3px;
    width: 100%;
    z-index: 40;
    background: rgba(12, 15, 26, 0.06);
    pointer-events: none;
}
.reading-progress-bar {
    height: 100%;
    width: var(--p, 0%);
    background: linear-gradient(90deg, #5a1224 0%, #e2a8a0 100%);
    transition: width 0.12s linear;
}


/* ============================================================
 * JOURNAL HERO — décors signature (marques, règles, glyphe, compteur)
 * Repris de l'esthétique cinema-hero des réalisations.
 * ============================================================ */
.journal-hero {
    position: relative;
    overflow: hidden;
}

/* Marques d'imprimerie aux 4 coins (croix fines bordeaux) */
.journal-hero-mark {
    position: absolute;
    width: 14px;
    height: 14px;
    z-index: 1;
    pointer-events: none;
    opacity: 0.55;
}
.journal-hero-mark::before,
.journal-hero-mark::after {
    content: "";
    position: absolute;
    background: rgba(90, 18, 36, 0.55);
}
.journal-hero-mark::before { top: 50%; left: 0; width: 100%; height: 1px; transform: translateY(-50%); }
.journal-hero-mark::after  { left: 50%; top: 0; width: 1px; height: 100%; transform: translateX(-50%); }
.journal-hero-mark-tl { top: 22px; left: 22px; }
.journal-hero-mark-tr { top: 22px; right: 22px; }
.journal-hero-mark-bl { bottom: 22px; left: 22px; }
.journal-hero-mark-br { bottom: 22px; right: 22px; }

/* Règles verticales de construction */
.journal-hero-rule {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(12, 15, 26, 0.06);
    z-index: 0;
    pointer-events: none;
}
.journal-hero-rule-1 { left: 18%; }
.journal-hero-rule-2 { right: 18%; }

/* Glyphe « C » filigrane massif (Fraunces italic) */
.journal-hero-glyph {
    position: absolute;
    bottom: -7rem;
    right: -2rem;
    font-family: "Fraunces", Georgia, serif;
    font-style: italic;
    font-weight: 500;
    font-size: clamp(16rem, 32vw, 34rem);
    line-height: 1;
    color: rgba(90, 18, 36, 0.05);
    z-index: 0;
    pointer-events: none;
    user-select: none;
}

/* Compteur géant filigrane (nombre d'articles) */
.journal-hero-counter {
    position: absolute;
    top: 50%;
    right: 3%;
    transform: translateY(-50%);
    font-family: "Fraunces", Georgia, serif;
    font-weight: 300;
    font-size: clamp(9rem, 20vw, 20rem);
    line-height: 0.8;
    color: rgba(19, 35, 79, 0.05);
    font-variant-numeric: tabular-nums;
    z-index: 0;
    pointer-events: none;
    user-select: none;
}

/* Label édition en haut à droite (mono vertical-ish) */
.journal-hero-edition {
    position: absolute;
    top: 26px;
    right: 46px;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(12, 15, 26, 0.35);
    z-index: 1;
    pointer-events: none;
}


/* ============================================================
 * JOURNAL FILTERBAR — bandeau de rubriques sticky, scrollable
 * ============================================================ */
.journal-filterbar {
    position: sticky;
    top: var(--navbar-h, 72px);
    z-index: 30;
    background: rgba(245, 239, 224, 0.92);
    backdrop-filter: saturate(1.2) blur(8px);
    border-bottom: 1px solid rgba(12, 15, 26, 0.1);
}
.journal-filterbar-inner {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 12px 0;
}
.journal-filterbar-label {
    flex: none;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6b6557;
}
.journal-filterbar-label::before {
    content: "§";
    color: #5a1224;
    font-family: "Fraunces", serif;
    font-style: italic;
    margin-right: 8px;
}
.journal-filterbar-track {
    flex: 1 1 auto;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: x proximity;
}
.journal-filterbar-track::-webkit-scrollbar { display: none; }
.journal-filterbar-list {
    display: flex;
    align-items: center;
    gap: 8px;
    width: max-content;
}

.journal-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border: 1px solid rgba(12, 15, 26, 0.14);
    border-radius: 999px;
    background: transparent;
    text-decoration: none;
    white-space: nowrap;
    scroll-snap-align: start;
    transition: border-color 0.25s ease, background-color 0.25s ease, color 0.25s ease;
}
.journal-filter-num {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 9px;
    letter-spacing: 0.08em;
    color: #6b6557;
    font-variant-numeric: tabular-nums;
    transition: color 0.25s ease;
}
.journal-filter-name {
    font-family: "Inter", sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #1b1e2a;
    transition: color 0.25s ease;
}
.journal-filter-count {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 10px;
    color: #6b6557;
    font-variant-numeric: tabular-nums;
    transition: color 0.25s ease;
}
.journal-filter:hover {
    border-color: rgba(90, 18, 36, 0.45);
    background: rgba(90, 18, 36, 0.04);
}
.journal-filter.is-active {
    background: #5a1224;
    border-color: #5a1224;
}
.journal-filter.is-active .journal-filter-name,
.journal-filter.is-active .journal-filter-num,
.journal-filter.is-active .journal-filter-count {
    color: #f5efe0;
}


/* ============================================================
 * JOURNAL FEATURED — article à la une (carte large, 2 colonnes)
 * ============================================================ */
.journal-featured {
    display: grid;
    grid-template-columns: 1fr;
    background: #fbf9f3;
    border: 1px solid rgba(12, 15, 26, 0.1);
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 0.5s ease, box-shadow 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.journal-featured:hover {
    border-color: rgba(90, 18, 36, 0.4);
    box-shadow: 0 18px 36px -18px rgba(12, 15, 26, 0.4);
}
.journal-featured-media {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    background: #ece5d6;
}
.journal-featured-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.journal-featured:hover .journal-featured-media img {
    transform: scale(1.04);
}
.journal-featured-flag {
    position: absolute;
    top: 18px;
    left: 18px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(12, 15, 26, 0.78);
    backdrop-filter: blur(4px);
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 9px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #f5efe0;
}
.journal-featured-body {
    padding: 32px 30px 30px;
    display: flex;
    flex-direction: column;
}

@media (min-width: 1024px) {
    .journal-featured {
        grid-template-columns: 1.15fr 1fr;
    }
    .journal-featured-media {
        aspect-ratio: auto;
        height: 100%;
        min-height: 420px;
    }
    .journal-featured-body {
        padding: 48px 48px 44px;
    }
}


/* ============================================================
 * JOURNAL CARD — carte article de la grille
 * ============================================================ */
.journal-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fbf9f3;
    border: 1px solid rgba(12, 15, 26, 0.1);
    border-radius: 14px;
    overflow: hidden;
    transition: border-color 0.5s ease, box-shadow 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.journal-card:hover {
    border-color: rgba(90, 18, 36, 0.4);
    box-shadow: 0 14px 30px -16px rgba(12, 15, 26, 0.32);
    transform: translateY(-3px);
}
.journal-card-media {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    background: #ece5d6;
}
.journal-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.journal-card:hover .journal-card-media img {
    transform: scale(1.05);
}
.journal-card-num {
    position: absolute;
    top: 14px;
    right: 16px;
    font-family: "Fraunces", Georgia, serif;
    font-style: italic;
    font-size: 1.6rem;
    line-height: 1;
    color: rgba(245, 239, 224, 0.92);
    text-shadow: 0 1px 8px rgba(12, 15, 26, 0.45);
    pointer-events: none;
}
.journal-card-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding: 24px 24px 26px;
}
.journal-card-title {
    font-family: "Fraunces", Georgia, serif;
    font-weight: 500;
    font-size: 1.4rem;
    line-height: 1.18;
    letter-spacing: -0.015em;
    color: #0c0f1a;
    margin-bottom: 12px;
    transition: color 0.25s ease;
}
.journal-card:hover .journal-card-title {
    color: #5a1224;
}
.journal-card-excerpt {
    font-family: "Inter", sans-serif;
    font-size: 0.92rem;
    line-height: 1.6;
    color: #534e44;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 20px;
}
.journal-card-foot {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid rgba(12, 15, 26, 0.08);
}

/* Pastille catégorie (sur carte + meta) */
.journal-cat {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(90, 18, 36, 0.08);
    color: #5a1224;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 9px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    transition: background-color 0.25s ease;
}
.journal-cat:hover {
    background: rgba(90, 18, 36, 0.16);
}


/* ============================================================
 * EMPTY STATE — aucun article
 * ============================================================ */
.journal-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 64px 24px;
    border: 1px dashed rgba(12, 15, 26, 0.18);
    border-radius: 14px;
    background: rgba(251, 249, 243, 0.6);
}


/* ============================================================
 * ARTICLE — page de lecture premium
 * ============================================================ */

/* Cover encadrée façon « planche d'atelier » */
.article-planche {
    position: relative;
    padding: 14px;
    background: #fbf9f3;
    border: 1px solid rgba(12, 15, 26, 0.12);
    border-radius: 14px;
    box-shadow: 0 18px 40px -22px rgba(12, 15, 26, 0.45);
}
.article-planche-frame {
    overflow: hidden;
    border-radius: 8px;
    background: #ece5d6;
}
.article-planche-frame img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 560px;
    object-fit: cover;
}
.article-planche-mark {
    position: absolute;
    width: 12px;
    height: 12px;
    opacity: 0.5;
    pointer-events: none;
}
.article-planche-mark::before,
.article-planche-mark::after {
    content: "";
    position: absolute;
    background: rgba(90, 18, 36, 0.6);
}
.article-planche-mark::before { top: 50%; left: 0; width: 100%; height: 1px; transform: translateY(-50%); }
.article-planche-mark::after  { left: 50%; top: 0; width: 1px; height: 100%; transform: translateX(-50%); }
.article-planche-mark-tl { top: -5px; left: -5px; }
.article-planche-mark-tr { top: -5px; right: -5px; }
.article-planche-mark-bl { bottom: -5px; left: -5px; }
.article-planche-mark-br { bottom: -5px; right: -5px; }

/* Layout lecture : rail chapitre sticky (desktop) + colonne de texte */
.article-reading-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
}
@media (min-width: 1024px) {
    .article-reading-grid {
        grid-template-columns: 132px minmax(0, 1fr);
        gap: 64px;
    }
}

/* Rail chapitre vertical sticky */
.article-toc {
    position: sticky;
    top: calc(var(--navbar-h, 72px) + 40px);
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.article-toc-num {
    font-family: "Fraunces", Georgia, serif;
    font-style: italic;
    font-size: 3rem;
    line-height: 1;
    color: #5a1224;
}
.article-toc-rule {
    width: 1px;
    height: 40px;
    background: rgba(12, 15, 26, 0.18);
}
.article-toc-label {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 9px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #6b6557;
    line-height: 1.8;
}

/* Colonne de lecture : largeur de mesure confortable */
.article-reading-col {
    max-width: 68ch;
}

/* Lede / chapô avec drop-cap signature */
.article-lede {
    font-family: "Fraunces", Georgia, serif;
    font-size: clamp(1.25rem, 1.9vw, 1.6rem);
    line-height: 1.5;
    color: #13234f;
    margin-bottom: 36px;
    padding-bottom: 32px;
    border-bottom: 1px solid rgba(12, 15, 26, 0.1);
}
.article-dropcap {
    float: left;
    font-family: "Fraunces", Georgia, serif;
    font-style: italic;
    font-weight: 500;
    font-size: 4.6rem;
    line-height: 0.78;
    color: #5a1224;
    margin: 6px 14px 0 0;
}

/* Partage — boutons éditoriaux */
.article-share {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 48px;
    padding-top: 28px;
    border-top: 1px solid rgba(12, 15, 26, 0.12);
}
.article-share-label {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6b6557;
    margin-right: 4px;
}
.article-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid rgba(12, 15, 26, 0.16);
    color: #13234f;
    text-decoration: none;
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.article-share-btn:hover {
    background: #5a1224;
    border-color: #5a1224;
    color: #f5efe0;
    transform: translateY(-2px);
}

/* Mot-clé / tag */
.article-keyword {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid rgba(12, 15, 26, 0.15);
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 10px;
    letter-spacing: 0.05em;
    color: #534e44;
    text-decoration: none;
}

/* Bandeau preview staff (article non publié) */
.article-preview-banner {
    background: #ece5d6;
    border-bottom: 1px solid rgba(12, 15, 26, 0.15);
}


/* ============================================================
 * REDUCED MOTION
 * ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .journal-featured-media img,
    .journal-card-media img,
    .reading-progress-bar {
        transition: none !important;
    }
}
