/* Article detail pages (FR + EN) — layout, TOC, figures & images */

.article-layout {
  display: flex;
  gap: 48px;
  align-items: flex-start;
}

.article-main {
  flex: 1;
  min-width: 0;
  line-height: 1.8;
}

.article-toc {
  flex: 0 0 240px;
  position: sticky;
  top: calc(var(--nav-header-height, 80px) + 24px);
  max-height: calc(100vh - var(--nav-header-height, 80px) - 48px);
  overflow-y: auto;
  padding: 16px 0 16px 20px;
  border-left: 2px solid #e8e8e8;
}

.article-toc__summary {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  list-style: none;
}

.article-toc__summary::-webkit-details-marker {
  display: none;
}

.article-toc__nav {
  margin: 0;
}

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

.article-toc__item + .article-toc__item {
  margin-top: 8px;
}

.article-toc__link {
  display: block;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  color: #555;
  text-decoration: none;
}

.article-toc__link:hover,
.article-toc__link:focus-visible {
  color: #111;
  text-decoration: underline;
}

@media (min-width: 1025px) {
  .article-toc__summary {
    pointer-events: none;
    cursor: default;
  }
}

@media (max-width: 1024px) {
  .article-layout {
    flex-direction: column;
    gap: 0;
  }

  .article-toc {
    position: static;
    flex: none;
    width: 100%;
    max-height: none;
    overflow: visible;
    order: -1;
    margin-bottom: 20px;
    padding: 0;
    border-left: none;
    border-bottom: 1px solid #e8e8e8;
  }

  .article-toc__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0;
    padding: 14px 0;
    cursor: pointer;
    text-transform: none;
    letter-spacing: normal;
  }

  .article-toc__summary::after {
    content: '';
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    margin-left: 12px;
    border-right: 2px solid #555;
    border-bottom: 2px solid #555;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
  }

  .article-toc[open] .article-toc__summary::after {
    transform: rotate(-135deg);
  }

  .article-toc__nav {
    padding-bottom: 14px;
  }
}

/* Back to top — same style as chatbot .pchat-v2-scroll-down, arrow up */
.article-back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9998;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.98);
  color: #000;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}

.article-back-to-top span {
  display: block;
  font-size: 18px;
  line-height: 1;
  pointer-events: none;
}

.article-back-to-top.is-visible {
  display: flex;
}

.article-back-to-top:active {
  transform: translateY(-1px);
}

@media (max-width: 991px) {
  .article-back-to-top {
    right: 16px;
    bottom: 28px;
  }
}

.article-body .article-figure {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.article-body .article-figure img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  background: transparent;
  border: none;
  box-shadow: none;
}

/* Desktop: float beside prose (logical start/end) */
.article-body .article-figure--end {
  float: right;
  margin: 0 0 20px 30px;
}

.article-body .article-figure--start {
  float: left;
  margin: 0 30px 20px 0;
}

.article-body h1,
.article-body h2 {
  scroll-margin-top: calc(var(--nav-header-height, 80px) + 55px);
}

.article-body h2 {
  margin-top: 1em;
}

/* Desktop size tokens (explicit px — halved on mobile below) */
.article-body .article-figure--max-w-250 img { max-width: 250px; }
.article-body .article-figure--max-w-300 img { max-width: 300px; }
.article-body .article-figure--max-w-315 img { max-width: 315px; }
.article-body .article-figure--max-w-380 img { max-width: 380px; }

.article-body .article-figure--max-h-200 img { max-height: 200px; }
.article-body .article-figure--max-h-290 img { max-height: 290px; }
.article-body .article-figure--max-h-300 img { max-height: 300px; }

/* Mobile: ~50% of desktop display, no float, centered */
@media (max-width: 768px) {
  .article-body .article-figure {
    float: none;
    margin: 0 auto 20px;
    text-align: center;
    max-width: 100%;
  }

  .article-body .article-figure img {
    margin-left: auto;
    margin-right: auto;
  }

  .article-body .article-figure--max-w-250 img { max-width: 125px; max-height: none; }
  .article-body .article-figure--max-w-300 img { max-width: 150px; max-height: none; }
  .article-body .article-figure--max-w-315 img { max-width: 158px; max-height: none; }
  .article-body .article-figure--max-w-380 img { max-width: 190px; max-height: none; }

  .article-body .article-figure--max-h-200 img { max-height: 100px; max-width: 100%; }
  .article-body .article-figure--max-h-290 img { max-height: 145px; max-width: 100%; }
  .article-body .article-figure--max-h-300 img { max-height: 150px; max-width: 100%; }
}

/* Clear floats after article prose */
.article-body::after {
  content: '';
  display: table;
  clear: both;
}
