/* Shared navigation chrome for long pSEO pages.
 *
 * Provides three components, all opt-in via separate elements in the page:
 *   - Cross-page switcher pill bar  (#msc-pagenav-switcher, server-rendered)
 *   - Sticky right-rail TOC + mobile drawer  (built by page-nav.js)
 *   - Top-of-viewport scroll progress bar  (built by page-nav.js)
 *
 * Colour tokens reuse the per-page CSS variables already defined on the
 * zodiac forecast pages: --deep-brown, --gold, --cream-light, --warm-white.
 * Falls back to hex literals if the host page hasn't defined them.
 */

/* ── Scroll-progress bar ─────────────────────────────────────────── */
.msc-pagenav-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(168, 149, 122, 0.10);
  z-index: 100;
  pointer-events: none;
}
.msc-pagenav-progress__bar {
  height: 100%;
  width: 100%;
  transform-origin: 0 50%;
  transform: scaleX(var(--msc-pagenav-pct, 0));
  background: linear-gradient(90deg, #D6AD60, #B26E3C);
  transition: transform 60ms linear;
  will-change: transform;
}

/* ── Cross-page switcher pill bar ─────────────────────────────────── */
.msc-pagenav-switcher {
  margin: 22px 0 28px;
  padding: 0;
  border-top: 1px solid rgba(168, 149, 122, 0.25);
  border-bottom: 1px solid rgba(168, 149, 122, 0.25);
  background: rgba(245, 238, 216, 0.35);
}
.msc-pagenav-switcher__inner {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 12px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(168, 149, 122, 0.4) transparent;
}
.msc-pagenav-switcher__inner::-webkit-scrollbar { height: 6px; }
.msc-pagenav-switcher__inner::-webkit-scrollbar-thumb { background: rgba(168, 149, 122, 0.4); border-radius: 3px; }
.msc-pagenav-switcher__label {
  flex: 0 0 auto;
  align-self: center;
  margin: 0 8px 0 0;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: #8A7A5C;
  white-space: nowrap;
}
.msc-pagenav-switcher__pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  color: #5C4A3A;
  background: #FBF7E8;
  border: 1px solid rgba(168, 149, 122, 0.35);
  border-radius: 99px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.msc-pagenav-switcher__pill:hover {
  background: #F5EED8;
  border-color: #D6AD60;
  color: #3B2F26;
}
.msc-pagenav-switcher__pill[aria-current="page"] {
  background: #3B2F26;
  border-color: #3B2F26;
  color: #F5EED8;
  cursor: default;
  font-weight: 600;
}
.msc-pagenav-switcher__pill[aria-current="page"]:hover {
  background: #3B2F26;
  color: #F5EED8;
}
.msc-pagenav-switcher__pill .msc-pagenav-switcher__zh {
  font-family: Georgia, "Songti SC", "Noto Serif SC", serif;
  font-size: 14px;
  color: #D6AD60;
}
.msc-pagenav-switcher__pill[aria-current="page"] .msc-pagenav-switcher__zh {
  color: #D6AD60;
}

@media (max-width: 720px) {
  .msc-pagenav-switcher__inner { padding: 10px 14px; gap: 5px; }
  .msc-pagenav-switcher__pill { padding: 7px 12px; font-size: 12px; }
  .msc-pagenav-switcher__label { font-size: 10px; margin-right: 6px; }
}

/* ── TOC: desktop right-rail ─────────────────────────────────────── */
.msc-pagenav-rail {
  display: none;
}
@media (min-width: 1180px) {
  .msc-pagenav-rail {
    display: block;
    position: fixed;
    top: 92px;
    right: max(20px, calc((100vw - 880px) / 2 - 240px));
    width: 220px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    padding: 14px 16px;
    border-left: 2px solid rgba(214, 173, 96, 0.4);
    background: rgba(255, 250, 235, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 0 4px 4px 0;
    z-index: 50;
    font-size: 13px;
    line-height: 1.5;
  }
}
.msc-pagenav-rail__label {
  margin: 0 0 10px;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 700;
  color: #8A7A5C;
}
.msc-pagenav-rail__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.msc-pagenav-rail__item { margin: 0 0 6px; }
.msc-pagenav-rail__link {
  display: block;
  padding: 4px 8px;
  color: #5C4A3A;
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 3px 3px 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-size: 12.5px;
  line-height: 1.45;
}
.msc-pagenav-rail__link:hover {
  background: rgba(214, 173, 96, 0.10);
  color: #3B2F26;
}
.msc-pagenav-rail__link.is-active {
  border-left-color: #D6AD60;
  background: rgba(214, 173, 96, 0.14);
  color: #3B2F26;
  font-weight: 600;
}

/* ── TOC: mobile drawer trigger + drawer body ───────────────────── */
.msc-pagenav-mobile {
  display: block;
  margin: 0 0 24px;
}
@media (min-width: 1180px) {
  .msc-pagenav-mobile { display: none; }
}
.msc-pagenav-mobile__trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #3B2F26;
  background: #F5EED8;
  border: 1px solid #D6AD60;
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.15s;
}
.msc-pagenav-mobile__trigger:hover { background: #EFE4C8; }
.msc-pagenav-mobile__trigger[aria-expanded="true"] {
  background: #3B2F26;
  color: #F5EED8;
  border-color: #3B2F26;
}
.msc-pagenav-mobile__icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}
.msc-pagenav-mobile__panel {
  display: none;
  margin: 10px 0 0;
  padding: 14px 16px;
  background: #FBF7E8;
  border: 1px solid rgba(168, 149, 122, 0.35);
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.5;
}
.msc-pagenav-mobile__panel.is-open { display: block; }
.msc-pagenav-mobile__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.msc-pagenav-mobile__item { margin: 0 0 6px; }
.msc-pagenav-mobile__item:last-child { margin-bottom: 0; }
.msc-pagenav-mobile__link {
  display: block;
  padding: 8px 10px;
  color: #5C4A3A;
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 3px 3px 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.msc-pagenav-mobile__link:hover,
.msc-pagenav-mobile__link.is-active {
  border-left-color: #D6AD60;
  background: rgba(214, 173, 96, 0.12);
  color: #3B2F26;
}
.msc-pagenav-mobile__link.is-active { font-weight: 600; }

/* ── Anchor scroll-margin so jumps clear the progress bar ───────── */
.msc-pagenav-anchor {
  scroll-margin-top: 24px;
}

/* ── Anchor pilcrow (#) — appears on heading hover, click-to-copy URL ── */
.msc-pagenav-pilcrow {
  display: inline-block;
  margin-left: 0.4em;
  padding: 0 0.2em;
  font-family: inherit;
  font-weight: 500;
  color: rgba(168, 149, 122, 0.55);
  text-decoration: none;
  border-radius: 2px;
  opacity: 0;
  transform: translateY(-1px);
  transition: opacity 0.15s, color 0.15s, background 0.15s;
  vertical-align: baseline;
  font-size: 0.75em;
  letter-spacing: 0;
  user-select: none;
}
.msc-pagenav-anchor:hover .msc-pagenav-pilcrow,
.msc-pagenav-pilcrow:focus {
  opacity: 1;
}
.msc-pagenav-pilcrow:hover {
  color: #D6AD60;
  background: rgba(214, 173, 96, 0.10);
  text-decoration: none;
}
.msc-pagenav-pilcrow.is-copied {
  opacity: 1;
  color: #4A7C59;
  background: rgba(74, 124, 89, 0.12);
}
.msc-pagenav-pilcrow.is-copied::after {
  content: ' copied';
  font-size: 11px;
  letter-spacing: 0.04em;
  margin-left: 4px;
  text-transform: uppercase;
}
@media (hover: none) {
  /* On touch devices, show pilcrows always-on at low opacity so they're tap-able. */
  .msc-pagenav-pilcrow { opacity: 0.55; }
}
