/* ═══════════════════════════════════════════
   GHARD SPACE — Mobile Overlay Nav & Touch Fixes
   (responsive upgrade, option 1)
   ═══════════════════════════════════════════ */

/* ── Mobile Nav Toggle Button ────────────── */
.mobile-nav-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 101;
  width: 44px;
  height: 44px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.mobile-nav-toggle:hover {
  background: var(--bg-card-hover);
}
.mobile-nav-toggle .bar {
  width: 22px;
  height: 2px;
  background: var(--text-main);
  border-radius: 1px;
  transition: all 0.3s ease;
  position: relative;
}
.mobile-nav-toggle .bar::before,
.mobile-nav-toggle .bar::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 2px;
  background: var(--text-main);
  border-radius: 1px;
  transition: all 0.3s ease;
}
.mobile-nav-toggle .bar::before { top: -7px; }
.mobile-nav-toggle .bar::after { top: 7px; }

/* Hamburger → X animation */
.mobile-nav-toggle.active .bar {
  background: transparent;
}
.mobile-nav-toggle.active .bar::before {
  top: 0;
  transform: rotate(45deg);
}
.mobile-nav-toggle.active .bar::after {
  top: 0;
  transform: rotate(-45deg);
}

/* ── Mobile Nav Overlay ──────────────────── */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(10, 10, 18, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.mobile-nav-overlay.open {
  display: block;
  opacity: 1;
}

/* ── Mobile Bottom Nav ───────────────────── */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 98;
  background: rgba(10, 10, 18, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  padding: 0.4rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mobile-bottom-nav::-webkit-scrollbar { display: none; }
.mobile-bottom-nav-inner {
  display: flex;
  gap: 0.25rem;
  min-width: max-content;
  padding: 0 0.5rem;
}
.mobile-bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.58rem;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
  min-width: fit-content;
}
.mobile-bottom-nav a i {
  width: 18px;
  height: 18px;
  stroke-width: 1.5;
  color: var(--text-muted);
  transition: color 0.3s ease;
}
.mobile-bottom-nav a:hover,
.mobile-bottom-nav a.active {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}
.mobile-bottom-nav a.active i {
  color: var(--accent-blue);
}

/* ── Mobile Nav Overlay (slide-in) ───────── */
.mobile-nav-panel {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 80%;
  max-width: 320px;
  z-index: 100;
  background: linear-gradient(180deg, rgba(10, 10, 20, 0.97) 0%, rgba(17, 17, 26, 0.99) 100%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--border-subtle);
  padding: 4.5rem 1.5rem 2rem;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.mobile-nav-panel.open {
  display: block;
  transform: translateX(0);
}
.mobile-nav-panel .mobile-nav-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}
.mobile-nav-panel .mobile-nav-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}
.mobile-nav-panel .mobile-nav-header span {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.mobile-nav-links a {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.75rem;
  border-radius: 10px;
  color: var(--text-sub);
  font-size: 0.92rem;
  font-weight: 400;
  text-decoration: none;
  transition: var(--transition);
  border: 1px solid transparent;
}
.mobile-nav-links a:hover,
.mobile-nav-links a.active {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-subtle);
}
.mobile-nav-links a i {
  width: 20px;
  height: 20px;
  stroke-width: 1.5;
  color: var(--text-muted);
  flex-shrink: 0;
}
.mobile-nav-links a.active i,
.mobile-nav-links a:hover i {
  color: var(--accent-blue);
}
.mobile-nav-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
}

