.template-gallery .gallery-masthead { background: var(--footer); color: var(--ivory); }
.gallery-intro { display: grid; grid-template-columns: 1.15fr 1fr; gap: 60px; align-items: end; padding-top: clamp(48px, 5vw, 86px); padding-bottom: 42px; }
.gallery-intro h1 { font-size: clamp(58px, 7vw, 96px); line-height: 1; letter-spacing: -.035em; }
.gallery-intro > p { max-width: 37ch; margin-left: auto; padding-bottom: 7px; font-size: clamp(15px, 1.2vw, 19px); line-height: 1.65; text-wrap: pretty; }
.gallery-collection { padding-bottom: clamp(70px, 7vw, 120px); }
.gallery-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.gallery-filters { display: flex; flex-wrap: wrap; gap: 9px; }
.gallery-filter { min-height: 48px; padding: 13px 21px; border-radius: 3px; background: var(--canvas); color: var(--ink); font-size: 14px; font-weight: 700; line-height: 1.4; transition: background .2s, color .2s; }
.gallery-filter:hover { background: var(--line); }
.gallery-filter[aria-pressed='true'] { background: var(--button-gold); color: var(--button-ink); }
.gallery-filter[aria-pressed='true']:hover { background: var(--button-gold-hover); }
.gallery-result-count { flex: none; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }

/* Masonry. Columns and gutter live here; gallery-page.js reads both, then places
   every tile in the shortest column (the leftmost one on a tie). Until the script
   has run, a row-major grid shows the same first row, so nothing visibly jumps. */
.gallery-masonry { --masonry-columns: 2; --masonry-gap: 12px; display: grid; grid-template-columns: repeat(var(--masonry-columns), minmax(0, 1fr)); gap: var(--masonry-gap); align-items: start; margin: 0; padding: 0; list-style: none; }
.gallery-masonry.is-masonry { display: block; position: relative; }
.gallery-masonry.is-masonry > .gallery-tile { --placed: min(var(--masonry-columns), var(--masonry-visible, 99)); position: absolute; left: calc(var(--column, 0) * (100% + var(--masonry-gap)) / var(--placed)); width: calc((100% - (var(--placed) - 1) * var(--masonry-gap)) / var(--placed)); }
.gallery-tile { min-width: 0; margin: 0; }
.gallery-tile[hidden] { display: none !important; }
@media (scripting: none) {
  .gallery-masonry { display: block; columns: var(--masonry-columns); column-gap: var(--masonry-gap); }
  .gallery-tile { break-inside: avoid; margin-bottom: var(--masonry-gap); }
}
@media (min-width: 600px) { .gallery-masonry { --masonry-gap: 16px; } }
@media (min-width: 700px) { .gallery-masonry { --masonry-columns: 3; } }
@media (min-width: 1000px) { .gallery-masonry { --masonry-gap: 20px; } }
@media (min-width: 1400px) { .gallery-masonry { --masonry-columns: 4; } }

.gallery-tile-photo { position: relative; display: block; width: 100%; padding: 0; border-radius: 4px; background: none; color: var(--ink); text-align: left; cursor: zoom-in; }
.gallery-tile-photo:focus-visible { outline-offset: 4px; }
.gallery-tile-media { display: block; overflow: hidden; border-radius: 4px; background: var(--canvas); }
.gallery-tile-media img { width: 100%; height: auto; transition: opacity .6s var(--ease), transform .8s var(--ease); }
.gallery-masonry.is-masonry .gallery-tile:not(.is-loaded) img { opacity: 0; }
/* Touch screens: a quiet caption under the photograph, as on a pinboard. */
.gallery-tile-caption { display: block; padding: 9px 1px 5px; line-height: 1.45; }
.gallery-tile-title { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 13px; }
.gallery-tile-category { display: block; margin-top: 1px; font-size: 11px; color: var(--muted); }
@media (max-width: 600px) {
  .gallery-tile-caption { padding: 7px 1px 4px; }
  .gallery-tile-title { font-size: 12px; }
  .gallery-tile-category { font-size: 10px; }
}

