/* ============================================================
   C365 — ARTICLE PAGE V3
   Dépend de dark-shared.css (chargé avant ce fichier).
   ============================================================ */

/* ── Barre de progression ── */
#readingProgress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--acc);
  z-index: 200;
  transition: width 0.1s linear;
}

/* ══════════════════════════════════════════
   LAYOUT LECTURE
══════════════════════════════════════════ */
.hv3-article-page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  align-items: start;
  padding-top: 32px;
  padding-bottom: 48px;
}

.hv3-article-main    { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.hv3-article-sidebar { position: sticky; top: 52px; display: flex; flex-direction: column; gap: 0; }

/* ── Breadcrumb ── */
.hv3-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--fg4);
  letter-spacing: 0.04em;
}

.hv3-breadcrumb a { color: var(--fg4); transition: color 0.15s; }
.hv3-breadcrumb a:hover { color: var(--fg2); }
.hv3-breadcrumb-sep { color: var(--fg4); }
.hv3-breadcrumb-current { color: var(--fg3); }

/* ── En-tête article ── */
.hv3-article-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hv3-article-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hv3-article-cat-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 2px;
  background: var(--bg2);
  border: 1px solid var(--line2);
  color: var(--fg3);
  transition: all 0.15s;
}

.hv3-article-cat-tag:hover { color: var(--fg); border-color: var(--line3); }
.hv3-article-cat-tag img { width: 12px; height: 12px; object-fit: contain; opacity: 0.7; }

.hv3-article-title {
  font-family: var(--sans);
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 600;
  color: var(--fg);
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0;
}

.hv3-article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--fg4);
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.hv3-article-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.hv3-article-roadmap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 2px;
  font-size: 10px;
  background: rgba(96,165,250,0.08);
  border: 1px solid rgba(96,165,250,0.2);
  color: var(--acc2);
}

/* ── Image / Carousel ── */
.hv3-article-media {
  border-radius: var(--rad);
  overflow: hidden;
  border: 1px solid var(--line2);
  background: var(--bg2);
}

.hv3-article-media img,
.hv3-article-media picture { display: block; width: 100%; height: auto; }

/* Carousel (réutilise les classes existantes de article.js) */
.article-carousel {
  border-radius: var(--rad);
  overflow: hidden;
  border: 1px solid var(--line2);
  background: var(--bg2);
  margin: 0;
}

.article-carousel-track-wrap { position: relative; overflow: hidden; }
.article-carousel-track { display: flex; transition: transform 0.35s ease; }
.article-carousel-slide { flex: 0 0 100%; min-width: 0; }
.article-carousel-slide img,
.article-carousel-slide picture { display: block; width: 100%; height: auto; }

.article-carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(10,10,15,0.7);
  border: 1px solid var(--line2);
  color: var(--fg2);
  border-radius: 2px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  z-index: 2;
}

.article-carousel-btn:hover { background: rgba(10,10,15,0.9); color: var(--fg); }
.article-carousel-prev { left: 8px; }
.article-carousel-next { right: 8px; }

.article-carousel-counter {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(10,10,15,0.7);
  border: 1px solid var(--line2);
  border-radius: 2px;
  font-size: 10px;
  padding: 2px 7px;
  color: var(--fg3);
  font-family: var(--mono);
}

.article-carousel-thumbs {
  display: flex;
  gap: 6px;
  padding: 8px;
  background: var(--bg1);
  border-top: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}

.article-carousel-thumbs::-webkit-scrollbar { display: none; }

.article-carousel-thumb {
  width: 52px; height: 40px;
  flex-shrink: 0;
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid var(--line2);
  cursor: pointer;
  opacity: 0.5;
  transition: all 0.15s;
  background: none;
  padding: 0;
}

.article-carousel-thumb img,
.article-carousel-thumb picture { width: 100%; height: 100%; object-fit: cover; display: block; }
.article-carousel-thumb:hover   { opacity: 0.75; border-color: var(--line3); }
.article-carousel-thumb.is-active { opacity: 1; border-color: var(--acc); }

.article-cover-caption {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--fg4);
  padding: 7px 10px;
  background: var(--bg1);
  border-top: 1px solid var(--line);
  font-family: var(--mono);
}

