/**
 * GS MultiTools - Responsive Design System
 * Mobile-first responsive styles for all viewports (320px to 1440px+)
 */

/* ==========================================================================
   1. Large Desktop (1440px+)
   ========================================================================== */
@media (min-width: 1440px) {
  :root {
    --container-max: 1360px;
  }
}

/* ==========================================================================
   2. Desktop & Tablet Landscape (1024px to 1279px)
   ========================================================================== */
@media (max-width: 1200px) {
  .tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
  }

  .footer-grid {
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 28px;
  }
}

/* ==========================================================================
   3. Tablet Portrait & Small Laptops (768px to 1023px)
   ========================================================================== */
@media (max-width: 1023px) {
  :root {
    --header-height: 64px;
  }

  .site-header .nav-links {
    display: none; /* Hidden on tablet/mobile in favor of drawer */
  }

  .mobile-nav-toggle {
    display: flex;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 36px;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

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

/* ==========================================================================
   4. Mobile Devices (Under 768px)
   ========================================================================== */
@media (max-width: 767px) {
  .section {
    padding: 56px 0;
  }

  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .tools-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }

  .footer-bottom-links {
    justify-content: center;
    flex-wrap: wrap;
  }

  /* Tool workspace dual-pane turns into single column stacked */
  .tool-workspace {
    grid-template-columns: 1fr !important;
  }

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

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

  /* Toast notification on mobile */
  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .toast {
    min-width: unset;
    width: 100%;
  }

  .back-to-top {
    bottom: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
  }
}

/* ==========================================================================
   5. Very Small Phones (Under 380px)
   ========================================================================== */
@media (max-width: 379px) {
  .brand-logo {
    font-size: 1.15rem;
  }

  .brand-emblem {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }

  .btn {
    padding: 10px 18px;
    font-size: 0.9rem;
  }
}

/* ==========================================================================
   6. Mobile Navigation Drawer
   ========================================================================== */
.mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.mobile-drawer-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 82%;
  max-width: 340px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  z-index: 2010;
  padding: 24px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-smooth);
  box-shadow: var(--shadow-lg);
}

.mobile-drawer-backdrop.open .mobile-drawer {
  transform: translateX(0);
}

.mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.mobile-drawer-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
}

.mobile-drawer-close:hover {
  color: var(--gold-primary);
}

.mobile-drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
}

.mobile-nav-item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1rem;
}

.mobile-nav-item a:hover, .mobile-nav-item a.active {
  background: rgba(229, 9, 20, 0.1);
  color: var(--gold-primary);
}

.mobile-category-list {
  padding-left: 14px;
  margin-top: 4px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 2px solid var(--border-color);
}

.mobile-category-list a {
  padding: 8px 12px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.mobile-drawer-footer {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
