/* =============================================
   Shared Article Layout — TOC + Content Grid
   ============================================= */

/* Disable reveal animation when article layout is loaded */
.article-page .single-post__content > * {
  opacity: 1;
  transform: none;
  transition: none;
}

/* -- Two-column layout via CSS grid --------- */
.article-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 0 48px;
  max-width: 1200px;
  margin: 0 auto;
}

/* -- Content area --------------------------- */
.article-content {
  padding: 48px 0 80px;
  min-width: 0;
}

/* -- Table of Contents (sticky sidebar) ----- */
.article-toc {
  position: sticky;
  top: 100px;
  padding: 48px 0;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(57, 89, 53, 0.25) transparent;
}

.article-toc__heading {
  font-family: Inter, system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  margin: 0 0 16px;
  padding: 0 0 0 12px;
}

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

.article-toc__list li {
  margin: 0;
  padding: 0;
}

.article-toc__list a {
  display: block;
  padding: 7px 12px;
  font-family: Inter, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  color: #6b7280;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.article-toc__list a:hover {
  color: #395935;
  background: rgba(57, 89, 53, 0.04);
}

.article-toc__list a.is-active {
  color: #395935;
  font-weight: 600;
  border-left-color: #395935;
  background: rgba(57, 89, 53, 0.06);
}

/* -- Content typography --------------------- */
.article-content h2 {
  font-family: Inter, system-ui, sans-serif;
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 700;
  line-height: 1.25;
  color: #1f2937;
  margin: 0 0 16px;
  padding-top: 40px;
  scroll-margin-top: 90px;
}

.article-content h2:first-of-type {
  padding-top: 0;
}

.article-content h2 + h3 {
  margin-top: 0;
}

.article-content h2:not(:first-of-type) {
  border-top: 1px solid #e5e7eb;
  padding-top: 40px;
  margin-top: 40px;
}

.article-content h3 {
  font-family: Inter, system-ui, sans-serif;
  font-size: clamp(16px, 2.5vw, 19px);
  font-weight: 600;
  line-height: 1.35;
  color: #374151;
  margin: 28px 0 12px;
  scroll-margin-top: 90px;
}

.article-content p {
  font-family: Inter, system-ui, sans-serif;
  font-size: clamp(15px, 2vw, 17px);
  line-height: 1.75;
  color: #4b5563;
  margin: 0 0 16px;
}

.article-content ul,
.article-content ol {
  margin: 0 0 20px;
  padding-left: 24px;
}

.article-content li {
  font-family: Inter, system-ui, sans-serif;
  font-size: clamp(15px, 2vw, 17px);
  line-height: 1.7;
  color: #4b5563;
  margin-bottom: 6px;
}

.article-content li strong {
  color: #1f2937;
  font-weight: 600;
}

.article-content a {
  color: #395935;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article-content a:hover {
  color: #2d472a;
}

.article-content hr.wp-block-separator {
  display: none;
}

/* -- Back to top button --------------------- */
.article-back-to-top {
  position: fixed;
  bottom: 100px;
  right: 24px;
  z-index: 50;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e7eb;
  border-radius: 50%;
  background: #fff;
  color: #395935;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease, background-color 0.15s ease;
}

.article-back-to-top:hover {
  background: #395935;
  color: #fff;
  border-color: #395935;
}

.article-back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* -- Mobile TOC toggle ---------------------- */
.article-toc__mobile-toggle {
  display: none;
}

/* =============================================
   Tablet / Mobile (< 960px)
   ============================================= */
@media (max-width: 960px) {
  .article-layout {
    display: block;
  }

  .article-toc {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 24px 0 0;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 8px;
  }

  .article-toc__heading {
    display: none;
  }

  .article-toc__mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px 16px;
    font-family: Inter, system-ui, sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    margin-bottom: 8px;
  }

  .article-toc__mobile-toggle svg {
    transition: transform 0.2s ease;
    flex-shrink: 0;
  }

  .article-toc__mobile-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
  }

  .article-toc__list {
    display: none;
    padding: 4px 0 12px;
  }

  .article-toc__list.is-open {
    display: block;
  }

  .article-toc__list a {
    padding: 8px 16px;
    border-left: none;
    border-radius: 4px;
  }

  .article-toc__list a.is-active {
    border-left: none;
    background: rgba(57, 89, 53, 0.08);
  }

  .article-content {
    padding: 32px 0 60px;
  }

  .article-back-to-top {
    bottom: 80px;
    right: 16px;
  }
}

@media (max-width: 600px) {
  .article-content h2:not(:first-of-type) {
    padding-top: 28px;
    margin-top: 28px;
  }

  .article-content {
    padding: 24px 0 48px;
  }
}
