/* Wirecutter sticky chapter navbar — full width under header; lower nav hides on scroll */

body.single-post.oc-has-wirecutter-toc {
  scroll-behavior: smooth;
}

body.single-post.oc-has-wirecutter-toc .elementor-widget-theme-post-content h2.wp-block-heading,
body.single-post.oc-has-wirecutter-toc .elementor-widget-theme-post-content h2.gspb_heading,
body.single-post.oc-has-wirecutter-toc .elementor-widget-theme-post-content .elementor-widget-container > h2 {
  scroll-margin-top: calc(var(--oc-wirecutter-toc-scroll-offset, 100px) + 58px);
}

/* Hide lower header nav when chapter bar is active (Wirecutter) */
body.single-post.oc-chapter-nav-visible .oc-lower-nav,
body.single-post.oc-chapter-nav-visible .oc-lower-nav-container {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
}

/* Full-width fixed bar directly under remaining header */
.oc-sticky-chapter-wrap {
  position: fixed;
  top: var(--oc-sticky-chapter-top, 81px);
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  z-index: 990;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-100%);
  transition: opacity 0.2s ease, transform 0.22s ease, visibility 0.2s ease;
}

.oc-sticky-chapter-wrap.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.oc-sticky-chapter-nav {
  width: 100%;
  background: #fff;
  border: none;
  border-bottom: 1px solid #e2e8f0;
  border-radius: 0;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.oc-sticky-chapter-nav__bar {
  min-height: 50px;
  display: flex;
  align-items: stretch;
}

.oc-sticky-chapter-nav__toggle {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  min-height: 50px;
  margin: 0;
  padding: 0 20px 0 var(--oc-chapter-nav-inset-left, 20px);
  border: none;
  background: #fff;
  color: #111518;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.oc-sticky-chapter-nav__toggle:hover,
.oc-sticky-chapter-nav__toggle:focus-visible {
  background: #f8fafc;
  outline: none;
}

.oc-sticky-chapter-nav__browse {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #111518;
  flex-shrink: 0;
}

.oc-sticky-chapter-nav__divider {
  display: inline-block;
  width: 1px;
  height: 18px;
  margin: 0 14px;
  background: #cbd5e1;
  flex-shrink: 0;
}

.oc-sticky-chapter-nav__title {
  font-size: 15px;
  font-weight: 600;
  color: #111518;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.oc-sticky-chapter-nav__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: 12px;
  flex-shrink: 0;
  color: #111518;
  transition: transform 0.2s ease;
}

.oc-sticky-chapter-nav__chevron svg {
  width: 16px;
  height: auto;
  display: block;
}

.oc-sticky-chapter-wrap.is-expanded .oc-sticky-chapter-nav__chevron {
  transform: rotate(180deg);
}

.oc-sticky-chapter-nav__panel {
  border-top: 1px solid #e8edf2;
  background: #fff;
  max-height: min(50vh, 360px);
  overflow-y: auto;
  padding: 10px 20px 14px var(--oc-chapter-nav-inset-left, 20px);
}

.oc-sticky-chapter-nav__panel[hidden] {
  display: none !important;
}

.oc-sticky-chapter-nav .oc-wirecutter-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.oc-sticky-chapter-nav .oc-wirecutter-toc__item + .oc-wirecutter-toc__item {
  margin-top: 8px;
}

.oc-sticky-chapter-nav .oc-wirecutter-toc__link {
  display: block;
  font-size: 14px;
  line-height: 1.45;
  color: #111518;
  text-decoration: none;
  padding: 4px 0;
}

.oc-sticky-chapter-nav .oc-wirecutter-toc__link:hover,
.oc-sticky-chapter-nav .oc-wirecutter-toc__link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.oc-sticky-chapter-nav .oc-wirecutter-toc__link.is-active {
  font-weight: 700;
  text-decoration: none;
}

/* Legacy sidebar/mobile TOC — hidden */
.oc-wirecutter-toc--sidebar,
.oc-wirecutter-toc--mobile {
  display: none !important;
}

@media (max-width: 768px) {
  .oc-sticky-chapter-nav__title {
    font-size: 14px;
  }

  .oc-sticky-chapter-nav__toggle {
    padding: 0 16px 0 var(--oc-chapter-nav-inset-left, 16px);
  }

  .oc-sticky-chapter-nav__panel {
    padding: 10px 16px 14px var(--oc-chapter-nav-inset-left, 16px);
  }
}
