    body {
      font-family: system-ui, sans-serif;
      margin: 0;
      background: #f9f9f9;
      color: #6600ff;
    }
    h1 {
      text-align: center;
      margin: 1rem 0 0.3rem;
    }
    h2 {
      text-align: center;
      margin: 0 0 1rem;
      font-weight: normal;
    }
    .grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
      gap: 1rem;
      padding: 1rem;
      max-width: 1200px; 
      margin: 0 auto;
      justify-items: center;
    }
    figure {
      margin: 0;
      background: #f0e6ff;
      border-radius: 8px;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: space-between;
      height: 100%;
    }
    .figure-img-wrap {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      padding: 0.5rem;
    }
    img {
      max-width: 100%;
      height: auto;
      object-fit: contain;
      cursor: pointer;
    }
    figcaption {
      margin-top: auto;
      padding: 0.3rem;
      font-size: 0.85rem;
      line-height: 1.2;
      text-align: center;
      color: #6600ff;
      width: 100%;
    }
    .lightbox {
      position: fixed;
      inset: 0;
      background: rgba(255,255,255,0.95);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 9999;
    }
    .lightbox img {
      max-width: 90%;
      max-height: 90%;
      box-shadow: 0 0 20px rgba(0,0,0,0.5);
    }
    .nav-btn {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      background: rgba(102,0,255,0.7);
      color: #fff;
      border: none;
      padding: 0.5rem 0.8rem;
      font-size: 2rem;
      cursor: pointer;
      border-radius: 4px;
    }
    #prevBtn { left: 10px; }
    #nextBtn { right: 10px; }
    .nav-btn:hover { background: rgba(102,0,255,0.9); }

	  
/* footer position */	  
html, body {
  height: 100%;          /* full viewport height */
  margin: 0;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;               /* Main content grows to push footer down */
}

.footer {
  margin-top: auto;      /* anchors footer at bottom when content is short */
  text-align: center;
  padding: 0.5rem;
  color: #6600ff;
}

/* iPad Portrait (vertical mode) */
@media (min-width: 601px) and (max-width: 820px) and (orientation: portrait) {
  h1 {
    font-size: 1.4rem;
    padding: 0.8rem;
  }
  h2 {
    font-size: 1.1rem;
    margin-bottom: 0.9rem;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.8rem;
    padding: 0.8rem;
    max-width: 95%;
  }

  figcaption {
    font-size: 0.8rem;
    padding: 0.3rem;
  }

  .lightbox img {
    max-width: 90%;
    max-height: 85%;
  }

  .nav-btn {
    font-size: 1.6rem;
    padding: 0.4rem 0.6rem;
  }
  #prevBtn { left: 8px; }
  #nextBtn { right: 8px; }

  .footer {
    font-size: 0.9rem;
    padding: 0.5rem;
  }
}

/* iPad Landscape (horizontal mode) */
@media (min-width: 821px) and (max-width: 1024px) and (orientation: landscape) {
  h1 {
    font-size: 1.6rem;
    padding: 1rem;
  }
  h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    padding: 1rem;
    max-width: 1000px;
  }

  figcaption {
    font-size: 0.85rem;
    padding: 0.35rem;
  }

  .lightbox img {
    max-width: 92%;
    max-height: 88%;
  }

  .nav-btn {
    font-size: 1.8rem;
    padding: 0.5rem 0.7rem;
  }
  #prevBtn { left: 10px; }
  #nextBtn { right: 10px; }

  .footer {
    font-size: 1rem;
    padding: 0.6rem;
  }
}

/* Mobile phones */
@media (max-width: 600px) {
  h1 {
    font-size: 1.1rem;
    padding: 0.4rem;
    margin: 0.5rem 0;
  }
  h2 {
    font-size: 0.95rem;
    margin-bottom: 0.6rem;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.4rem;
    padding: 0.4rem;
    max-width: 100%;
    margin: 0 auto;
    justify-items: center;
  }

  figure {
    border-radius: 6px;
  }

  figcaption {
    font-size: 0.7rem;
    padding: 0.2rem;
    line-height: 1.1;
  }

  .lightbox img {
    max-width: 95%;
    max-height: 75%;
  }

  .nav-btn {
    padding: 0.25rem 0.4rem;
    font-size: 1.2rem;
  }
  #prevBtn { left: 4px; }
  #nextBtn { right: 4px; }

  .footer {
    font-size: 0.75rem;
    padding: 0.3rem;
  }
}