/* =============================================
 * RESPONSIVE UTILITIES
 * Mobile-first responsive design system
 * ============================================= */

/* =============================================
 * BREAKPOINTS
 * ============================================= */

/*
 * Mobile: 320px - 767px
 * Tablet: 768px - 1023px
 * Desktop: 1024px+
 */

/* =============================================
 * VISIBILITY UTILITIES
 * ============================================= */

/* Hide on mobile */
@media (max-width: 767px) {
  .hide-on-mobile {
    display: none !important;
  }
}

/* Show only on mobile */
.show-on-mobile {
  display: none !important;
}

@media (max-width: 767px) {
  .show-on-mobile {
    display: block !important;
  }
}

/* Hide on tablet */
@media (min-width: 768px) and (max-width: 1023px) {
  .hide-on-tablet {
    display: none !important;
  }
}

/* Show only on tablet */
.show-on-tablet {
  display: none !important;
}

@media (min-width: 768px) and (max-width: 1023px) {
  .show-on-tablet {
    display: block !important;
  }
}

/* Hide on desktop */
@media (min-width: 1024px) {
  .hide-on-desktop {
    display: none !important;
  }
}

/* Show only on desktop */
.show-on-desktop {
  display: none !important;
}

@media (min-width: 1024px) {
  .show-on-desktop {
    display: block !important;
  }
}

/* =============================================
 * SCREEN READER ONLY
 * ============================================= */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* =============================================
 * SPACING UTILITIES
 * ============================================= */

/* Responsive padding */
@media (max-width: 768px) {
  .container-padding-mobile {
    padding-left: 16px;
    padding-right: 16px;
  }
}

/* Responsive margins */
.mt-responsive {
  margin-top: 80px;
}

@media (max-width: 1024px) {
  .mt-responsive {
    margin-top: 60px;
  }
}

@media (max-width: 768px) {
  .mt-responsive {
    margin-top: 40px;
  }
}

.mb-responsive {
  margin-bottom: 80px;
}

@media (max-width: 1024px) {
  .mb-responsive {
    margin-bottom: 60px;
  }
}

@media (max-width: 768px) {
  .mb-responsive {
    margin-bottom: 40px;
  }
}

/* =============================================
 * TYPOGRAPHY UTILITIES
 * ============================================= */

/* Responsive text sizes */
.text-responsive-xl {
  font-size: 40px;
  line-height: 48px;
}

@media (max-width: 768px) {
  .text-responsive-xl {
    font-size: 32px;
    line-height: 40px;
  }
}

@media (max-width: 480px) {
  .text-responsive-xl {
    font-size: 28px;
    line-height: 36px;
  }
}

.text-responsive-lg {
  font-size: 32px;
  line-height: 40px;
}

@media (max-width: 768px) {
  .text-responsive-lg {
    font-size: 24px;
    line-height: 32px;
  }
}

@media (max-width: 480px) {
  .text-responsive-lg {
    font-size: 20px;
    line-height: 28px;
  }
}

.text-responsive-md {
  font-size: 24px;
  line-height: 32px;
}

@media (max-width: 768px) {
  .text-responsive-md {
    font-size: 20px;
    line-height: 28px;
  }
}

@media (max-width: 480px) {
  .text-responsive-md {
    font-size: 18px;
    line-height: 26px;
  }
}

/* =============================================
 * LAYOUT UTILITIES
 * ============================================= */

/* Responsive flex direction */
.flex-column-mobile {
  display: flex;
}

@media (max-width: 768px) {
  .flex-column-mobile {
    flex-direction: column;
  }
}

/* Responsive grid */
.grid-responsive-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

@media (max-width: 1024px) {
  .grid-responsive-4 {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .grid-responsive-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

@media (max-width: 480px) {
  .grid-responsive-4 {
    grid-template-columns: 1fr;
  }
}

.grid-responsive-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 1024px) {
  .grid-responsive-3 {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .grid-responsive-3 {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

.grid-responsive-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

@media (max-width: 768px) {
  .grid-responsive-2 {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* =============================================
 * BUTTON UTILITIES
 * ============================================= */

/* Full width button on mobile */
.button-full-width-mobile {
  width: auto;
}

@media (max-width: 768px) {
  .button-full-width-mobile {
    width: 100%;
  }
}

/* =============================================
 * IMAGE UTILITIES
 * ============================================= */

/* Responsive images */
.img-responsive {
  width: 100%;
  height: auto;
  display: block;
}

/* Object fit utilities */
.img-cover {
  object-fit: cover;
}

.img-contain {
  object-fit: contain;
}

/* =============================================
 * CONTAINER UTILITIES
 * ============================================= */

.container-full-width-mobile {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

@media (max-width: 768px) {
  .container-full-width-mobile {
    max-width: 100%;
    padding: 0 16px;
  }
}

/* =============================================
 * OVERFLOW UTILITIES
 * ============================================= */

.overflow-x-auto-mobile {
  overflow-x: visible;
}

@media (max-width: 768px) {
  .overflow-x-auto-mobile {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* =============================================
 * POSITION UTILITIES
 * ============================================= */

.sticky-mobile {
  position: relative;
}

@media (max-width: 768px) {
  .sticky-mobile {
    position: sticky;
    top: 0;
    z-index: 100;
  }
}

/* =============================================
 * ANIMATION UTILITIES
 * ============================================= */

/* 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;
  }
}

/* =============================================
 * PRINT UTILITIES
 * ============================================= */

@media print {
  .no-print {
    display: none !important;
  }

  .print-break-before {
    page-break-before: always;
  }

  .print-break-after {
    page-break-after: always;
  }

  .print-no-break {
    page-break-inside: avoid;
  }
}

/* =============================================
 * FOCUS UTILITIES
 * ============================================= */

/* Enhanced focus indicators for keyboard navigation */
.focus-ring:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.focus-ring-inset:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

/* Remove focus outline when using mouse */
.no-focus-outline:focus:not(:focus-visible) {
  outline: none;
}

/* =============================================
 * TOUCH TARGET UTILITIES
 * ============================================= */

/* Ensure touch targets are at least 44x44px */
@media (max-width: 768px) {
  .touch-target {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* =============================================
 * ORIENTATION UTILITIES
 * ============================================= */

@media (orientation: landscape) and (max-height: 500px) {
  .hide-on-landscape-mobile {
    display: none !important;
  }
}

/* =============================================
 * HIGH CONTRAST MODE
 * ============================================= */

@media (prefers-contrast: high) {
  .high-contrast-border {
    border-width: 2px !important;
  }

  .high-contrast-text {
    font-weight: 600 !important;
  }
}
