/* ==================== TAM AIR Club - Responsive Styles ==================== */

/* Mobile First - Base styles in styles.css are for mobile */

/* ==================== Small Devices (640px+) ==================== */

@media (min-width: 640px) {
  .container {
    padding: 0 2rem;
  }

  .hero-content {
    padding: 3rem;
  }

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

/* ==================== Tablets (768px+) ==================== */

@media (min-width: 768px) {
  .section {
    padding: 5rem 0;
  }

  .hero-logo {
    width: 140px;
    height: 140px;
  }

  .hero h1 {
    font-size: 3rem;
  }

  .hero-tagline {
    font-size: 1.5rem;
  }

  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }

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

  /* Video grid on tablets - stack vertically */
  .video-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  /* Partner logos - 2x2 grid on tablets */
  .partners-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ==================== Laptops (1024px+) ==================== */

@media (min-width: 1024px) {
  .nav-toggle {
    display: none;
  }

  .nav-menu {
    display: flex;
  }

  .hero {
    padding-top: 0;
  }

  .mission-content {
    grid-template-columns: 1fr 1fr;
  }

  .contact-grid {
    grid-template-columns: 1fr 1fr;
  }

  .grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }

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

  /* Video grid - side by side on laptops */
  .video-grid {
    grid-template-columns: 1.5fr 1fr !important;
    gap: 3rem !important;
  }

  /* Partner logos - 4 columns on laptops */
  .partners-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

/* ==================== Desktops (1280px+) ==================== */

@media (min-width: 1280px) {
  .container {
    max-width: 1280px;
  }

  .hero-content {
    max-width: 900px;
  }
}

/* ==================== Mobile Navigation (below 1024px) ==================== */

@media (max-width: 1023px) {
  .nav-toggle {
    display: flex;
    z-index: 1001;
  }

  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    background: var(--nav-bg);
    flex-direction: column;
    padding: 5rem 2rem 2rem;
    gap: 0.25rem;
    transition: right 0.3s ease;
    box-shadow: var(--shadow-xl);
  }

  .nav-menu.active {
    right: 0;
  }

  .nav-link {
    padding: 1rem;
    width: 100%;
    text-align: left;
    font-size: 1rem;
  }

  .nav-actions {
    position: fixed;
    top: 1rem;
    right: 4.5rem;
    z-index: 1001;
  }

  /* Mobile menu backdrop */
  .nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
  }

  .nav-backdrop.active {
    display: block;
  }

  /* Hamburger animation */
  .nav-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

/* ==================== Mobile Adjustments (below 768px) ==================== */

@media (max-width: 767px) {
  .section {
    padding: 3rem 0;
  }

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

  .hero {
    min-height: auto;
    padding: 6rem 0 4rem;
  }

  .hero-logo {
    width: 100px;
    height: 100px;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: center;
  }

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

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

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  /* Video grid responsive - stack on mobile */
  .video-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  .video-grid > div:first-child {
    order: 1;
  }

  .video-grid > div:last-child {
    order: 2;
  }

  /* Partner logos grid - 2 columns on tablet, 1 on small mobile */
  .partners-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .contact-info {
    padding: 1.5rem;
    text-align: center;
  }

  .contact-item {
    justify-content: center;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer-brand {
    max-width: none;
    margin: 0 auto;
  }

  .footer-links {
    align-items: center;
  }

  .footer-social {
    justify-content: center;
  }

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

  .timeline-item,
  .timeline-item:nth-child(odd),
  .timeline-item:nth-child(even) {
    width: 100%;
    margin-left: 0;
    padding-left: 50px;
    padding-right: 1rem;
    text-align: left;
  }

  .timeline-dot,
  .timeline-item:nth-child(odd) .timeline-dot,
  .timeline-item:nth-child(even) .timeline-dot {
    left: 12px;
    right: auto;
  }

  .social-links {
    flex-direction: column;
    align-items: center;
  }

  .social-link {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }

  /* Research page - full width images on mobile */
  .research-visual img {
    width: 100%;
    height: auto;
  }

  /* Touch-friendly tap targets */
  .btn {
    min-height: 44px;
    min-width: 44px;
  }

  .nav-link {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* CTA sections on mobile */
  .donate-section h2 {
    font-size: 1.5rem;
  }

  .donate-section p {
    font-size: 0.95rem;
  }

  /* Card hover states for touch */
  .card:active {
    transform: scale(0.98);
  }
}

/* ==================== Small Mobile (below 480px) ==================== */

@media (max-width: 479px) {
  html {
    font-size: 14px;
  }

  .container {
    padding: 0 1rem;
  }

  .nav-container {
    padding: 0.75rem 1rem;
  }

  .nav-logo span {
    display: none;
  }

  .card {
    padding: 1.25rem;
  }

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

  .feature-icon {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
  }

  .team-card img {
    width: 120px;
    height: 120px;
  }

  .btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 0.9rem;
  }

  .page-header {
    padding: 6rem 0 3rem;
  }

  /* Partner logos - single column on small mobile */
  .partners-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ==================== Landscape Phone Adjustments ==================== */

@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding: 5rem 0;
  }

  .hero-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
  }

  .hero h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
  }

  .hero-tagline {
    font-size: 1rem;
    margin-bottom: 1rem;
  }
}

/* ==================== Print Styles ==================== */

@media print {
  .navbar,
  .nav-toggle,
  .theme-toggle,
  .footer,
  .hero-buttons {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .hero {
    min-height: auto;
    padding: 2rem 0;
  }

  .hero::before {
    display: none;
  }

  .section {
    padding: 2rem 0;
  }

  a {
    color: black;
    text-decoration: underline;
  }
}

/* ==================== Reduced Motion ==================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ==================== High Contrast Mode ==================== */

@media (prefers-contrast: high) {
  :root,
  [data-theme="light"] {
    --text-secondary: #374151;
    --border: #9ca3af;
  }

  [data-theme="dark"] {
    --text-secondary: #d1d5db;
    --border: #6b7280;
  }

  .btn-primary {
    border: 2px solid white;
  }

  .card {
    border-width: 2px;
  }
}

/* ==================== iOS Safe Areas (iPhone X+) ==================== */

@supports (padding: max(0px)) {
  .navbar {
    padding-top: max(0.5rem, env(safe-area-inset-top));
  }

  .footer {
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
  }

  .nav-menu {
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
  }
}

/* ==================== Global Image Responsiveness ==================== */

img {
  max-width: 100%;
  height: auto;
}

iframe {
  max-width: 100%;
}

/* ==================== iPad Landscape (1024px - 1366px) ==================== */

@media (min-width: 1024px) and (max-width: 1366px) and (orientation: landscape) {
  .container {
    max-width: 95%;
  }

  .grid-4 {
    gap: 1rem;
  }

  .nav-link {
    padding: 0.5rem 0.6rem;
    font-size: 0.85rem;
  }
}

/* ==================== iPad Portrait (768px - 1024px) ==================== */

@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
  .mission-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .video-grid {
    grid-template-columns: 1fr !important;
  }

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