/* Mobile-specific styles for EMI site */
/* Base hamburger button styles (hidden on desktop by default) */
.menu-toggle {
  display: none;
  border: none;
  background: transparent;
  padding: 8px;
  border-radius: 999px;
  cursor: pointer;
}

.menu-toggle .menu-icon {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}

.menu-toggle .menu-icon span {
  width: 20px;
  height: 2px;
  background: #111827;
  border-radius: 999px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Animate into an "X" when nav is open */
body.nav-open .menu-toggle .menu-icon span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

body.nav-open .menu-toggle .menu-icon span:nth-child(2) {
  opacity: 0;
}

body.nav-open .menu-toggle .menu-icon span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Phone-width mobile layout (e.g., iPhone 15) */
@media (max-width: 640px) {
  /* Show hamburger on mobile */
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Slide-out nav from the right */
  nav[aria-label="primary"] {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 260px;
    background: #000; /* solid black background */
    padding: 80px 24px 24px;
    transform: translateX(100%);
    transition: transform 0.25s ease-out;
    box-shadow: -12px 0 30px rgba(0, 0, 0, 0.4);
    z-index: 60;
    display: flex;
    align-items: flex-start;
  }

  nav[aria-label="primary"] ul {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  nav[aria-label="primary"] a {
    display: block;
    padding: 12px 0;
    color: #ffffff; /* high-contrast text */
  }

  /* When nav is open, bring it into view */
  body.nav-open nav[aria-label="primary"] {
    transform: translateX(0);
  }

  /* Dim background when menu is open */
  body.nav-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 40;
  }

  header.sticky {
    z-index: 70;
  }

  /* Mosaic should appear above the text/h1 on mobile */
  .hero .wrap {
    display: flex;
    flex-direction: column;
    gap: 24px;
  }

  .hero .wrap > .mosaic {
    order: -1;
  }

  /* Single-column cards on mobile for Expertise and Partners */
  #our-expertise .gallery {
    grid-template-columns: 1fr;
  }

  #partners .partners-row {
    grid-template-columns: 1fr;
  }
}
