/* Mobile popup navigation (CSS-only) */

/* hide popup elements by default */
.mobile-nav-toggle { position: absolute; left: -9999px; }
.mobile-menu-label { display: none; }
.mobile-menu-popup { display: none; }

/* Keep mobile controls hidden while the preloader is active.
   The loader adds `.loaded` to #loader when finished (see js/app.js).
   While `#loader` does NOT have `.loaded`, hide the menu controls. */
#loader:not(.loaded) ~ .mobile-menu-label,
#loader:not(.loaded) ~ .mobile-menu-popup {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

@media (max-width: 767px) {
  /* hide desktop navigation on small screens only */
  .header__navigation, #header .header__navigation, nav#menu, .menu__list, .menu__item, .menu__link { display: none !important; visibility: hidden !important; }

  /* show hamburger label near the top-right (next to color switcher) */
  .mobile-menu-label {
    display: inline-flex;
    position: fixed;
    /* align with .color control (top/right) */
    top: 2rem;
    right: calc(2rem + 4rem + 0.6rem);
    width: 4rem;
    height: 4rem;
    align-items: center;
    justify-content: center;
    z-index: 4500;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border-radius: var(--_radius-s);
    overflow: hidden;
    background: transparent;
    cursor: pointer;
  }

  /* stacked hamburger lines: center with absolute positioning for consistent spacing */
  .mobile-menu-label__hamburger,
  .mobile-menu-label::before,
  .mobile-menu-label::after {
    content: '';
    display: block;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--t-bright, #fff);
    border-radius: 2px;
    transition: transform 220ms ease, opacity 160ms ease;
  }
  /* middle line */
  .mobile-menu-label__hamburger { top: 50%; transform: translate(-50%, -50%); }
  /* top line */
  .mobile-menu-label::before { top: calc(50% - 8px); }
  /* bottom line */
  .mobile-menu-label::after { top: calc(50% + 8px); }

  /* popup overlay */
  .mobile-menu-popup {
    display: flex;
    position: fixed;
    inset: 0;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.35);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    z-index: 4200;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, visibility 0s linear 180ms;
  }

  .mobile-menu-popup__inner {
    width: 92%;
    max-width: 420px;
    background: rgba(var(--base-rgb,20,20,20), 0.8);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    color: var(--t-bright, #fff);
  }

  .mobile-menu-popup__close {
    float: right;
    font-size: 28px;
    line-height: 1;
    color: var(--t-bright, #fff);
    cursor: pointer;
    background: transparent;
    border: none;
  }

  .mobile-menu-popup__list { list-style: none; padding: 0; margin: 10px 0 0 0; display: flex; flex-direction: column; gap: 12px; }
  .mobile-menu-popup__list a { color: var(--t-bright, #fff); text-decoration: none; font-size: 18px; display: inline-flex; align-items: center; gap: 12px; padding: 12px 10px; border-radius: 8px; }
  .mobile-menu-popup__list a i { font-size: 20px; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; opacity: 0.95; }
  .mobile-menu-popup__list a span { display: inline-block; }

  .mobile-menu-popup__list a:hover { background: rgba(255,255,255,0.03); }

  /* when checkbox is checked, show popup */
  #mobile-nav-toggle:checked ~ .mobile-menu-popup {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transition-delay: 0s;
  }

  /* hide mobile menu toggle while PhotoSwipe lightbox is open */
  body.lightbox-open .mobile-menu-label {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  /* adjust hamburger horizontal position for mid-size screens where .color is moved */
  @media (min-width: 768px) {
    .mobile-menu-label {
      top: 3rem;
      right: calc(5rem + 4rem + 0.6rem);
    }
  }

  /* account for larger .color size at very large screens */
  @media (min-width: 1400px) {
    .mobile-menu-label {
      width: 5rem;
      height: 5rem;
      right: calc(5rem + 5rem + 0.6rem);
      top: 3rem;
    }
  }

  /* optionally animate hamburger to X when open */
  #mobile-nav-toggle:checked + .mobile-menu-label .mobile-menu-label__hamburger { opacity: 0; transform: scaleX(0); }
  #mobile-nav-toggle:checked + .mobile-menu-label::before { top: 50%; transform: translate(-50%,-50%) rotate(45deg); }
  #mobile-nav-toggle:checked + .mobile-menu-label::after { top: 50%; transform: translate(-50%,-50%) rotate(-45deg); }

  /* ensure page content has space if needed */
  .header-offset { height: 0; }
}

/* Show hamburger on tablet sizes (768px - 1199px) */
@media (min-width: 768px) and (max-width: 1199px) {
  .mobile-menu-label {
    display: flex !important;
    position: fixed !important;
    top: 3rem;
    right: calc(5rem + 4rem + 0.6rem);
    width: 4rem;
    height: 4rem;
    align-items: center;
    justify-content: center;
    z-index: 4500;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    border-radius: var(--_radius-s);
    overflow: hidden;
    background: transparent;
    cursor: pointer;
  }
  .mobile-menu-label__hamburger,
  .mobile-menu-label::before,
  .mobile-menu-label::after {
    content: '';
    display: block;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--t-bright, #fff);
    border-radius: 2px;
    transition: transform 220ms ease, opacity 160ms ease;
  }
  .mobile-menu-label__hamburger { top: 50%; transform: translate(-50%, -50%); }
  .mobile-menu-label::before { top: calc(50% - 8px); }
  .mobile-menu-label::after { top: calc(50% + 8px); }
  #mobile-nav-toggle:checked + .mobile-menu-label .mobile-menu-label__hamburger { opacity: 0; transform: scaleX(0); }
  #mobile-nav-toggle:checked + .mobile-menu-label::before { top: 50%; transform: translate(-50%,-50%) rotate(45deg); }
  #mobile-nav-toggle:checked + .mobile-menu-label::after { top: 50%; transform: translate(-50%,-50%) rotate(-45deg); }
  
  /* Popup overlay */
  .mobile-menu-popup {
    display: flex !important;
    position: fixed;
    inset: 0;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.35);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    z-index: 4200;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 180ms ease, visibility 0s linear 180ms;
  }
  
  .mobile-menu-popup__inner {
    width: 92%;
    max-width: 420px;
    background: rgba(var(--base-rgb,20,20,20), 0.8);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    color: var(--t-bright, #fff);
  }
  
  .mobile-menu-popup__close {
    float: right;
    font-size: 28px;
    line-height: 1;
    color: var(--t-bright, #fff);
    cursor: pointer;
    background: transparent;
    border: none;
  }
  
  .mobile-menu-popup__list { list-style: none; padding: 0; margin: 10px 0 0 0; display: flex; flex-direction: column; gap: 12px; }
  .mobile-menu-popup__list a { color: var(--t-bright, #fff); text-decoration: none; font-size: 18px; display: inline-flex; align-items: center; gap: 12px; padding: 12px 10px; border-radius: 8px; }
  .mobile-menu-popup__list a i { font-size: 20px; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; opacity: 0.95; }
  .mobile-menu-popup__list a span { display: inline-block; }
  .mobile-menu-popup__list a:hover { background: rgba(255,255,255,0.03); }
  
  /* When checkbox is checked, show popup */
  #mobile-nav-toggle:checked ~ .mobile-menu-popup { 
    visibility: visible !important; 
    opacity: 1 !important; 
    pointer-events: auto !important; 
    transition-delay: 0s;
  }
  
  .header__navigation, #header .header__navigation, nav#menu, .menu__list, .menu__item, .menu__link { display: none !important; visibility: hidden !important; }
  .header { display: none !important; visibility: hidden !important; }
}

/* Restore header navigation at desktop (1200px+) */
@media (min-width: 1200px) {
  .mobile-menu-label, .mobile-menu-popup { display: none !important; }
  .header { display: block !important; visibility: visible !important; position: fixed !important; }
  .header__navigation, #header .header__navigation, nav#menu, .menu__list, .menu__item, .menu__link { display: flex !important; visibility: visible !important; }
}

/* Hide social cards permanently except in footer */
.socials-cards {
  display: none !important;
}

.footer .socials-cards {
  display: flex !important;
}

/* Mobile Menu Submenu Styles */
.mobile-menu-popup__submenu {
  display: none;
  list-style: none;
  padding-left: 1.5rem;
  margin-top: 0.5rem;
  border-left: 2px solid var(--neutral-bright);
}

.mobile-menu-popup__list > li:hover > .mobile-menu-popup__submenu,
.mobile-menu-popup__list > li.active > .mobile-menu-popup__submenu {
  display: block;
}

.mobile-menu-popup__submenu li {
  padding: 0.5rem 0;
}

.mobile-menu-popup__submenu a {
  display: block;
  padding: 0.8rem 1rem;
  font-size: 1.4rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
}

.mobile-menu-popup__submenu a:hover {
  color: var(--t-bright);
  padding-left: 1.5rem;
}
