/* ===================================================================
   VPRR ARTICLE - Styles spécifiques (Apple-inspired Design)
   =================================================================== */

/* ===================================================================
   2. ARTICLE HEADER
   =================================================================== */

.article-header {
  padding: var(--space-3xl) 0 var(--space-xl);
  background: var(--color-surface);
  text-align: center;
}

.article-meta-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.article-tag {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-2xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-white);
  background: var(--brand-accent-text);
  border-radius: var(--radius-sm);
}

.article-meta-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.meta-separator {
  color: var(--color-border);
}

.read-time {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.article-title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
  letter-spacing: -0.02em;
  max-width: 800px;
  margin: 0 auto var(--space-md);
  color: var(--color-text);
}

.article-description {
  font-size: var(--text-2xl);
  color: var(--color-text-light);
  line-height: 1.6;
  max-width: 700px;
  margin: 0 auto;
}

/* ===================================================================
   3. ARTICLE HERO IMAGE
   =================================================================== */

.article-hero-image {
  padding-bottom: var(--space-2xl);
  background: var(--color-surface);
}

.hero-image-wrapper {
  margin: 0;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.hero-image-wrapper img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 7;
  max-height: 460px;
  display: block;
  object-fit: cover;
  object-position: center 40%;
}

@media (max-width: 639px) {
  .hero-image-wrapper img {
    aspect-ratio: 16 / 10;
  }
}

/* ===================================================================
   4. ARTICLE BODY & LAYOUT
   =================================================================== */

.article-body {
  padding: var(--space-3xl) 0;
  background: var(--color-bg);
}

.article-content-wrapper {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr); /* minmax(0,…) : un tableau large ne doit pas élargir la colonne */
  gap: var(--space-3xl);
  align-items: start;
}

/* Sidebar - Sommaire */
.article-sidebar {
  position: relative;
}

.sidebar-sticky {
  position: sticky;
  top: calc(var(--header-height) + var(--space-xl));
}

.sidebar-title {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
}

.toc {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow-md);
}

.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc li {
  margin-bottom: var(--space-xs);
}

.toc li:last-child {
  margin-bottom: 0;
}

.toc a {
  display: block;
  padding: var(--space-xs) 0;
  font-size: var(--text-md);
  color: var(--color-text-light);
  text-decoration: none;
  border-left: 2px solid transparent;
  padding-left: var(--space-sm);
  margin-left: calc(-1 * var(--space-sm));
  transition: all 0.2s ease;
}

.toc a:hover {
  color: var(--color-primary);
  border-left-color: var(--brand-accent);
}

.toc li.toc-h2 a {
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
}

.toc li.toc-h3 {
  padding-left: var(--space-md);
}

.toc li.toc-h3 a {
  font-size: var(--text-sm);
}

/* Content principal */
.article-content {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-3xl);
  box-shadow: var(--shadow-lg);
}

/* Typographie article */
.article-content h2 {
  font-size: var(--text-5xl);
  font-weight: var(--font-weight-semibold);
  margin: var(--space-2xl) 0 var(--space-md);
  color: var(--color-text);
  text-align: left;
  letter-spacing: -0.01em;
}

.article-content h3 {
  font-size: var(--text-3xl);
  font-weight: var(--font-weight-semibold);
  margin: var(--space-xl) 0 var(--space-sm);
  color: var(--color-text);
}

.article-content p {
  font-size: var(--text-lg);
  line-height: 1.8;
  color: var(--color-text-light);
  margin-bottom: var(--space-lg);
}

.article-content p:first-child {
  font-size: var(--text-xl);
  color: var(--color-text);
}

.article-content ul {
  list-style: disc;
  padding-left: var(--space-xl);
}

.article-content ol {
  list-style: decimal;
  padding-left: var(--space-xl);
}

.article-content li {
  margin-bottom: var(--space-xs);
  font-size: var(--text-lg);
  line-height: 1.7;
  color: var(--color-text-light);
}

.article-content strong {
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
}

