/**
 * Shared nav dropdown styles for affix-io.com.
 * Requires :root vars: --slate-800, --slate-900, --border, --text-muted, --white
 */

/* Metal-style nav toggle (burger); !important on visual props so it wins over page-level .nav-toggle */
.nav-toggle {
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 16px;
  font-weight: 600;
  color: #ffffff !important;
  background: linear-gradient(145deg, #5a5a5a, #2e2e2e, #4a4a4a) !important;
  border: 2px solid #d4af37 !important;
  border-radius: 8px;
  box-shadow:
    0 0 0 1px #f5d77a inset,
    0 4px 10px rgba(0, 0, 0, 0.5),
    0 0 6px rgba(212, 175, 55, 0.4) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  cursor: pointer;
  transition: all 0.25s ease;
}
.nav-toggle:hover {
  background: linear-gradient(145deg, #6b6b6b, #3a3a3a, #555) !important;
  border-color: #d4af37 !important;
  box-shadow:
    0 0 0 1px #ffd700 inset,
    0 6px 14px rgba(0, 0, 0, 0.6),
    0 0 10px rgba(212, 175, 55, 0.7) !important;
}
.nav-toggle:active {
  transform: translateY(1px);
  box-shadow:
    0 0 0 1px #d4af37 inset,
    0 2px 5px rgba(0, 0, 0, 0.5) !important;
}
.nav-toggle svg {
  width: 22px;
  height: 22px;
  color: #ffffff !important;
}
.nav-toggle svg path {
  stroke: #ffffff !important;
}

.nav-dropdown {
  position: relative;
  display: inline-block;
}
.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0;
  background: none;
  border: none;
  font-family: inherit;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  line-height: 1.5;
}
.nav-dropdown-trigger:hover {
  color: var(--white);
}
.nav-dropdown-trigger::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 0.2em;
  border: 4px solid transparent;
  border-top-color: currentColor;
  border-bottom: none;
  vertical-align: 0.2em;
}
.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  margin: 0;
  padding: 0.5rem 0;
  list-style: none;
  background: var(--slate-900);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 1001;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
}
.nav-dropdown-menu a {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
}
.nav-dropdown-menu a:hover {
  color: var(--white);
  background: var(--slate-800);
}

/* Mobile: dropdown is inline, always visible when nav is open */
@media (max-width: 768px) {
  .nav-dropdown {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .nav-dropdown-trigger {
    padding: 0.875rem 24px;
    font-size: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--slate-800);
    pointer-events: none;
  }
  .nav-dropdown-trigger::after {
    display: none;
  }
  .nav-dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    min-width: 0;
    padding: 0 0 0.5rem 0;
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    border-left: 2px solid var(--slate-700);
    margin-left: 24px;
    margin-right: 24px;
    margin-bottom: 0.5rem;
  }
  .nav-dropdown-menu a {
    padding: 0.5rem 24px 0.5rem 0.75rem;
    font-size: 0.9375rem;
    border-bottom: none;
  }
}

/* Header search (main-nav) — pill section, clear separation */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.header-search {
  display: inline-flex;
  align-items: center;
  margin-left: 0.25rem;
}
.header-search form {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: var(--slate-800);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.5rem 0.25rem 0.75rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.header-search form:focus-within {
  border-color: #d4af37;
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.25);
}
.header-search input[type="search"] {
  width: 130px;
  padding: 0.3rem 0.4rem;
  font-size: 0.875rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--white);
}
.header-search input[type="search"]::placeholder {
  color: var(--text-muted);
}
.header-search input[type="search"]:focus {
  outline: none;
}
.header-search button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: rgba(212, 175, 55, 0.15);
  border: none;
  border-radius: 50%;
  color: #d4af37;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.header-search button[type="submit"]:hover {
  background: rgba(212, 175, 55, 0.3);
  color: #f5d77a;
}
@media (max-width: 768px) {
  .header-search { margin-left: 0; }
  .header-search form { margin: 0 24px; width: 100%; max-width: 280px; }
  .header-search input[type="search"] { width: 100%; min-width: 0; }
}
