/* ===== BLOG : liste des articles + pages article =====
   Complète style.min.css (variables --navy, --accent, --border…). Chargé uniquement par blog.html et blog/*.html. */

:root {
  --cat-smartphones: #2563eb;
  --cat-informatique: #0d9488;
  --cat-securite: #16a34a;
  --cat-budget: #f97316;
  --post-text: #3b3b4f;
}

/* ---------- Catégorie (pastille) ---------- */
.post-cat {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px 5px 10px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  background: color-mix(in srgb, var(--c, var(--accent)) 12%, #fff);
  color: color-mix(in srgb, var(--c, var(--accent)) 78%, #000);
}
.post-cat svg { width: 14px; height: 14px; }
.cat-smartphones { --c: var(--cat-smartphones); }
.cat-informatique { --c: var(--cat-informatique); }
.cat-securite { --c: var(--cat-securite); }
.cat-budget { --c: var(--cat-budget); }

/* ---------- Visuel des cartes (pas de photo : dégradé + icône) ---------- */
.post-visual {
  position: relative; overflow: hidden;
  display: grid; place-items: center;
  background:
    radial-gradient(circle at 85% 15%, color-mix(in srgb, var(--c, var(--accent)) 55%, transparent) 0, transparent 55%),
    radial-gradient(circle at 10% 100%, color-mix(in srgb, var(--c, var(--accent)) 30%, transparent) 0, transparent 50%),
    var(--navy);
  color: #fff;
}
.post-visual::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.09) 1px, transparent 1px);
  background-size: 16px 16px;
}
.post-visual svg { position: relative; width: 64px; height: 64px; opacity: .95; filter: drop-shadow(0 6px 18px rgba(0,0,0,.35)); }

