/*
 * Blog (/blog, /en/blog) : liste, catégories et articles. Chargé dans le contenu des pages du blog
 * (docs/seo.md, règle 7) ; les cartes d'articles, partagées avec l'accueil et les villes, sont dans
 * site.css (.post-card). Mobile d'abord, clair et sombre (variables de site.css).
 */

/* ---------- Liste ---------- */

.blog-hero { background: var(--canvas); padding-bottom: clamp(24px, 4vw, 40px); }
.blog-hero__head { max-width: 46rem; padding-top: clamp(16px, 3vw, 32px); }
.blog-hero h1 { font-size: clamp(2.1rem, 5.4vw, 3.6rem); margin-bottom: .35em; }
.blog-hero .lead { margin-bottom: 0; }

.blog-filter { margin-top: clamp(22px, 3vw, 32px); }
.blog-filter ul { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 0; padding: 0; }
.blog-filter a {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 999px;
    background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink); font-weight: 800; font-size: .92rem;
    text-decoration: none; transition: box-shadow .2s, background .2s, color .2s;
}
.blog-filter a:hover { box-shadow: inset 0 0 0 2px var(--petrol); color: var(--petrol); }
.blog-filter a[aria-current] { background: var(--petrol-night); box-shadow: none; color: #fff; }
.blog-filter .icon { width: 18px; height: 18px; color: var(--petrol); }
.blog-filter a[aria-current] .icon { color: var(--amber); }
.blog-filter__count { min-width: 24px; padding: 1px 7px; border-radius: 999px; background: var(--petrol-mist); color: var(--petrol); font-size: .78rem; text-align: center; }
.blog-filter a[aria-current] .blog-filter__count { background: rgba(255, 255, 255, .16); color: #fff; }
@media (prefers-color-scheme: dark) { .blog-filter a[aria-current] { background: var(--petrol-deep); } }

.blog-featured-wrap { padding-top: clamp(24px, 4vw, 44px); }
.blog-featured {
    position: relative; display: grid; overflow: hidden; border-radius: calc(var(--radius) + 4px);
    background: var(--petrol-night); color: #fff; box-shadow: var(--shadow-2); transition: transform .3s var(--ease-out);
}
.blog-featured:hover, .blog-featured:focus-within { transform: translateY(-4px); }
.blog-featured:has(.post-card__link:focus-visible) { outline: 3px solid var(--focus); outline-offset: 4px; }
.blog-featured__img { aspect-ratio: 16 / 9; overflow: hidden; background: var(--petrol-deep); }
.blog-featured__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease-out); }
.blog-featured:hover .blog-featured__img img { transform: scale(1.03); }
.blog-featured__body { display: flex; flex-direction: column; gap: 12px; padding: clamp(22px, 3.4vw, 40px); }
.blog-featured__badge { margin: 0; font-size: .76rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--amber); }
.blog-featured__title { margin: 0; font-size: clamp(1.6rem, 3.4vw, 2.5rem); line-height: 1.1; }
.blog-featured__title .post-card__link { color: #fff; }
.blog-featured__text { margin: 0; color: #d3ebf1; font-size: clamp(1rem, 1.5vw, 1.12rem); }
.blog-featured .post-card__meta { color: #a9cfd9; }
.blog-featured__more { color: var(--amber); min-height: 0; margin-top: 4px; }
@media (min-width: 960px) {
    .blog-featured { grid-template-columns: 1.25fr 1fr; align-items: stretch; }
    .blog-featured__img { aspect-ratio: auto; min-height: 380px; }
    .blog-featured__body { justify-content: center; }
}

.blog-list__title { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-bottom: 22px; }
.blog-empty { padding: 28px; border-radius: var(--radius); background: var(--canvas); font-weight: 700; color: var(--ink-2); }
.blog-pages { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 36px; }
.blog-pages ol { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.blog-pages a {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; min-height: 44px; padding: 0 12px;
    border-radius: 12px; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 800; color: var(--ink); text-decoration: none;
}
.blog-pages a[aria-current] { background: var(--petrol); color: #fff; box-shadow: none; }
.blog-pages .icon { width: 18px; height: 18px; }
.blog-rss { margin: 28px 0 0; text-align: center; font-size: .88rem; font-weight: 700; }
.blog-rss a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); }

/* ---------- Article ---------- */

.post-preview { position: sticky; top: var(--header-h); z-index: 5; padding: 10px 0; background: var(--amber); color: var(--amber-ink); font-weight: 800; font-size: .92rem; }

.post-hero { background: linear-gradient(180deg, var(--canvas) 0 calc(100% - min(24vw, 340px)), var(--bg) 0); }
.post-hero:not(:has(.post-cover)) { background: var(--canvas); }
.post-hero__inner { max-width: calc(52rem + 2 * var(--gutter)); padding-bottom: clamp(24px, 4vw, 40px); }
@media (max-width: 719px) { .post-hero .breadcrumb li[aria-current] { display: none; } }
.post-hero__cat {
    display: inline-flex; align-items: center; gap: 8px; min-height: 36px; margin-top: clamp(10px, 2vw, 22px); padding: 6px 14px 6px 10px;
    border-radius: 999px; background: var(--amber-soft); color: var(--amber-ink); font-size: .8rem; font-weight: 800; letter-spacing: .06em;
    text-transform: uppercase; text-decoration: none;
}
.post-hero__cat:hover { background: var(--amber); color: var(--amber-ink); }
.post-hero__cat .icon { width: 18px; height: 18px; }
@media (prefers-color-scheme: dark) { .post-hero__cat { color: var(--amber); } .post-hero__cat:hover { color: var(--amber-ink); } }
.post-hero h1 { margin: 16px 0 14px; font-size: clamp(2rem, 5.2vw, 3.5rem); line-height: 1.06; letter-spacing: -.035em; max-width: 19em; }
.post-hero__lead { margin: 0; max-width: 40rem; font-size: clamp(1.1rem, 1.9vw, 1.32rem); line-height: 1.55; color: var(--ink-2); font-weight: 500; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 22px 0 0; font-size: .88rem; font-weight: 700; color: var(--muted); }
.post-meta > span { display: inline-flex; align-items: center; gap: 7px; }
.post-meta .icon { width: 16px; height: 16px; }
.post-meta__author { color: var(--ink); }
.post-meta__author img { width: 28px; height: 28px; border-radius: 50%; background: var(--card); box-shadow: 0 0 0 2px var(--line); }

.post-cover { margin: 0 auto; }
.post-cover img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: clamp(14px, 2vw, 24px); background: var(--petrol-mist); box-shadow: var(--shadow-1); }
.post-cover__credit { margin-top: 8px; text-align: right; font-size: .78rem; font-weight: 600; color: var(--muted); }
.post-cover__credit a { color: inherit; display: inline-flex; min-height: 24px; align-items: center; }

.post-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 56px; padding-top: clamp(28px, 4vw, 52px); padding-bottom: clamp(40px, 6vw, 72px); }
.post-aside { display: none; }
.post-main { width: 100%; min-width: 0; max-width: 39rem; margin-inline: auto; }
@media (min-width: 1040px) {
    .post-layout { grid-template-columns: 240px minmax(0, 39rem); justify-content: center; }
    .post-main { margin-inline: 0; }
    .post-aside { display: block; }
    .post-aside > * { position: sticky; top: calc(var(--header-h) + 24px); }
    .post-aside .post-share { position: static; margin-top: 22px; }
    .post-toc-mobile { display: none; }
}

.post-toc { max-height: calc(100vh - var(--header-h) - 160px); overflow-y: auto; padding: 4px 0 4px 18px; border-left: 3px solid var(--line); }
.post-toc__title, .post-share__title { margin: 0 0 8px; font-size: .74rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.post-toc ol { list-style: none; margin: 0; padding: 0; }
.post-toc a { display: block; padding: 7px 0; color: var(--ink-2); font-size: .9rem; font-weight: 700; line-height: 1.35; text-decoration: none; }
.post-toc a:hover { color: var(--petrol); text-decoration: underline; }

.post-toc-mobile { margin-bottom: 28px; border-radius: var(--radius-s); background: var(--canvas); }
.post-toc-mobile summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 0 18px; font-weight: 800; cursor: pointer; list-style: none; }
.post-toc-mobile summary::-webkit-details-marker { display: none; }
.post-toc-mobile summary::after { content: ""; width: 10px; height: 10px; border-right: 2.5px solid var(--petrol); border-bottom: 2.5px solid var(--petrol); transform: rotate(45deg) translateY(-3px); transition: transform .2s; }
.post-toc-mobile[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.post-toc-mobile ol { margin: 0; padding: 0 18px 14px 38px; }
.post-toc-mobile li { padding: 4px 0; }
.post-toc-mobile a { display: inline-block; min-height: 32px; padding: 4px 0; color: var(--ink-2); font-weight: 700; }

/* Corps de l'article : environ 65 caractères par ligne (colonne de 39rem, texte de 18 px) */
.post-body { font-size: clamp(1.05rem, 1.25vw, 1.125rem); line-height: 1.75; color: var(--ink-2); }
.post-body p { margin: 0 0 1.15em; }
.post-body h2 {
    position: relative; margin: 2.1em 0 .6em; padding-top: 18px; font-size: clamp(1.5rem, 3vw, 1.95rem); line-height: 1.15;
    color: var(--ink); scroll-margin-top: calc(var(--header-h) + 20px);
}
.post-body h2::before { content: ""; position: absolute; top: 0; left: 0; width: 44px; height: 5px; border-radius: 3px; background: linear-gradient(90deg, var(--amber) 0 50%, var(--green) 50% 100%); }
.post-body > h2:first-child { margin-top: 0; }
.post-body h3 { margin: 1.7em 0 .5em; font-size: clamp(1.18rem, 2vw, 1.35rem); color: var(--ink); scroll-margin-top: calc(var(--header-h) + 20px); }
.post-body a { color: var(--link); font-weight: 700; }
/* Lien vers un autre site (nouvel onglet) : petite flèche discrète, non soulignée */
.ext-link__icon { display: inline-block; margin-left: .18em; font-size: .78em; font-weight: 700; line-height: 1; opacity: .7; text-decoration: none; vertical-align: .08em; }
a.ext-link:hover .ext-link__icon, a.ext-link:focus-visible .ext-link__icon { opacity: 1; }
.post-body strong { color: var(--ink); font-weight: 800; }
.post-body ul, .post-body ol { margin: 0 0 1.2em; padding-left: 1.3em; }
.post-body li { margin-bottom: .5em; padding-left: .2em; }
.post-body li::marker { color: var(--petrol); font-weight: 800; }
.post-body ol > li::marker { color: var(--num-amber); }
.post-body hr { margin: 2.4em 0; border: 0; border-top: 1.5px solid var(--line); }
.post-body blockquote { margin: 1.6em 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--amber); font-size: 1.08em; color: var(--ink); }
.post-body code { padding: 1px 6px; border-radius: 6px; background: var(--canvas); font-size: .9em; }

/* Encadrés « À retenir », « Bon à savoir », « Attention » */
.post-body .callout { margin: 2em 0; padding: 22px 24px; border-radius: var(--radius); box-shadow: none; background: var(--petrol-mist); border-left: 5px solid var(--petrol); }
.post-body .callout__title { margin: 0 0 10px; font-size: .8rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--petrol); }
.post-body .callout > :last-child { margin-bottom: 0; }
.post-body .callout ul { margin-bottom: 0; }
.post-body .callout--key { background: var(--display-bg); color: #e6f1f4; border-left: 0; box-shadow: inset 0 0 0 1.5px var(--display-edge); }
.post-body .callout--key .callout__title { color: var(--digit-amber); }
.post-body .callout--key p, .post-body .callout--key li { color: #e6f1f4; }
.post-body .callout--key strong { color: #fff; }
.post-body .callout--key li::marker { color: var(--digit-amber); }
.post-body .callout--key a { color: #9fdcec; }
.post-body .callout--warning { background: var(--amber-soft); border-left-color: var(--amber-deep); }
.post-body .callout--warning .callout__title { color: var(--num-amber); }

/* Images et graphiques */
.post-figure { margin: 2.2em 0; }
.post-figure img { width: 100%; height: auto; border-radius: 16px; background: var(--canvas); }
.post-figure__zoom { display: block; border-radius: 16px; cursor: zoom-in; }
.post-figure--chart img { border-radius: 16px; box-shadow: inset 0 0 0 1.5px var(--line), var(--shadow-1); }
.post-figure figcaption { margin-top: 10px; padding-left: 12px; border-left: 3px solid var(--amber); font-size: .86rem; line-height: 1.5; color: var(--muted); font-weight: 600; }

/* Tableaux */
.post-table { margin: 1.8em 0; overflow-x: auto; border-radius: var(--radius-s); box-shadow: inset 0 0 0 1.5px var(--line); }
.post-table:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.post-table table { width: 100%; border-collapse: collapse; font-size: .93rem; line-height: 1.45; }
.post-table th, .post-table td { padding: 11px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.post-table th { background: var(--petrol-mist); color: var(--ink); font-weight: 800; white-space: nowrap; }
.post-table tr:last-child td { border-bottom: 0; }
.post-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--canvas) 55%, transparent); }

/* Appel à télécharger l'app, dans le texte */
.post-app {
    display: grid; gap: 16px; margin: 2.4em 0; padding: clamp(20px, 3vw, 28px); border-radius: var(--radius);
    background: linear-gradient(140deg, var(--petrol) 0%, var(--petrol-deep) 55%, var(--petrol-night) 100%); color: #fff;
}
@media (prefers-color-scheme: dark) { .post-app { background: linear-gradient(140deg, #0d6680 0%, #084a5c 55%, #063845 100%); } }
.post-app__icon img { width: 56px; height: 56px; border-radius: 16px; background: #fff; padding: 6px; }
.post-app__kicker { margin: 0 0 4px; font-size: .74rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--amber); }
@media (prefers-color-scheme: dark) { .post-app__kicker { color: #ffc857; } }
.post-app__title { margin: 0 0 6px; font-size: clamp(1.25rem, 2.4vw, 1.5rem); font-weight: 800; line-height: 1.2; color: #fff; }
.post-app__text { margin: 0 0 14px; color: #d3ebf1; font-size: .98rem; line-height: 1.55; }
.post-app .stores { margin: 0; }
.post-app .store-badge__soon { color: #fff; }
.post-app__more { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-top: 6px; color: #fff !important; font-weight: 800; }
.post-app__more .icon { width: 1.1em; height: 1.1em; }
@media (min-width: 640px) { .post-app { grid-template-columns: 56px 1fr; gap: 20px; } }

/* Sources */
.post-sources { margin-top: clamp(36px, 5vw, 56px); padding: 22px 24px; border-radius: var(--radius); background: var(--canvas); font-size: .9rem; line-height: 1.55; color: var(--ink-2); }
.post-sources h2 { margin: 0 0 4px; font-size: 1.15rem; }
.post-sources__lead { margin: 0 0 12px; color: var(--muted); font-weight: 600; }
.post-sources ul, .post-sources ol { margin: 0; padding-left: 1.2em; }
.post-sources li { margin-bottom: 8px; }
.post-sources li::marker { color: var(--petrol); }
.post-sources a { overflow-wrap: anywhere; word-break: break-word; }
.post-sources p { margin: 0 0 8px; }

/* Partage et liens de fin */
.post-end { display: grid; gap: 24px; margin-top: 32px; padding-top: 28px; border-top: 1.5px solid var(--line); }
.post-share__list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.post-share__link {
    display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 14px; border-radius: 999px;
    background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink); font-size: .86rem; font-weight: 800; text-decoration: none;
}
.post-share__link:hover { box-shadow: inset 0 0 0 2px var(--petrol); color: var(--petrol); }
.post-share__link .icon { width: 16px; height: 16px; }
.post-aside .post-share__list { display: grid; grid-template-columns: 1fr 1fr; }
.post-aside .post-share__link { display: flex; justify-content: center; padding-inline: 8px; }
.post-aside .post-share__list li:last-child { grid-column: 1 / -1; }
.post-explore { display: flex; flex-wrap: wrap; gap: 10px; }
.post-explore a {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 12px;
    background: var(--petrol-mist); color: var(--petrol); font-weight: 800; font-size: .9rem; text-decoration: none;
}
.post-explore a:hover { background: var(--petrol); color: #fff; }
.post-explore .icon { width: 18px; height: 18px; }
@media (prefers-color-scheme: dark) { .post-explore a { color: #9fdcec; } .post-explore a:hover { color: #0b1215; background: #5fb3c9; } }
.post-related__title { margin-bottom: 24px; font-size: clamp(1.5rem, 3vw, 2rem); }

/* ---------- Compteur de vues (App\Services\Blog\BlogViews) ---------- */

.post-meta__views[hidden] { display: none; }
.post-card__views { white-space: nowrap; }

.blog-most-read { padding-top: 0; }
.blog-most-read__list {
    display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    list-style: none; margin: 0; padding: 0;
}
.blog-most-read__item {
    position: relative; display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px; border-radius: var(--radius);
    background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line); transition: box-shadow .2s;
}
.blog-most-read__item:hover, .blog-most-read__item:focus-within { box-shadow: inset 0 0 0 2px var(--petrol); }
.blog-most-read__rank { min-width: 1.3em; font-size: 2rem; font-weight: 800; line-height: 1; color: var(--petrol); font-variant-numeric: tabular-nums; }
.blog-most-read__body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.blog-most-read__link { color: var(--ink); font-weight: 800; line-height: 1.3; text-decoration: none; }
.blog-most-read__link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.blog-most-read__link:focus-visible { outline: none; }
.blog-most-read__item:has(.blog-most-read__link:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }
.blog-most-read__meta { margin: 0; font-size: .82rem; font-weight: 700; color: var(--muted); }
@media (prefers-color-scheme: dark) { .blog-most-read__rank { color: #9fdcec; } }
