/* =============================================================================
   COMPLETE NAVIGATION STYLES
   Consolidated from old working styles + mega menu functionality
   ============================================================================= */

/* =============================================================================
   BASE NAVBAR STYLES
   ============================================================================= */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  color: #fff;
  z-index: 9;
  display: flex;
  background-color: var(--color-dark-grey);
  min-height: 88px;
}

.navbar .hamburger-menu span {
  background-color: var(--color-light-grey);
}

.navbar.show, .navbar.open {
  background-color: var(--color-dark-grey);
}

.navbar.show .logo {
  display: block;
}

/* =============================================================================
   HAMBURGER MENU (MOBILE)
   ============================================================================= */
.hamburger-menu {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 18px;
  cursor: pointer;
  position: absolute;
  right: 2rem;
  z-index: 1000;
}

.hamburger-menu span {
  display: block;
  width: 100%;
  height: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger-menu.open span:nth-child(1) {
  transform: rotate(45deg);
  position: absolute;
  top: 50%;
}

.hamburger-menu.open span:nth-child(2) {
  opacity: 0;
}

.hamburger-menu.open span:nth-child(3) {
  transform: rotate(-45deg);
  position: absolute;
  top: 50%;
}

/* =============================================================================
   MOBILE MENU
   ============================================================================= */
.menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 120vh;
  background-color: var(--color-dark-grey);
  display: flex;
  flex-direction: column;
  z-index: 999;
  transform: translateY(-100%);
  transition: transform 0.3s ease-in-out, clip-path 0.5s ease-in-out;
  padding: 0;
  padding-top: 3rem;
  clip-path: polygon(0 0, 100% 0, 100% 50%, 0% 100%);
  animation-delay: 0.5s;
}

.menu.open {
  top: 88px;
  transform: translateY(0);
}

.menu > ul > li > a {
  position: relative;
  color: #999;
  text-decoration: none;
  font-size: 2rem;
  letter-spacing: 1rem;
  font-weight: 600;
  padding-left: 3rem;
  font-family: var(--font-montserrat);
  text-transform: uppercase;
  margin-top: 4rem; /* Increased from 3rem for more spacing */
}

.menu li {
  list-style: none;
}

.submenuclick {
  cursor: pointer;
}

@media (max-width: 480px) {
  .menu > ul > li > a {
  font-size: 1.5rem;
  }
}

.navbar.open .fadeInLeft {
  animation: fadeInLeft 0.5s ease forwards;
  animation-delay: calc(0.4s * var(--i));
  opacity: 0;
}

.menu a.submenuclick:before {
  content: '';
  display: block;
  width: 20px;
  height: 20px;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%) rotate(90deg);
  transition: width 0.3s ease, transform 0.2s ease;
  background-color: var(--color-orange);
}

.menu a.submenuclick.active:before {
  transform: translateY(-50%) rotate(180deg);
}

.submenuclick.active:before {
  background-color: #fff !important;
}

.submenuclick.active {
  color: var(--color-orange);
}

/* =============================================================================
   MOBILE SUBMENUS
   ============================================================================= */
@media screen and (max-width: 991px) {
  .menu .submenu {
    display: block;
    padding: 0;
    margin: 0;
    margin-top: 1rem;
    padding-left: 2rem;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.4s ease;
    list-style: none;
  }

  .submenuclick.active + .submenu {
    max-height: 500px; /* Large enough to contain all submenu items */
    opacity: 1;
    overflow: visible;
  }
  .menu .submenu li {
    margin: 0;
    padding: 0;
    width: 100%;
    
  }

  .menu .submenu a {
    color: #fff;
    font-size: 1rem;
    margin: 0.25rem 0;
    text-decoration: none;
    display: block;
    padding: 0.75rem 1rem;
    text-transform: none;
    letter-spacing: normal;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
  }

  .menu .submenu a:hover {
    color: var(--color-orange);
    border-left-color: var(--color-orange);
    background-color: rgba(255, 255, 255, 0.05);
  }

  /* Two-column layout for Services and Work submenus */
  .menu .nav-column:nth-child(2) .submenu, /* Services */
  .menu .nav-column:nth-child(4) .submenu { /* Work */
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    column-gap: 1rem;
  }

  .menu .nav-column:nth-child(2) .submenu li, /* Services */
  .menu .nav-column:nth-child(4) .submenu li { /* Work */
    width: auto;
  }

  .menu .nav-column:nth-child(2) .submenu a, /* Services */
  .menu .nav-column:nth-child(4) .submenu a { /* Work */
    padding: 0.5rem 0.75rem;
  }
}

/* =============================================================================
   SOCIAL MEDIA (MOBILE)
   ============================================================================= */
