/**
 * Header Styles - Vitalisite FSE
 * Inspired by Ollie theme - minimal, clean, modern
 */

/* ============================================
   BASE HEADER STYLES
   ============================================ */

.vitalisite-header {
  position: relative;
  z-index: 100;
}

header {
  margin-top: 0 !important;
}

/* ============================================
   HEADER MINIMAL VARIANT
   ============================================ */

.vitalisite-header--minimal {
  background-color: var(--wp--preset--color--on-primary);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  transition: all 0.3s ease;
  padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--50);
}

.vitalisite-header--minimal > .wp-block-group {
  padding: 0 var(--wp--preset--spacing--60);
}

/* Sticky header effect (optional - can be enabled via theme settings) */
.vitalisite-header--minimal.is-sticky {
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  background-color: rgba(241, 245, 249, 0.95);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

/* ============================================
   SITE LOGO & TITLE
   ============================================ */

.vitalisite-header--minimal .wp-block-site-logo {
  margin: 0;
}

.vitalisite-header--minimal .wp-block-site-logo img {
  display: block;
  height: auto;
  transition: opacity 0.2s ease;
}

.vitalisite-header--minimal .wp-block-site-logo a:hover img {
  opacity: 0.8;
}

.has-custom-logo .vitalisite-header--minimal .wp-block-site-title {
  display: none;
}

.vitalisite-header--minimal .wp-block-site-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.2;
}

.vitalisite-header--minimal .wp-block-site-title a {
  color: var(--wp--preset--color--main-text);
  text-decoration: none;
  transition: color 0.2s ease;
}

.vitalisite-header--minimal .wp-block-site-title a:hover {
  color: var(--wp--preset--color--primary);
}

/* ============================================
   NAVIGATION
   ============================================ */

.vitalisite-header--minimal .wp-block-navigation {
  gap: 0.5rem;
}

.vitalisite-header--minimal .wp-block-navigation__responsive-container {
  gap: 0.5rem;
}

.vitalisite-header--minimal .wp-block-navigation-item {
  margin: 0;
}

.vitalisite-header--minimal .wp-block-navigation-item a,
.vitalisite-header--minimal .wp-block-navigation-item button {
  color: var(--wp--preset--color--bg);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40);
  border-radius: 6px;
  transition: all 0.2s ease;
  position: relative;
}

.vitalisite-header--minimal .wp-block-navigation-item a:hover {
  color: var(--wp--preset--color--primary);
  background-color: rgba(11, 61, 145, 0.05);
}

.vitalisite-header--minimal .wp-block-navigation-item a:focus-visible {
  outline: 2px solid var(--wp--preset--color--primary);
  outline-offset: 2px;
}

/* Active/Current page indicator */
.vitalisite-header--minimal .wp-block-navigation-item.current-menu-item a {
  color: var(--wp--preset--color--primary);
  font-weight: 600;
}

.vitalisite-drawer li {
  color: var(--wp--preset--color--bg);
}

/* Submenu styles */
.vitalisite-header--minimal .wp-block-navigation__submenu-container {
  background-color: var(--wp--preset--color--on-primary);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
  padding: 0.5rem;
  min-width: 200px;
}

.vitalisite-header--minimal
  .wp-block-navigation__submenu-container
  .wp-block-navigation-item
  a {
  display: block;
  width: 100%;
}

/* Mobile menu button */
.vitalisite-header--minimal .wp-block-navigation__responsive-container-open {
  color: var(--wp--preset--color--main-text);
  padding: 0.5rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.vitalisite-header--minimal
  .wp-block-navigation__responsive-container-open:hover {
  background-color: rgba(11, 61, 145, 0.05);
  color: var(--wp--preset--color--primary);
}

.vitalisite-header--minimal
  .wp-block-navigation__responsive-container-open:focus-visible {
  outline: 2px solid var(--wp--preset--color--primary);
  outline-offset: 2px;
}

/* ============================================
   CTA BUTTON
   ============================================ */

.vitalisite-header__cta {
  margin: 0;
}

.vitalisite-header__cta .wp-block-button {
  margin: 0;
}

.vitalisite-header__cta .wp-block-button__link {
  border-radius: var(--wp--custom--border-radius--cta, 6px);
  padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--60);
  background-color: var(--wp--preset--color--primary);
  color: var(--wp--preset--color--on-primary);
  transition: all 0.3s ease;
}

.vitalisite-header__cta .wp-block-button__link:hover {
  opacity: 0.8;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(11, 61, 145, 0.25);
}

.vitalisite-header__cta .wp-block-button__link:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(11, 61, 145, 0.2);
}

.vitalisite-header__cta .wp-block-button__link:focus-visible {
  outline: 2px solid var(--wp--preset--color--primary);
  outline-offset: 2px;
}

/* ============================================
   RESPONSIVE NAV — ANTI-FLASH
   The header is hidden until JS determines the
   nav mode (desktop vs mobile). The .is-nav-ready
   class is added by responsive-nav.js after the
   first overflow check.
   ============================================ */

