/**
 * Hope Verify International - site header and navigation
 * Plain CSS so the navbar works when Tailwind arbitrary utilities
 * (pt-[76px], bg-white/95, z-[100]) are not in tailwind.min.css.
 */

/* Room for fixed header */
body.hvi-has-fixed-header,
body.pt-\[76px\] {
  padding-top: 76px !important;
}

.nav-link-desktop {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  color: #0f172a;
}

.nav-link-desktop::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background-color: #1e40af;
  transition: width 0.3s ease, transform 0.3s ease;
  transform: translateX(-50%);
}

.nav-link-desktop:hover::after,
.nav-link-desktop.active::after {
  width: calc(100% - 16px);
}

.nav-link-desktop.active {
  color: #1e40af !important;
  font-weight: 600;
}

a.nav-more-active {
  color: #1e40af !important;
  font-weight: 600;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
}

/* Fixed header - always visible white bar on top */
.site-header,
#main-header.site-header,
header.site-header {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  height: 76px !important;
  min-height: 76px;
  z-index: 9999 !important;
  background-color: #ffffff !important;
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
  overflow: visible;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.site-header nav,
#main-header nav {
  height: 100%;
  overflow: visible;
}

#main-header.scrolled {
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.1);
}

/* Readable link colors on white header */
.site-header a.nav-link-desktop,
.site-header button.nav-link-desktop,
.site-header .text-text-dark,
.site-header span.text-text-dark {
  color: #0f172a;
}

.site-header #mobile-menu-button {
  color: #0f172a;
}

/* Desktop nav row — overflow-x:auto clips dropdown panels in Chrome/Safari */
.hvi-nav-desktop {
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px;
}

@media (min-width: 1024px) {
  .hvi-nav-desktop {
    overflow: visible !important;
  }

  .site-header nav > .flex.items-center.justify-between {
    overflow: visible !important;
  }
}

/* lg breakpoint = 1024px (matches Tailwind lg) */
@media (min-width: 1024px) {
  .hvi-nav-desktop {
    display: flex !important;
  }
}

@media (max-width: 1023px) {
  .hvi-nav-desktop {
    display: none !important;
  }
}

.hvi-nav-desktop::-webkit-scrollbar {
  display: none;
}

@media (min-width: 1024px) and (max-width: 1279px) {
  .hvi-nav-desktop .nav-link-desktop {
    font-size: 0.8125rem;
  }

  .hvi-nav-desktop {
    gap: 12px !important;
  }
}

/* Resources dropdown — plain CSS (Tailwind group-hover not in build) */
.hvi-nav-more {
  position: relative;
}

.hvi-nav-more-trigger {
  cursor: pointer;
  background: transparent;
  border: none;
  font: inherit;
}

.hvi-nav-more-chevron {
  transition: transform 0.2s ease;
}

.hvi-nav-more:hover .hvi-nav-more-chevron,
.hvi-nav-more.is-open .hvi-nav-more-chevron,
.hvi-nav-more:focus-within .hvi-nav-more-chevron {
  transform: rotate(180deg);
}

.hvi-nav-more-panel {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 240px;
  padding-top: 10px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, visibility 0.18s ease;
  z-index: 10001;
}

.hvi-nav-more:hover .hvi-nav-more-panel,
.hvi-nav-more:focus-within .hvi-nav-more-panel,
.hvi-nav-more.is-open .hvi-nav-more-panel {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.hvi-nav-more-panel.hvi-nav-more-panel--fixed {
  position: fixed !important;
  top: auto;
  left: auto;
  padding-top: 0;
  transform: translateX(-50%);
}

.hvi-nav-more-panel-inner {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  padding: 6px 0 8px;
  overflow: hidden;
}

.hvi-nav-more-section + .hvi-nav-more-section {
  border-top: 1px solid #f1f5f9;
  margin-top: 4px;
  padding-top: 4px;
}

.hvi-nav-more-label {
  margin: 0;
  padding: 8px 16px 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}

.hvi-nav-more-link {
  display: block;
  padding: 9px 16px;
  font-size: 0.875rem;
  line-height: 1.35;
  color: #0f172a;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.hvi-nav-more-link:hover,
.hvi-nav-more-link:focus-visible {
  background-color: #f8fafc;
  color: #1e40af;
  outline: none;
}

.hvi-nav-more-link.active {
  background-color: #eff6ff;
  color: #1e40af;
  font-weight: 600;
}

.hvi-cta-primary,
.apply-cta-button,
.give-button {
  flex-shrink: 0;
}

.apply-cta-button:hover {
  transform: translateY(-2px);
}

.apply-cta-button:active {
  transform: translateY(0);
}

/* Mobile menu — plain CSS (no Tailwind hidden/fixed/lg:hidden required) */
.hvi-mobile-menu-backdrop {
  position: fixed;
  inset: 0;
  top: 76px;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.hvi-mobile-menu-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#mobile-menu {
  position: fixed !important;
  top: 76px !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-height: calc(100vh - 76px);
  max-height: calc(100dvh - 76px);
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  background: #ffffff !important;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
  z-index: 10001 !important;
  display: none !important;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.22s ease, visibility 0.22s ease, transform 0.22s ease;
}

#mobile-menu.is-open {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: translateY(0);
}

body.hvi-mobile-nav-open {
  overflow: hidden !important;
}

.hvi-icon-hidden {
  display: none !important;
}

.site-header #mobile-menu-button {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem;
  margin: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

@media (min-width: 1024px) {
  #mobile-menu,
  #mobile-menu.is-open,
  .hvi-mobile-menu-backdrop,
  .hvi-mobile-menu-backdrop.is-open {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .site-header #mobile-menu-button {
    display: none !important;
  }
}

@media (max-width: 1023px) {
  .site-header #mobile-menu-button {
    display: flex !important;
  }

  /* Donate / apply in header bar — links are inside the slide-out menu */
  .hvi-header-ctas .hvi-header-donate,
  .hvi-header-ctas .hvi-header-apply-link,
  .hvi-header-ctas .apply-cta-button {
    display: none !important;
  }
}

.site-header .flex.items-center.justify-between {
  gap: 0.5rem;
}

@media (max-width: 1023px) {
  .site-header nav > .flex.items-center.justify-between > a:first-child span.hidden.sm\:inline-block {
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Applicant portal — track status (header + mobile menu) */
.hvi-portal-track-link {
  display: none;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #475569;
  text-decoration: none;
  white-space: nowrap;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}

.hvi-portal-track-link:hover,
.hvi-portal-track-link.active {
  color: #1e40af;
  background: #f8fafc;
}

@media (min-width: 768px) {
  .hvi-portal-track-link {
    display: inline-flex;
  }
}

.hvi-portal-track-link--mobile {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1rem;
  padding: 0.875rem 1rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  font-weight: 500;
  text-decoration: none;
}

.hvi-portal-track-link--mobile:hover {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1e40af;
}

@media (min-width: 1024px) {
  .hvi-portal-track-link--mobile {
    display: none;
  }
}