/* ---------- Page liste : en-tête ---------- */
.blog-hero { background: var(--navy); color: #fff; padding: 64px 24px 56px; text-align: center; position: relative; overflow: hidden; }
.blog-hero::after {
  content: ""; position: absolute; inset: auto -10% -60% -10%; height: 120%;
  background: radial-gradient(ellipse at center, rgba(249,115,22,.18), transparent 60%);
  pointer-events: none;
}
.blog-hero > * { position: relative; z-index: 1; }
.blog-hero h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin: 0 auto 14px; max-width: 760px; color: #fff; }
.blog-hero p { color: rgba(255,255,255,.62); font-size: 1rem; line-height: 1.7; max-width: 560px; margin: 0 auto; }
.blog-filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 30px; }
.blog-filters button {
  font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06); color: rgba(255,255,255,.8);
  transition: background .2s, color .2s, border-color .2s;
}
.blog-filters button:hover { background: rgba(255,255,255,.12); color: #fff; }
.blog-filters button[aria-pressed="true"] { background: #fff; color: var(--navy); border-color: #fff; }

.blog-list { max-width: 1160px; margin: 0 auto; padding: 48px 24px 72px; }

/* Article à la une */
.post-feature {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 0;
  background: var(--card); border: 1px solid var(--border); border-radius: 18px; overflow: hidden;
  box-shadow: var(--sh-sm); text-decoration: none; color: inherit; margin-bottom: 36px;
  transition: box-shadow .25s, transform .25s;
}
.post-feature:hover { box-shadow: var(--sh-md); transform: translateY(-3px); }
.post-feature .post-visual { min-height: 320px; }
.post-feature .post-visual svg { width: 96px; height: 96px; }
.post-feature-body { padding: 40px 40px 36px; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.post-feature-kicker { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.post-new { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); }
.post-feature h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.2; color: var(--navy); margin: 0; }
.post-feature p { color: var(--muted); font-size: .97rem; line-height: 1.7; margin: 0; }

/* Grille */
.post-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.post-card {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
  box-shadow: var(--sh-sm); text-decoration: none; color: inherit;
  transition: box-shadow .25s, transform .25s, border-color .25s;
}
.post-card:hover { box-shadow: var(--sh); transform: translateY(-4px); border-color: color-mix(in srgb, var(--c, var(--accent)) 45%, var(--border)); }
.post-card .post-visual { height: 170px; }
.post-card-body { padding: 22px 22px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.post-card h3 { font-size: 1.08rem; font-weight: 700; line-height: 1.35; color: var(--navy); margin: 0; }
.post-card p { font-size: .9rem; color: var(--muted); line-height: 1.65; margin: 0; }
.post-info { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--light); margin-top: auto; padding-top: 6px; }
.post-info i { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.post-go { margin-left: auto; font-weight: 700; color: var(--accent-text); white-space: nowrap; }
.post-card:hover .post-go, .post-feature:hover .post-go { text-decoration: underline; }
.post-empty { text-align: center; color: var(--muted); padding: 32px 0; }
[hidden] { display: none !important; }

/* Bandeau d'appel */
.blog-cta {
  max-width: 1160px; margin: 0 auto 80px; padding: 0 24px;
}
.blog-cta-inner {
  background: var(--navy); color: #fff; border-radius: 20px; padding: 40px;
  display: flex; align-items: center; justify-content: space-between; gap: 28px; flex-wrap: wrap;
  background-image: radial-gradient(circle at 100% 0, rgba(249,115,22,.25), transparent 45%);
}
.blog-cta h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; margin: 0 0 6px; color: #fff; }
.blog-cta p { color: rgba(255,255,255,.62); margin: 0; font-size: .95rem; line-height: 1.6; max-width: 520px; }
.blog-cta p a { color: #fdba74; }
.blog-cta .btn-group { margin: 0; }

/* ---------- Page article ---------- */
.read-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 1000; pointer-events: none; }
.read-progress span { display: block; height: 100%; width: 100%; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, #f97316, #fbbf24); }

.post-hero { background: var(--navy); color: #fff; padding: 52px 24px 56px; position: relative; overflow: hidden; }
.post-hero::after {
  content: ""; position: absolute; right: -15%; top: -40%; width: 70%; height: 180%;
  background: radial-gradient(circle, color-mix(in srgb, var(--c, var(--accent)) 30%, transparent), transparent 60%);
  pointer-events: none;
}
.post-hero-inner { max-width: 1160px; margin: 0 auto; position: relative; z-index: 1; }
.post-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .82rem; color: rgba(255,255,255,.5); margin-bottom: 26px; }
.post-crumb a { color: rgba(255,255,255,.75); text-decoration: none; }
.post-crumb a:hover { color: #fff; text-decoration: underline; }
.post-hero .post-cat { background: rgba(255,255,255,.1); color: #fff; }
.post-hero h1 { font-size: clamp(1.9rem, 4.6vw, 3rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.12; color: #fff; margin: 16px 0 16px; max-width: 860px; }
.post-lede { color: rgba(255,255,255,.68); font-size: 1.05rem; line-height: 1.7; max-width: 720px; margin: 0 0 26px; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; font-size: .86rem; color: rgba(255,255,255,.6); }
.post-author { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-weight: 600; }
.post-author .avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-btn); color: #fff; font-size: .75rem; font-weight: 800; letter-spacing: .02em; }
.post-meta .sep { width: 4px; height: 4px; border-radius: 50%; background: rgba(255,255,255,.35); }

.post-section { padding: 48px 24px 24px; }
.post-layout { max-width: 1160px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; align-items: start; }

.post-body { min-width: 0; max-width: 720px; }
.post-body > p, .post-body > ul, .post-body > ol, .post-body li { font-size: 1.04rem; line-height: 1.85; color: var(--post-text); }
.post-body > p { margin: 0 0 18px; }
.post-body > p:first-child { font-size: 1.14rem; line-height: 1.8; color: var(--text); }
.post-body > ul, .post-body > ol { padding-left: 1.4rem; margin: 0 0 18px; }
.post-body li { margin-bottom: 6px; }
.post-body h2 {
  font-size: clamp(1.3rem, 2.4vw, 1.6rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.25;
  color: var(--navy); margin: 48px 0 14px; scroll-margin-top: 90px;
  padding-left: 16px; border-left: 4px solid var(--accent);
}
.post-body h3 { font-size: 1.15rem; font-weight: 700; color: var(--navy); margin: 30px 0 8px; }
.post-body strong { color: var(--text); }
.post-body a { color: var(--accent-text); text-underline-offset: 3px; }
.post-body a:hover { color: var(--accent-btn-h); }

.post-body .tip-box, .post-body .warn-box {
  border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 12px;
  background: #fff; padding: 18px 22px; margin: 26px 0; box-shadow: var(--sh-sm);
}
.post-body .warn-box { border-left-color: #f59e0b; background: #fffbeb; }
.post-body .tip-box p, .post-body .warn-box p { font-size: .98rem; line-height: 1.75; }
.post-body .tip-box p { color: var(--post-text) !important; }

.post-body .compare-table {
  display: block; overflow-x: auto; width: 100%;
  border: 1px solid var(--border); border-radius: 14px; background: #fff; box-shadow: var(--sh-sm);
  margin: 22px 0 30px; font-size: .93rem; border-collapse: separate; border-spacing: 0;
}
.post-body .compare-table th { background: var(--bg-alt); border-bottom: 0; padding: 13px 16px; white-space: nowrap; }
.post-body .compare-table td { padding: 13px 16px; color: var(--post-text); }
.post-body .compare-table td:first-child { font-weight: 600; color: var(--navy); }
.post-body .compare-table tr:hover td { background: #fbf8f4; }

.post-body .cta-inline {
  border-radius: 18px; padding: 36px 32px; margin: 44px 0 28px; text-align: left;
  background: var(--navy); background-image: radial-gradient(circle at 100% 0, rgba(249,115,22,.28), transparent 50%);
}
.post-body .cta-inline h3 { font-size: 1.35rem; font-weight: 800; color: #fff; margin: 0 0 8px; }
.post-body .cta-inline p { font-size: .98rem; line-height: 1.65; color: rgba(255,255,255,.7) !important; }
.post-body .cta-inline .btn-group { justify-content: flex-start; }
.post-body .cta-inline a.btn { text-decoration: none; }
.post-body .cta-inline a.btn-primary, .post-body .cta-inline a.btn-primary:hover { color: #fff; }
.post-body .cta-inline a.btn-outline { color: #fff; border-color: rgba(255,255,255,.35); }

/* Colonne de droite */
.post-aside { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 18px; }
.aside-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 22px; box-shadow: var(--sh-sm); }
.aside-title { font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--light); margin: 0 0 12px; }
.toc-list { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc-list li { counter-increment: toc; }
.toc-list a {
  display: flex; gap: 10px; padding: 7px 10px; margin: 0 -10px; border-radius: 8px;
  font-size: .88rem; line-height: 1.45; color: var(--muted); text-decoration: none;
  transition: background .2s, color .2s;
}
.toc-list a::before { content: counter(toc, decimal-leading-zero); font-weight: 700; font-size: .75rem; color: var(--light); padding-top: 2px; }
.toc-list a:hover { background: var(--bg); color: var(--navy); }
.toc-list a.is-active { background: color-mix(in srgb, var(--accent) 10%, #fff); color: var(--accent-text); font-weight: 600; }
.toc-list a.is-active::before { color: var(--accent-text); }

.aside-cta { background: var(--navy); border-color: var(--navy); color: #fff; }
.aside-cta b { display: block; font-size: 1.08rem; margin-bottom: 6px; }
.aside-cta p { color: rgba(255,255,255,.65); font-size: .88rem; line-height: 1.6; margin: 0 0 16px; }
.aside-cta .btn { width: 100%; justify-content: center; margin-top: 8px; text-decoration: none; }
.aside-cta .btn-outline { color: #fff; border-color: rgba(255,255,255,.3); }

/* À lire aussi */
.post-more { background: var(--bg-alt); padding: 56px 24px 72px; margin-top: 40px; }
.post-more-inner { max-width: 1160px; margin: 0 auto; }
.post-more-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.post-more h2 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; color: var(--navy); margin: 0; }
.post-more-head a { font-weight: 700; color: var(--accent-text); text-decoration: none; }
.post-more-head a:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .post-layout { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .post-body { max-width: none; }
  .post-aside { position: static; order: -1; }
  .post-aside .aside-cta { display: none; }
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .post-feature { grid-template-columns: 1fr; }
  .post-feature .post-visual { min-height: 180px; }
  .post-feature .post-visual svg { width: 72px; height: 72px; }
  .post-feature-body { padding: 26px 22px 24px; }
  .post-grid { grid-template-columns: 1fr; gap: 18px; }
  .blog-hero { padding: 48px 16px 40px; }
  .blog-list { padding: 32px 16px 56px; }
  .blog-cta { padding: 0 16px; margin-bottom: 56px; }
  .blog-cta-inner { padding: 28px 22px; }
  .post-hero { padding: 36px 16px 40px; }
  .post-section { padding: 28px 16px 8px; }
  .post-body > p, .post-body li { font-size: 1rem; }
  .post-body > p:first-child { font-size: 1.06rem; }
  .post-body .cta-inline { padding: 28px 22px; }
  .post-more { padding: 44px 16px 56px; }
}

@media (prefers-reduced-motion: reduce) {
  .post-card, .post-feature { transition: none; }
  .post-card:hover, .post-feature:hover { transform: none; }
}

/* ---------- Retouches ---------- */
.post-card-body .post-cat, .post-feature-kicker .post-cat { align-self: flex-start; }
.blog-cta .btn-outline { color: #fff; border-color: rgba(255,255,255,.35); }
.blog-cta .btn-outline:hover { background: rgba(255,255,255,.08); color: #fff; }

/* Liste : cartes horizontales sur 2 colonnes (pas de carte orpheline) */
.blog-list .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.blog-list .post-card { flex-direction: row; }
.blog-list .post-card .post-visual { height: auto; width: 34%; flex-shrink: 0; min-height: 210px; }
.blog-list .post-card .post-visual svg { width: 52px; height: 52px; }

/* Sommaire repliable */
.toc-card summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; margin: 0; }
.toc-card summary::-webkit-details-marker { display: none; }
.toc-card summary::after { content: "+"; font-size: 1.1rem; font-weight: 600; color: var(--muted); }
.toc-card[open] summary::after { content: "–"; }
.toc-card[open] summary { margin-bottom: 12px; }
@media (min-width: 1025px) { .toc-card summary { pointer-events: none; } .toc-card summary::after { display: none; } }

@media (max-width: 760px) {
  .blog-list .post-grid { grid-template-columns: 1fr; }
  .blog-list .post-card { flex-direction: column; }
  .blog-list .post-card .post-visual { width: auto; min-height: 0; height: 140px; }
}

/* Nombre impair d'articles : le dernier prend toute la largeur */
@media (min-width: 761px) {
  .blog-list .post-grid > .post-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .blog-list .post-grid > .post-card:last-child:nth-child(odd) .post-visual { width: 22%; }
}
