/* =================================================================
   GUARIP About Page Side Navigator
   Editorial sticky vertical menu. Manuscript Folio direction.
   Desktop: vertical, Cormorant italic numbers, 8-segment progress,
     two-line eyebrow, brass underline draws on active title.
   Mobile (≤980px): top horizontal pill strip + continuous hairline.
   Single class for AR + EN. Direction is driven entirely by the
     `dir` attribute on the page (logical properties).
   ================================================================= */

.ab-nav {
  position: sticky;
  top: calc(var(--site-header-h, 80px) + clamp(40px, 6vh, 80px));
  inset-inline-start: clamp(20px, 3vw, 48px);
  align-self: start;
  z-index: 2;
  width: clamp(220px, 18vw, 280px);
  max-height: calc(100vh - var(--site-header-h, 80px) - clamp(80px, 12vh, 160px));
  overflow-y: auto;
  pointer-events: auto;
  font-family: var(--g-font-body-en);
  scrollbar-width: none;
}
.ab-nav::-webkit-scrollbar { display: none; }

/* ── Desktop rail: an absolute, full-height column inside the relative
      .ab-root. It takes the nav out of normal flow (so it never pushes the
      Hero down) while the nav inside pins via its existing position:sticky,
      bounded to the About content (releases at the footer, never floats over
      it). inset-inline-start keeps AR on the right edge and EN on the left.
      Base is display:contents so on mobile the rail is transparent and the
      nav's sticky horizontal strip keeps working as a child of .ab-root. ── */
.ab-nav-rail { display: contents; }
@media (min-width: 981px) {
  .ab-nav-rail {
    display: block;
    position: absolute;
    inset-block: 0;
    inset-inline-start: clamp(20px, 3vw, 48px);
    width: clamp(220px, 18vw, 280px);
    z-index: 20;
    pointer-events: none;
  }
  .ab-nav {
    inset-inline-start: 0;
    width: 100%;
    z-index: 21;
    pointer-events: auto;
  }
}

/* ── Eyebrow stack ──────────────────────────────────────── */
.ab-nav__eyebrows {
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ab-nav__label {
  margin: 0;
  font-family: var(--g-font-label);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--g-brass);
}
.ab-nav__label-rule {
  display: block;
  width: 28px;
  height: 1px;
  background: var(--g-brass);
  opacity: 0.85;
  margin-top: 8px;
}
.ab-nav__sublabel {
  margin: 8px 0 0;
  font-family: var(--g-font-label);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(184, 152, 96, 0.50);
}

/* ── Vertical track with 8 discrete segments (one per scene) ── */
.ab-nav__track {
  position: absolute;
  inset-inline-start: 0;
  top: 72px;
  bottom: 0;
  width: 1px;
  z-index: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
[dir="rtl"] .ab-nav__track {
  inset-inline-start: auto;
  inset-inline-end: 0;
}
.ab-nav__seg {
  display: block;
  flex: 1 1 0;
  width: 1px;
  background: rgba(184, 152, 96, 0.18);
  transition: background var(--g-dur-base) var(--g-ease-out);
}
.ab-nav__seg.is-on {
  background: var(--g-brass);
}

/* ── Item list ───────────────────────────────────────────── */
.ab-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
  padding-inline-start: 18px;
}
[dir="rtl"] .ab-nav__list {
  padding-inline-start: 0;
  padding-inline-end: 18px;
}

/* Thicker brass segment beside the active item. */
.ab-nav__marker {
  position: absolute;
  inset-inline-start: -1px;
  width: 2px;
  top: 0;
  height: 0;
  background: var(--g-brass);
  opacity: 0;
  z-index: 1;
  transition:
    top var(--g-dur-base) var(--g-ease-out),
    height var(--g-dur-base) var(--g-ease-out),
    opacity var(--g-dur-fast) var(--g-ease-out);
}
.ab-nav__marker.is-on { opacity: 1; }

[dir="rtl"] .ab-nav__marker {
  inset-inline-start: auto;
  inset-inline-end: -1px;
}

.ab-nav__list > li {
  margin: 0;
  padding: 0;
}
/* Mini-gaps at narrative breaks: before "the team" (item 5) and "where you begin" (item 8). */
.ab-nav__list > li:nth-child(5) { margin-top: 14px; }
.ab-nav__list > li:nth-child(8) { margin-top: 14px; }

.ab-nav__link {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: baseline;
  gap: 10px;
  padding: 11px 0;
  text-decoration: none;
  color: rgba(63, 51, 39, 0.70);
  transition:
    color var(--g-dur-base) var(--g-ease-out),
    transform var(--g-dur-base) var(--g-ease-out);
  position: relative;
}
.ab-nav__link:hover {
  color: rgba(184, 152, 96, 0.85);
  transform: translateX(5px);
}
[dir="rtl"] .ab-nav__link:hover {
  transform: translateX(-5px);
}
.ab-nav__link.is-active {
  color: var(--g-brass);
}

/* Section number: Cormorant Garamond italic, manuscript display weight. */
.ab-nav__num {
  font-family: var(--g-font-display-en);
  font-style: italic;
  font-weight: 500;
  font-size: 22px;
  line-height: 1;
  color: rgba(63, 51, 39, 0.45);
  min-width: 30px;
  transition:
    color var(--g-dur-base) var(--g-ease-out),
    transform var(--g-dur-base) var(--g-ease-out);
  transform-origin: 0 50%;
}
[dir="rtl"] .ab-nav__num { transform-origin: 100% 50%; }
.ab-nav__link:hover .ab-nav__num {
  transform: scale(1.04);
  color: rgba(184, 152, 96, 0.70);
}
.ab-nav__link.is-active .ab-nav__num {
  color: var(--g-brass);
  transform: scale(1.04);
}
@media (max-width: 1279px) and (min-width: 981px) {
  .ab-nav__num { font-size: 18px; min-width: 26px; }
}

