/* ============================================================
   GLOBAL ACCESSIBILITY GUARD — 2026-08-15
   Keep the skip link visually hidden until keyboard focus on EVERY page.
   This is global because some hub pages do not ship their own skip-link rule.
   ============================================================ */
.skip-link {
  position: fixed !important;
  top: 8px !important;
  left: 8px !important;
  z-index: 100000 !important;
  transform: translateY(-180%) !important;
  border-radius: 8px;
  background: var(--lime, #c9e84a);
  color: var(--ink, #1d1d21);
  padding: 12px 16px;
  font: 750 12px/1 Arial, sans-serif;
  opacity: 0;
  pointer-events: none;
  transition: transform .18s ease, opacity .18s ease;
}
.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0) !important;
  opacity: 1;
  pointer-events: auto;
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* ============================================================
   NAVIGATION ENHANCEMENT — 2026-08-14
   Additive only: preserves the approved header/nav geometry.
   Provides richer Knee/Hip subviews plus mobile nested groups.
   ============================================================ */

/* Never change the approved header shell; only refine menu panels. */
.nav-group[data-nav-enhanced="knee"] > .mega-menu {
  width: min(980px, 88vw);
  grid-template-columns: minmax(220px, .62fr) minmax(0, 2.25fr);
}

.nav-group[data-nav-enhanced="hip"] > .mega-menu {
  width: min(790px, 80vw);
}

.nav-group[data-nav-enhanced] .mega-links {
  grid-template-columns: 1fr;
  align-content: start;
  gap: 0;
  padding: 20px;
}

.nav-group[data-nav-enhanced] .mega-overview-link {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(100, 29, 59, .12);
  border-radius: 13px;
  background: rgba(100, 29, 59, .045);
  color: var(--wine, #641d3b);
  text-decoration: none;
}

.nav-group[data-nav-enhanced] .mega-overview-link strong {
  display: block;
  margin-bottom: 2px;
  font-size: 12px;
}

.nav-group[data-nav-enhanced] .mega-overview-link small {
  display: block;
  color: rgba(28, 29, 33, .58);
  font-size: 9px;
  line-height: 1.35;
}

.nav-group[data-nav-enhanced] .mega-overview-link::before,
.nav-group[data-nav-enhanced] .nav-mega-section > a::before { display: none !important; }

.nav-group[data-nav-enhanced] .mega-overview-link:hover,
.nav-group[data-nav-enhanced] .mega-overview-link:focus-visible {
  background: rgba(100, 29, 59, .075);
}

.nav-group[data-nav-enhanced] .mega-overview-link > b {
  flex: 0 0 auto;
  font-size: 15px;
  font-weight: 500;
}

.nav-mega-sections {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.nav-mega-section {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(28, 29, 33, .075);
  border-radius: 14px;
  background: rgba(255, 255, 255, .55);
}

.nav-mega-section > strong {
  display: block;
  margin-bottom: 8px;
  color: var(--wine, #641d3b);
  font-size: 9px;
  font-weight: 830;
  letter-spacing: .08em;
  line-height: 1.3;
  text-transform: uppercase;
}

.nav-mega-section > a {
  display: block !important;
  min-height: 0 !important;
  padding: 7px 0 !important;
  border: 0 !important;
  border-top: 1px solid rgba(28, 29, 33, .065) !important;
  color: rgba(28, 29, 33, .77) !important;
  font-size: 10px !important;
  font-weight: 650 !important;
  line-height: 1.3 !important;
  text-decoration: none !important;
}

.nav-mega-section > a:first-of-type {
  border-top: 0 !important;
}

.nav-mega-section > a:hover,
.nav-mega-section > a:focus-visible {
  color: var(--wine, #641d3b) !important;
  transform: translateX(2px);
}

.nav-group[data-nav-enhanced="hip"] .nav-mega-sections {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Mobile: preserve the existing full-screen menu and add tidy nested groups. */
.mobile-nav-group[data-nav-enhanced] .mobile-submenu {
  padding-right: 2px;
}

.mobile-view-all {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 2px 0 8px;
  padding: 8px 0 10px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  color: var(--lime, #c9e84a);
  font-size: 11px;
  font-weight: 760;
  text-decoration: none;
}

.mobile-nested {
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.mobile-nested summary {
  display: flex;
  min-height: 48px;
  cursor: pointer;
  list-style: none;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: rgba(255,255,255,.9);
  font-size: 12px;
  font-weight: 720;
}

.mobile-nested summary::-webkit-details-marker { display: none; }
.mobile-nested summary::after {
  content: "+";
  color: var(--lime, #c9e84a);
  font-size: 17px;
  font-weight: 400;
}
.mobile-nested[open] summary::after { content: "−"; }

.mobile-nested-links {
  display: grid;
  padding: 0 0 10px 12px;
}
.mobile-nested-links a {
  min-height: 38px;
  padding: 9px 0;
  border-top: 1px solid rgba(255,255,255,.07);
  color: rgba(255,255,255,.72);
  font-size: 11px;
  line-height: 1.35;
  text-decoration: none;
}
.mobile-nested-links a[aria-current="page"],
.mobile-view-all[aria-current="page"] {
  color: var(--lime, #c9e84a);
}

/* Sticky header must not cover anchored chapter headings. */
main [id], section[id], article[id] {
  scroll-margin-top: 118px;
}

@media (max-width: 1140px) {
  main [id], section[id], article[id] { scroll-margin-top: 98px; }
}

@media (max-width: 760px) {
  .mobile-nav-group.is-open .mobile-submenu {
    max-height: min(62vh, 620px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

.mobile-nav-group[data-nav-enhanced] > button > span:last-child {
  color: var(--lime, #c9e84a);
  font-size: 16px;
  transition: transform 220ms ease;
}
.mobile-nav-group[data-nav-enhanced].is-open > button > span:last-child {
  transform: rotate(180deg);
}

/* Enhanced menu overlays the original React-rendered links: the originals stay
   in the DOM so React can re-render them in Arabic once the block is removed. */
.mega-links.is-nav-enhanced > a { display: none !important; }
.nav-enhanced-block { display: contents; }