/* ══════════════════════════════════════════
   CONTENU ARTICLE (typographie lecture)
══════════════════════════════════════════ */
.hv3-content-card {
  background: var(--bg1);
  border: 1px solid var(--line2);
  border-radius: var(--rad);
  padding: 28px 32px;
}

.article-content {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.75;
  color: var(--fg2);
}

.article-content h2 {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--acc);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 2em 0 0.75em;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line2);
}

.article-content h3 {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  margin: 1.5em 0 0.5em;
}

.article-content h4 {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--fg2);
  margin: 1.25em 0 0.4em;
}

.article-content p { margin-bottom: 1em; }

.article-content a {
  color: var(--acc);
  text-decoration: underline;
  text-decoration-color: rgba(74,222,128,0.35);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s;
}

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

.article-content ul,
.article-content ol {
  padding-left: 1.4em;
  margin-bottom: 1em;
}

.article-content li { margin-bottom: 0.35em; }

.article-content blockquote {
  border-left: 3px solid var(--acc);
  margin: 1.25em 0;
  padding: 10px 16px;
  background: var(--bg2);
  border-radius: 0 var(--rad) var(--rad) 0;
  color: var(--fg3);
  font-style: italic;
}

.article-content code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--bg3);
  border: 1px solid var(--line2);
  border-radius: 2px;
  padding: 0.15em 0.45em;
  color: var(--acc3);
}

.article-content pre {
  background: #0d1117;
  border: 1px solid var(--line2);
  border-radius: var(--rad);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 1.25em 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
}

.article-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: #e2e8f0;
  font-size: inherit;
}

.article-content img {
  max-width: 100%;
  border-radius: var(--rad);
  border: 1px solid var(--line2);
  margin: 1em 0;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 13px;
}

.article-content th,
.article-content td {
  padding: 8px 12px;
  text-align: left;
  border: 1px solid var(--line2);
}

.article-content th {
  background: var(--bg2);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg4);
}

.article-content td { color: var(--fg2); }
.article-content tr:nth-child(even) td { background: rgba(255,255,255,0.02); }

.article-content strong { color: var(--fg); font-weight: 600; }

/* Source */
.article-source {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg2);
  border: 1px solid var(--line2);
  border-radius: var(--rad);
  margin-top: 24px;
}

.article-source-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--fg4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.article-source-value { display: flex; align-items: center; gap: 6px; min-width: 0; }

.article-source-value a {
  font-size: 11px;
  color: var(--acc2);
  text-decoration: underline;
  text-decoration-color: rgba(96,165,250,0.3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ══════════════════════════════════════════
   PARTAGE + LIKE
══════════════════════════════════════════ */
.article-share {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.article-share-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--fg4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.article-share-buttons { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.article-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--fg3);
  border: 1px solid var(--line2);
  background: transparent;
  border-radius: var(--rad);
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  text-decoration: none;
}

.article-share-btn:hover { color: var(--fg); border-color: var(--line3); background: var(--bg2); }

.article-like-btn.is-liked { color: var(--acc4); border-color: rgba(248,113,113,0.35); background: rgba(248,113,113,0.06); }

@keyframes hv3-heartbeat { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.3); } }
.article-like-btn.is-animating .like-icon-heart { animation: hv3-heartbeat 0.4s ease; }

