/**
 * Site header (nav + logo + global link defaults).
 * Load after site-theme.css for CSS variables.
 */

html {
  scroll-behavior: smooth;
}

a {
  color: var(--link);
  text-decoration: none;
  margin-right: 24px;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.nav {
  --haa-nav-bar-height: 44px;
  margin-bottom: clamp(28px, 4vw, 40px);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.92;
  padding: 4px min(200px, 26vw) 6px min(160px, 22vw);
  min-height: var(--haa-nav-bar-height);
  box-sizing: border-box;
  border-bottom: 1px solid var(--haa-nav-border, rgba(255, 255, 255, 0.08));
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 200;
}

.nav-menu-cb {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.nav-mobile-head {
  display: contents;
}

.nav-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  border: 1px solid var(--haa-border-strong, rgba(230, 230, 235, 0.14));
  border-radius: var(--haa-radius-sm, 10px);
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.nav-menu-toggle:hover {
  border-color: rgba(212, 175, 55, 0.35);
  background: rgba(255, 255, 255, 0.05);
}

.nav-menu-toggle:focus-visible {
  outline: 2px solid var(--haa-accent, #d4af37);
  outline-offset: 2px;
}

.nav-menu-icon {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 20px;
  pointer-events: none;
}

.nav-menu-icon span {
  display: block;
  height: 2px;
  background: #e8e8e8;
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-menu-cb:checked + .nav-mobile-head .nav-menu-icon span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-menu-cb:checked + .nav-mobile-head .nav-menu-icon span:nth-child(2) {
  opacity: 0;
}

.nav-menu-cb:checked + .nav-mobile-head .nav-menu-icon span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.brand {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  line-height: 0;
  height: var(--haa-nav-bar-height);
  overflow: visible;
  background: transparent;
}

.brand-link {
  display: flex;
  align-items: center;
  height: 100%;
  margin-right: 0;
  padding: 0;
  border: none;
  background: transparent;
  text-decoration: none;
  line-height: 0;
}

.brand-link:hover {
  text-decoration: none;
  opacity: 0.9;
}

.brand-logo {
  display: block;
  height: 46px;
  width: auto;
  max-height: calc(var(--haa-nav-bar-height) - 2px);
  max-width: min(168px, 38vw);
  object-fit: contain;
  object-position: left center;
  background: transparent;
  border: none;
  box-shadow: none;
}

[data-theme="light"] .brand-logo {
  filter: invert(1);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 16px;
}

.nav-links a {
  margin-right: 0;
  border: none;
  padding: 4px 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-links a:hover {
  color: var(--text-soft);
  background: transparent;
  text-decoration: none;
}

.nav-links a.active {
  color: var(--text);
  background: transparent;
}

@media (min-width: 769px) {
  .nav-menu-cb {
    display: none;
  }
}

@media (max-width: 768px) {
  body:has(.nav-menu-cb:checked) {
    overflow: hidden;
  }

  .nav {
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    padding: 10px 0 12px;
    padding-left: 0;
    padding-right: 0;
    gap: 0;
  }

  .nav-mobile-head {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
    padding: 4px 2px 12px;
    margin-bottom: 0;
  }

  .brand {
    position: static;
    transform: none;
    margin: 0;
    top: auto;
    bottom: auto;
    height: auto;
    flex: 1;
    min-width: 0;
  }

  .brand-link {
    height: auto;
  }

  .brand-logo {
    height: clamp(36px, 10vw, 44px);
    max-height: calc(var(--haa-nav-bar-height) - 2px);
    max-width: min(160px, 52vw);
  }

  .nav-menu-toggle {
    display: flex;
  }

  .nav-menu-cb:not(:checked) ~ .nav-links {
    display: none;
  }

  .nav-menu-cb:checked ~ .nav-links {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin-top: 10px;
    padding: 6px 0 4px;
    border-radius: var(--haa-radius-sm, 10px);
    background: var(--surface);
    border: 1px solid var(--haa-border-strong, rgba(230, 230, 235, 0.12));
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .nav-links a {
    margin: 0;
    padding: 12px 16px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 14px;
    text-align: center;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 5px;
    transition: color 0.2s ease, text-decoration-color 0.25s ease, background 0.2s ease;
  }

  .nav-links a:last-child {
    border-bottom: none;
    border-right: none;
    padding: 12px 16px;
  }

  .nav-links a:hover {
    background: rgba(212, 175, 55, 0.06);
    text-decoration: underline;
    text-decoration-color: rgba(245, 230, 168, 0.45);
  }

  .nav-links a.active {
    background: rgba(212, 175, 55, 0.1);
    text-decoration: underline;
    text-decoration-color: rgba(232, 200, 92, 0.5);
  }

  .nav-links .nav-collections__trigger {
    display: block;
    width: 100%;
    margin: 0;
    padding: 12px 16px;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 5px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s ease, text-decoration-color 0.25s ease, background 0.2s ease;
  }

  .nav-links .nav-collections__trigger:hover,
  .nav-links .nav-collections.open .nav-collections__trigger {
    background: rgba(212, 175, 55, 0.06);
    text-decoration: underline;
    text-decoration-color: rgba(245, 230, 168, 0.45);
    color: var(--text-soft);
  }

  .nav-links .nav-collections__trigger.active {
    background: rgba(212, 175, 55, 0.1);
    text-decoration: underline;
    text-decoration-color: rgba(232, 200, 92, 0.5);
    color: var(--text);
  }
}

/* Collections dropdown — matches avatar account menu */
.nav-dropdown {
  position: relative;
  z-index: 1002;
  display: inline-block;
  padding-bottom: 0;
}

.nav-collections {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0;
  margin: 0;
}

.nav-dropdown__trigger,
.nav-dropdown-trigger,
.nav-collections__trigger {
  margin: 0;
  display: inline-block;
  border-radius: 0;
  background: transparent;
  border: none;
  padding: 4px 0;
  font-family: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
}

.nav-dropdown__trigger:hover,
.nav-dropdown-trigger:hover,
.nav-collections__trigger:hover {
  color: var(--text-soft);
  background: transparent;
  text-decoration: none;
}

.nav-dropdown__trigger.active,
.nav-collections__trigger.active {
  color: var(--text);
}

.nav-dropdown__panel,
.nav-dropdown-panel,
.nav-collections__menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 190px;
  margin-top: 0;
  padding: 8px;
  border-radius: var(--haa-radius-sm);
  border: 1px solid var(--haa-border-strong);
  background: var(--bg-soft);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.nav-dropdown__panel::before,
.nav-collections__menu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -14px;
  height: 14px;
}

[data-theme="light"] .nav-dropdown__panel,
[data-theme="light"] .nav-collections__menu {
  background: #fffef8;
  box-shadow: 0 12px 36px rgba(42, 38, 32, 0.14);
}

.nav-dropdown:hover .nav-dropdown__panel,
.nav-dropdown:focus-within .nav-dropdown__panel,
.nav-dropdown.open .nav-dropdown__panel,
.nav-collections:hover .nav-collections__menu,
.nav-collections:focus-within .nav-collections__menu,
.nav-collections.open .nav-collections__menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.nav-dropdown__item,
.nav-collections__item {
  display: block;
  box-sizing: border-box;
  width: 100%;
  margin: 0 !important;
  margin-right: 0 !important;
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  font-family: var(--haa-font-body);
  font-size: 0.875rem;
  letter-spacing: normal;
  text-transform: none;
  text-align: left;
  color: var(--haa-text-soft);
  text-decoration: none !important;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-dropdown__item:hover,
.nav-dropdown__item:focus-visible,
.nav-collections__item:hover,
.nav-collections__item:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none !important;
  box-shadow: none;
}

.nav-dropdown__item.active,
.nav-collections__item.active {
  color: var(--haa-text);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.22);
}

.nav-mod-link {
  opacity: 0.75;
}

@media (max-width: 768px) {
  .nav-dropdown {
    padding-bottom: 0;
    margin-bottom: 0;
  }

  .nav-dropdown__trigger,
  .nav-collections__trigger {
    margin-right: 0;
  }

  .nav-dropdown__panel,
  .nav-collections__menu {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    margin-top: 0;
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 0 0 4px;
    min-width: 0;
    display: none;
  }

  .nav-dropdown.open .nav-dropdown__panel,
  .nav-collections.open .nav-collections__menu {
    display: block;
  }

  .nav-dropdown__item,
  .nav-collections__item {
    margin: 0 !important;
    padding: 10px 16px;
    border-radius: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 14px;
  }
}