/* ── Mobile Responsive Tweaks ────────────── */
@media (max-width: 960px) {
  .mobile-nav-toggle {
    display: flex;
  }
  .mobile-bottom-nav {
    display: block;
  }

  /* Sidebar content hidden, nav via mobile panels */
  .sidebar {
    display: none;
  }

  .main-content {
    padding: 2rem 1rem 5rem;
  }

  /* ── Hero ── */
  .hero {
    min-height: 50vh;
    padding: 4rem 0.5rem;
  }
  .hero h1 {
    font-size: clamp(1.8rem, 10vw, 3rem);
  }

  /* ── Intro 2-col → 1-col ── */
  .intro-section {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  /* ── Grids single-col on mobile ── */
  .grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  /* ── Featured card ── */
  .featured-card {
    padding: 1.5rem !important;
  }
  .featured-card h3 {
    font-size: clamp(1.2rem, 5vw, 1.5rem) !important;
  }

  /* ── Modals ── */
  .modal-card {
    border-radius: 16px !important;
    max-height: 90vh !important;
  }
  .modal-inner {
    padding: 1.25rem !important;
  }
  .modal-columns {
    grid-template-columns: 1fr !important;
  }
  .modal-title {
    font-size: 1.5rem !important;
  }
  .modal-banner {
    height: 180px !important;
  }

  /* ── Timeline ── */
  .timeline-container {
    padding-left: 1.5rem !important;
  }
  .timeline-grid {
    grid-template-columns: 1fr !important;
  }

  /* ── Contact / Legal ── */
  .contact-grid,
  .legal-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  /* ── Weather ── */
  .weather-grid {
    grid-template-columns: 1fr !important;
  }
  .main-weather-card,
  .meteogram-card {
    grid-column: span 1 !important;
  }
  .main-card-metrics {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .weather-header {
    flex-direction: column !important;
    align-items: flex-start !important;
  }
  .weather-search-suggestions {
    left: 0.5rem !important;
    right: 0.5rem !important;
  }

  /* ── Frogger game ── */
  .game-container {
    padding: 16px !important;
  }
  .game-header h1 {
    font-size: 1.4rem !important;
  }
  .hud-top {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .hud-item {
    flex: 1 1 calc(33% - 6px) !important;
  }

  /* ── D-Pad bigger on touch ── */
  .d-pad-btn {
    width: 56px !important;
    height: 56px !important;
    font-size: 1.4rem !important;
  }
  .d-pad {
    transform: scale(1.2);
    margin: 1rem auto 0 !important;
  }

  /* ── Creature stats ── */
  .creature-numerical-stats {
    grid-template-columns: 1fr !important;
  }
  .creature-card {
    flex-direction: column !important;
  }
  .creature-img-box {
    height: 160px !important;
  }
  .creature-footer {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
  }

  /* ── Phenomenon cards ── */
  .phenomenon-img-box {
    height: 140px !important;
  }

  /* ── Footer space ── */
  footer {
    padding: 2rem 1rem !important;
  }
}

/* ── Very small screens (iPhone SE etc.) ── */
@media (max-width: 400px) {
  .main-content {
    padding: 1.5rem 0.75rem 5rem !important;
  }
  .hero h1 {
    font-size: clamp(1.6rem, 11vw, 2.5rem) !important;
  }
  .card {
    padding: 1.25rem !important;
  }
  .weather-city-name {
    font-size: 1.3rem !important;
  }
  .weather-temp-large {
    font-size: clamp(2.2rem, 8vw, 2.8rem) !important;
  }
  .d-pad-btn {
    width: 50px !important;
    height: 50px !important;
    font-size: 1.2rem !important;
  }
}

/* ── Landscape mobile ── */
@media (max-height: 500px) and (orientation: landscape) {
  .mobile-bottom-nav {
    display: none !important;
  }
  .mobile-nav-toggle {
    display: flex !important;
  }
  .hero {
    min-height: 40vh !important;
  }
}

/* ── Safe area (iOS notch etc.) ──────────── */
@supports (padding: max(0px)) {
  .mobile-bottom-nav {
    padding-bottom: max(0.4rem, env(safe-area-inset-bottom));
  }
  .main-content {
    padding-bottom: max(4rem, calc(4rem + env(safe-area-inset-bottom)));
  }
}