.vitalisite-header--minimal {
  visibility: hidden;
}

.vitalisite-header--minimal.is-nav-ready,
body.wp-admin .vitalisite-header--minimal,
.block-editor-iframe__body .vitalisite-header--minimal,
.editor-styles-wrapper .vitalisite-header--minimal {
  visibility: visible !important;
}

/* ============================================
   RESPONSIVE NAV — DESKTOP MODE
   ============================================ */

.vitalisite-header--minimal.is-desktop-nav .wp-block-navigation {
  flex-grow: 1;
}

.vitalisite-header--minimal.is-desktop-nav .vitalisite-burger {
  display: none;
}

/* ============================================
   RESPONSIVE NAV — MOBILE MODE
   In mobile mode, the inline nav + CTA are hidden.
   A custom burger button + drawer are injected by JS.
   ============================================ */

.vitalisite-header--minimal.is-mobile-nav .wp-block-navigation {
  display: none;
}

.vitalisite-header--minimal.is-mobile-nav .vitalisite-header__cta {
  display: none;
}

/* --- Burger button (injected by JS) --- */

.vitalisite-burger {
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  color: var(--wp--preset--color--main-text);
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
  margin-left: auto;
}

.vitalisite-burger:hover {
  background-color: rgba(11, 61, 145, 0.05);
  color: var(--wp--preset--color--primary);
}

.vitalisite-burger:focus-visible {
  outline: 2px solid var(--wp--preset--color--primary);
  outline-offset: 2px;
}

.is-mobile-nav .vitalisite-burger {
  display: flex;
}

/* --- Backdrop --- */

.vitalisite-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.25);
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0s linear 0.3s;
}

.vitalisite-drawer-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
  transition:
    opacity 0.3s ease,
    visibility 0s linear 0s;
}

/* --- Drawer panel (slides from right) --- */

.vitalisite-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 500px;
  background-color: var(--wp--preset--color--primary);
  box-shadow: -4px 0 24px rgba(15, 23, 42, 0.12);
  z-index: 100000;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.vitalisite-drawer.is-open {
  transform: translateX(0);
}

/* --- Close button --- */

.vitalisite-drawer__close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: transparent;
  border: none;
  padding: 0.625rem;
  border-radius: 8px;
  cursor: pointer;
  color: var(--wp--preset--color--bg);
  z-index: 1;
}

.vitalisite-drawer__close:focus-visible {
  outline: 2px solid var(--wp--preset--color--primary);
  outline-offset: 2px;
}

/* --- Drawer nav content --- */

.vitalisite-drawer__nav {
  padding: 5rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
}

.vitalisite-drawer__nav .wp-block-navigation__container {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.vitalisite-drawer__nav .wp-block-navigation-item {
  margin: 0;
}

.vitalisite-drawer__nav .wp-block-navigation-item a {
  display: block;
  padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--50);
  font-size: 1.0625rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: 8px;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.vitalisite-drawer__nav .wp-block-navigation-item a:hover {
  background-color: rgba(11, 61, 145, 0.05);
  color: var(--wp--preset--color--primary);
}

.vitalisite-drawer__nav .wp-block-navigation-item.current-menu-item a {
  color: var(--wp--preset--color--primary);
  font-weight: 600;
}

/* Submenu inside drawer */
.vitalisite-drawer__nav .wp-block-navigation__submenu-container {
  display: flex;
  flex-direction: column;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0 0 0 1rem;
  border-left: 2px solid rgba(15, 23, 42, 0.08);
}

.vitalisite-drawer__nav .wp-block-navigation__submenu-container a {
  font-size: 0.9375rem;
  padding: 0.5rem 1rem;
}

/* ============================================
   FALLBACK — no JS
   If JS never runs, reveal the header after 1s
   and use a media query as fallback.
   ============================================ */

@media (max-width: 781px) {
  .vitalisite-header--minimal:not(.is-nav-ready) {
    visibility: visible;
  }

  .vitalisite-header--minimal:not(.is-nav-ready) .vitalisite-header__cta {
    display: none;
  }
}

/* ============================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================ */

/* Skip to content link (for screen readers and keyboard navigation) */
.vitalisite-header .skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background-color: var(--wp--preset--color--primary);
  color: var(--wp--preset--color--on-primary);
  padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--50);
  text-decoration: none;
  font-weight: 600;
  z-index: 1000;
  transition: top 0.2s ease;
}

.vitalisite-header .skip-link:focus {
  top: 0;
  outline: 2px solid var(--wp--preset--color--primary);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .vitalisite-header--minimal {
    border-bottom-width: 2px;
  }

  .vitalisite-header--minimal .wp-block-navigation-item a:hover {
    background-color: rgba(11, 61, 145, 0.15);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .vitalisite-header--minimal,
  .vitalisite-header--minimal *,
  .vitalisite-header__cta .wp-block-button__link {
    transition: none !important;
    animation: none !important;
  }
}