/* ══════════════════════════════════════════
   NAVIGATION PRÉCÉDENT / SUIVANT
══════════════════════════════════════════ */
.article-adjacent {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.article-adjacent-link {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 14px;
  background: var(--bg1);
  border: 1px solid var(--line2);
  border-radius: var(--rad);
  transition: all 0.15s;
}

.article-adjacent-link:hover { border-color: var(--line3); background: var(--bg2); }
.article-adjacent-next { text-align: right; }

.article-adjacent-dir {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 700;
  color: var(--fg4);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.article-adjacent-next .article-adjacent-dir { justify-content: flex-end; }

.article-adjacent-title {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--fg2);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ══════════════════════════════════════════
   SIDEBAR — TOC + AUTEUR + RELATÉS
══════════════════════════════════════════ */
.hv3-sidebar-block {
  background: var(--bg1);
  border: 1px solid var(--line2);
  border-radius: var(--rad);
  margin-bottom: 12px;
  overflow: hidden;
}

.hv3-sidebar-title {
  display: block;
  font-size: 9px;
  font-weight: 700;
  color: var(--fg4);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

/* TOC */
.article-toc { background: none; border: none; margin: 0; }
.article-toc-title { display: none; }

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

.article-toc-list li a {
  display: block;
  padding: 7px 14px;
  font-size: 11px;
  color: var(--fg3);
  border-left: 2px solid transparent;
  transition: all 0.15s;
  line-height: 1.4;
  font-family: var(--sans);
}

.article-toc-list li a:hover { color: var(--fg2); background: var(--bg2); }
.article-toc-list li a.is-active { color: var(--acc); border-left-color: var(--acc); background: var(--acc-dim); }

/* Auteur sidebar */
.hv3-author-sidebar { padding: 14px; display: flex; flex-direction: column; gap: 10px; }

/* Articles relatés */
.hv3-related-list { display: flex; flex-direction: column; }

.hv3-related-item {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s;
}

.hv3-related-item:last-child { border-bottom: none; }
.hv3-related-item:hover { background: var(--bg2); }
.hv3-related-item:hover .hv3-related-title { color: var(--acc); }

.hv3-related-cat {
  font-size: 9px;
  font-weight: 700;
  color: var(--fg4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 3px;
}

.hv3-related-title {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--fg2);
  line-height: 1.4;
  transition: color 0.12s;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ══════════════════════════════════════════
   SECTION ARTICLES LIÉS (bas de page)
══════════════════════════════════════════ */
.hv3-related-section {
  border-top: 1px solid var(--line);
  padding: 32px 20px 48px;
  max-width: 1120px;
  margin: 0 auto;
}

.hv3-related-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}

.hv3-related-heading {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--fg4);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.hv3-related-all {
  font-size: 10px;
  color: var(--acc);
  letter-spacing: 0.04em;
  transition: opacity 0.15s;
}

.hv3-related-all:hover { opacity: 0.7; }

/* Grille de 3 cards relatées */
.hv3-related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.hv3-related-card {
  background: var(--bg1);
  border: 1px solid var(--line2);
  border-radius: var(--rad);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.15s;
  text-decoration: none;
  color: inherit;
}

.hv3-related-card:hover { border-color: var(--line3); background: var(--bg2); }
.hv3-related-card:hover .hv3-related-card-title { color: var(--acc); }

.hv3-related-card-cat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  font-weight: 700;
  color: var(--fg4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hv3-related-card-cat img { width: 12px; height: 12px; object-fit: contain; opacity: 0.6; }

.hv3-related-card-title {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--fg);
  line-height: 1.4;
  transition: color 0.12s;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hv3-related-card-date { font-size: 10px; color: var(--fg4); margin-top: auto; }

/* ══════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════ */
@media (max-width: 900px) {
  .hv3-article-page { grid-template-columns: 1fr; }
  .hv3-article-sidebar { position: static; }
  .hv3-related-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .hv3-content-card { padding: 18px 16px; }
  .article-adjacent { grid-template-columns: 1fr; }
  .hv3-related-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lb-zoomable {
    cursor: zoom-in;
    transition: opacity 0.15s;
}
.lb-zoomable:hover { opacity: 0.9; }
.hv3-article-media .lb-zoomable { display: block; width: 100%; }

#lbBackdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: lb-fade-in 0.2s ease;
}
#lbBackdrop[hidden] { display: none; }

@keyframes lb-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.lb-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.15s;
    z-index: 1;
    flex-shrink: 0;
}
.lb-close:hover  { background: rgba(255, 255, 255, 0.24); }
.lb-close:active { transform: scale(0.93); }
.lb-close:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

.lb-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    max-width: min(92vw, 1200px);
    max-height: 92vh;
    margin: 0;
    animation: lb-scale-in 0.22s ease;
}

@keyframes lb-scale-in {
    from { transform: scale(0.93); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.lb-img {
    display: block;
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.55);
    cursor: zoom-out;
}

.lb-caption {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
    text-align: center;
    margin: 0;
    max-width: 60ch;
    line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
    #lbBackdrop, .lb-figure { animation: none; }
}
