/* Base Reset & Variables */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Base Mobile Layout (Portrait) 
   Default: One image per row, caption underneath */
.gallery-container {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.gallery-card {
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.image-wrapper img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.caption {
  padding: 12px 15px;
}

.caption h3 {
  margin-bottom: 4px; margin-top: 5px;
  font-size: 1.1rem; line-height: 1.4rem;
  font-family: "josefin_sanssemibold", Arial, sans-serif;	}

.caption p {
  font-size: 0.85rem;
  color: #666;
  line-height: 1.4;
}

/* 1. Mobile Held Sideways (Landscape) 
   Image no higher than screen, caption alongside */
@media (max-width: 900px) and (orientation: landscape) {
  .gallery-container {
    gap: 20px;
  }

  .gallery-card {
    display: grid;
    grid-template-columns: 1.2fr 1fr; /* Adjust ratios to give image or text more room */
    align-items: center;
  }

  .image-wrapper {
    height: 100%;
    max-height: 80vh; /* Prevents the image from being taller than the screen */
    overflow: hidden;
  }

  .image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures landscape images fill the space beautifully without distortion */
   }
  
  .caption {
    padding: 20px;  }
}

/* 2. Desktop Screens (600px width and up) */
@media (min-width: 600px) and (orientation: portrait), (min-width: 901px) {
  
  body {max-width: 620px; margin: auto;	
  border-left: 1px solid; border-right: 1px solid;	}
  
  .gallery-container {
    display: flex;       /* Explicitly Flexbox */
    flex-direction: row; /* Puts the cards side-by-side */
    flex-wrap: wrap;     /* Drops cards 3 and 4 to the next line */
    gap: 24px;
    align-items: center;         /* This aligns the cards themselves along their vertical centers 
       if one row happens to be taller than the other: */
  }

  .gallery-card {
    /* (100% width minus the 24px gap) divided by 2 columns */
    width: calc((100% - 24px) / 2); 
    
    display: flex;
    flex-direction: column; /* Keeps caption BELOW the image */
  }

  /* To center the image wrapper inside its own card if needed: */
  .image-wrapper {
    margin-top: auto;
    margin-bottom: auto;
  }
}

/*styles lifted from books-offwhite stylesheet*/
 
.cream {
    max-width: 100%;
    margin: auto;
    border: 1px solid black;
    background-image: url(greybar00.jpg);
    background-repeat: no-repeat;    
    background-color: #fdfaf3; /* Classic book parchment */
    color: #2e2e2e;           /* Deep charcoal, softer than pure black */
    min-height: 100vh;
    display: flex;
    flex-wrap: wrap; 
    align-content: flex-start; 	}