/* Pointer screens: the caption rises out of a soft shade on hover or focus. */
@media (hover: hover) and (pointer: fine) {
  .gallery-tile-caption { position: absolute; inset: auto 0 0; padding: 56px 17px 15px; border-radius: 0 0 4px 4px; background: linear-gradient(to top, rgb(30 23 17 / .72), rgb(30 23 17 / .38) 48%, rgb(30 23 17 / 0)); color: var(--ivory); opacity: 0; pointer-events: none; transition: opacity .35s var(--ease); }
  .gallery-tile-caption > span { transform: translateY(6px); transition: transform .5s var(--ease); }
  .gallery-tile-title { font-family: var(--serif); font-size: clamp(15px, 1.25vw, 18px); line-height: 1.25; letter-spacing: -.005em; }
  .gallery-tile-category { margin-top: 4px; color: rgb(248 244 236 / .8); }
  .gallery-tile-photo:hover .gallery-tile-caption, .gallery-tile-photo:focus-visible .gallery-tile-caption { opacity: 1; }
  .gallery-tile-photo:hover .gallery-tile-caption > span, .gallery-tile-photo:focus-visible .gallery-tile-caption > span { transform: none; }
  .gallery-tile-photo:hover img { transform: scale(1.035); }
}
@media (hover: hover) and (pointer: fine) and (max-width: 600px) {
  .gallery-tile-caption { padding: 44px 12px 11px; }
}

.gallery-stay { display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: clamp(36px, 6vw, 96px); padding-top: clamp(48px, 5vw, 78px); padding-bottom: clamp(48px, 5vw, 78px); background: var(--gold-tint, #f1e8d6); }
.gallery-stay h2 { font-size: clamp(34px, 4vw, 60px); line-height: 1.08; letter-spacing: -.025em; }
.gallery-stay h2 span { display: block; }
.gallery-stay-copy > p { max-width: 39ch; margin-top: 23px; font-size: 15px; line-height: 1.75; text-wrap: pretty; }
.gallery-stay .button { margin-top: 30px; }
.gallery-stay > img { width: 100%; aspect-ratio: 1.14; height: auto; object-fit: cover; object-position: 60% 50%; border-radius: 4px; }
@media (max-width: 1000px) {
  .gallery-intro { gap: 30px; padding-top: 50px; padding-bottom: 34px; }
  .gallery-intro h1 { font-size: 72px; }
  .gallery-intro > p { font-size: 15px; padding-bottom: 2px; }
  .gallery-stay { gap: 38px; }
  .gallery-stay h2 { font-size: clamp(30px, 4.4vw, 40px); }
  .gallery-stay-copy > p { font-size: 14px; }
}
@media (max-width: 600px) {
  .gallery-intro { grid-template-columns: 1fr; gap: 22px; padding-top: 39px; padding-bottom: 27px; }
  .gallery-intro h1 { font-size: clamp(53px, 14vw, 67px); }
  .gallery-intro > p { margin-left: 0; max-width: 34ch; padding: 0; font-size: 14px; line-height: 1.7; }
  .gallery-toolbar { display: block; margin-bottom: 22px; }
  .gallery-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
  .gallery-filter { width: 100%; }
  .gallery-filter { min-height: 44px; padding: 11px 13px; font-size: 12px; }
  .gallery-result-count { margin-top: 15px; font-size: 11px; }
  .gallery-collection { padding-bottom: 48px; }
  .gallery-stay { grid-template-columns: 1fr; gap: 31px; padding-block: 43px; }
  .gallery-stay h2 { font-size: clamp(30px, 9.6vw, 38px); line-height: 1.12; }
  .gallery-stay-copy > p { margin-top: 18px; max-width: 34ch; font-size: 14px; }
  .gallery-stay .button { margin-top: 25px; }
  .gallery-stay > img { aspect-ratio: 1.3; }
}
@media (prefers-reduced-motion: reduce) {
  .gallery-tile-media img, .gallery-tile-caption, .gallery-tile-caption > span, .gallery-filter { transition: none; }
  .gallery-tile-photo:hover img { transform: none; }
}
.gallery-tile-media.is-stretched img { height: 100%; object-fit: cover; }
@media (max-width: 759px) {
  .gallery-toolbar { display: block; }
  .gallery-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
  .gallery-filter { width: 100%; }
  .gallery-result-count { margin-top: 15px; }
}
@media (max-width: 1000px) { .gallery-stay h2 { font-size: clamp(27px, 4.4vw, 40px); } }
