/* Mobile-First Optimizations for NextEast Media */

/* Touch-Friendly Interactive Elements */
@media (max-width: 768px) {
  /* Full-bleed utility for hero/sections */
  .full-bleed {
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    width: 100vw;
  }

  /* Safe-area aware fixed header spacing handled by main */
  .has-fixed-header {
    padding-top: calc(80px + env(safe-area-inset-top));
  }

  /* Ensure all clickable elements are at least 44x44px (Apple HIG) */
  button, a, input, select, textarea {
    min-height: 44px;
    min-width: 44px;
  }

  /* Larger tap targets for navigation */
  nav a, header a {
    padding: 12px 16px;
    display: inline-block;
  }

  /* Improved form controls */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  textarea {
    font-size: 16px; /* Prevents iOS zoom on focus */
    padding: 12px 16px;
  }

  /* Better button sizing */
  .btn, button {
    padding: 14px 24px;
    font-size: 16px;
  }
}

/* Responsive Grid Improvements */
@media (max-width: 768px) {
  /* Team grid - 1 column on mobile */
  #teamProfiles {
    grid-template-columns: 1fr !important;
    gap: 24px;
    padding: 0 16px;
    max-width: 100%;
  }

  /* Center cards on mobile */
  #teamProfiles > * {
    max-width: 420px;
    margin: 0 auto;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  /* Team grid - 2 columns on tablet */
  #teamProfiles {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px;
  }
}

/* Mobile Navigation Improvements */
@media (max-width: 768px) {
  header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(11, 12, 16, 0.95);
    backdrop-filter: blur(10px);
    padding-top: env(safe-area-inset-top);
  }

  /* Mobile menu */
  nav {
    flex-direction: column;
    gap: 8px;
  }

  /* Hamburger menu touch target */
  #mobileMenuToggle {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Viewport and Content Spacing */
@media (max-width: 768px) {
  /* Better content spacing on mobile */
  main {
    padding-left: 20px;
    padding-right: 20px;
  }

  /* Section spacing */
  section {
    padding-top: 32px;
    padding-bottom: 32px;
  }

  /* Heading improvements */
  h1 {
    font-size: 2.25rem;
    line-height: 1.2;
  }

  h2 {
    font-size: 1.5rem;
    line-height: 1.3;
  }

  /* Better text readability */
  p {
    font-size: 16px;
    line-height: 1.7;
  }
}

