/* Galleries: the Galleries page (/galleries.html), the static list (/galleries/) and each gallery page.
   Builds on styles.css tokens and classes (.wrap, .eyebrow, .filters, .gallery-card, dialog). */

.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

/* Draft preview banner */
.preview-banner{background:var(--gold);color:var(--green);text-align:center;padding:12px 20px;font-size:13px;font-weight:700;letter-spacing:.3px;border-bottom:2px solid #c99a2e}
.preview-banner span{font-weight:400;margin-left:6px}

/* Page heading additions */
.gallery-heading .eyebrow{text-transform:uppercase}
.gallery-heading h1{font-size:clamp(40px,6vw,64px);overflow-wrap:anywhere}
.gallery-meta{display:flex;flex-wrap:wrap;justify-content:center;gap:6px 18px;margin-top:22px;font-size:12px;font-weight:700;letter-spacing:.5px;color:#5e6b58}
.gallery-meta span+span:before{content:'·';margin-right:18px;color:#a7ad9d}

/* Photos or videos tabs: pinned to the top of the window while scrolling a gallery. */
.gallery-tabs{position:sticky;top:0;z-index:20;background:var(--cream);border-bottom:1px solid var(--line);box-shadow:0 6px 12px -10px #23463b55}
.gallery-tabs-inner{display:flex;gap:6px;padding-block:8px}
.gallery-tab{display:inline-flex;align-items:center;gap:8px;padding:10px 18px;border-radius:3px;font-size:14px;font-weight:700;color:var(--green);text-decoration:none;border:1px solid transparent}
.gallery-tab span{font-size:12px;opacity:.7}
.gallery-tab:hover{border-color:var(--line)}
.gallery-tab.active{background:var(--green);color:var(--cream)}
.gallery-tab:focus-visible{outline-offset:2px}
/* With tabs, the tab names the section, so the section headings step aside. */
.has-tabs .photo-section>.gallery-section-head,.has-tabs .video-section>.gallery-section-head{display:none}
.has-tabs .photo-section,.has-tabs .video-section{padding-top:22px;scroll-margin-top:70px}
.gallery-tabs[hidden],.video-filters[hidden],.video-card[hidden],.photo-section[hidden],.video-section[hidden]{display:none!important}

/* Photo grid: justified rows on wider screens. Each tile grows in proportion to its aspect
   ratio, so every row has one height and every photo keeps its shape. --w and --h come from
   the template. Phones get three square tiles per row, like a phone's own photo app. */
.photo-section{padding:10px 0 40px}
.photo-grid{--row:150px;display:flex;flex-wrap:wrap;gap:6px}
.photo-grid:after{content:'';flex:999 1 0}
.photo-tile{--w:3;--h:2;position:relative;display:block;flex:calc(var(--w) / var(--h)) 1 calc(var(--w) / var(--h) * var(--row));aspect-ratio:var(--w) / var(--h);min-width:0;max-width:100%;overflow:hidden;background:var(--paper) center/cover no-repeat;border-radius:2px}
.photo-tile img{width:100%;height:100%;object-fit:cover;transition:opacity .35s,transform .3s}
.photo-tile.is-waiting img{opacity:0}
.photo-tile:hover img{transform:scale(1.03)}
.photo-tile:focus-visible{outline-offset:3px;z-index:1}
@media(max-width:760px){
  .photo-section.wrap{width:calc(100% - 16px)}
  .photo-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:3px}
  .photo-grid:after{display:none}
  .photo-tile{aspect-ratio:1;border-radius:0}
}
@media(min-width:761px){.photo-grid{--row:160px;gap:6px}}
@media(min-width:1101px){.photo-grid{--row:180px}}

/* Section headings inside a gallery */
.gallery-section-head{display:flex;align-items:baseline;justify-content:space-between;gap:20px;border-top:1px solid var(--line);padding-top:30px;margin-bottom:24px}
.gallery-section-head h2{font-size:32px}
.gallery-section-head p{margin:0;font-size:12px;font-weight:700;color:#6c7464}

/* Videos: a grid of cards (a list on phones); each opens the video player. */
.video-section{padding:20px 0 40px}
.video-filters{flex-wrap:nowrap;overflow-x:auto;max-width:100%;width:max-content;margin-bottom:22px;scrollbar-width:thin}
.video-filters button{flex-shrink:0;white-space:nowrap}
.video-grid{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(2,1fr);gap:28px 22px}
@media(min-width:1101px){.video-grid{grid-template-columns:repeat(3,1fr)}}
.video-card{margin:0;min-width:0}
.video-link{display:block;color:var(--ink);text-decoration:none}
.video-thumb{position:relative;display:block;aspect-ratio:16 / 9;background:#16271f center/cover no-repeat;border-radius:3px;overflow:hidden}
.video-thumb img{display:block;width:100%;height:100%;object-fit:contain;transition:opacity .35s,transform .3s}
.video-thumb.is-waiting img{opacity:0}
.video-link:hover .video-thumb img{transform:scale(1.03)}
.video-play{position:absolute;left:50%;top:50%;width:58px;height:58px;margin:-29px 0 0 -29px;border-radius:50%;background:#23463bd9;box-shadow:0 2px 12px #0005;transition:transform .2s,background .2s}
.video-play:after{content:'';position:absolute;left:23px;top:18px;border-style:solid;border-width:11px 0 11px 17px;border-color:transparent transparent transparent var(--cream)}
.video-link:hover .video-play{background:var(--red);transform:scale(1.08)}
.video-duration{position:absolute;right:8px;bottom:8px;background:#000000b3;color:#fff;font-size:12px;font-weight:700;padding:3px 7px;border-radius:2px;letter-spacing:.5px}
.video-title{display:block;padding:12px 0 0;font-size:15px;font-weight:700;line-height:1.35}
.video-link:focus-visible{outline-offset:4px}
@media(max-width:760px){
  .video-grid{grid-template-columns:1fr;gap:14px}
  .video-link{display:grid;grid-template-columns:42% 1fr;gap:14px;align-items:center}
  .video-title{padding:0;font-size:15px}
  .video-play{width:40px;height:40px;margin:-20px 0 0 -20px}
  .video-play:after{left:16px;top:12px;border-width:8px 0 8px 12px}
  .video-duration{font-size:11px;right:5px;bottom:5px}
}

/* Video player (dialog), built on the photo viewer's look. */
.video-viewer[open]{justify-content:center}
.video-viewer .video-stage{flex:0 1 auto;min-height:0;display:flex;align-items:center;justify-content:center;background:#000;border-radius:3px;overflow:hidden}
.video-viewer video{display:block;width:100%;height:auto;max-height:calc(96vh - 140px);object-fit:contain;background:#000}
.video-viewer .viewer-bar p{margin:0;text-align:left;font-size:15px;font-weight:700;flex:1 1 220px}
.video-steps{display:flex;gap:8px}
.video-step{padding:9px 14px;font-size:13px;background:transparent;border:1px solid var(--line);gap:6px}
.video-step:hover{background:var(--paper)}
@media(max-width:760px){
  .video-viewer video{max-height:calc(100dvh - 190px)}
  .video-steps{order:3;width:100%;justify-content:space-between}
}

/* Privacy note and back link */
.gallery-privacy{background:#eee8d7;padding:22px 24px;border-radius:3px;font-size:14px;color:#4f5c4b;margin:10px 0 40px;text-align:center}
.gallery-privacy a{font-weight:700;text-decoration:underline;text-underline-offset:3px;user-select:all;-webkit-user-select:all}
.back-row{padding:0 0 70px}

/* Album cards (Galleries page, /galleries/ list, Related galleries) */
.album-grid{display:grid;grid-template-columns:1fr;gap:26px}
@media(min-width:620px){.album-grid{grid-template-columns:1fr 1fr}}
@media(min-width:1000px){.album-grid{grid-template-columns:repeat(3,1fr)}}
.album-card{display:block}
.album-cover{position:relative;display:block;aspect-ratio:4 / 3;overflow:hidden;background:var(--paper) center/cover no-repeat;border-radius:2px}
.album-cover img{width:100%;height:100%;object-fit:cover;transition:opacity .35s,transform .3s}
.album-cover.is-waiting img{opacity:0}
.album-card:hover .album-cover img{transform:scale(1.04)}
.album-cover.no-cover{display:flex;align-items:center;justify-content:center;background:#eee8d7;color:var(--red);font-size:46px}
.album-card .gallery-caption{padding:18px 0}
.album-card .gallery-caption strong{font-size:22px;line-height:1.2}
.album-count{display:block;font-size:12px;color:#66705f;margin-top:6px}
.video-badge{position:absolute;left:12px;top:12px;background:var(--green);color:var(--cream);font-size:10px;font-weight:700;letter-spacing:1.2px;padding:6px 10px;border-radius:2px;text-transform:uppercase}
.video-badge:before{content:'▶';margin-right:6px;font-size:9px}

/* Galleries page */
.galleries-section{padding:20px 0 85px}
.galleries-section .archive-top h2{font-size:32px}
/* One row of chips that scrolls sideways when there are many events, so it never changes height. */
.galleries-section .archive-top{gap:20px}
.event-filters{flex-wrap:nowrap;overflow-x:auto;max-width:100%;min-width:0;min-height:52px;scrollbar-width:thin}
.event-filters:empty{border-color:transparent}
.event-filters button{flex-shrink:0;white-space:nowrap}
.gallery-years.is-loading{min-height:100vh}
.gallery-year{margin-top:40px}
.gallery-year:first-child{margin-top:0}
.year-heading{display:flex;align-items:center;gap:20px;font-size:44px;color:var(--red);margin-bottom:26px}
.year-heading:after{content:'';flex:1;height:1px;background:var(--line)}
.galleries-status{font-size:13px;color:#66715e;min-height:22px;margin:0 0 18px}
.galleries-empty h2 em{color:var(--red)}
.noscript-note{background:#eee8d7;padding:18px 20px;font-size:14px;text-align:center;border-radius:3px}
.noscript-note a{font-weight:700;text-decoration:underline}
.galleries-list .gallery-year{margin-top:50px}
.album-list{list-style:none;margin:0;padding:0}

/* Photo viewer (dialog). Reuses the site's dialog look, wider for photos. */
.photo-viewer{width:min(1400px,96vw);max-width:none;max-height:96vh;padding:46px 16px 16px;overflow:hidden}
.photo-viewer[open]{display:flex;flex-direction:column}
.viewer-close{position:absolute;right:9px;top:5px;background:transparent;font-size:32px;line-height:1.2;width:38px;height:38px;border-radius:3px}
.photo-viewer button:focus-visible{outline-offset:-3px}
.viewer-stage{position:relative;margin:0;flex:1 1 auto;min-height:0;display:flex;align-items:center;justify-content:center;touch-action:pan-y pinch-zoom}
.viewer-stage img{display:block;max-width:100%;max-height:none;object-fit:contain;background:var(--paper) center/cover no-repeat;margin:auto}
.viewer-nav{position:absolute;top:50%;transform:translateY(-50%);width:46px;height:46px;border-radius:50%;background:#fff9edd9;color:var(--green);font-size:30px;line-height:1;box-shadow:0 2px 10px #0003;display:flex;align-items:center;justify-content:center}
.viewer-nav:hover{background:var(--cream)}
.viewer-nav[disabled]{opacity:.35;cursor:default}
.viewer-prev{left:8px}
.viewer-next{right:8px}
.viewer-bar{display:flex;align-items:center;justify-content:space-between;gap:16px;padding-top:14px;flex-wrap:wrap}
.photo-viewer .viewer-bar p{margin:0;text-align:left;font-size:13px;flex:1 1 200px}
.viewer-count{font-size:11px;font-weight:700;letter-spacing:1px;color:#717664;white-space:nowrap}
.viewer-download{white-space:nowrap}
@media(max-width:760px){
  .photo-viewer{width:100vw;height:100vh;height:100dvh;max-height:none;border-radius:0;padding:48px 10px 14px}
  .viewer-nav{width:40px;height:40px;font-size:26px}
  .gallery-section-head h2{font-size:28px}
  .year-heading{font-size:36px}
}

@media(prefers-reduced-motion:reduce){
  .photo-tile:hover img,.album-card:hover .album-cover img,.video-link:hover .video-thumb img,.video-link:hover .video-play{transform:none}
}
.galleries-empty .text-link{margin:20px 12px 0}
.galleries-section .archive-note a{text-decoration:underline;text-underline-offset:3px}
