.gallery-page { color: #263a2a; padding-top: 150px; }
.gallery-intro { padding-bottom: 34px; }
.gallery-breadcrumb { display: flex; gap: 12px; font-size: 13px; color: #778071; margin-bottom: 30px; }
.gallery-breadcrumb a { color: #778071; }
.gallery-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; }
.gallery-heading h1 { font-size: clamp(36px, 5vw, 64px); line-height: 1.1; letter-spacing: -1.8px; margin: 0 0 20px; }
.gallery-total { color: #778071; font-size: 15px; white-space: nowrap; }
.gallery-intro > p { font-size: 18px; line-height: 1.6; max-width: 760px; margin: 0 0 8px; }
.gallery-intro > .gallery-disclaimer { font-size: 13px; color: #778071; }
.gallery-projects { display: flex; flex-wrap: wrap; gap: 10px; padding: 22px 0 30px; border-top: 1px solid #dfe4dc; }
.gallery-projects a { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 8px; border: 1px solid #dfe4dc; color: #263a2a; font-size: 14px; line-height: 1.4; }
.gallery-projects a span { color: #778071; }
.gallery-projects a[aria-current] { background: #263a2a; border-color: #263a2a; color: #fff; }
.gallery-projects a[aria-current] span { color: #cbd5c8; }
.gallery-projects a:hover { border-color: #788974; }
.gallery-photo-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 38px 28px; align-items: end; }
.gallery-frame { grid-column: span 4; min-width: 0; }
.gallery-frame:nth-child(9n+1), .gallery-frame:nth-child(9n+7) { grid-column: span 8; }
.gallery-frame:nth-child(9n+8), .gallery-frame:nth-child(9n+9) { grid-column: span 6; }
.album-photo { position: relative; display: block; overflow: hidden; border-radius: 10px; background: #edf0ea; }
.album-photo img { display: block; width: 100%; aspect-ratio: 1.65; object-fit: cover; }
.album-photo-open { position: absolute; right: 14px; bottom: 14px; display: inline-flex; gap: 16px; align-items: center; padding: 8px 12px; border-radius: 6px; background: #fff; color: #263a2a; font-size: 12px; opacity: 0; transition: opacity .15s; }
.album-photo:hover .album-photo-open, .album-photo:focus-visible .album-photo-open { opacity: 1; }
.album-caption { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 14px; }
.album-caption h2 { font-size: 18px; line-height: 1.3; margin: 0 0 4px; font-weight: 600; }
.album-caption > div > span { font-size: 13px; color: #778071; }
.gallery-page .gallery-project-link { padding: 8px 0; font-size: 13px; gap: 10px; white-space: nowrap; font-weight: 400; }
.gallery-invitation { display: flex; justify-content: space-between; align-items: center; gap: 30px; margin-top: 70px; padding-top: 40px; padding-bottom: 60px; border-top: 1px solid #dfe4dc; }
.gallery-invitation h2 { font-size: clamp(26px, 3vw, 36px); line-height: 1.2; margin-bottom: 12px; }
.gallery-invitation p { font-size: 16px; color: #778071; margin: 0; }
.gallery-invitation > a { flex-shrink: 0; }
.gallery-page a:focus-visible { outline: 3px solid #ed9d3b; outline-offset: 4px; }
@media (max-width: 991px) {
  .gallery-frame:nth-child(n) { grid-column: span 6; }
  .gallery-frame:first-child { grid-column: span 12; }
}
@media (max-width: 575px) {
  .gallery-page { padding-top: 98px; }
  .gallery-breadcrumb { margin-bottom: 22px; }
  .gallery-heading { gap: 12px; }
  .gallery-heading h1 { font-size: 36px; letter-spacing: -1px; }
  .gallery-total { font-size: 12px; }
  .gallery-intro > p { font-size: 16px; }
  .gallery-intro { padding-bottom: 18px; }
  .gallery-projects { flex-wrap: nowrap; overflow-x: auto; padding: 18px 0 24px; }
  .gallery-projects a { flex-shrink: 0; }
  .gallery-photo-grid { gap: 28px; }
  .gallery-frame:nth-child(n) { grid-column: span 12; }
  .album-photo-open { display: none; }
  .album-caption h2 { font-size: 17px; }
  .gallery-invitation { flex-direction: column; align-items: flex-start; margin-top: 48px; padding-top: 30px; padding-bottom: 40px; }
}
/* Header already occupies space in the normal page flow. */
.gallery-page { padding-top: 40px; }
.gallery-page .theme-btn { text-transform: none; }
@media (max-width: 575px) { .gallery-page { padding-top: 24px; } }
.gallery-projects a { white-space: nowrap; }
@media (max-width: 575px) { .gallery-projects a { min-width: max-content; } }
/* Automatic nine-frame rhythm: one large photo beside two stacked photos. */
@media (min-width: 992px) {
  .gallery-photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: clamp(260px, 23vw, 360px);
    grid-auto-flow: row dense;
    align-items: stretch;
    gap: 28px;
  }
  .gallery-photo-grid .gallery-frame:nth-child(n) {
    grid-column: span 1;
    grid-row: span 1;
    display: flex;
    flex-direction: column;
  }
  .gallery-photo-grid .gallery-frame:nth-child(9n+1) {
    grid-column: span 2;
    grid-row: span 2;
  }
  .gallery-photo-grid .album-photo { flex: 1; min-height: 0; }
  .gallery-photo-grid .album-photo img { height: 100%; aspect-ratio: auto; }
  .gallery-photo-grid .album-caption { min-height: 66px; flex-shrink: 0; }
  /* A final single frame occupies the whole row instead of leaving a gap. */
  .gallery-photo-grid .gallery-frame:last-child:nth-child(9n+1) {
    grid-column: 1 / -1;
    grid-row: span 1;
  }
}
@media (min-width: 992px) {
  /* Balance incomplete final batches too, regardless of the number of uploads. */
  .gallery-photo-grid:has(> .gallery-frame:last-child:nth-child(9n+2)) > .gallery-frame:nth-last-child(2) { grid-row: span 1; }
  .gallery-photo-grid .gallery-frame:last-child:nth-child(9n+4),
  .gallery-photo-grid .gallery-frame:last-child:nth-child(9n+7) { grid-column: 1 / -1; }
  .gallery-photo-grid .gallery-frame:last-child:nth-child(9n+5),
  .gallery-photo-grid .gallery-frame:last-child:nth-child(9n+8) { grid-column: span 2; }
}