.article-content blockquote {
  margin: var(--space-xl) 0;
  padding: var(--space-lg) var(--space-xl);
  background: var(--color-surface-alt);
  border-left: 4px solid var(--brand-accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.article-content blockquote p {
  margin: 0;
  font-style: italic;
  color: var(--color-text);
}

/* Encadré « service associé » inséré après le chapeau (scripts/build-blog.js) */
.article-content .article-service-callout {
  margin: var(--space-xl) 0;
  padding: var(--space-lg) var(--space-xl);
  background: var(--color-surface-alt);
  border-left: 4px solid var(--brand-accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.article-content .article-service-callout p {
  margin: 0;
  font-size: var(--text-base);
  color: var(--color-text);
}

.article-content a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-color: var(--brand-accent);
  text-underline-offset: 3px;
  transition: all 0.2s ease;
}

.article-content a:hover {
  color: var(--color-primary-hover);
  text-decoration-color: var(--brand-accent);
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: var(--space-xl) 0;
}

.article-content figure {
  margin: var(--space-xl) 0;
}

.article-content figure img {
  margin: 0 0 var(--space-sm);
}

/* Vidéos embed responsive */
.video-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* Ratio 16:9 */
  height: 0;
  overflow: hidden;
  max-width: 100%;
  margin: var(--space-xl) 0;
  border-radius: var(--radius-lg);
  background: var(--color-surface-alt);
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: var(--radius-lg);
}

.article-content figcaption {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-align: center;
  font-style: italic;
}

.article-content .table-wrapper {
  overflow-x: auto;
  margin: var(--space-xl) 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-alt);
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

.article-content th,
.article-content td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text-light);
}

.article-content thead th {
  background: var(--primary-a8);
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
}

.article-content tbody tr:last-child td {
  border-bottom: none;
}

.article-content hr {
  border: none;
  height: 1px;
  background: var(--color-border);
  margin: var(--space-2xl) 0;
}

/* ===================================================================
   5. TAGS & SHARE
   =================================================================== */

.article-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-3xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--color-border);
}

.tags-label {
  font-size: var(--text-md);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.tag-link {
  display: inline-flex;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--text-xs);
  color: var(--color-text-light);
  background: var(--color-surface-alt);
  border-radius: var(--radius-pill);
  text-decoration: none;
  transition: all 0.2s ease;
}

.tag-link:hover {
  background: var(--brand-accent-light);
  color: var(--color-primary);
}

/* Share buttons */
.article-share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--color-border);
}

.share-label {
  font-size: var(--text-md);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
}

.share-buttons {
  display: flex;
  gap: var(--space-sm);
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* 44px : cible tactile minimale recommandée (Apple HIG / WCAG 2.5.5). */
  width: var(--touch-target);
  height: var(--touch-target);
  border-radius: 50%;
  text-decoration: none;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.share-btn.copy {
  /* .copy est un <button> (les autres sont des <a>) : rendu actuel = 12px, pas un cercle.
     Voir note sur .burger dans assets/css/styles.css. */
  border-radius: var(--radius);
}

.share-btn:hover {
  box-shadow: 0 4px 12px var(--black-a15);
}

/* ===================================================================
   6. ARTICLE NAVIGATION
   =================================================================== */

.article-navigation {
  padding: var(--space-3xl) 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

.nav-articles {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-xl);
}

.nav-article {
  display: flex;
  flex-direction: column;
  padding: var(--space-lg);
  background: var(--color-surface-alt);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: all 0.3s ease;
}

.nav-article:hover {
  background: var(--color-bg);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.nav-article.prev {
  align-items: flex-start;
  text-align: left;
}

.nav-article.next {
  align-items: flex-end;
  text-align: right;
}

.nav-article.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.nav-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-xs);
}

.nav-title {
  font-size: var(--text-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
}

.nav-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  font-size: var(--text-md);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-light);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: all 0.2s ease;
}

.nav-back:hover {
  color: var(--color-primary);
  border-color: var(--brand-accent);
}

@media (max-width: 767px) {
  .nav-articles {
    display: flex;
    gap: var(--space-md);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    padding: var(--space-sm) 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .nav-articles::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  .nav-article,
  .nav-back {
    flex: 0 0 86%;
    scroll-snap-align: start;
  }

  .nav-back {
    justify-content: center;
    text-align: center;
  }

  .article-navigation {
    position: relative;
  }

  .article-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    /* 44px : cible tactile minimale recommandée (Apple HIG / WCAG 2.5.5). */
    width: var(--touch-target);
    height: var(--touch-target);
    /* Rendu actuel = 12px, pas une pilule : voir note sur .burger dans assets/css/styles.css. */
    border-radius: var(--radius);
    border: 1px solid var(--primary-a16);
    background: var(--white-a95);
    color: var(--color-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 5;
  }

  .article-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
  }

  .article-nav-btn-prev {
    left: 10px;
  }

  .article-nav-btn-next {
    right: 10px;
  }
}

