/* ==========================================================
   Nalapad Group – Site header, main navigation, Portfolio mega menu
   Loaded on every page, after base.css.
   ========================================================== */

/* ---------------- Header bar ---------------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  color: var(--color-white);
  transition-property: background-color, color, box-shadow, transform;
  transition-duration: .35s;
  transition-timing-function: var(--ease);
}

.site-header__inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  transition: height .35s var(--ease);
}

/* Solid white bar: after scrolling past the hero, or (desktop) while the mega menu is open */
.site-header.is-scrolled,
.has-solid-header .site-header{
  background: var(--color-white);
  color: var(--color-body);
  box-shadow: 0 1px 0 rgba(16, 24, 32, .08);
}

.site-header.is-scrolled .site-header__inner { height: var(--header-h-scrolled); }

/* Hide while scrolling down, show while scrolling up */
.site-header.is-hidden { transform: translateY(-100%); }

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 2;
}

/* Logo always fits inside the bar: a little shorter than the bar itself,
   and it shrinks with the bar after scrolling (and on phones) */
/* .brand img {
  display: block;
  height: calc(var(--header-h) - 24px);
  width: auto;
  max-width: 100%;
  transition: height .35s var(--ease);
}
.site-header.is-scrolled .brand img { height: calc(var(--header-h-scrolled) - 16px); } */

.brand img {
  display: block;
  height: calc(var(--header-h) - 24px);
  width: auto;
  max-width: 100%;
  transform-origin: left top;
  transition: height .35s var(--ease), transform .35s var(--ease);
}

/* Transparent bar (top of a page with a photo hero): bigger logo.
   Never on solid-header pages, where the bar is always white. */
body:not(.has-solid-header) .site-header:not(.is-scrolled):not(.mega-open) .brand img { transform: scale(1.35); }
.site-header.is-scrolled .brand img { height: calc(var(--header-h-scrolled) - 16px); }

[dir="rtl"] .brand img { transform-origin: right top; }

/* ---------------- Main navigation ---------------- */
.primary-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 32px;
  font-size: 14px;
}

.primary-nav__list > li > a:not(.btn-outline) {
  position: relative;
  padding-block: 8px;
}
/* Underline that grows on hover */
.primary-nav__list > li > a:not(.btn-outline)::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 2px;
  height: 1px;
  background: var(--color-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s var(--ease);
}
.primary-nav__list > li > a:not(.btn-outline):hover::after,
.primary-nav__list > li > a[aria-current="page"]::after { transform: scaleX(1); }

/* "Contact Us" button in the bar */
.btn-outline {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid currentColor;
  transition: background-color .25s, color .25s;
}
.btn-outline:hover { background: var(--color-white); color: var(--color-primary); }
.site-header.is-scrolled .btn-outline:hover,
.has-solid-header .site-header .btn-outline:hover { background: var(--color-primary); color: var(--color-white); }

/* Hamburger button (mobile only) */
.nav-toggle {
  display: none;
  position: relative;
  z-index: 2;
  width: 44px; height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}
.nav-toggle__bar {
  display: block;
  width: 26px; height: 1.5px;
  margin: 6px auto;
  background: currentColor;
  transition: transform .3s var(--ease), opacity .2s;
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* ---------------- Portfolio dropdown (mega menu) ---------------- */
.nav-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.nav-trigger__chev { transition: transform .25s var(--ease); }
.nav-trigger[aria-expanded="true"] .nav-trigger__chev { transform: rotate(180deg); }

/* .mega and .mega-backdrop share the same fade in/out */
.mega,
.mega-backdrop {
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s var(--ease), transform .3s var(--ease), visibility 0s linear .3s;
}
.mega.is-open,
body.mega-open .mega-backdrop {
  opacity: 1;
  visibility: visible;
  transition: opacity .3s var(--ease), transform .3s var(--ease), visibility 0s;
}

.mega {
  position: absolute;          /* positioned against the fixed header, so it spans the full width */
  inset-inline: 0;
  top: 100%;
  background: var(--color-white);
  color: var(--color-body);
  border-top: 1px solid #E6E9ED;
  box-shadow: 0 30px 60px -20px rgba(16, 24, 32, .25);
  transform: translateY(-8px);
}
.mega.is-open { transform: none; }

.mega__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 56px;
  padding-block: 48px 56px;
}

.mega__eyebrow {
  margin: 0 0 20px;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* Left: company list */
.mega__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 32px;
}
.mega__list a {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 60px;
  padding: 10px 12px;
  margin-inline: -12px;
  border-radius: 10px;
  transition: background-color .2s, color .2s;
}
.mega__list a:hover,
.mega__list a:focus-visible { background: #F4F6F8; color: var(--color-teal); }

.mega__icon {
  flex: 0 0 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--color-mist);
  color: var(--color-primary);
  transition: background-color .2s, color .2s;
}
.mega__list a:hover .mega__icon { background: var(--color-primary); color: var(--color-white); }

