/* Header Styles */
.header {
  position: fixed;
  top: -72px; /* Initial position for animation */
  left: 0;
  width: 100%;
  height: 72px;
  z-index: 1000;
  background-color: #424341;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background-color 0.3s ease;
  will-change: transform;
}

.header__container {
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

/* Logo Styles */
.header__logo {
  display: block;
  z-index: 2;
  height: 60px;
  width: auto; /* Allow width to adjust proportionally */
}

.header__logo img {
  max-width: 100%;
  height: 100%;
  object-fit: contain;
  display: block; /* Ensure it behaves as a block for sizing */
}

/* Desktop Navigation Styles */
.header__nav {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
}

.header__menu {
  display: flex;
  list-style: none;
  gap: 2rem;
  margin: 0;
  padding: 0;
}

.header__menu-item {
  position: relative;
}

.header__menu-link {
  color: rgb(255, 255, 255);
  text-decoration: none;
  font-family: 'Open Sans', sans-serif;
  font-size: var(--font-size-caption);
  font-weight: normal;
  padding: 12px 0;
  transition: color 0.3s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.header__menu-link:hover {
  color: #00d08b;
}

.header__menu-arrow {
  width: 8px;
  height: 9px;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.header__menu-item--industries.open .header__menu-arrow {
  transform: rotate(180deg);
}

/* Mobile Menu Button Styles */
.header__menu-toggle {
  position: relative;
  width: 24px;
  height: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 2;
}

.header__menu-toggle-line {
  position: absolute;
  left: 2px;
  width: 20px;
  height: 2px;
  background-color: white;
  transition:
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header__menu-toggle-line:nth-child(1) {
  top: 8px;
}
.header__menu-toggle-line:nth-child(2) {
  top: 14px;
}

.header.is-mobile-menu-open .header__menu-toggle-line:nth-child(1) {
  transform: translateY(3px) rotate(45deg);
}
.header.is-mobile-menu-open .header__menu-toggle-line:nth-child(2) {
  transform: translateY(-3px) rotate(-45deg);
}

/* Mobile Menu Styles */
.header__mobile-menu {
  position: fixed;
  top: 72px;
  left: 0;
  width: 100%;
  height: calc(100vh - 72px);
  background-color: #424341;
  padding: 2rem 2rem 2rem;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 1;
  overflow-y: auto;
}

.header__mobile-menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.header__mobile-menu-item {
  margin-bottom: 1rem;
}

.header__mobile-menu-link {
  color: white;
  text-decoration: none;
  font-size: var(--font-size-body-xl);
  font-weight: 500;
  display: block;
  padding: 0.5rem 0;
  transition: color 0.3s ease;
}

.header__mobile-menu-link:hover {
  color: #00d08b;
}

/* Active States */
.header.is-scrolled {
  background-color: #424341;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header.is-mobile-menu-open .header__mobile-menu {
  transform: translateX(0);
}

/* Responsive Styles */
@media (min-width: 1280px) {
  .header__nav {
    display: flex;
  }

  .header__menu-toggle {
    display: none;
  }

  .header__actions {
    min-width: 7.25em; /* Match logo width for balance */
    height: 60px; /* Match logo height for balance */
  }

  .header__container {
    padding: 0 1rem 0 0.5rem;
  }

  .header__logo {
    height: 60px;
  }
}

@media (min-width: 1280px) {
  .header__menu {
    gap: 1.5rem;
  }
  
  .header__menu-link {
    font-size: var(--font-size-caption);
    white-space: nowrap;
  }
  
  .header__mega-menu {
    top: 56px; /* Adjusted for 40px link height (16px font + 24px padding) */
  }
}

@media (max-width: 1279px) {
  .header__nav {
    display: none;
  }

  .header__menu-toggle {
    display: block;
  }

  .header__container {
    padding: 0 1.5rem;
  }

  .header__logo {
    height: 50px; /* Adjusted for mobile */
  }

  .header__mega-menu {
    display: none !important;
    pointer-events: none !important;
    opacity: 0 !important;
  }
}

/* Animation Classes */
.header__menu-link {
  position: relative;
}

/* Mega Menu Styles */
.header__mega-menu {
  position: absolute;
  left: 0;
  top: 54px; /* Adjusted for 36px link height (12px font + 24px padding) */
  width: 100%;
  background: rgba(24, 24, 24, 0.95);
  z-index: 1001;
  padding: 3rem 6vw 3rem 6vw;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    background 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.header__mega-menu[aria-expanded='true'],
.header__mega-menu.active {
  opacity: 1;
  pointer-events: auto;
}
.mega-menu__container {
  max-width: 1440px;
  margin: 0 auto;
}
.mega-menu__title-row {
  display: flex;
  align-items: center;
  margin-bottom: 1.5rem;
}
.mega-menu__title {
  color: #fff;
  font-size: var(--font-size-heading-xxxl);
  font-weight: 500;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.mega-menu__title-arrow {
  width: 1.2em;
  height: 1.2em;
  color: #fff;
  transform: rotate(0deg);
  transition: none;
}
.mega-menu__divider {
  border: none;
  border-top: 1px solid #333;
  margin: 0 0 2rem 0;
}
.mega-menu__columns {
  display: flex;
  gap: 4rem;
}
.mega-menu__column {
  display: flex;
  flex-direction: column;
  min-width: 200px;
  gap: 1.2rem;
}
.mega-menu__label {
  color: #888;
  font-size: var(--font-size-label);
  font-weight: 500;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}
.mega-menu__column a {
  color: #fff;
  text-decoration: none;
  font-size: var(--font-size-body-lg);
  font-weight: 400;
  transition: color 0.2s;
}
.mega-menu__column a:hover {
  color: #00d08b;
}

@media (min-width: 1024px) {
  .header__mega-menu {
    display: block;
  }
}
@media (max-width: 1023px) {
  .header__mega-menu {
    display: none !important;
  }
}

/* Mobile submenu for Industries */
.header__mobile-menu-item--industries {
  position: static;
}

.header__mobile-submenu {
  position: static;
  background: #232323;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  margin: 0;
  gap: 0.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition:
    max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.2s;
}
.header__mobile-submenu.active {
  max-height: 500px;
  opacity: 1;
  pointer-events: auto;
  margin-bottom: 1rem;
}
.header__mobile-submenu .mega-menu__label {
  color: #888;
  font-size: var(--font-size-label);
  font-weight: 500;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}
.header__mobile-submenu a {
  color: #fff;
  text-decoration: none;
  font-size: var(--font-size-body-lg);
  font-weight: 400;
  padding: 0.2rem 0;
  transition: color 0.2s;
}
.header__mobile-submenu a:hover {
  color: #00d08b;
}

.header__mobile-menu-item--industries.open .header__menu-arrow {
  transform: rotate(180deg);
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.header__menu-arrow {
  margin-left: 6px;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Header Actions (placeholder for mobile toggle and future CTAs) */
.header__actions {
  display: flex;
  align-items: center;
}
