/* Mobile-First Enhancements for Galaxy Sports Management */
/* Ultra-responsive design for all mobile devices */

/* ========== GLOBAL MOBILE OPTIMIZATIONS ========== */

/* Prevent text size adjustment on orientation change */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Optimize for high-DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* ========== ENHANCED TOUCH TARGETS ========== */

/* Ensure all interactive elements meet 44x44px minimum (WCAG AAA) */
.cta, .button, nav a, .nav-menu a {
  min-height: 44px;
  padding: 12px 20px;
}

@media (max-width: 640px) {
  .cta, .button {
    min-height: 48px;
    padding: 14px 24px;
    font-size: 1rem;
  }
}

/* ========== NAVIGATION MOBILE OPTIMIZATIONS ========== */

@media (max-width: 640px) {
  .nav-menu {
    width: 100%;
    right: -100%;
  }
  
  .nav-menu.open {
    right: 0;
  }
  
  .nav-menu ul li {
    margin: 0;
  }
  
  .nav-menu ul li a {
    padding: 18px 24px;
    font-size: 1.1rem;
  }
}

/* ========== CARD ENHANCEMENTS ========== */

/* Better card spacing on small screens */
@media (max-width: 480px) {
  .card, .player-card, .team-card, .service-card {
    margin-bottom: 16px;
    border-radius: 12px;
  }
}

/* ========== IMAGE OPTIMIZATIONS ========== */

/* Lazy loading hint for browsers */
img {
  content-visibility: auto;
}

/* Responsive images by default */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Better image rendering on mobile */
@media (max-width: 640px) {
  img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* ========== TYPOGRAPHY SCALING ========== */

/* Fluid typography for better readability */
@media (max-width: 640px) {
  h1, .brand__title h1 {
    font-size: clamp(1.25rem, 4vw, 1.75rem);
  }
  
  h2 {
    font-size: clamp(1.5rem, 5vw, 2rem);
  }
  
  h3 {
    font-size: clamp(1.25rem, 4vw, 1.5rem);
  }
  
  h4 {
    font-size: clamp(1rem, 3vw, 1.25rem);
  }
  
  p, .card p {
    font-size: clamp(0.95rem, 2.5vw, 1rem);
    line-height: 1.6;
  }
}

/* ========== SPACING OPTIMIZATIONS ========== */

@media (max-width: 480px) {
  section {
    margin-top: 16px;
    padding: 16px 0;
  }
  
  .page-header {
    padding: 28px 16px !important;
  }
  
  .breadcrumb {
    padding: 8px 0;
    font-size: 0.85rem;
  }
}

/* ========== FORM OPTIMIZATIONS ========== */

@media (max-width: 640px) {
  input, textarea, select {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 14px;
    border-radius: 8px;
  }
}

/* ========== FOOTER MOBILE ========== */

@media (max-width: 640px) {
  footer {
    padding: 24px 16px;
    text-align: center;
  }
  
  footer > div {
    margin-bottom: 16px;
  }
  
  .contact-details {
    font-size: 0.9rem;
  }
}

/* ========== BACK TO TOP BUTTON ========== */

@media (max-width: 640px) {
  #backToTop {
    right: 16px;
    bottom: 16px;
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
  }
}

/* ========== LANDSCAPE ORIENTATION ========== */

@media (max-width: 980px) and (orientation: landscape) {
  .hero__image {
    height: 280px;
  }
  
  .team-card__media {
    min-height: 220px;
  }
  
  .staff-photo-wrapper {
    width: 140px;
    height: 140px;
  }
}

/* ========== VERY SMALL DEVICES (< 360px) ========== */

@media (max-width: 360px) {
  .container {
    padding: 16px 12px;
  }
  
  .brand__logo {
    width: 42px;
    height: 42px;
  }
  
  .brand__title h1 {
    font-size: 15px;
  }
  
  .team-card__body {
    padding: 12px;
  }
  
  .staff-photo-wrapper {
    width: 140px;
    height: 140px;
  }
}

/* ========== LARGER PHONES (> 414px) ========== */

@media (min-width: 414px) and (max-width: 640px) {
  .players, .team-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
}

/* ========== TABLETS IN PORTRAIT ========== */

@media (min-width: 641px) and (max-width: 980px) {
  .container {
    padding: 24px 20px;
  }
  
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

/* ========== PERFORMANCE HINTS ========== */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Dark mode optimization (if browser supports it) */
@media (prefers-color-scheme: dark) {
  body {
    /* Already dark, but enhance contrast */
    color: #f0f4f8;
  }
}

/* ========== ACCESSIBILITY ENHANCEMENTS ========== */

/* Focus visible for keyboard navigation on mobile */
@media (max-width: 640px) {
  *:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
  }
  
  /* Skip link optimization */
  .skip-link:focus {
    top: 0;
    left: 0;
    z-index: 9999;
    padding: 12px 20px;
  }
}

/* ========== PRINT STYLES ========== */

@media print {
  .nav-menu,
  #menu_checkbox,
  label[for="menu_checkbox"],
  .nav-overlay,
  #backToTop,
  .cta,
  footer {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
  }
  
  .container {
    max-width: 100%;
  }
}
