/* =========================================================================
   VISHWAKARMA INDIA SERVICES — ENTERPRISE HEADER COMPONENT
   Unified desktop + mobile header. Modular, CMS-ready, no inline styles/JS.
   ========================================================================= */

:root {
  --vis-brand-primary: #004080;      /* Primary brand blue (matches mobile header) */
  --vis-brand-primary-dark: #00305f;
  --vis-brand-accent: #db2f20;       /* Theme accent (matches color.css) */
  --vis-brand-gold: #ffcc00;
  --vis-on-brand: #ffffff;
  --vis-on-brand-muted: rgba(255, 255, 255, 0.78);
  --vis-surface: #ffffff;
  --vis-shadow-sm: 0 2px 10px rgba(0, 20, 55, 0.08);
  --vis-shadow-md: 0 8px 30px rgba(0, 20, 55, 0.14);
  --vis-radius-pill: 999px;
  --vis-radius-md: 10px;
  --vis-header-height: 84px;
  --vis-header-height-scrolled: 66px;
  --vis-font: 'Poppins', Arial, sans-serif;
  --vis-transition: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reduced motion respect */
@media (prefers-reduced-motion: reduce) {
  :root { --vis-transition: 0s; }
}

/* -------------------------------------------------------------------------
   Namespaced wrapper — deliberately NOT named .main-header.
   The legacy theme (style.css / responsive.css / rtl.css / script.js) owns
   dozens of rules and a scroll handler keyed on ".main-header" /
   ".sticky-header" / ".fixed-header" from the old template. Reusing that
   class name here caused the old sticky-header logic and header-upper/
   logo-box styles to fire alongside this component, producing the
   duplicate-header / duplicate-logo rendering. Keep this name unique.
   ------------------------------------------------------------------------- */
.vis-site-header {
  margin: 0;
  padding: 0;
  background: transparent;
  font-family: var(--vis-font);
}

/* -------------------------------------------------------------------------
   HEADER SHELL — sticky, fades in on load (opacity only, zero CLS)
   ------------------------------------------------------------------------- */
.vis-header {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: var(--vis-brand-primary);
  box-shadow: var(--vis-shadow-sm);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.5s ease, transform 0.5s ease, box-shadow var(--vis-transition), background var(--vis-transition);
}

.vis-header.vis-header--ready {
  opacity: 1;
  transform: translateY(0);
}

.vis-header.vis-header--scrolled {
  box-shadow: var(--vis-shadow-md);
  background: var(--vis-brand-primary-dark);
}

/* Auto-hide on scroll-down, reveal instantly on scroll-up (saves screen space on mobile) */
.vis-header.vis-header--hidden {
  transform: translateY(-100%);
}

/* =========================================================================
   DESKTOP HEADER  (>= 992px)
   ========================================================================= */
.vis-header__desktop {
  display: none;
}

@media (min-width: 992px) {
  .vis-header__desktop {
    display: block;
  }

  .vis-header__inner {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 24px;
    height: var(--vis-header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    transition: height var(--vis-transition);
  }

  .vis-header--scrolled .vis-header__inner {
    height: var(--vis-header-height-scrolled);
  }

  /* --- Brand block (left) --- */
  .vis-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    min-width: 0;
    flex-shrink: 0;
  }

  .vis-brand__logo-wrap {
    background: var(--vis-on-brand);
    border-radius: 8px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    transition: width var(--vis-transition), height var(--vis-transition);
  }

  .vis-header--scrolled .vis-brand__logo-wrap {
    width: 44px;
    height: 44px;
  }

  .vis-brand__logo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
    display: block;
  }

  .vis-brand__text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
  }

  .vis-brand__name {
    color: var(--vis-on-brand);
    font-weight: 700;
    font-size: 19px;
    letter-spacing: 0.2px;
    white-space: nowrap;
  }

  .vis-brand__tagline {
    color: var(--vis-on-brand-muted);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    margin-top: 2px;
  }

  /* --- Navigation (right) --- */
  .vis-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: flex-end;
  }

  .vis-nav__list {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .vis-nav__item {
    position: relative;
  }

  .vis-nav__link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--vis-on-brand-muted);
    font-size: 14.5px;
    font-weight: 500;
    text-decoration: none;
    padding: 10px 16px;
    border-radius: var(--vis-radius-pill);
    transition: background var(--vis-transition), color var(--vis-transition);
    white-space: nowrap;
  }

  .vis-nav__link:hover,
  .vis-nav__link:focus-visible {
    color: var(--vis-on-brand);
    background: rgba(255, 255, 255, 0.12);
  }

  /* Active menu item highlight */
  .vis-nav__item.is-active > .vis-nav__link {
    color: var(--vis-on-brand);
    background: rgba(255, 255, 255, 0.18);
    font-weight: 600;
  }

  .vis-nav__link .vis-caret {
    font-size: 10px;
    transition: transform var(--vis-transition);
  }

  .vis-nav__item:hover .vis-caret,
  .vis-nav__item.is-open .vis-caret {
    transform: rotate(180deg);
  }

  /* --- Dropdown / mega-menu ready --- */
  .vis-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 240px;
    background: var(--vis-surface);
    border-radius: var(--vis-radius-md);
    box-shadow: var(--vis-shadow-md);
    list-style: none;
    margin: 0;
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
    z-index: 1001;
  }

  /* Mega-menu variant: wider, multi-column ready */
  .vis-dropdown--mega {
    min-width: 560px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
  }

  .vis-nav__item:hover > .vis-dropdown,
  .vis-nav__item.is-open > .vis-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .vis-dropdown__link {
    display: block;
    padding: 9px 14px;
    border-radius: 8px;
    color: #23334a;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--vis-transition), color var(--vis-transition);
  }

  .vis-dropdown__link:hover,
  .vis-dropdown__link:focus-visible {
    background: rgba(0, 64, 128, 0.08);
    color: var(--vis-brand-primary);
  }

  /* --- CTA button --- */
  .vis-header__cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
    padding: 11px 22px;
    background: var(--vis-brand-accent);
    color: var(--vis-on-brand);
    font-size: 14.5px;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--vis-radius-pill);
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(219, 47, 32, 0.35);
    transition: background var(--vis-transition), transform var(--vis-transition), box-shadow var(--vis-transition);
  }

  .vis-header__cta:hover,
  .vis-header__cta:focus-visible {
    background: #c22619;
    color: var(--vis-on-brand);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(219, 47, 32, 0.45);
  }

  .vis-header__cta i {
    font-size: 13px;
  }
}

