/* =========================
   NAV LINK STATES
========================= */

nav a,
nav a:visited {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.25s ease;
}

nav a:hover {
  color: var(--text-highlighted);
}


/* =========================
   NAV SEARCH
========================= */

.nav-search {
  position: relative;
}

.nav-search input {
  background: var(--color-bg-secondary);
  border: 1px solid #1f1f1f;
  color: var(--text-primary);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  width: 180px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.nav-search input:focus {
  outline: none;
  border-color: var(--color-bg-tertiary);
}

#search-results {
  position: absolute;
  top: 110%;
  left: 0;
  right: 0;
  background: var(--color-bg-secondary);
  border: 1px solid #1f1f1f;
  border-radius: 10px;
  max-height: 320px;
  overflow-y: auto;
  display: none;
  z-index: 200;
}

.search-result {
  padding: 0.75rem;
  border-bottom: 1px solid #1f1f1f;
  cursor: pointer;
  transition: background 0.25s ease;
}

.search-result:hover {
  background: var(--color-bg-tertiary);
}

.search-result a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.85rem;
}

.search-result span {
  display: block;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* =========================
   HAMBURGER & MOBILE NAV
========================= */

.nav-toggle {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  gap: 0.4rem;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background-color: var(--text-secondary);
  transition: all 0.3s ease;
  transform-origin: center;
}

/* Hamburger → X: center lines then rotate */
.nav-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  nav {
    position: relative;
    flex-wrap: nowrap;
    gap: 0.75rem;
  }

  /* Dropdown below nav bar; full width so it never wraps under logo */
  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    min-width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-bg-tertiary);
    flex-direction: column;
    gap: 0;
    margin-left: 0 !important;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    z-index: 50;
  }

  .nav-menu.active {
    max-height: 50vh;
    overflow-y: auto;
  }

  .nav-menu li {
    border-bottom: 1px solid var(--color-bg-tertiary);
  }

  .nav-menu li:last-child {
    border-bottom: none;
  }

  .nav-menu li a {
    display: block;
    padding: 1rem 2rem;
    transition: background-color 0.3s ease;
  }

  .nav-menu li a:hover {
    background-color: var(--color-bg-secondary);
    color: var(--text-highlighted);
  }

  /* Shrink search on small screens so logo + search + hamburger fit in one row */
  .nav-search {
    min-width: 0;
    flex: 1;
    max-width: 140px;
  }

  .nav-search input {
    width: 100%;
    min-width: 0;
  }
}
