/* Carlivanta — pages articles (SEO) */
.article-page, .blog-page {
  padding: 0;
  max-width: none;
  margin: 0;
}

.blog-page h1 {
  font-family: var(--font-display, Georgia, serif);
  margin-bottom: 0.5rem;
  color: var(--text);
}

/* ─── Article : coque page (le contenu HTML est isolé dans Shadow DOM) ─── */
html[data-theme="dark"] .article-header h1 {
  color: var(--text);
}

html[data-theme="dark"] .article-meta {
  color: var(--text-muted);
}

html[data-theme="dark"] .article-cta {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

html[data-theme="dark"] .article-cta strong {
  color: var(--text);
}

/* ─── Corps article SSR : encadrés à fond clair en mode sombre ─── */
html[data-theme="dark"] .article-body-ssr h2,
html[data-theme="dark"] .article-body-ssr h3 {
  color: var(--text);
}

html[data-theme="dark"] .article-body-ssr :is(
  .card,
  .highlight,
  .warning,
  .note,
  .callout,
  .box,
  .info,
  .tip,
  .alert,
  blockquote
) {
  color: #0f172a !important;
}

html[data-theme="dark"] .article-body-ssr :is(
  .card,
  .highlight,
  .warning,
  .note,
  .callout,
  .box,
  .info,
  .tip,
  .alert,
  blockquote
) :is(h1, h2, h3, h4, h5, h6, strong, b) {
  color: #1f3a5f !important;
}

html[data-theme="dark"] .article-body-ssr :is(
  .card,
  .highlight,
  .warning,
  .note,
  .callout,
  .box,
  .info,
  .tip,
  .alert,
  blockquote
) :is(p, li, span, em, i, small, label, td, th, div) {
  color: inherit !important;
}

html[data-theme="dark"] .article-body-ssr :is(
  .card,
  .highlight,
  .warning,
  .note,
  .callout,
  .box,
  .info,
  .tip,
  .alert,
  blockquote
) a {
  color: #2b6cb0 !important;
}

/* Exports HTML / collages avec style inline fond clair */
html[data-theme="dark"] .article-body-ssr :is(
  div[style*="background-color:#fff"],
  div[style*="background-color: #fff"],
  div[style*="background-color:#ffffff"],
  div[style*="background-color: #ffffff"],
  div[style*="background-color: white"],
  div[style*="background-color: rgb(255, 255, 255)"],
  div[style*="background-color:rgb(255, 255, 255)"],
  div[style*="background:#fff"],
  div[style*="background: #fff"],
  div[style*="background:#ffffff"],
  div[style*="background: #ffffff"],
  div[style*="background: white"],
  div[style*="background-color:#e8f2ff"],
  div[style*="background-color: #e8f2ff"],
  div[style*="background-color:#fff4e5"],
  div[style*="background-color: #fff4e5"],
  div[style*="background-color:#f8fafc"],
  div[style*="background-color: #f8fafc"]
) {
  color: #0f172a !important;
}

html[data-theme="dark"] .article-body-ssr :is(
  div[style*="background-color:#fff"],
  div[style*="background-color: #fff"],
  div[style*="background-color:#ffffff"],
  div[style*="background-color: #ffffff"],
  div[style*="background-color: white"],
  div[style*="background-color: rgb(255, 255, 255)"],
  div[style*="background-color:rgb(255, 255, 255)"],
  div[style*="background:#fff"],
  div[style*="background: #fff"],
  div[style*="background:#ffffff"],
  div[style*="background: #ffffff"],
  div[style*="background: white"],
  div[style*="background-color:#e8f2ff"],
  div[style*="background-color: #e8f2ff"],
  div[style*="background-color:#fff4e5"],
  div[style*="background-color: #fff4e5"],
  div[style*="background-color:#f8fafc"],
  div[style*="background-color: #f8fafc"]
) :is(p, li, span, em, i, small, label, td, th, div, h1, h2, h3, h4, h5, h6, strong, b) {
  color: inherit !important;
}

html[data-theme="dark"] .article-body-ssr :is(
  div[style*="background-color:#fff"],
  div[style*="background-color: #fff"],
  div[style*="background-color:#ffffff"],
  div[style*="background-color: #ffffff"],
  div[style*="background-color: white"],
  div[style*="background-color: rgb(255, 255, 255)"],
  div[style*="background-color:rgb(255, 255, 255)"],
  div[style*="background:#fff"],
  div[style*="background: #fff"],
  div[style*="background:#ffffff"],
  div[style*="background: #ffffff"],
  div[style*="background: white"],
  div[style*="background-color:#e8f2ff"],
  div[style*="background-color: #e8f2ff"],
  div[style*="background-color:#fff4e5"],
  div[style*="background-color: #fff4e5"],
  div[style*="background-color:#f8fafc"],
  div[style*="background-color: #f8fafc"]
) a {
  color: #2b6cb0 !important;
}

.article-body-host {
  display: block;
  width: 100%;
  margin: 0.5rem 0 0;
  min-height: 1rem;
}

html[data-theme="dark"] .blog-sidebar-link--active {
  color: #c7d2fe;
}

.blog-lead { color: var(--text-muted); margin-bottom: 2rem; }

.blog-category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.5rem;
}

