/* ==========================================================================
   GG-Idea Innovations - Responsive Breakpoints & Mobile Optimization
   ========================================================================== */

/* Prevent horizontal overflow globally */
html, body {
  overflow-x: hidden;
  width: 100%;
  position: relative;
}

/* Large Tablets & Small Laptops (<= 1024px) */
@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
    text-align: center;
  }

  .hero-content {
    align-items: center;
  }

  .hero-description {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-actions {
    justify-content: center;
  }

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

  .spelling-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    padding: 2.5rem 2rem;
  }

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

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

  /* Two-column media cards stack */
  [style*="grid-template-columns:1.1fr 1fr"],
  [style*="grid-template-columns: 1.1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* Tablets & Phablets (<= 768px) */
@media (max-width: 768px) {
  /* Navigation */
  .nav-links {
    display: none;
  }

  .navbar .btn-sm {
    display: none; /* Hide secondary navbar CTA on tablet/mobile to make room */
  }

  .hamburger {
    display: flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: var(--radius-sm);
  }

  .navbar {
    padding: 0.75rem 0;
  }

  /* Hero Section */
  .hero {
    padding-top: 6rem;
    padding-bottom: 3.5rem;
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
    gap: 0.85rem;
  }

  .hero-actions .btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .floating-badge {
    position: static;
    margin: 1rem auto 0;
    display: inline-flex;
    animation: none;
  }

  /* Pillars */
  .pillars-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  /* Podium */
  .podium-container {
    flex-direction: column;
    align-items: center;
    gap: 1.75rem;
  }

  .podium-tier {
    width: 100%;
    max-width: 340px;
  }

  .podium-tier.first {
    order: -1;
  }

  .podium-tier.first .champion-card {
    transform: none;
  }

  .podium-base {
    display: none; /* Hide 3D base steps on mobile stack for clean visual flow */
  }

  /* Galleries & Grids */
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  /* Forms: Ensure inputs have at least 16px font to prevent iOS Safari auto-zoom */
  .form-control,
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px !important;
    min-height: 48px;
    padding: 0.75rem 1rem;
  }

  /* Form submit buttons can be full width */
  .form-card .btn-lg,
  .form-card button[type="submit"] {
    width: 100%;
    justify-content: center;
  }

  .spelling-input-group {
    flex-direction: column;
    gap: 0.75rem;
  }

  .spelling-input-group .btn {
    width: 100%;
  }

  /* Stats Bar */
  .stats-bar {
    margin-top: -1.5rem;
    padding: 1.75rem 1.25rem;
    border-radius: var(--radius-lg);
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
  }

  /* Spelling Game Card */
  .challenge-card {
    border-radius: var(--radius-lg);
  }

  .challenge-body {
    padding: 1.75rem 1rem;
  }

  .challenge-stats {
    flex-direction: column;
    gap: 0.75rem;
  }

  /* Lightbox on mobile */
  #galleryLightbox {
    padding: 1rem !important;
  }

  #galleryLightbox img {
    max-width: 96% !important;
    max-height: 70vh !important;
  }

  #lightboxClose {
    top: 1rem !important;
    right: 1rem !important;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Standard Mobile Phones (<= 480px) */
@media (max-width: 480px) {
  .container {
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }

  .section {
    padding-top: 3.25rem;
    padding-bottom: 3.25rem;
  }

  .section-header {
    margin-bottom: 2.25rem;
  }

  .brand-name {
    font-size: 1.05rem;
  }

  .brand-tagline {
    font-size: 0.58rem;
    letter-spacing: 0.08em;
  }

  .brand-logo-img {
    width: 38px;
    height: 38px;
  }

  h1 {
    font-size: clamp(2rem, 7vw, 2.4rem);
  }

  h2 {
    font-size: clamp(1.6rem, 5.5vw, 1.95rem);
  }

  h3 {
    font-size: 1.35rem;
  }

  p {
    font-size: 0.98rem;
    line-height: 1.65;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

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

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

  .footer-bottom > div:last-child {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
  }

  /* Action buttons inside cards */
  .btn {
    min-height: 44px;
    padding: 0.65rem 1.25rem;
    font-size: 0.92rem;
  }

  /* Modals */
  #formSuccessModal > div {
    padding: 1.75rem 1.25rem !important;
    max-width: 94% !important;
  }
}

/* Small Mobile Phones (320px - 380px) */
@media (max-width: 380px) {
  .container {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .brand-text {
    display: flex;
    flex-direction: column;
  }

  .brand-name {
    font-size: 0.95rem;
  }

  .section-pill {
    font-size: 0.75rem;
    padding: 0.35rem 0.85rem;
  }

  .hero-badge {
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
  }

  .hero {
    padding-top: 5.5rem;
    padding-bottom: 2.75rem;
  }

  .stat-card {
    padding: 1.25rem 1rem;
  }

  .stat-number {
    font-size: 2rem;
  }

  .pillar-card {
    padding: 1.5rem 1.15rem;
  }

  .form-card {
    padding: 1.5rem 1rem;
  }
}