@media (max-width: 1023px) {
  .article-content-wrapper {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: var(--space-2xl);
  }

  .article-content {
    padding: var(--space-2xl);
  }

  .toc {
    padding: var(--space-md);
  }
}

@media (max-width: 991px) {
  .article-content-wrapper {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "content"
      "sidebar";
    gap: var(--space-xl);
  }

  .article-content {
    grid-area: content;
  }

  .article-sidebar {
    grid-area: sidebar;
  }

  .sidebar-sticky {
    position: static;
    top: auto;
  }

  .toc {
    max-height: min(46vh, 380px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .toc a {
    font-size: var(--text-sm);
  }

  .toc li.toc-h3 a {
    font-size: var(--text-xs);
  }

  .article-content {
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
  }

  .article-content .table-wrapper {
    margin-inline: calc(-1 * var(--space-sm));
  }
}

@media (max-width: 480px) {
  .article-header {
    padding: var(--space-2xl) 0 var(--space-lg);
  }

  .article-title {
    font-size: var(--text-5xl);
    line-height: 1.2;
    padding-inline: var(--space-sm);
  }

  .article-description {
    font-size: var(--text-lg);
    padding-inline: var(--space-md);
  }

  .article-body {
    padding: var(--space-2xl) 0;
  }

  .article-content {
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
  }

  .article-content h2 {
    font-size: var(--text-3xl);
    margin: var(--space-xl) 0 var(--space-sm);
  }

  .article-content h3 {
    font-size: var(--text-xl);
  }

  .article-content p,
  .article-content li {
    font-size: var(--text-md);
  }

  .article-content p:first-child {
    font-size: var(--text-base);
  }

  .article-content blockquote {
    padding: var(--space-md) var(--space-lg);
  }

  .article-content .table-wrapper {
    border-radius: var(--radius);
  }
}

@media (max-width: 767px) {
  .article-content pre {
    overflow-x: auto;
    max-width: 100%;
  }

  .article-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }
}


/* ===================================================================
   9. RESPONSIVE
   =================================================================== */

@media (max-width: 1023px) {
  .article-content-wrapper {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-2xl);
  }
  
  .article-sidebar {
    order: -1;
  }
  
  .sidebar-sticky {
    position: static;
  }
  
  .toc {
    max-height: 300px;
    overflow-y: auto;
  }
}

@media (max-width: 767px) {
  .article-header {
    padding: var(--space-2xl) 0 var(--space-lg);
  }
  
  .article-title {
    font-size: var(--text-5xl);
  }
  
  .article-description {
    font-size: var(--text-base);
  }
  
  .hero-image-wrapper {
    border-radius: var(--radius-lg);
  }
  
  .article-content {
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
  }
  
  .article-content h2 {
    font-size: var(--text-4xl);
  }
  
  .article-content h3 {
    font-size: var(--text-2xl);
  }
  
  .nav-articles {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  
  .nav-article.prev,
  .nav-article.next {
    align-items: center;
    text-align: center;
  }
  
  .nav-back {
    order: -1;
  }
}

@media (max-width: 480px) {
  .breadcrumb-item.current span {
    max-width: 220px;
  }
  
  .article-content {
    padding: var(--space-lg);
  }
  
  .article-tags {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .article-share {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .cta-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ===================================================================
   À LIRE AUSSI (3 articles liés) + CTA de fin
   =================================================================== */
.article-related {
  padding: var(--space-3xl) 0 var(--space-2xl);
  background: var(--color-bg);
}

.article-related h2 {
  margin-bottom: var(--space-xl);
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.related-grid {
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .related-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.related-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-white);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
  transition: box-shadow var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}

.related-card:hover {
  border-color: var(--brand-accent);
  box-shadow: var(--shadow-md);
}

.related-image {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--color-surface-alt);
}

.related-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-lg);
}

.related-tag {
  font-size: var(--text-2xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-accent-text);
}

.related-title {
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  line-height: 1.35;
  color: var(--color-text);
}

.related-more {
  margin-top: auto;
  padding-top: var(--space-sm);
  font-size: var(--text-md);
  font-weight: var(--font-weight-medium);
  color: var(--color-primary);
}
