    body {
      margin: 200;
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      background: #f6f6f6;
      color: #222;
      counter-reset: photo;
    }

    header {
      padding: 1.5rem;
      text-align: center;
    }

    header h1 {
      margin: 200;
      font-weight: 400;
      letter-spacing: 0.05em;
    }

    section {
      max-width: 1400px;
      margin: 0 auto 3rem auto;
    }

    section h2 {
      font-weight: 400;
      letter-spacing: 0.04em;
      margin: 2rem 12px 1rem 12px;
    }

    .gallery {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
      grid-auto-flow: row;
      gap: 12px;
      padding: 12px;
      max-width: 1400px;
      margin: 0 auto 3rem auto;
    }

    .gallery img {
      width: 100%; 
      height: 220px;
      object-fit: cover;
      cursor: pointer;
      display: block;
      border-radius: 8px;
      background: #ddd;
    }

    .gallery img:hover {
      filter: brightness(0.95);
    }

    .gallery img::before {
      content: counter(photo);
      position: absolute;
      top: 6px;
      left: 6px;
      background: rgba(0,0,0,0.6);
      color: #fff;
      font-size: 0.75rem;
      padding: 2px 6px;
      border-radius: 3px;
    }


    .gallery-loose {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      grid-auto-flow: row;
      gap: 24px;
    }


    .pair {
      grid-column: span 2;
      break-inside: avoid;     /* prevents column/page breaks */
      justify-self: center;
      max-width: calc(2 * 260px + 24px); /* optional tuning */
      page-break-inside: avoid;
      display: grid;
      grid-template-columns: 1fr 1fr;
      padding: 12px;
      background: #f0f0f0;
      border-radius: 6px;
      margin-top: 12px;
      margin-bottom: 12px;
      gap: 12px;
      counter-increment: photo;

    }

    .pair img {
      width: 100%;
      height: 220px;
      object-fit: contain;
    }

    .pair::before {
      content: counter(photo);
      position: absolute;
      top: 6px;
      left: 6px;
    }
  
    /* Lightbox */
    .lightbox {
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.9);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 1000;
    }

    .lightbox img {
      max-width: 95vw;
      max-height: 95vh;
    }

    .lightbox.active {
      display: flex;
    }

    .lightbox-number {
      position: absolute;
      top: 1rem;
      left: 1rem;
      background: rgba(0,0,0,0.7);
      color: #fff;
      font-size: 1rem;
      padding: 4px 10px;
      border-radius: 4px;
      z-index: 1100;
    }

    .lightbox-caption {
      position: absolute;
      bottom: 1.25rem;
      max-width: 90%;
      color: #ddd;
      font-size: 0.95rem;
      line-height: 1.4;
      text-align: center;
      background: rgba(0,0,0,0.4);
      padding: 6px 10px;
      border-radius: 4px;
    }


    .nav {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      font-size: 3rem;
      color: #fff;
      cursor: pointer;
      user-select: none;
      padding: 0 1rem;
    }

    .nav.prev { left: 0; }
    .nav.next { right: 0; }

    .close {
      position: absolute;
      top: 0.75rem;
      right: 1.25rem;
      font-size: 2rem;
      color: #fff;
      cursor: pointer;
    }

    .toc {
      text-align: center;
      margin-bottom: 1.5rem;
    }

    .toc a {
      margin: 0 0.75rem;
      text-decoration: none;
      color: #555;
      font-size: 0.95rem;
    }

    .toc a:hover {
      text-decoration: underline;
    }

    .back-to-top {
      text-align: right;
      margin: 0 12px;
      font-size: 0.85rem;
    }

    .back-to-top a {
      text-decoration: none;
      color: #666;
    }

    .back-to-top a:hover {
      text-decoration: underline;
    }

    .thumb {
      position: relative;
    }

    .thumb::before {
      counter-increment: photo;
      content: counter(photo);
      position: absolute;
      top: 6px;
      left: 6px;
      background: rgba(0,0,0,0.6);
      color: #fff;
      font-size: 0.75rem;
      padding: 2px 6px;
      border-radius: 3px;
      z-index: 2;
    }

    .num {
      position: absolute;
      top: 6px;
      left: 6px;
      background: rgba(0,0,0,0.6);
      color: #fff;
      font-size: 0.75rem;
      padding: 2px 6px;
      border-radius: 3px;
    }


    .caption {
      font-size: 0.8rem;
      color: #444;
      margin-top: 4px;
      line-height: 1.3;
    }


    @media (max-width: 900px) {
      .gallery-loose {
      grid-template-columns: repeat(2, 1fr);
      }
    }

    @media (max-width: 500px) {
      .gallery-loose {
      grid-template-columns: 1fr;
    }

      .pair {
        grid-template-columns: 1fr;
      }
    }