.mega__text { display: flex; flex-direction: column; gap: 2px; }
.mega__text strong { font-size: 16px; font-weight: 600; }
.mega__text small { font-size: 13px; color: var(--color-muted); }

.mega__all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-teal);
}
.mega__all svg { transition: transform .2s; }
.mega__all:hover svg { transform: translateX(4px); }

/* Right: featured cards */
.mega__cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
.mega-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 14px;
  background: #F4F6F8;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.mega-card:hover { transform: translateY(-4px); box-shadow: 0 18px 36px -16px rgba(16, 24, 32, .3); }
.mega-card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.mega-card__body { display: flex; flex-direction: column; gap: 8px; padding: 20px 22px 24px; }
.mega-card__tag { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--color-muted); }
.mega-card__title { font-size: 18px; font-weight: 600; color: var(--color-primary); }
.mega-card__desc { font-size: 14px; line-height: 1.6; color: var(--color-text-alt); }
.mega-card__cta { margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--color-teal); }
.mega-card:hover .mega-card__cta { text-decoration: underline; }

/* Solid-header pages: push the page down so the bar doesn't cover the content */
body.has-solid-header { padding-top: var(--header-h); }

/* About dropdown: same panel as Portfolio, links three across */
.mega--about .mega__inner { grid-template-columns: 1fr; }
.mega__list--row { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Dims the page behind the open dropdown */
.mega-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;                 /* just below the header (100) */
  background: rgba(8, 18, 32, .45);
}

/* ---------------- Desktop ---------------- */
@media (min-width: 1025px) {
  /* Header turns white while a dropdown is open (like the scrolled state) */
  .site-header.mega-open {
    background: var(--color-white);
    color: var(--color-body);
    box-shadow: 0 1px 0 rgba(16, 24, 32, .08);
  }
  .site-header.mega-open .nav-trigger[aria-expanded="true"] { color: var(--color-teal); }
  .site-header.mega-open .btn-outline:hover { background: var(--color-primary); color: var(--color-white); }
}

@media (max-width: 1240px) and (min-width: 1025px) {
  .mega__inner { grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr); gap: 40px; }
}

/* ---------------- Tablet and phone: full-screen menu ---------------- */
@media (max-width: 1024px) {
  :root { --header-h: 76px; --header-h-scrolled: 64px; }

  .nav-toggle { display: block; }

  .primary-nav {
    position: fixed;
    inset: 0;
    z-index: 1;
    background: var(--color-primary);
    color: var(--color-white);
    padding: calc(var(--header-h) + 32px) var(--gutter) 40px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity .35s var(--ease), visibility 0s linear .35s;
  }
  .primary-nav.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity .35s var(--ease), visibility 0s;
  }

  .primary-nav__list {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    font-size: 28px;
    font-weight: 300;
  }
  .primary-nav__list > li { width: 100%; border-bottom: 1px solid rgba(255, 255, 255, .12); }
  .primary-nav__list > li > a:not(.btn-outline) { display: block; padding-block: 16px; }
  .primary-nav__list > li > a::after { display: none; }
  .primary-nav__list > li:last-child { border: 0; padding-top: 24px; }
  .btn-outline { font-size: 16px; }

  /* Keep the logo and the X white while the menu is open */
  body.nav-open .site-header { color: var(--color-white); background: transparent; box-shadow: none; }
  body.nav-open { overflow: hidden; }

  /* Portfolio dropdown becomes a fold-out list inside the menu */
  .nav-trigger {
    width: 100%;
    justify-content: space-between;
    padding-block: 16px;
    font-size: 28px;
    font-weight: 300;
  }
  .nav-trigger__chev { width: 20px; height: 20px; }

  .mega {
    position: static;
    display: none;
    background: none;
    color: var(--color-white);
    border: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  .mega.is-open { display: block; }
  .mega__inner { display: block; padding: 0 0 20px; }
  .mega__eyebrow, .mega__cards { display: none; }
  .mega__list { grid-template-columns: 1fr; gap: 2px; }
  .mega__list a { margin-inline: 0; padding-inline: 0; }
  .mega__list a:hover, .mega__list a:focus-visible { background: none; color: var(--color-white); }
  .mega__icon { background: rgba(255, 255, 255, .08); color: var(--color-white); }
  .mega__text small { color: #AEB9C6; }
  .mega__all { color: #8FD9CF; margin-top: 12px; }
  .mega-backdrop { display: none; }
}

/* ---------------- Right-to-left ---------------- */
[dir="rtl"] .primary-nav__list > li > a::after { transform-origin: right; }
