/* ==========================================================================
   navbar.css — Floating pill navbar
   --------------------------------------------------------------------------
   Uses tokens from style.css (--bg, --text, --amber, --font-body, etc).
   ========================================================================== */

/* Smooth scroll + anchor offset for fixed navbar */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
html { scroll-padding-top: 80px; }

/* Root light-theme token overrides were moved to the centralized tokens.css
   (migration decision #3). Component-specific light tweaks remain below. */

/* ==========================================================================
   NAVBAR CONTAINER
   ========================================================================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 14px var(--gutter, 24px);
}

.navbar-inner {
  max-width: var(--container-w, 1120px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

/* ==========================================================================
   LOGO / MONOGRAM
   ========================================================================== */
.navbar-logo {
  text-decoration: none;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-self: start;
}

.navbar-logo-svg {
  width: 50px;
  height: 50px;
  color: var(--text, #f2f1ec);
  transition: color 0.35s ease;
}

/* ==========================================================================
   MAIN PILL
   ========================================================================== */
.navbar-pill {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  padding: 4px 4px 4px 4px;
  gap: 0;
  transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

[data-theme="light"] .navbar-pill {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.08);
}

.navbar.scrolled .navbar-pill {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .navbar.scrolled .navbar-pill {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   NAV LINKS
   ========================================================================== */
.navbar-nav {
  position: relative;
  display: flex;
  align-items: center;
}

.navbar-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
  z-index: 2;
}

.navbar-link {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  border-radius: 9999px;
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s ease;
  line-height: 1;
}

.navbar-link:hover {
  color: rgba(255, 255, 255, 0.9);
}

.navbar-link.active {
  color: var(--bg, #0b0b0d);
}

[data-theme="light"] .navbar-link {
  color: rgba(0, 0, 0, 0.5);
}

[data-theme="light"] .navbar-link:hover {
  color: rgba(0, 0, 0, 0.8);
}

[data-theme="light"] .navbar-link.active {
  color: #ffffff;
}

/* ==========================================================================
   ACTIVE PILL INDICATOR (sliding highlight)
   ========================================================================== */
.navbar-active-pill {
  position: absolute;
  top: 50%;
  left: 0;
  height: calc(100% + 2px);
  background: var(--text, #f2f1ec);
  border-radius: 9999px;
  transform: translateY(-50%);
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  will-change: left, width;
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.2s ease;
}

.navbar-active-pill.visible {
  opacity: 1;
}

[data-theme="light"] .navbar-active-pill {
  background: #1a1a1a;
}

@media (prefers-reduced-motion: reduce) {
  .navbar-active-pill {
    transition: none;
  }
}

/* ==========================================================================
   MORE DROPDOWN
   ========================================================================== */
.navbar-more-wrapper {
  position: relative;
}

.navbar-more-btn {
  gap: 4px;
}

.navbar-chevron {
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.navbar-more-btn[aria-expanded="true"] .navbar-chevron {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  .navbar-chevron { transition: none; }
}

.navbar-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  min-width: 180px;
  background: rgba(23, 23, 26, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl, 20px);
  padding: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 100;
}

.navbar-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

[data-theme="light"] .navbar-dropdown {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

@media (prefers-reduced-motion: reduce) {
  .navbar-dropdown { transition: opacity 0.1s ease, visibility 0.1s; }
}

.navbar-dropdown-item {
  display: block;
  padding: 10px 16px;
  border-radius: 12px;
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.navbar-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

[data-theme="light"] .navbar-dropdown-item {
  color: rgba(0, 0, 0, 0.65);
}
[data-theme="light"] .navbar-dropdown-item:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #000;
}

/* ==========================================================================
   DIVIDER
   ========================================================================== */
.navbar-divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 6px;
  flex-shrink: 0;
}

[data-theme="light"] .navbar-divider {
  background: rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   THEME TOGGLE
   ========================================================================== */
.navbar-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.2s ease, background 0.2s ease;
  padding: 0;
}

.navbar-icon-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .navbar-icon-btn {
  color: rgba(0, 0, 0, 0.5);
}
[data-theme="light"] .navbar-icon-btn:hover {
  color: #000;
  background: rgba(0, 0, 0, 0.06);
}

.navbar-icon-sun { display: none; }
.navbar-icon-moon { display: block; }
[data-theme="light"] .navbar-icon-sun { display: block; }
[data-theme="light"] .navbar-icon-moon { display: none; }

/* ==========================================================================
   CONTACT BUTTON
   ========================================================================== */
.navbar-contact-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 20px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #f2f1ec);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease;
  flex-shrink: 0;
  line-height: 1;
  margin-left: 2px;
}

.navbar-contact-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

[data-theme="light"] .navbar-contact-btn {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text, #1a1a1a);
}
[data-theme="light"] .navbar-contact-btn:hover {
  background: rgba(0, 0, 0, 0.14);
}

/* ==========================================================================
   COMMAND PALETTE BUTTON
   ========================================================================== */
.navbar-cmd-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  padding: 0;
}

.navbar-cmd-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .navbar-cmd-btn {
  border-color: rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.04);
  color: rgba(0, 0, 0, 0.45);
}
[data-theme="light"] .navbar-cmd-btn:hover {
  color: #000;
  border-color: rgba(0, 0, 0, 0.2);
  background: rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   HAMBURGER (mobile only)
   ========================================================================== */
.navbar-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.navbar-hamburger:hover {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .navbar-hamburger:hover {
  background: rgba(0, 0, 0, 0.06);
}

.navbar-hamburger-line {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text, #f2f1ec);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform-origin: center;
}

.navbar-hamburger[aria-expanded="true"] .navbar-hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.navbar-hamburger[aria-expanded="true"] .navbar-hamburger-line:nth-child(2) {
  opacity: 0;
}
.navbar-hamburger[aria-expanded="true"] .navbar-hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (prefers-reduced-motion: reduce) {
  .navbar-hamburger-line { transition: none; }
}

/* ==========================================================================
   MOBILE PANEL
   ========================================================================== */
.navbar-mobile-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(11, 11, 13, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 999;
  padding: 90px var(--gutter, 24px) 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transform: translateY(-100%);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.35s ease,
              visibility 0.35s;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.navbar-mobile-panel.open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

[data-theme="light"] .navbar-mobile-panel {
  background: rgba(245, 245, 240, 0.98);
}

.navbar-mobile-close {
  position: absolute;
  top: 24px;
  right: var(--gutter, 24px);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  background: transparent;
  color: var(--text, #f2f1ec);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.navbar-mobile-close:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: rotate(90deg);
}

[data-theme="light"] .navbar-mobile-close:hover {
  background: rgba(0, 0, 0, 0.04);
}

@media (prefers-reduced-motion: reduce) {
  .navbar-mobile-panel {
    transition: none;
  }
}

.navbar-mobile-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.navbar-mobile-link {
  display: block;
  padding: 16px 20px;
  border-radius: 16px;
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--text, #f2f1ec);
  text-decoration: none;
  transition: background 0.15s ease;
}

.navbar-mobile-link:hover,
.navbar-mobile-link.active {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .navbar-mobile-link:hover,
[data-theme="light"] .navbar-mobile-link.active {
  background: rgba(0, 0, 0, 0.04);
}

.navbar-mobile-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}

.navbar-mobile-theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 9999px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  background: transparent;
  color: var(--text, #f2f1ec);
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.navbar-mobile-theme-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
}

.navbar-mobile-contact {
  display: inline-flex;
  align-items: center;
  padding: 12px 28px;
  border-radius: 9999px;
  background: var(--text, #f2f1ec);
  color: var(--bg, #0b0b0d);
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  margin-left: auto;
  transition: opacity 0.15s ease;
}

.navbar-mobile-contact:hover {
  opacity: 0.85;
}

/* ==========================================================================
   COMMAND PALETTE MODAL
   ========================================================================== */
.cmd-palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: min(20vh, 160px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s;
}

.cmd-palette-overlay.open {
  opacity: 1;
  visibility: visible;
}

[data-theme="light"] .cmd-palette-overlay {
  background: rgba(0, 0, 0, 0.3);
}

@media (prefers-reduced-motion: reduce) {
  .cmd-palette-overlay { transition: none; }
}

.cmd-palette-card {
  width: 100%;
  max-width: 520px;
  background: rgba(23, 23, 26, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl, 20px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  transform: translateY(-8px) scale(0.98);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cmd-palette-overlay.open .cmd-palette-card {
  transform: translateY(0) scale(1);
}

[data-theme="light"] .cmd-palette-card {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

@media (prefers-reduced-motion: reduce) {
  .cmd-palette-card { transition: none; }
}

.cmd-palette-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .cmd-palette-input-wrap {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

.cmd-palette-search-icon {
  width: 20px;
  height: 20px;
  color: var(--text-faint, #6b6b70);
  flex-shrink: 0;
}

.cmd-palette-input {
  flex: 1;
  border: none;
  background: none;
  font-family: var(--font-body, "Inter", sans-serif);
  font-size: 16px;
  color: var(--text, #f2f1ec);
  outline: none;
}

.cmd-palette-input::placeholder {
  color: var(--text-faint, #6b6b70);
}

.cmd-palette-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  max-height: 340px;
  overflow-y: auto;
}

.cmd-palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.1s ease;
}

.cmd-palette-item:hover,
.cmd-palette-item.selected {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .cmd-palette-item:hover,
[data-theme="light"] .cmd-palette-item.selected {
  background: rgba(0, 0, 0, 0.05);
}

.cmd-palette-item-icon {
  width: 18px;
  height: 18px;
  color: var(--text-faint, #6b6b70);
  flex-shrink: 0;
}

.cmd-palette-item-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text, #f2f1ec);
  flex: 1;
}

.cmd-palette-item-type {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--text-faint, #6b6b70);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cmd-palette-empty {
  padding: 24px 14px;
  text-align: center;
  font-size: 14px;
  color: var(--text-faint, #6b6b70);
}

/* ==========================================================================
   RESPONSIVE — MOBILE (< 768px)
   ========================================================================== */
@media (max-width: 768px) {
  .navbar-pill {
    display: none;
  }

  .navbar-hamburger {
    display: flex;
    margin-left: auto;
  }

  .navbar-cmd-btn {
    margin-left: 0;
  }

  .navbar-inner {
    display: flex;
    gap: 8px;
  }

  .cmd-palette-card {
    margin: 0 16px;
  }

  .cmd-palette-overlay {
    padding-top: 80px;
  }

  .navbar-mobile-link {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .navbar-mobile-footer {
    flex-wrap: wrap;
    gap: 8px;
  }

  .navbar-mobile-theme-toggle,
  .navbar-mobile-lang-switch {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 13px;
  }

  .navbar-mobile-contact {
    padding: 10px 18px;
    font-size: 13px;
  }
}

@media (max-width: 768px) and (orientation: landscape) {
  .navbar-mobile-panel {
    padding-top: 60px;
    padding-bottom: 16px;
  }

  .navbar-mobile-links {
    gap: 0;
  }

  .navbar-mobile-link {
    padding: 10px 20px;
    font-size: 17px;
  }
}

@media (max-width: 480px) {
  .navbar {
    padding: 10px var(--gutter, 16px);
  }

  .cmd-palette-card {
    margin: 0 8px;
  }

  .cmd-palette-list {
    max-height: 280px;
  }
}