/* Section title: IBM Plex body, line-height 1.55. Contains an optional
       inline .g-latin Cormorant italic accent that grows on hover/active. */
.ab-nav__title {
  font-family: var(--g-font-body-en);
  font-size: 14px;
  line-height: 1.55;
  position: relative;
  padding-bottom: 4px;
}
[lang="ar"] .ab-nav__title { font-family: var(--g-font-body-ar); }

/* Brass underline that draws beneath the active title.
       Width tweened 0→100% via inline transition; transform-origin honors
       the logical inline-start so it draws from the title's natural start
       (left in LTR, right in RTL). */
.ab-nav__title::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--g-brass);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 450ms cubic-bezier(0.22, 1, 0.36, 1);
}
[dir="rtl"] .ab-nav__title::after {
  transform-origin: 100% 50%;
}
.ab-nav__link.is-active .ab-nav__title::after {
  transform: scaleX(1);
}

.ab-nav__title .g-latin {
  font-family: var(--g-font-display-en);
  font-style: italic;
  font-weight: 500;
  font-size: 16px;
  display: inline-block;
  transform-origin: 0 100%;
  transition: transform var(--g-dur-base) var(--g-ease-out);
}
[dir="rtl"] .ab-nav__title .g-latin {
  transform-origin: 100% 100%;
}
.ab-nav__link:hover .ab-nav__title .g-latin {
  transform: scale(1.04);
}
.ab-nav__link.is-active .ab-nav__title .g-latin {
  transform: scale(1.08);
}

.ab-nav__link:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px var(--g-brass),
    0 0 0 5px var(--g-ink);
  border-radius: 2px;
}

/* ── Over dark-toned sections: lift ink to cream so the pinned rail stays
      legible against the espresso background (toggled by about-nav.js). ── */
.ab-nav.is-on-dark .ab-nav__link { color: rgba(245, 239, 224, 0.72); }
.ab-nav.is-on-dark .ab-nav__num { color: rgba(245, 239, 224, 0.45); }
.ab-nav.is-on-dark .ab-nav__link:hover { color: var(--g-cream-text); }
.ab-nav.is-on-dark .ab-nav__link:hover .ab-nav__num { color: var(--g-cream-text); }
.ab-nav.is-on-dark .ab-nav__link.is-active,
.ab-nav.is-on-dark .ab-nav__link.is-active .ab-nav__num { color: var(--g-brass); }

/* ── Mobile (≤980px): horizontal pill strip under header ── */
@media (max-width: 980px) {
  .ab-nav {
    position: sticky;
    top: var(--site-header-h, 64px);
    inset-inline-start: 0;
    align-self: auto;
    width: 100%;
    margin: 0;
    background: rgba(251, 246, 236, 0.92);
    backdrop-filter: saturate(140%) blur(8px);
    -webkit-backdrop-filter: saturate(140%) blur(8px);
    border-bottom: 1px solid rgba(184, 152, 96, 0.22);
    padding: 10px 16px 0;
    max-height: none;
    overflow-y: visible;
  }

  .ab-nav__eyebrows { display: none; }
  .ab-nav__track { display: none; }
  .ab-nav__marker { display: none; }

  .ab-nav__list {
    padding: 0;
    display: flex;
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .ab-nav__list::-webkit-scrollbar { display: none; }
  [dir="rtl"] .ab-nav__list { padding: 0; }

  .ab-nav__list > li {
    scroll-snap-align: start;
    flex-shrink: 0;
    margin-top: 0;
  }
  .ab-nav__list > li:nth-child(5),
  .ab-nav__list > li:nth-child(8) { margin-top: 0; }

  .ab-nav__link {
    grid-template-columns: auto auto;
    padding: 8px 14px;
    border: 1px solid rgba(184, 152, 96, 0.30);
    border-radius: var(--g-radius-button);
    background: transparent;
    transform: none !important;
  }
  .ab-nav__link.is-active {
    background: var(--g-brass);
    border-color: var(--g-brass);
    color: var(--g-cream-text);
  }
  .ab-nav__link.is-active .ab-nav__num {
    color: var(--g-cream-text);
    transform: none;
  }
  .ab-nav__link.is-active .ab-nav__title::after { display: none; }
  .ab-nav__link.is-active .ab-nav__title .g-latin { transform: none; }

  .ab-nav__num { font-size: 12px; min-width: 18px; }
  .ab-nav__title { font-size: 13px; white-space: nowrap; padding-bottom: 0; }
  .ab-nav__title .g-latin { font-size: 13px; }

  /* Horizontal continuous progress line under the strip (8 segments are
       illegible at this size, fall back to a single hairline fill). */
  .ab-nav__hbar {
    display: block;
    position: relative;
    margin-top: 10px;
    height: 1px;
    background: rgba(184, 152, 96, 0.22);
  }
  .ab-nav__hbar::after {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    height: 1px;
    width: var(--ab-nav-progress, 0%);
    background: var(--g-brass);
    transition: width 200ms linear;
  }
}

/* On desktop hide the mobile horizontal bar */
@media (min-width: 981px) {
  .ab-nav__hbar { display: none; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .ab-nav__marker,
  .ab-nav__seg,
  .ab-nav__link,
  .ab-nav__num,
  .ab-nav__title::after,
  .ab-nav__title .g-latin {
    transition: none !important;
  }
  .ab-nav__title::after { transform: scaleX(1); }
}