/* =========================================================================
   MOBILE / TABLET HEADER  (< 992px)
   ========================================================================= */
.vis-header__mobile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
}

@media (min-width: 992px) {
  .vis-header__mobile {
    display: none;
  }
}

.vis-header__mobile .vis-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}

.vis-header__mobile .vis-brand__logo-wrap {
  background: var(--vis-on-brand);
  border-radius: 6px;
  padding: 3px;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vis-header__mobile .vis-brand__logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

.vis-header__mobile .vis-brand__text {
  min-width: 0;
  line-height: 1.2;
}

.vis-header__mobile .vis-brand__name {
  display: block;
  color: var(--vis-on-brand);
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vis-header__mobile .vis-brand__tagline {
  display: block;
  color: var(--vis-on-brand-muted);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vis-header__mobile-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.vis-header__mobile-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--vis-brand-accent);
  color: var(--vis-on-brand);
  font-size: 15px;
  text-decoration: none;
  transition: background var(--vis-transition);
}

.vis-header__mobile-cta:hover,
.vis-header__mobile-cta:focus-visible {
  background: #c22619;
  color: var(--vis-on-brand);
}

.vis-nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  border: none;
  color: var(--vis-on-brand);
  font-size: 17px;
  cursor: pointer;
  transition: background var(--vis-transition);
}

.vis-nav-toggle:hover,
.vis-nav-toggle:focus-visible {
  background: rgba(255, 255, 255, 0.24);
}

/* --- Mobile slide-in menu --- */
.vis-mobile-menu {
  position: fixed;
  top: 0;
  left: -100%;
  width: 84%;
  max-width: 340px;
  height: 100%;
  background: var(--vis-surface);
  z-index: 1100;
  padding: 20px;
  overflow-y: auto;
  box-shadow: var(--vis-shadow-md);
  transition: left 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.vis-mobile-menu.is-open {
  left: 0;
}

.vis-mobile-menu__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #eef0f3;
}

.vis-mobile-menu__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.vis-mobile-menu__brand img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 6px;
}

.vis-mobile-menu__brand span {
  font-weight: 700;
  font-size: 14px;
  color: var(--vis-brand-primary);
}

.vis-mobile-menu__close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: #f1f3f6;
  color: #444;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.vis-mobile-menu__close:hover {
  background: #e4e7ec;
}

.vis-mobile-menu__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.vis-mobile-menu__list > li {
  border-bottom: 1px solid #f1f3f6;
}

.vis-mobile-menu__list > li > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 4px;
  color: #23334a;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}

.vis-mobile-menu__list > li.is-active > a {
  color: var(--vis-brand-primary);
  font-weight: 700;
}

.vis-mobile-menu__list .vis-has-submenu > a i {
  transition: transform var(--vis-transition);
  font-size: 12px;
}

.vis-mobile-menu__list .vis-has-submenu.is-open > a i {
  transform: rotate(180deg);
}

.vis-mobile-menu__list .vis-mobile-submenu {
  list-style: none;
  margin: 0 0 8px;
  padding: 0 0 0 12px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.vis-mobile-menu__list li.is-open .vis-mobile-submenu {
  max-height: 500px;
}

.vis-mobile-submenu li a {
  display: block;
  padding: 9px 4px;
  font-size: 13.5px;
  color: #55617a;
  text-decoration: none;
}

.vis-mobile-menu__cta {
  display: block;
  text-align: center;
  margin-top: 18px;
  padding: 13px;
  background: var(--vis-brand-accent);
  color: var(--vis-on-brand);
  border-radius: var(--vis-radius-pill);
  font-weight: 600;
  text-decoration: none;
}

.vis-menu-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 35, 0.45);
  z-index: 1090;
}

.vis-menu-backdrop.is-active {
  display: block;
}

/* Prevent background scroll when mobile menu open */
body.vis-menu-locked {
  overflow: hidden;
}

/* Skip link (accessibility) */
.vis-skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--vis-brand-primary);
  color: #fff;
  padding: 10px 16px;
  z-index: 2000;
  border-radius: 0 0 8px 0;
}

.vis-skip-link:focus {
  left: 0;
  top: 0;
}
