/* Floating article index. Loaded only on pages that opt in to the experiment. */
.article-toc-root {
  --article-toc-primary: var(--primary, #023f5f);
  --article-toc-secondary: var(--secondary, #4381a4);
  --article-toc-ink: #1a2b3c;
  --article-toc-muted: #687887;
  --article-toc-accent: #b08a4b;
  --article-toc-paper: rgba(255, 255, 255, 0.92);
  --article-toc-line: rgba(2, 63, 95, 0.14);
  --article-toc-progress: 0%;
  --article-toc-desktop-top: clamp(260px, 40vh, 430px);
  font-family: 'Raleway', 'Inter', sans-serif;
}

.article-body h2[tabindex="-1"]:focus,
.article-body h3[tabindex="-1"]:focus,
.article-body h4[tabindex="-1"]:focus {
  outline: none;
}

.article-body h2[id],
.article-body h3[id],
.article-body h4[id] {
  scroll-margin-top: var(--article-toc-scroll-offset, 130px);
}

.article-toc {
  display: none;
}

.article-toc__panel {
  position: relative;
  border: 1px solid rgba(2, 63, 95, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 252, 0.90)),
    var(--article-toc-paper);
  box-shadow: 0 16px 34px rgba(2, 63, 95, 0.11);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.article-toc__header {
  padding: 15px 17px 13px;
  border-bottom: 1px solid rgba(2, 63, 95, 0.08);
}

.article-toc__eyebrow {
  display: block;
  color: rgba(176, 138, 75, 0.92);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  margin-bottom: 4px;
}

.article-toc__title,
.article-toc-sheet__title {
  display: block;
  color: var(--article-toc-ink);
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.25;
}

.article-toc__progress {
  position: absolute;
  inset: 72px auto 14px 18px;
  width: 2px;
  border-radius: 999px;
  background: rgba(2, 63, 95, 0.10);
  pointer-events: none;
}

.article-toc__progress-fill {
  display: block;
  width: 100%;
  height: var(--article-toc-progress);
  border-radius: inherit;
  background: linear-gradient(180deg, var(--article-toc-secondary), var(--article-toc-accent));
  transition: height 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.article-toc__list {
  list-style: none;
  margin: 0;
  padding: 10px 8px 12px 26px;
}

.article-toc__list--desktop {
  max-height: min(58vh, 560px);
  overflow-y: auto;
  scrollbar-color: rgba(67, 129, 164, 0.45) transparent;
  scrollbar-width: thin;
}

.article-toc__list--desktop::-webkit-scrollbar {
  width: 7px;
}

.article-toc__list--desktop::-webkit-scrollbar-track {
  background: transparent;
}

.article-toc__list--desktop::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(67, 129, 164, 0.36);
}

.article-toc__item {
  margin: 0;
}

.article-toc__list--desktop .article-toc__item[data-level="3"],
.article-toc__list--desktop .article-toc__item[data-level="4"] {
  display: none;
}

.article-toc__list--desktop .article-toc__item.is-in-active-section[data-level="3"],
.article-toc__list--desktop .article-toc__item.is-in-active-section[data-level="4"] {
  display: block;
}

.article-toc__link {
  position: relative;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  padding: 8px 8px;
  border-radius: 7px;
  color: var(--article-toc-muted);
  font-size: 0.79rem;
  font-weight: 500;
  line-height: 1.34;
  text-decoration: none;
  transition:
    background 180ms cubic-bezier(0.16, 1, 0.3, 1),
    color 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.article-toc__link:hover,
.article-toc__link:focus-visible {
  color: var(--article-toc-primary);
  background: rgba(67, 129, 164, 0.08);
  outline: none;
}

.article-toc__link:focus-visible {
  box-shadow: 0 0 0 2px rgba(176, 138, 75, 0.35);
}

.article-toc__link.is-active {
  color: var(--article-toc-primary);
  background: rgba(67, 129, 164, 0.12);
  font-weight: 600;
}

.article-toc__marker {
  box-sizing: border-box;
  width: 8px;
  height: 8px;
  margin-top: 0.36em;
  border: 1px solid rgba(67, 129, 164, 0.5);
  border-radius: 50%;
  background: #ffffff;
  transition:
    background 180ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 180ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 180ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.article-toc__item[data-level="2"] .article-toc__marker {
  border-color: transparent;
  background: rgba(176, 138, 75, 0.84);
  box-shadow: 0 0 0 3px rgba(176, 138, 75, 0.10);
}

.article-toc__item[data-level="3"] .article-toc__marker {
  width: 7px;
  height: 7px;
  border-color: rgba(67, 129, 164, 0.58);
  background: rgba(255, 255, 255, 0.92);
}

.article-toc__item[data-level="4"] .article-toc__marker {
  width: 9px;
  height: 2px;
  margin-top: 0.65em;
  border: 0;
  border-radius: 999px;
  background: rgba(67, 129, 164, 0.48);
}

.article-toc__link.is-active .article-toc__marker,
.article-toc__item[data-level="2"] .article-toc__link.is-active .article-toc__marker {
  border-color: var(--article-toc-primary);
  background: var(--article-toc-primary);
  box-shadow: 0 0 0 4px rgba(67, 129, 164, 0.18);
  transform: scale(1.16);
}

.article-toc__item[data-level="3"] .article-toc__link.is-active .article-toc__marker {
  background: rgba(176, 138, 75, 0.18);
}

.article-toc__item[data-level="4"] .article-toc__link.is-active .article-toc__marker {
  border: 0;
  background: var(--article-toc-accent);
  box-shadow: none;
  transform: scaleX(1.25);
}

.article-toc__label {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.article-toc__item[data-level="3"] .article-toc__link {
  padding-left: 20px;
  font-size: 0.74rem;
  font-weight: 500;
}

.article-toc__item[data-level="4"] .article-toc__link {
  padding-left: 34px;
  color: rgba(104, 120, 135, 0.86);
  font-size: 0.71rem;
  font-weight: 500;
}

.article-toc-fab {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: calc(14px + env(safe-area-inset-bottom));
  left: max(14px, env(safe-area-inset-left));
  z-index: 980;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 54px;
  max-width: 430px;
  margin: 0 auto;
  padding: 8px 15px 8px 12px;
  border: 1px solid rgba(2, 63, 95, 0.14);
  border-radius: 8px;
  color: var(--article-toc-ink);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 34px rgba(2, 63, 95, 0.18);
  backdrop-filter: blur(18px);
  cursor: pointer;
  transition:
    width 220ms cubic-bezier(0.16, 1, 0.3, 1),
    left 220ms cubic-bezier(0.16, 1, 0.3, 1),
    border-radius 220ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.article-toc-fab:hover,
.article-toc-fab:focus-visible {
  outline: none;
  border-color: rgba(176, 138, 75, 0.55);
  box-shadow:
    0 14px 34px rgba(2, 63, 95, 0.18),
    0 0 0 3px rgba(176, 138, 75, 0.18);
}

.article-toc-fab__icon {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--article-toc-primary), var(--article-toc-secondary));
}

.article-toc-fab__icon span {
  display: block;
  width: 15px;
  height: 2px;
  border-radius: 999px;
  background: #ffffff;
}

.article-toc-fab__text {
  display: grid;
  min-width: 0;
  text-align: left;
}

.article-toc-fab__kicker {
  color: var(--article-toc-accent);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

.article-toc-fab__current {
  display: block;
  overflow: hidden;
  color: var(--article-toc-ink);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.28;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.article-toc-root.is-condensed .article-toc-fab {
  left: auto;
  width: 54px;
  padding: 9px;
  border-radius: 999px;
}

.article-toc-root.is-condensed .article-toc-fab__text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.article-toc-sheet {
  position: fixed;
  inset: 0;
  z-index: 1200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.article-toc-sheet.is-open {
  opacity: 1;
  pointer-events: auto;
}

.article-toc-sheet__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(1, 24, 38, 0.34);
  backdrop-filter: blur(3px);
  cursor: pointer;
}

.article-toc-sheet__panel {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  max-height: min(78vh, 680px);
  padding-bottom: env(safe-area-inset-bottom);
  border-radius: 8px 8px 0 0;
  background: #ffffff;
  box-shadow: 0 -18px 50px rgba(2, 63, 95, 0.22);
  transform: translateY(100%);
  transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

.article-toc-sheet.is-open .article-toc-sheet__panel {
  transform: translateY(0);
}

.article-toc-sheet__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 12px;
  border-bottom: 1px solid rgba(2, 63, 95, 0.09);
}

.article-toc-sheet__close {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid rgba(2, 63, 95, 0.14);
  border-radius: 7px;
  color: var(--article-toc-primary);
  background: rgba(2, 63, 95, 0.04);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.article-toc-sheet__close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(176, 138, 75, 0.24);
}

.article-toc__list--mobile {
  max-height: calc(min(78vh, 680px) - 86px);
  padding: 12px 12px 18px;
  overflow-y: auto;
}

.article-toc__list--mobile .article-toc__link {
  min-height: 44px;
  padding: 10px 9px;
  font-size: 0.9rem;
  font-weight: 500;
}

.article-toc__list--mobile .article-toc__item[data-level="3"] .article-toc__link {
  padding-left: 28px;
  font-size: 0.82rem;
}

.article-toc__list--mobile .article-toc__item[data-level="4"] .article-toc__link {
  padding-left: 46px;
  font-size: 0.78rem;
}

body.article-toc-lock {
  overflow: hidden;
}

@media (min-width: 1280px) {
  .article-toc {
    position: fixed;
    top: var(--article-toc-desktop-top);
    left: calc(50% + 410px);
    z-index: 850;
    display: block;
    width: clamp(200px, calc(50vw - 440px), 260px);
    transition: top 220ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  .article-toc-fab,
  .article-toc-sheet {
    display: none;
  }
}

@media (max-width: 380px) {
  .article-toc-fab {
    min-height: 52px;
    padding-right: 12px;
  }

  .article-toc-fab__current {
    font-size: 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .article-toc__progress-fill,
  .article-toc__link,
  .article-toc__marker,
  .article-toc,
  .article-toc-fab,
  .article-toc-sheet,
  .article-toc-sheet__panel {
    transition: none;
  }
}
