/* ── Core Styles for GiggleAcademy ── */

body {
  font-family: 'Comic Sans MS', cursive, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f9f9f9;
  text-align: center;
  overflow-x: hidden; /* guard against any sideways scroll */
}

/* Global Link Reset */
a {
  text-decoration: none;
  color: inherit;
}

/* Utility Classes */
.hidden { display: none !important; }
.error-message { color: #e74c3c; font-size: 1rem; margin-top: 0.5rem; }

/* Header & Navigation */
header, .site-header {
  position: relative;
  background-color: #ffd54f;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-header h1 a {
  font-size: 1.5rem;
  color: #000;
}

nav {
  position: relative;
}

/* ── Mobile-First Menu ── */

/* Always show hamburger on mobile */
.menu-icon {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  cursor: pointer;
  position: absolute;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  z-index: 2000;
}

.menu-icon span {
  height: 3px;
  background: #000;
  border-radius: 2px;
}

/* Hide desktop menu on mobile */
nav ul {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;               /* lock to both edges */
  background-color: #ffd54f;
  padding: 15px 0;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  border-bottom-left-radius: 15px;
  border-bottom-right-radius: 15px;
  flex-direction: column;
  gap: 0;
  z-index: 1500;
}

/* When toggled open */
nav ul.show {
  display: flex;
}

.menu-icon.open span {
  display: none;
}

.menu-icon.open::before {
  content: '×';
  font-size: 24px;
  color: #000;
  position: absolute;
  top: 0;
  left: 0;
}

/* Mobile menu links */
nav ul.show li a {
  display: block;
  width: 100%;
  text-align: center;
  padding: 12px 0;
  font-size: 1.3rem;
  color: #000;
}

/* ── Hero Section ── */
#hero {
  background-color: #fff;
  padding: 40px 20px;
}
#hero h2 {
  font-size: 2.5rem;
  margin: 0 0 10px;
}
#hero p {
  font-size: 1.5rem;
  margin: 0 0 20px;
}

/* ── Call-To-Action Button ── */
.cta-button {
  background-color: #ff6f61;
  color: #fff;
  border: none;
  border-radius: 15px;
  padding: 15px 30px;
  font-size: 1.5rem;
  cursor: pointer;
  margin: 20px 0 30px;
}

/* ── Search Input ── */
#search { margin-top: 30px; }
#search input {
  width: 90%;
  max-width: 800px;
  padding: 10px;
  font-size: 1.2rem;
  border: 2px solid #ffcc00;
  border-radius: 15px;
}

/* ── Games Grid ── */
#games {
  background-color: #fff;
  padding: 10px 20px 40px;
}
.games-container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  max-width: 1200px;
  margin: 10px auto;
}
.game-box {
  background-color: #ffd54f;
  border-radius: 15px;
  padding: 10px;
  width: calc(100% - 40px); /* full-width on mobile */
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
}
.game-box a {
  font-weight: bold;
  color: #333;
}
.game-box p {
  margin: 0;
}

/* ── Footer ── */
footer, .site-footer {
  background-color: #ffd54f;
  padding: 20px;
  text-align: center;
}

/* ── Tablet (≥ 481px) ── */
@media (min-width: 481px) and (max-width: 768px) {
  .game-box {
    width: calc(50% - 20px);
  }
}

/* ── Desktop (≥ 769px) ── */
@media (min-width: 769px) {
  /* Hide hamburger, always show desktop menu */
  .menu-icon {
    display: none;
  }

  nav ul,
  nav ul.show {
    display: flex !important;  /* enforce horizontal */
    position: static;
    flex-direction: row;
    gap: 15px;
    background: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    width: auto;
  }

  nav ul li a {
    padding: 5px 10px;
    font-size: 1.2rem;
  }

  /* Games grid more columns */
  .game-box {
    width: calc(20% - 20px);
  }
}
