/* ============================================
   ISHAM CRICKET CLUB — MOBILE NAV
   Link this AFTER your main page styles.
   ============================================ */

/* Fix body scroll lock on mobile */
body { overflow-x: hidden; overflow-y: auto !important; }

/* Hamburger button (hidden on desktop) */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 28px;
  height: 22px;
  padding: 0;
  z-index: 201;
}

.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--crimson, #6B1230);
  transition: transform 0.25s, opacity 0.25s;
}

/* Animate hamburger → X when open */
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 768px) {
  nav {
    padding: 0.9rem 1.25rem;
    flex-wrap: nowrap;
    position: fixed;
    /* nav stays single-line; menu drops as overlay below it */
  }

  .nav-toggle { display: flex; }

  .nav-social-icons { margin-left: auto; margin-right: 0.75rem; }

  /* ── Dropdown menu: fixed overlay, not inline ── */
  .nav-links {
    display: none;
    position: fixed;
    top: var(--nav-h, 56px);   /* sits just below the nav bar */
    left: 0;
    right: 0;
    /* only as tall as needed, max half screen */
    max-height: calc(50vh);
    overflow-y: auto;
    flex-direction: column;
    gap: 0;
    background: rgba(206,203,198,0.98);
    backdrop-filter: blur(12px);
    border-bottom: 1.5px solid rgba(107,18,48,0.2);
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    z-index: 200;
    order: unset;
  }

  .nav-links.open { display: flex; }

  .nav-links li { width: 100%; }

  .nav-links a {
    display: block;
    padding: 0.7rem 1.25rem;
    font-size: 0.82rem;
    border-bottom: 0.5px solid rgba(107,18,48,0.1);
    width: 100%;
  }

  .nav-links li:last-child a { border-bottom: none; }

  .nav-links .has-dropdown > a::after { float: right; }

  /* Sub-dropdown: static within the overlay */
  .dropdown {
    display: none;
    position: static;
    transform: none;
    width: 100%;
    border: none;
    box-shadow: none;
    background: rgba(107,18,48,0.06);
    padding: 0;
  }

  .dropdown li a {
    padding-left: 2rem;
    font-size: 0.76rem;
  }

  .has-dropdown.open .dropdown { display: block; }
  .has-dropdown:hover .dropdown,
  .has-dropdown:focus-within .dropdown { display: none; }
  .has-dropdown.open:hover .dropdown,
  .has-dropdown.open:focus-within .dropdown { display: block; }

  /* Dim the page content behind the open menu */
  body.nav-open::after {
    content: '';
    position: fixed;
    inset: 0;
    top: var(--nav-h, 56px);
    background: rgba(0,0,0,0.35);
    z-index: 199;
    pointer-events: all;
  }
}