.social-media {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.navbar.open .social-media {
  display: flex;
}

.social-media img {
  width: 50px;
  margin: 0 5px;
}

/* =============================================================================
   DESKTOP NAVIGATION
   ============================================================================= */
@media screen and (min-width: 992px) {
  /* Hide hamburger button on desktop */
  .menu a:hover {
    color: var(--color-orange);
  }
  .hamburger-menu {
    display: none;
  }
  .navbar:hover .mega-menu-footer-logo {
    opacity: 1;
  }
  .menu {
    position: absolute;
    transform: none;
    height: auto;
    width: 100%;
    background-color: transparent;
    padding: 0;
    clip-path: none;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    z-index: 10;
    height: 100%;
  }
  
  .navbar {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    height:490px;
  }
  
  .nav-columns {
    display: flex;
    width: 100%;
    justify-content: space-evenly;
    padding: 0;
    margin: 0;
    list-style: none;
    max-width: 1500px;
  }
  .nav-column {
    display: flex;
    width: 15%;
    position: relative;
    margin: 0;
    height: 100%;
    flex-direction: column;
    min-height: 350px;
  }

  /* .nav-column:not(:last-child):not(.logo-column):after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 40px;
    background-color: var(--color-dark-grey);
  } */
  
  .logo-column {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 10%;
  }
  
  .navbar .logo {
    width: 100px;
    z-index: 20;
    display: block;
  }
  
  .navbar .logo img {
    max-width: 70px;
    /* width: 150px; */
    height: auto;
    left: 50%;
    transition: all 0.4s ease-in-out;
    position: absolute;
    transform: translate(-50%, 0);
  }

  .navbar:hover .logo img {
    /* transform: scale(2); */
    top: 50px !important;
    max-width: 125px !important;
  }
  
  .nav-columns > li > a,
  .nav-columns > li > .submenuclick,
  .nav-columns > li > a.contact-link {
    color: #fff;
    text-decoration: none;
    font-size: 1rem;
    padding: 2rem 1rem 2rem 1rem;
    letter-spacing: 10px;
    text-transform: uppercase;
    white-space: nowrap;
    font-family: var(--font-montserrat);
    margin-top: 0;
    display: inline-block;
    position: relative;
    transition: color 0.3s ease;
    text-align: center;
  }

  /* UPDATED: Static diagonal lines (using ::before to avoid conflict with arrow) */
  .nav-columns > li > a:not(.contact-link)::before,
  .nav-columns > li > .submenuclick::before {
    content: '';
    position: absolute;
    bottom: 15px;
    left: 50%;
    width: 2px;
    height: 35px; /* Set a static height */
    background-color: var(--color-orange);
    transform: translateX(-50%) skewX(-25deg); /* Creates the NW diagonal effect */
    /* Removed transition for static appearance */
  }

  .nav-columns > li > a.contact-link {
    color: #fff;
    background-color: transparent;
  }
  
  .nav-columns > li > a:hover,
  .nav-columns > li > .submenuclick:hover {
    color: var(--color-orange);
  }

  /* Desktop submenu arrow (uses ::after) */
  /* .menu a.submenuclick:after {
    content: '';
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    width: 18px;
    height: 18px;
    display: inline-block;
    margin-left: 0.5rem;
    transition: none;
    vertical-align: middle;
  } */

  /* Hides mobile-only elements on desktop */
  .menu a.submenuclick:before {
    display: none;
  }
}

/* =============================================================================
   MOBILE LOGO POSITIONING
   ============================================================================= */
@media screen and (max-width: 991px) {
  .navbar .logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    max-width: 60px;
    z-index: 20;
    display: block;
  }

  .nav-columns {
    margin-top: 2rem;
  }

  .navbar .logo.mobile-logo {
    transition: all 0.4s ease;
  }
  .navbar.open .logo.mobile-logo {
    transform: translate(-50%) scale(1.7);
    top: 1.5rem;
    left: 50%;
    position: absolute;
  }

  .menu > ul > li > a {
    margin: 0;
  }
  .menu  {
    padding: 0;
  }
  .logo, .hamburger-menu {
    z-index: 999999 !important;
  }
  .menu {
    z-index: 99;
  }

  .submenu.open {
    z-index: 99999 ;
  }

  .nav-columns {
    display: block !important;
  }
  .logo-column, .navbar .nav-columns .nav-column::before, .navbar .nav-column-line:before, .nav-column-line, .nav-column .social-icons,.nav-column:last-child h3, .submenu-column h3, .nav-columns .nav-column::after, .nav-column-line:after {
    display: none !important;
  }
  .menu .nav-column:nth-child(2) .submenu, .menu .nav-column:nth-child(4) .submenu {
    display: block;
  }

  .nav-column:last-child .social-icons {
    margin-top: 6rem;
  }
  .social-media {
    z-index: 9999;
  }
  div.mega-menu-footer-logo, div.mega-menu-footer-logo img {
    position: static !important;
    width: 100%;
    max-width: 97%;
    margin: 0 auto;
    transform: unset;
  }
}

/* =============================================================================
   MEGA MENU (DESKTOP ONLY)
   ============================================================================= */
/* UPDATED: Changed animation from slide/fade to reveal/grow */

.navbar {
  transition: max-height 0.4s ease-in-out, clip-path 0.3s ease-in-out;
  max-height: 88px;
  overflow: hidden;
}

