/* =============================================================
   NAV.CSS — Unified sliding pill across all nav controls
   ============================================================= */

.nav {
  background-color: var(--color-nav-bg);
  border-radius: var(--border-radius-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 36px 12px 44px;
  flex-shrink: 0;
  width: 100%;
  box-shadow: var(--shadow-card);
  position: relative;
  z-index: 50;
}

/* -------------------------------------------------------------
   Logo
   ------------------------------------------------------------- */
.nav__logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.nav__logo-mark {
  height: 36px;
  width: 30px;
  display: block;
  overflow: visible;
}

/* Both strokes share the mark's original styling. The ghost is a faint
   copy that only shows while the outline is being redrawn, so the logo
   never disappears mid-trace. */
.nav__logo-path,
.nav__logo-ghost {
  stroke: #444444;
  stroke-width: 2.2;
  stroke-linejoin: round;
  stroke-linecap: round;
  fill: none;
}

.nav__logo-ghost {
  opacity: 0;
  transition: opacity 200ms ease;
}

/* pathLength="1" on the path makes the whole outline one unit long, so a
   single dash of 1 covers it and the offset runs 1 → 0 as it draws. */
.nav__logo-path {
  stroke-dasharray: 1 1;
  stroke-dashoffset: 0;
}

/* Hover (or keyboard focus) traces the outline from its start, every time */
@media (prefers-reduced-motion: no-preference) {
  .nav__logo:hover .nav__logo-ghost,
  .nav__logo:focus-visible .nav__logo-ghost {
    opacity: 0.16;
  }

  .nav__logo:hover .nav__logo-path,
  .nav__logo:focus-visible .nav__logo-path {
    animation: nav-logo-trace 1.1s cubic-bezier(0.65, 0, 0.35, 1) both;
  }
}

@keyframes nav-logo-trace {
  from { stroke-dashoffset: 1; }
  to   { stroke-dashoffset: 0; }
}

.nav__logo-text {
  display: none;
  font-family: 'Courier New', 'Courier', monospace;
  font-size: 13px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.04em;
}

/* -------------------------------------------------------------
   Right group — pill is absolute here and slides to any child
   ------------------------------------------------------------- */
.nav__right {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
}

/* The pill — spans the full nav__right, slides to whatever is hovered */
.nav__pill {
  position: absolute;
  top: 50%;
  left: 0;
  height: 38px;
  width: 60px;
  background: var(--color-active);
  border-radius: 100px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(0px);
  transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1),
              width     220ms cubic-bezier(0.4, 0, 0.2, 1),
              opacity   150ms ease;
  will-change: transform, width;
  z-index: 0;
}

/* Links wrap — above the pill */
.nav__links-wrap {
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 0;
}

/* Mode drop — above the pill */
.nav__mode-drop {
  position: relative;
  z-index: 1;
}

/* Mode dropdown hidden — no UI access to mode switching */
.nav__mode-drop {
  display: none;
}

/* -------------------------------------------------------------
   Shared interactive style — links, mode trigger
   ------------------------------------------------------------- */
.nav__link,
.nav__mode-trigger {
  font-family: var(--font-primary);
  font-size: var(--scale-3);
  font-weight: 800;
  line-height: normal;
  color: var(--color-text-inactive);
  white-space: nowrap;
  padding: 9px 18px;
  border-radius: 100px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 150ms ease;
}

/* Suppress link color transition during initial pill placement */
.nav__right--no-transition .nav__link,
.nav__right--no-transition .nav__mode-trigger {
  transition: none;
}

/* Active page link — blue text when pill is elsewhere */
.nav__link.is-active { color: var(--color-active); }

/* Pill is on this element — white text */
.nav__link.has-pill,
.nav__mode-trigger.has-pill {
  color: #ffffff;
}

/* Caret */
.nav__caret {
  flex-shrink: 0;
  transition: transform 200ms ease;
}
.nav__mode-drop.is-open .nav__caret { transform: rotate(180deg); }

/* -------------------------------------------------------------
   Experience dropdown menu
   ------------------------------------------------------------- */
.nav__mode-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 150px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12),
              inset 0 1px 0 rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px) scale(0.97);
  transform-origin: top right;
  transition: opacity 180ms ease, transform 180ms cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 200;
}

.nav__mode-drop.is-open .nav__mode-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.nav__mode-opt {
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-secondary);
  padding: 8px 12px;
  border-radius: 8px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 150ms ease, color 150ms ease;
}

.nav__mode-opt:hover {
  background: var(--color-surface);
  color: var(--color-text-primary);
}

.nav__mode-opt.is-active {
  color: var(--color-active);
  background: rgba(17, 160, 255, 0.08);
}

/* =============================================================
   Machine mode — same light nav, Other link hidden
   ============================================================= */

html[data-mode="machine"] .nav__link[href*="other"] { display: none; }

html[data-mode="machine"] .nav {
  background: #ffffff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 4px;
  padding-left: 20px;
  padding-right: 20px;
}

html[data-mode="machine"] .nav__pill { display: none; }

html[data-mode="machine"] .nav__link,
html[data-mode="machine"] .nav__mode-trigger {
  font-family: 'Courier New', 'Courier', monospace;
  font-size: 13px;
  font-weight: 400;
}

html[data-mode="machine"] .nav__caret {
  stroke-width: 1;
}

html[data-mode="machine"] .nav__link.is-active,
html[data-mode="machine"] .nav__link.has-pill,
html[data-mode="machine"] .nav__link:hover,
html[data-mode="machine"] .nav__mode-trigger.has-pill,
html[data-mode="machine"] .nav__mode-trigger:hover {
  color: var(--color-active);
}

html[data-mode="machine"] .nav__mode-menu {
  background: #ffffff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
}

html[data-mode="machine"] .nav__mode-opt {
  font-family: 'Courier New', 'Courier', monospace;
  font-size: 13px;
  font-weight: 400;
  border-radius: 2px;
  color: rgba(0, 0, 0, 0.82);
}

html[data-mode="machine"] .nav__mode-opt:hover {
  background: rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.92);
}

html[data-mode="machine"] .nav__mode-opt.is-active {
  color: var(--color-active);
  background: rgba(17, 160, 255, 0.06);
}
