/* --- Base (Mobile First) --- */
.grid {
  display: grid;
  grid-template-columns: 1fr;
}

.gallery {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.gallery img {
  flex-shrink: 1;
  flex-grow: 1;
  flex-basis: 90%;  /* flex-basis practice */
}

/* STUDENT CODE STARTS HERE */
@media (min-width: 768px) {
  .grid {
    grid-template-columns: 45% 45%;
    justify-items: center;
  }
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: 45% 45%;
    justify-items: center;
  }

  .grid > *:nth-child(3n) {
    grid-column: 1 / span 2; 
    width: 50%;              
  }

  .grid > *:nth-child(3n) {
    justify-self: center;
  }

  .gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
  }

  .gallery img {
    flex: 1 1 30%;
  }

  .grid > *:nth-child(even) {
    background-color: #e8da0b;
  }
}

@media (min-width: 1200px) {
  .grid {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem; 
  }

  .grid > * {
    grid-column: auto; 
    width: 100%;        
    justify-self: stretch;
  }

  .grid > *:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: box-shadow 0.3s ease;
  }

  .gallery {
    justify-content: space-between;
  }

  .gallery img {
    flex: 1 1 200px;
  }
}

@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }

  .gallery {
    display: none !important;
  }

  .grid {
    display: block !important;
    grid-template-columns: none !important;
  }

  .grid > * {
    border: 1px solid #aaa !important;
    margin: 0 0 8px 0;        
    page-break-inside: avoid; 
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important; 
  }

  .card {
    page-break-inside: avoid !important;
  }
}

@media (prefers-color-scheme: dark) {
  body {
    background: #111 !important;
    color: #eee !important;
  }
  .grid {
    background-color: #111 !important;
    border: 1px solid #EB5B00 !important;
  }
}