/* UPDATED: Show mega menu on desktop hover using max-height */
@media screen and (min-width: 992px) {
  .navbar {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 100% 100%, 0 100%);
  }
  .navbar:hover {
    max-height: 505px;
    clip-path: polygon(0 0, 100% 0, 100% 65%, 80% 100%, 0 100%);
  }
  .mobile-logo {
    display: none !important;
  }
}

.nav-columns .nav-column {
  flex: 1;
  padding: 0 1.5rem;
  min-width: 275px;
  position: relative;
}

/* =============================================================================
   MEGA MENU TWO-STAGE DIVIDER ANIMATION (DESKTOP)
   ============================================================================= */

/* --- Part 1: The Vertical Stem (:before) --- */
/* This targets all columns except the last one and the one with the logo */
.nav-columns .nav-column::before, .nav-column-line:before {
  content: '';
  position: absolute;
  bottom: 0;
  left: -1rem;
  transform: translateY(20px); /* Positions start point below center */
  width: 2px; /* Thinner for a more subtle look */
  height: 0; /* Starts with zero height */
  background-color:black; /* Visible on dark background */
  /* Animation starts after the menu begins to open (delay) */
  transition: height 0.2s ease-in-out 0.2s, transform 0.2s ease-in-out 0.2s;
}

/* --- Part 2: The Diagonal Branch (:after) --- */
.nav-columns .nav-column::after, .nav-column-line:after {
  content: '';
  position: absolute;
  bottom: 86%; /* Starts where the vertical stem will end (at the center) */
  left: -1rem;
  width: 2px;
  height: 0; /* Starts with zero length */
  background-color:black;
  transform: rotate(-29deg);
  transform-origin: bottom right;
  /* This animation has a longer DELAY, waiting for the stem to finish */
  transition: height 0.2s ease-in-out 0.4s; /* Delay is 0.2s (menu) + 0.2s (stem) */
}

.nav-column-line:before,.nav-column-line:after {
  right: 0;
  left: unset;
  position: absolute;
}

/* --- The Hover States that Trigger the Animations --- */
/* This is triggered by hovering the entire navbar */

/* 1. The vertical stem grows upwards to the center */
.navbar:hover .nav-columns .nav-column::before, .navbar:hover .nav-column-line:before {
  height: 86%;
  transform: translateY(0); /* Animates to its final position */
}

/* 2. The diagonal branch grows after the stem is complete */
.navbar:hover .nav-columns .nav-column::after, .navbar:hover .nav-column-line:after {
  height: 17%; /* This is the length of the diagonal part */
}

.nav-columns .nav-column.logo-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.nav-columns .nav-column.logo-column img {
  max-width: 80px;
  margin-bottom: 1.5rem;
  height: auto;
  width: 200px;
  top: 7px;
}

.nav-columns h3 {
  color: var(--color-orange);
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: var(--font-built-tiling);
  position: relative;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--color-orange);
  width: fit-content;
  display: inline-flex;
  text-wrap: unset;
}

.nav-columns ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 0rem;
}

.nav-columns .nav-column:first-child ul,
.nav-columns .nav-column.logo-column ul,
.nav-columns .nav-column:last-child ul {
  display: block;
}

.nav-columns a {
  color: #e0e0e0;
  font-size: 14px;
  text-decoration: none;
  display: block;
  padding: 0.2rem 0;
  transition: color 0.2s ease, transform 0.2s ease;
  position: relative;
  font-weight: normal !important;
}

@media (min-width: 481px) {
  .nav-columns a:hover {
    color: var(--color-orange);
  }
}

.nav-columns .mega-menu-contact {
  display: flex;
  flex-direction: column;
}

.nav-columns .social-icons {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.nav-columns .social-icons a {
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-columns .social-icons img {
  width: 40px;
  height: auto;
  opacity: 0.8;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.nav-columns .social-icons a:hover {
  transform: translateY(-3px);
}

.nav-columns .social-icons a:hover img {
  opacity: 1;
}

.mega-menu-footer-logo {
  width: 100%;
  text-align: center;
  padding-top: 2rem;
  padding: 0;
  margin: 0;
  position: absolute;
  bottom: -2px;
  left: 60%;
  transform: translate(-50%);
  transition: opacity 0.4s ease-in-out 0.1s ;
  opacity: 0;
}

.mega-menu-footer-logo img {
  max-width: 900px;
  height: auto;
}


/* =============================================================================
   STICKY NAVIGATION
   ============================================================================= */
.navbar-sticky {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: var(--color-dark-grey);
  z-index: 999;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  transform: translateY(-100%);
  transition: transform 0.3s ease;
  min-height: 88px;
}

.navbar-sticky.visible {
  transform: translateY(0);
}

.navbar-sticky.visible .logo {
  display: block !important;
}

/* =============================================================================
   ANIMATIONS
   ============================================================================= */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.nav-columns .fade-in {
  opacity: 0;
  animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.nav-columns li {
  animation-delay: calc(0.05s * var(--i));
}