/* ===== RESPONSIVE LAYOUT SYSTEM ===== */

/* Grid System */
.grid {
  display: grid;
  gap: var(--spacing-lg);
}

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

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

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

.grid-auto-fit {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-auto-fill {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

/* Flexbox Utilities */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-column {
  display: flex;
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.align-center { align-items: center; }
.align-start { align-items: flex-start; }
.align-end { align-items: flex-end; }

.justify-center { justify-content: center; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }

/* Container Responsive Behavior */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* ===== MOBILE FIRST MEDIA QUERIES ===== */

/* Small devices (landscape phones, 576px and up) */
@media screen and (min-width: 576px) {
  .container {
    padding: 0 var(--spacing-lg);
  }
  
  .section {
    padding: 5rem 0;
  }
  
  .grid {
    gap: var(--spacing-xl);
  }
}

/* Medium devices (tablets, 768px and up) */
@media screen and (min-width: 768px) {
  :root {
    --biggest-font-size: 3rem;
    --h1-font-size: 2.5rem;
    --h2-font-size: 2rem;
    --h3-font-size: 1.75rem;
    --normal-font-size: 1.125rem;
    --section-padding: 6rem 0;
  }
  
  .container {
    padding: 0 var(--spacing-xl);
  }
  
  .section__title {
    margin-bottom: var(--spacing-md);
  }
  
  .section__subtitle {
    margin-bottom: var(--spacing-3xl);
  }
  
  /* Grid adjustments for tablets */
  .grid-2-tablet {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-3-tablet {
    grid-template-columns: repeat(3, 1fr);
  }
  
  /* Show/hide utilities for tablets */
  .show-tablet {
    display: block !important;
  }
  
  .hide-tablet {
    display: none !important;
  }
}

/* Large devices (desktops, 992px and up) */
@media screen and (min-width: 992px) {
  .container {
    padding: 0 var(--spacing-2xl);
  }
  
  .section {
    padding: 7rem 0;
  }
  
  .grid {
    gap: var(--spacing-2xl);
  }
  
  /* Grid adjustments for desktop */
  .grid-2-desktop {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-3-desktop {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .grid-4-desktop {
    grid-template-columns: repeat(4, 1fr);
  }
  
  /* Show/hide utilities for desktop */
  .show-desktop {
    display: block !important;
  }
  
  .hide-desktop {
    display: none !important;
  }
}

/* Extra large devices (large desktops, 1200px and up) */
@media screen and (min-width: 1200px) {
  :root {
    --biggest-font-size: 3.5rem;
    --h1-font-size: 3rem;
    --section-padding: 8rem 0;
  }
  
  .container {
    max-width: var(--large-desktop);
  }
}

/* ===== MOBILE SPECIFIC STYLES ===== */
@media screen and (max-width: 767px) {
  /* Mobile-only utilities */
  .show-mobile {
    display: block !important;
  }
  
  .hide-mobile {
    display: none !important;
  }
  
  /* Stack grid items on mobile */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  
  /* Reduce spacing on mobile */
  .section {
    padding: 3rem 0;
  }
  
  .grid {
    gap: var(--spacing-md);
  }
  
  /* Button adjustments for mobile */
  .button {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: var(--small-font-size);
  }
  
  /* Text size adjustments for mobile */
  .section__title {
    font-size: var(--h3-font-size);
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  * {
    background: transparent !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.4;
  }
  
  .header,
  .footer,
  .nav,
  .button {
    display: none !important;
  }
  
  .section {
    page-break-inside: avoid;
    padding: 1rem 0;
  }
  
  h1, h2, h3 {
    page-break-after: avoid;
  }
}

/* ===== ACCESSIBILITY & MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  html {
    scroll-behavior: auto;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --primary-color: #0000ff;
    --text-color: #000000;
    --title-color: #000000;
    --border-color: #000000;
  }
  
  .button {
    border-width: 2px;
  }
}

/* ===== CONTAINER QUERIES (Future-proofing) ===== */
@container (min-width: 400px) {
  .card {
    padding: var(--spacing-lg);
  }
}

@container (min-width: 600px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}