/* Touch Gestures & Interactions */
@media (max-width: 768px) {
  /* Disable hover effects on touch devices */
  @media (hover: none) {
    .hover\:scale-105:hover {
      transform: none;
    }

    .hover\:border-primary:hover {
      border-color: inherit;
    }
  }

  /* Better scroll behavior */
  html {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  /* Prevent text size adjust on orientation change */
  body {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  /* Safe area insets for notched devices */
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

/* Performance Optimizations for Mobile */
@media (max-width: 768px) {
  /* Reduce animation complexity on mobile */
  * {
    will-change: auto !important;
  }

  /* Simplify animations */
  .animate-on-scroll {
    animation-duration: 0.3s !important;
  }

  /* Reduce blur effects (expensive on mobile) */
  .backdrop-blur {
    backdrop-filter: blur(8px) !important;
  }

  /* Optimize gradients */
  .bg-gradient-to-r,
  .bg-gradient-to-b {
    background-attachment: scroll;
  }
}

/* Image Optimizations */
@media (max-width: 768px) {
  img {
    max-width: 100%;
    height: auto;
    display: block;
  }

  /* Lazy loading hint */
  img[loading="lazy"] {
    content-visibility: auto;
  }
}

/* Modal & Overlay Improvements */
@media (max-width: 768px) {
  .modal, .overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
  }
}

/* Card Improvements on Mobile */
@media (max-width: 768px) {
  .bg-panel,
  .card {
    border-radius: 16px;
    padding: 16px;
  }

  /* Better card shadows on mobile */
  .shadow-xl {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}

/* Table Responsiveness */
@media (max-width: 768px) {
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  thead {
    display: none;
  }

  tbody {
    display: block;
  }

  tr {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
    border: 1px solid #20222B;
    border-radius: 12px;
    padding: 12px;
  }

  td {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
  }

  td::before {
    content: attr(data-label);
    font-weight: 600;
    margin-right: 12px;
  }
}

/* Footer Improvements */
@media (max-width: 768px) {
  footer {
    padding: 32px 20px;
    text-align: center;
  }

  footer .flex {
    flex-direction: column;
    gap: 16px;
  }
}

/* Loading States on Mobile */
@media (max-width: 768px) {
  .loading-spinner {
    width: 40px;
    height: 40px;
  }

  /* Skeleton loaders */
  .skeleton {
    background: linear-gradient(
      90deg,
      #111218 0%,
      #1a1b23 50%,
      #111218 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
  }

  @keyframes skeleton-loading {
    0% {
      background-position: 200% 0;
    }
    100% {
      background-position: -200% 0;
    }
  }
}

/* Accessibility Improvements */
@media (max-width: 768px) {
  /* Focus states more visible on mobile */
  button:focus,
  a:focus,
  input:focus,
  select:focus {
    outline: 3px solid #7C5CFF;
    outline-offset: 2px;
  }

  /* Skip to content link */
  .skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #7C5CFF;
    color: white;
    padding: 12px 20px;
    z-index: 10000;
    transition: top 0.3s;
  }

  .skip-to-content:focus {
    top: 0;
  }
}

/* Video Improvements */
@media (max-width: 768px) {
  video {
    max-width: 100%;
    height: auto;
    object-fit: cover;
  }

  /* Ensure videos are playable */
  video {
    -webkit-playsinline: true;
    playsinline: true;
  }

  /* Hero Section - Full Height on Mobile */
  .hero-gradient {
    min-height: 100svh;
    min-height: 100vh;
    display: flex;
    align-items: center;
  }

  /* Account for fixed header */
  .hero-gradient {
    padding-top: calc(5rem + env(safe-area-inset-top));
    padding-bottom: 2rem;
  }
}

/* Hero media aspect ratio on mobile */
/* (reverted hero-media changes) */

/* Responsive hero video sizing for optimal 16:9 and 9:16 viewing */
@media (min-width: 640px) {
  .hero-video {
    max-width: 320px !important;
  }
}

@media (min-width: 1024px) {
  .hero-video {
    max-width: 350px !important;
  }
}

@media (min-width: 1280px) {
  .hero-video {
    max-width: 360px !important;
  }
}

/* Landscape Mode Optimizations */
@media (max-width: 768px) and (orientation: landscape) {
  /* Reduce vertical spacing in landscape */
  section {
    padding-top: 24px;
    padding-bottom: 24px;
  }

  /* Adjust header height */
  header {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  /* Profile cards smaller in landscape */
  .pc-card {
    max-height: 60vh !important;
  }
}

/* Dark Mode Optimizations */
@media (prefers-color-scheme: dark) {
  /* Ensure good contrast on OLED screens */
  body {
    background-color: #000;
  }

  .bg-base {
    background-color: #000;
  }

  .bg-panel {
    background-color: #0a0a0a;
  }
}

/* Print Styles (bonus) */
@media print {
  header, footer, nav, .no-print {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  a {
    color: blue;
    text-decoration: underline;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .pc-card {
    transform: none !important;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  button,
  a,
  .card {
    border: 2px solid currentColor;
  }

  .text-textmuted {
    color: #fff;
  }
}

/* Large Text Support */
@media (min-width: 320px) {
  html {
    font-size: 16px;
  }
}

@media (min-width: 375px) {
  html {
    font-size: 17px;
  }
}

@media (min-width: 414px) {
  html {
    font-size: 18px;
  }
}

