/* ═══════════════════════════════════════════════════
   Nav — Fixed, Backdrop Blur, Theme Toggle
   Portfolio v3 · 2026
   ═══════════════════════════════════════════════════ */

.nav {
  position: fixed;
  top: 0;
  width: 100%;
  padding: 0.7rem var(--space-3xl);
  z-index: var(--z-fixed);
  background: color-mix(in oklch, var(--surface-base) 50%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--border-faint);
  transform: translateY(-100%);
  opacity: 1;
  animation: navSlideDown 1s var(--ease-out) 0.5s forwards;
  transition:
    transform 0.65s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.5s ease,
    background 0.5s ease,
    border-color 0.5s ease;
  will-change: transform, opacity;
}

.nav--hidden {
  transform: translateY(-100%) !important;
  opacity: 0 !important;
}

@keyframes navSlideDown {
  to { transform: translateY(0); }
}

/* ── Content layout ── */
.nav__content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

/* ── Logo wordmark — sized to match the site's typographic voice ── */
.nav__logo {
  font-size: 1.35rem;
  font-weight: 500;
  font-family: var(--font-body);
  font-style: normal;
  color: var(--text-primary);
  text-decoration: none;
  padding: var(--space-sm) 0;
  display: inline-block;
  position: relative;
  transition: color 0.35s ease;
}

.nav__logo em {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
  font-size: 1.18em;
  padding-left: 0.22em;
  letter-spacing: -0.01em;
  line-height: 1;
  transition: color 0.35s ease;
}

/* Telugu identity — quietly present, correctly tagged with lang="te" */
.nav__logo-te {
  display: block;
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-style: normal;
  font-weight: 400;
  color: var(--text-faint);
  letter-spacing: 0.01em;
  line-height: 1;
  margin-top: 0.15rem;
  transition: color 0.35s ease;
}

.nav__logo:hover .nav__logo-te {
  color: var(--text-muted);
}

/* Hover underline draws left-to-right */
.nav__logo::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: calc(var(--space-sm) - 2px);
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.4s var(--ease-spring);
}

.nav__logo:hover::after,
.nav__logo:focus-visible::after {
  transform: scaleX(1);
}

.nav__logo:hover em {
  color: var(--accent-hover);
}

.nav__logo:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

/* ── Nav links ── */
.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  list-style: none;
}

.nav__link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: color 0.35s ease;
  position: relative;
  padding: var(--space-sm) 0;
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.35s var(--ease-out);
}

.nav__link:hover { color: var(--accent); }
.nav__link:hover::after { width: 100%; }

.nav__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}

/* CV download link */
.nav__link--cv {
  color: var(--accent);
  font-weight: 600;
}
.nav__link--cv:hover { opacity: 0.85; }
.nav__link--cv::after { background: var(--accent); }

/* ── Theme toggle ── */
.nav__theme {
  background: none;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease;
  position: relative;
  flex-shrink: 0;
}

.nav__theme:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.nav__theme-icon {
  width: 18px;
  height: 18px;
  transition: transform 0.4s var(--ease-out);
}

/* Sun icon (shown in dark mode) */
.nav__theme .icon-sun { display: block; }
.nav__theme .icon-moon { display: none; }

/* Moon icon (shown in light mode) */
[data-theme="light"] .nav__theme .icon-sun { display: none; }
[data-theme="light"] .nav__theme .icon-moon { display: block; }

/* ── Work link flash animation ── */
.nav__link--flash::after {
  animation: navFlash 0.65s var(--ease-out) forwards;
}

@keyframes navFlash {
  0%   { width: 0;    opacity: 1; }
  60%  { width: 100%; opacity: 1; }
  100% { width: 100%; opacity: 0; }
}

/* ═══ Responsive ═══ */
@media (max-width: 768px) {
  .nav {
    padding: 0.5rem var(--space-lg);
  }
  .nav__logo {
    font-size: 1.15rem;
    padding: 0.75rem 0;
  }
  .nav__links {
    gap: 1rem;
  }
  .nav__link {
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    padding: 0.85rem 0.35rem;
  }
  .nav__theme {
    width: 40px;
    height: 40px;
  }
  .nav__theme-icon {
    width: 16px;
    height: 16px;
  }
}

@media (max-width: 480px) {
  .nav {
    padding: 0.35rem 0.85rem;
  }
  .nav__logo {
    font-size: 1rem;
  }
  .nav__links {
    gap: 0.55rem;
  }
  .nav__link {
    font-size: 0.6rem;
    letter-spacing: 0.05em;
    padding: 0.9rem 0.25rem;
  }
  .nav__theme {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 360px) {
  .nav {
    padding: 0.3rem 0.65rem;
  }
  .nav__logo {
    font-size: 0.9rem;
  }
  .nav__logo-te {
    display: none;
  }
  .nav__links {
    gap: 0.35rem;
  }
  .nav__link {
    font-size: 0.52rem;
    letter-spacing: 0.03em;
    padding: 0.85rem 0.15rem;
  }
  .nav__link--reviews {
    display: none;
  }
  .nav__theme {
    width: 44px;
    height: 44px;
  }
}
