{% import '../../css/_variables.css' as var %}

.toc-nav {
  position: relative;
  width: 100%;
  background: #000;
  z-index: 1;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.toc-nav--is-sticky {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-height: 100vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 20;
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.25);
  transform: translateZ(0);
}

/* Sticky/fixed bar only below md (1139px), where the mobile menu toggle is shown */
@media (min-width: 1140px) {
  .toc-nav--is-sticky {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    max-height: none;
    overflow-y: visible;
    z-index: 1;
    box-shadow: none;
    transform: none;
  }
}

.toc-nav__placeholder {
  display: block;
  height: 0;
  width: 100%;
  pointer-events: none;
  visibility: hidden;
}

/* ============================================================
   Back bar — PQ red strip
   ============================================================ */
.toc-nav__back-bar {
  width: 100%;
  background: linear-gradient(90deg, #d5232d -2.23%, #95050d 103.16%);
  display: flex;
  justify-content: center;
}

.toc-nav__back-bar-inner {
  max-width: 1920px;
  width: 100%;
  padding: 12px 24px;
}

.toc-nav__back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-family: Oswald, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.toc-nav__back-link:hover {
  opacity: 0.8;
  text-decoration: none;
  color: #fff;
}

/* ============================================================
   Main content area
   ============================================================ */
.toc-nav__inner {
  max-width: 1920px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px 48px;
}

/* Header row: heading + mobile toggle */
.toc-nav__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.toc-nav__heading {
  margin: 0;
  min-width: 0;
  flex: 1 1 auto;
  font-family: ;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
}

/* Mobile toggle — hidden on desktop (matches anchor-down-navigation__toggle) */
.toc-nav__toggle {
  display: none;
  flex-shrink: 0;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: transparent;
  color: #fff;
  font-family: Oswald, sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
}

.toc-nav__toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 2px;
}

/* ============================================================
   2-column grid list
   ============================================================ */
.toc-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 48px;
}

.toc-nav__item {
  margin: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.toc-nav__link {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 14px 0;
  box-sizing: border-box;
  text-decoration: none;
  color: inherit;
}

.toc-nav__link:hover .toc-nav__label {
  color: #fff;
  text-decoration: underline;
}

.toc-nav__number {
  flex-shrink: 0;
  min-width: 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: #d5232d;
  text-align: right;
}

/* 20px / 1.5 line-height: readable nav size; bold ≥~14pt equivalent for contrast “large text” band */
.toc-nav__label {
  font-size: 1.25rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.5;
  transition: color 0.15s ease;
}

.toc-nav__link--current .toc-nav__label {
  font-weight: 700;
  color: #fff;
}

/* ============================================================
   Mobile
   ============================================================ */
/* Literal px: matches _variables.css `md` (1139); avoids invalid @media if HubL fails in module scope */
@media (max-width: 1139px) {
  /* Mirror anchor-down-navigation__content mobile stack */
  .toc-nav__inner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .toc-nav__header {
    width: 100%;
    margin-bottom: 0;
  }

  .toc-nav__toggle {
    display: inline-flex;
  }

  /* Same mobile list pattern as .anchor-down-navigation__list */
  .toc-nav__list {
    width: 100%;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
    display: none;
    align-items: flex-end;
    text-align: right;
    grid-template-columns: none;
  }

  .toc-nav--open .toc-nav__list {
    display: flex;
  }

  .toc-nav__item {
    border-bottom: none;
  }

  /* Match anchor link rhythm; padding + min-height for WCAG 2.2 AA ~24px+ pointer targets */
  .toc-nav__link {
    gap: 10px;
    padding: 12px 4px;
    min-height: 48px;
    justify-content: flex-start;
    text-align: right;
    max-width: 100%;
    align-items: center;
  }
}

@media (max-width: 767px) {
  .toc-nav__inner {
    padding: 16px;
  }

  .toc-nav__back-bar-inner {
    padding: 10px 16px;
  }

  .toc-nav__heading {
    font-size: 22px;
  }
}