.blog-category-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.9rem;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.blog-category-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.blog-category-chip--active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.blog-category-count {
  font-size: 0.75rem;
  opacity: 0.85;
}

.blog-card-category {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 0.35rem;
}

.article-category-badge {
  margin: 0 0 0.65rem;
}

.article-category-badge a {
  display: inline-block;
  padding: 0.28rem 0.75rem;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  background: var(--primary-light);
  color: var(--primary-dark);
}

.article-category-badge a:hover {
  background: var(--primary);
  color: #fff;
}

.blog-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.blog-list li {
  border: none;
  padding: 0;
}

.blog-card {
  display: block;
  position: relative;
  min-height: 220px;
  border-radius: var(--radius, 12px);
  overflow: hidden;
  text-decoration: none;
  color: #fff;
  background-color: #1e293b;
  background-image: var(--blog-cover);
  background-size: cover;
  background-position: center;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.blog-card--no-cover {
  background-image: linear-gradient(135deg, #4f46e5 0%, #0d9488 55%, #134e4a 100%);
}

.blog-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.18);
}

.blog-card-overlay {
  position: relative;
  z-index: 1;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.35rem 1.4rem;
  background: linear-gradient(
    to top,
    rgba(15, 23, 42, 0.94) 0%,
    rgba(15, 23, 42, 0.72) 42%,
    rgba(15, 23, 42, 0.28) 72%,
    rgba(15, 23, 42, 0.08) 100%
  );
}

.blog-card h2 {
  font-size: clamp(1.15rem, 3vw, 1.45rem);
  margin: 0 0 0.35rem;
  color: #fff;
  font-family: var(--font-display, Georgia, serif);
  line-height: 1.25;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.blog-card time {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.82);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.blog-card p {
  margin: 0.55rem 0 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Ancien style liste simple — conservé pour compatibilité */
.blog-list a:not(.blog-card) {
  text-decoration: none;
  color: inherit;
}

.blog-list a:not(.blog-card) h2 {
  font-size: 1.2rem;
  margin: 0 0 0.35rem;
  color: var(--primary);
}

.blog-list a:not(.blog-card) time {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.blog-list a:not(.blog-card) p {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.article-header { margin-bottom: 1.5rem; }

.article-header h1 {
  font-family: var(--font-display, Georgia, serif);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  line-height: 1.2;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.article-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.article-cover-wrap {
  width: 100%;
  margin: 1rem 0 1.5rem;
}

.article-cover {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  object-fit: contain;
}

.article-back {
  margin-top: 2.5rem;
}

.article-cta {
  margin-top: 2rem;
  padding: 1.35rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.article-cta-lead {
  margin: 0 0 0.85rem;
  line-height: 1.5;
}

.article-cta-desc {
  margin: 0 0 1.35rem;
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.6;
}

.article-cta .btn {
  width: 100%;
  display: block;
  text-align: center;
}

.blog-start-cta {
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.blog-start-cta .btn {
  width: 100%;
  display: block;
  text-align: center;
}

/* ─── Layout blog (sidebar desktop + navigation) ─── */
.blog-layout.legal-main {
  max-width: 1120px;
}

.blog-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.blog-back-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.blog-back-arrow {
  font-size: 1.1rem;
  line-height: 1;
}

.blog-breadcrumb {
  margin: 0 0 1.25rem;
  max-width: 100%;
}

.blog-breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.blog-breadcrumb-item + .blog-breadcrumb-item::before {
  content: "›";
  margin-right: 0.5rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.blog-breadcrumb-item a {
  color: var(--primary);
  text-decoration: none;
}

.blog-breadcrumb-item a:hover {
  text-decoration: underline;
}

.blog-breadcrumb-item[aria-current="page"] {
  color: var(--text);
}

.blog-list-item {
  list-style: none;
}

.blog-layout-grid {
  display: block;
}

.blog-sidebar {
  display: none;
}

.blog-layout-content {
  min-width: 0;
}

.blog-scroll-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.75rem;
  z-index: 90;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #0d9488);
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.blog-scroll-top:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(99, 102, 241, 0.45);
}

.blog-scroll-top[hidden] {
  display: none;
}

@media (min-width: 1024px) {
  .blog-layout-grid {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
  }

  .blog-sidebar {
    display: block;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    grid-column: 1;
    grid-row: 1;
  }

  .blog-layout-content {
    grid-column: 2;
    grid-row: 1;
  }

  .blog-sidebar-inner {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius, 12px);
    background: var(--bg-card);
  }

  .blog-sidebar-title {
    margin: 0 0 0.75rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
  }

  .blog-sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
  }

  .blog-sidebar-link {
    display: block;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    border: 1px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease;
  }

  .blog-sidebar-link:hover {
    background: var(--primary-light);
    border-color: rgba(99, 102, 241, 0.2);
  }

  .blog-sidebar-link--active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark, var(--primary));
  }

  .blog-sidebar-link-title {
    display: block;
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1.35;
  }

  .blog-sidebar-link-date {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.72rem;
    color: var(--text-muted);
  }

  .blog-scroll-top {
    right: max(1.25rem, calc((100vw - 1120px) / 2 + 1rem));
  }
}

@media (max-width: 1023px) {
  .blog-scroll-top {
    right: 1rem;
    bottom: 1.25rem;
    width: 42px;
    height: 42px;
  }
}
