/* ═══════════════════════════════════════════════════════
   Shared Navigation Bar — subpages only (not homepage)
   ═══════════════════════════════════════════════════════ */

:root {
  --nav-height: 56px;
}

.ts-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.2s, border-color 0.2s;
}

/* Light mode: subtle shadow for depth */
:root:not(.dark-mode) .ts-nav {
  box-shadow: 0 1px 8px rgba(0, 20, 60, 0.06);
}

/* ── Brand Link ─────────────────────────────────────── */

.ts-nav__brand {
  display: flex;
  align-items: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.ts-nav__brand:hover {
  color: var(--secondary);
  text-decoration: none;
}

.ts-nav__wordmark {
  height: 28px;
  width: auto;
  display: block;
}

/* ── Desktop Links ──────────────────────────────────── */

.ts-nav__links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.ts-nav__links a {
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.ts-nav__links a:hover {
  color: var(--ink);
  text-decoration: none;
}

.ts-nav__links a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Contact pill button */
.ts-nav__links a[data-action="contact"] {
  background: var(--primary);
  color: #fff;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  border-bottom: none;
  font-size: 0.85rem;
  transition: background 0.2s, transform 0.15s;
}

.ts-nav__links a[data-action="contact"]:hover {
  background: var(--secondary);
  color: #fff;
  transform: translateY(-1px);
}

/* ── Right Section ──────────────────────────────────── */

.ts-nav__right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ── Theme Toggle (track / thumb slider) ───────────── */

.ts-nav__theme-wrap {
  position: relative;
  flex-shrink: 0;
}

.theme-toggle {
  position: relative;
  width: 48px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle-track {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--surface);
}

.theme-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  outline: 2px solid color-mix(in srgb, var(--ink-muted) 30%, transparent);
  outline-offset: -2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.theme-toggle[data-theme="light"] .theme-toggle-thumb { transform: translateX(0); }
.theme-toggle[data-theme="auto"] .theme-toggle-thumb { transform: translateX(12px); }
.theme-toggle[data-theme="dark"] .theme-toggle-thumb { transform: translateX(24px); }
.theme-toggle:hover .theme-toggle-track { border-color: var(--primary); }
.theme-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 12px; }

.theme-mode-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--primary);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
}

.theme-mode-label.show {
  animation: ts-slideUpFade 1.5s ease forwards;
}

@keyframes ts-slideUpFade {
  0%   { opacity: 1; transform: translate(-50%, -50%); }
  60%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -200%); }
}

/* ── Hamburger ──────────────────────────────────────── */

.ts-nav__hamburger {
  display: none;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 0;
}

.ts-nav__hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

/* ── Mobile Menu Dropdown ───────────────────────────── */

.ts-nav__mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1.5rem 1rem;
  flex-direction: column;
  z-index: 99;
  box-shadow: 0 4px 12px var(--shadow, rgba(0,0,0,0.1));
}

.ts-nav__mobile-menu a {
  color: var(--ink);
  text-decoration: none;
  font-size: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  display: block;
}

.ts-nav__mobile-menu a:last-child {
  border-bottom: none;
}

.ts-nav__mobile-menu a.active {
  color: var(--primary);
  font-weight: 600;
}

/* ── Mobile ─────────────────────────────────────────── */

@media (max-width: 767px) {
  .ts-nav__links {
    display: none;
  }

  .ts-nav__hamburger {
    display: flex;
  }

  /* Open state */
  .ts-nav--open .ts-nav__mobile-menu {
    display: flex;
  }

  .ts-nav--open .ts-nav__hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
  }

  .ts-nav--open .ts-nav__hamburger span:nth-child(2) {
    opacity: 0;
  }

  .ts-nav--open .ts-nav__hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
  }
}

/* ── Small Mobile ───────────────────────────────────── */

@media (max-width: 400px) {
  .ts-nav {
    padding: 0 1rem;
  }

  .ts-nav__mobile-menu {
    padding: 0.5rem 1rem 1rem;
  }
}
