/* ==========================================================================
   NEXUS SCIENTIFIC CLUB — RESPONSIVE CSS
   ========================================================================== */

/* Mobile Menu Drawer (Floating Frosted Sheet) */
.mobile-nav-drawer {
  position: fixed;
  top: calc(var(--header-height) + var(--sandbox-banner-height) + 16px);
  left: 14px;
  right: 14px;
  max-height: calc(100vh - (var(--header-height) + var(--sandbox-banner-height) + 32px));
  background: rgba(10, 14, 23, 0.94);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  z-index: 850;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  border-radius: 20px;
  border: 1px solid var(--border-medium);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.06);
  transform: translateY(-20px) scale(0.97);
  opacity: 0;
  visibility: hidden;
  transition: transform var(--transition-normal), opacity var(--transition-normal), visibility var(--transition-normal);
  overflow-y: auto;
}

[data-theme="light"] .mobile-nav-drawer {
  background: rgba(255, 255, 255, 0.97);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.mobile-nav-drawer.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
}

.mobile-nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.mobile-nav-link {
  font-size: 1.05rem;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  border-bottom: none;
  transition: all var(--transition-fast);
}

.mobile-nav-link:hover, .mobile-nav-link.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .mobile-nav-link:hover,
[data-theme="light"] .mobile-nav-link.active {
  background: rgba(0, 0, 0, 0.05);
  color: #111827;
}

.mobile-nav-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

/* Responsive Table Container */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
}

/* Breakpoint 1240px (grid intermediate: 4-col grids step down to 2) */@media (max-width: 1240px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem;
  }
}

/* Breakpoint 1279px (Burger threshold — with the Programs dropdown the pill
   nav fits 1280+ in every language, measured EN/FR/AR; below it the pill
   nav plus the action cluster cannot share the header with a visible logo) */
@media (max-width: 1279px) {
  :root {
    --sandbox-banner-height: 42px;
  }

  .nexus-header {
    top: calc(var(--sandbox-banner-height) + 8px);
    width: calc(100% - 20px);
    height: var(--header-height);
  }

  .nav-links, .header-cta-btn {
    display: none !important;
  }

  .mobile-menu-toggle {
    display: inline-flex;
  }
}

/* JS-measured overflow (navbar.js adds .nav-condensed on wide viewports
   where a long-label language still overflows the pill nav). Mirrors the
   breakpoint rules above without the :root height changes. */
.nexus-header.nav-condensed {
  width: calc(100% - 20px);
}

.nexus-header.nav-condensed .nav-links,
.nexus-header.nav-condensed .header-cta-btn {
  display: none !important;
}

.nexus-header.nav-condensed .mobile-menu-toggle {
  display: inline-flex;
}

/* Breakpoint 992px (Tablets & Mobile Transition) */
@media (max-width: 992px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* Breakpoint 480px (Compact Mobile) */
@media (max-width: 480px) {
  .nexus-header {
    width: calc(100% - 16px);
    padding: 0 4px 0 10px;
  }
}

/* Compact phones: the drawer carries Sign In and the theme toggle, so the
   header keeps only the language selector + menu toggle and the logo can
   stay large. Pills slim down accordingly. */
@media (max-width: 640px) {
  .brand-logo-img {
    height: 28px;
  }

  .brand-link {
    padding: 0 14px;
  }

  .account-signin-btn {
    display: none;
  }

  .header-actions {
    gap: 1rem;
    padding: 0 10px;
  }
}

@media (max-width: 400px) {
  .brand-logo-img {
    height: 26px;
  }

  .theme-toggle-btn {
    display: none;
  }

  .header-actions {
    gap: 0.8rem;
  }
}

/* Breakpoint 768px (Tablets & Mobile) */
@media (max-width: 768px) {

  .section {
    padding: 3.5rem 0;
  }

  .section-hero {
    padding: 2.5rem 0 3.5rem;
  }

  /* Timeline mobile adjustments */
  .roadmap-timeline::before {
    left: 20px;
  }

  .timeline-item {
    width: 100%;
    align-self: flex-start !important;
    margin-left: 0 !important;
    padding-left: 3rem !important;
    padding-right: 0 !important;
    justify-content: flex-start !important;
  }

  .timeline-node {
    left: 10px !important;
    right: auto !important;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    max-width: none;
  }

  .filter-search-row {
    flex-direction: column;
  }

  .modal-container {
    margin: 1rem;
    max-height: 94vh;
  }

  .sandbox-banner {
    padding: 0 0.75rem;
  }

  .sandbox-banner-text {
    display: none;
  }
}

/* Breakpoint 480px (Small Mobile) */
@media (max-width: 480px) {
  .nexus-card {
    padding: 1.25rem;
  }

  .hero-buttons {
    flex-direction: column;
    width: 100%;
  }

  .hero-buttons .btn {
    width: 100%;
  }

  .checkbox-group {
    grid-template-columns: 1fr;
  }
}

