/* Grand Prix theme: the photo gallery page (page-gallery.php, inc/gallery.php, assets/js/gallery.js).
   Each style follows the Gallery preview in Site Designer: plain tiles with a thin gap and no rounded corners,
   grid = even squares, mosaic = one large photo then four small, slideshow = one large photo with dots,
   strip = a row of photos you swipe sideways. */

.tgp-gal-page{
	--gal-primary:var(--tgp-primary,#0b63d6);
	--gal-on-primary:var(--tgp-on-primary,#fff);
	--gal-link:var(--tgp-link,#0b63d6);
	--gal-ink:var(--tgp-ink,#111318);
	--gal-muted:var(--tgp-muted,#5b6270);
	--gal-line:var(--tgp-line,#e3e6eb);
	--gal-tile:#dfe4ec;
	--gal-gap:6px;
	box-sizing:border-box;
	width:100%;
	max-width:1200px;
	margin:0 auto;
	padding:32px 16px 56px;
	color:var(--gal-ink);
}
.tgp-gal-page *,.tgp-gal-page *::before,.tgp-gal-page *::after,.tgp-gal-box,.tgp-gal-box *{box-sizing:border-box}
.tgp-gal-title{margin:0 0 8px;font-size:clamp(1.8rem,4vw,2.6rem);line-height:1.1;font-weight:900;letter-spacing:-.01em}
.tgp-gal-intro{max-width:46em;color:var(--gal-muted);margin:0 0 8px}
.tgp-gal-intro > :last-child{margin-bottom:0}
.tgp-gal{margin-top:20px;min-width:0}

/* messages after sending a photo */
.tgp-gal-note{margin:0 0 18px;padding:12px 14px;border-left:4px solid #17a34a;background:rgba(23,163,74,.08);font-weight:600}
.tgp-gal-note--err{border-left-color:#c8102e;background:rgba(200,16,46,.07)}

/* category tabs: small boxes, the open one filled with the track color */
.tgp-gal-tabs ul{display:flex;flex-wrap:wrap;gap:6px;list-style:none;margin:0 0 22px;padding:0}
.tgp-gal-tabs a{display:inline-block;padding:7px 14px;border:1px solid #d5d9e0;background:#fff;color:var(--gal-muted);font-weight:700;font-size:.9rem;line-height:1.3;text-decoration:none}
.tgp-gal-tabs a:hover{border-color:var(--gal-primary);color:var(--gal-link)}
.tgp-gal-tabs a[aria-current="true"]{background:var(--gal-primary);border-color:var(--gal-primary);color:var(--gal-on-primary)}
.tgp-gal-tabs a:focus-visible{outline:3px solid var(--gal-primary);outline-offset:2px}

/* one category: its name as the heading, then its photos */
.tgp-gal-cat{margin:0 0 34px;min-width:0}
.tgp-gal-cat[hidden]{display:none}
.tgp-gal-h{margin:0 0 10px;font-size:.95rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--gal-muted)}
.tgp-gal-empty{margin:0;color:#7b828f}

.tgp-gal-items{list-style:none;margin:0;padding:0;min-width:0}
.tgp-gal-item{margin:0;padding:0;background:var(--gal-tile);overflow:hidden;min-width:0;position:relative}
.tgp-gal-link{display:block;width:100%;height:100%;color:inherit}
.tgp-gal-img{display:block;width:100%;height:100%;object-fit:cover;max-width:none}
.tgp-gal-link:focus-visible{outline:3px solid var(--gal-primary);outline-offset:-3px;box-shadow:inset 0 0 0 5px #fff}
.tgp-gal-link:focus-visible .tgp-gal-img{opacity:.92}

/* Grid: even squares, three across (two on a phone) */
.tgp-gal--grid .tgp-gal-items{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--gal-gap)}
.tgp-gal--grid .tgp-gal-item{aspect-ratio:1/1}

/* Mosaic: one large photo beside four small ones, repeated */
.tgp-gal--mosaic .tgp-gal-items{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-auto-rows:170px;grid-auto-flow:row dense;gap:var(--gal-gap);container-type:inline-size}
@supports (width:1cqi){
	.tgp-gal--mosaic .tgp-gal-items{grid-auto-rows:calc((100cqi - 3 * var(--gal-gap)) / 4 * .75)}
}
.tgp-gal--mosaic .tgp-gal-item.is-big{grid-column:1 / span 2;grid-row:span 2}
.tgp-gal--mosaic .tgp-gal-item.is-big.is-right{grid-column:3 / span 2}

/* Slideshow: one large photo at a time, swipe or use the arrows and dots */
.tgp-gal-box{position:relative;min-width:0}
.tgp-gal--slideshow .tgp-gal-items,
.tgp-gal--strip .tgp-gal-items{display:flex;overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x mandatory;scrollbar-width:none;scroll-behavior:smooth;-webkit-overflow-scrolling:touch}
.tgp-gal--slideshow .tgp-gal-items::-webkit-scrollbar,
.tgp-gal--strip .tgp-gal-items::-webkit-scrollbar{display:none}
.tgp-gal--slideshow .tgp-gal-items:focus-visible,
.tgp-gal--strip .tgp-gal-items:focus-visible{outline:3px solid var(--gal-primary);outline-offset:3px}
.tgp-gal--slideshow .tgp-gal-item{flex:0 0 100%;aspect-ratio:16/9;max-height:75vh;scroll-snap-align:start;scroll-snap-stop:always}
.tgp-gal--strip .tgp-gal-items{gap:var(--gal-gap)}
.tgp-gal--strip .tgp-gal-item{flex:0 0 38%;aspect-ratio:4/3;scroll-snap-align:start}

/* arrows and dots (added by the script) */
.tgp-gal-arrow{position:absolute;top:50%;transform:translateY(-50%);z-index:2;width:44px;height:44px;border:0;border-radius:50%;background:rgba(17,19,24,.62);color:#fff;font-size:22px;line-height:1;cursor:pointer;display:grid;place-items:center;padding:0}
.tgp-gal-arrow:hover{background:rgba(17,19,24,.82)}
.tgp-gal-arrow:focus-visible{outline:3px solid #fff;box-shadow:0 0 0 6px var(--gal-primary)}
.tgp-gal-arrow[disabled]{opacity:0;pointer-events:none}
.tgp-gal-arrow--prev{left:10px}
.tgp-gal-arrow--next{right:10px}
.tgp-gal-dots{position:absolute;left:0;right:0;bottom:10px;z-index:2;display:flex;justify-content:center;flex-wrap:wrap;gap:2px;pointer-events:none}
.tgp-gal-dots button{pointer-events:auto;width:24px;height:24px;border:0;background:none;padding:0;cursor:pointer;display:grid;place-items:center}
.tgp-gal-dots button::before{content:"";width:9px;height:9px;border-radius:50%;background:rgba(255,255,255,.55);box-shadow:0 0 0 1px rgba(0,0,0,.25)}
.tgp-gal-dots button[aria-current="true"]::before{background:#fff}
.tgp-gal-dots button:focus-visible{outline:2px solid #fff;outline-offset:-2px;border-radius:50%}

/* "Add a photo" for signed-in members */
.tgp-gal-add{margin:0 0 26px;border:1px solid var(--gal-line);background:#fff}
.tgp-gal-add summary{cursor:pointer;padding:12px 16px;font-weight:800;color:var(--gal-link);list-style:none;display:flex;align-items:center;gap:10px}
.tgp-gal-add summary::-webkit-details-marker{display:none}
.tgp-gal-add summary::before{content:"+";display:grid;place-items:center;width:24px;height:24px;border-radius:50%;background:var(--gal-primary);color:var(--gal-on-primary);font-size:18px;line-height:1}
.tgp-gal-add[open] summary::before{content:"\2212"}
.tgp-gal-add summary:focus-visible{outline:3px solid var(--gal-primary);outline-offset:-3px}
.tgp-gal-form{padding:4px 16px 16px;max-width:560px}
.tgp-gal-form-help{margin:0 0 12px;color:var(--gal-muted);font-size:.95rem}
.tgp-gal-field{margin:0 0 12px}
.tgp-gal-field label{display:block;font-weight:700;margin-bottom:4px}
.tgp-gal-field label span{display:block;font-weight:400;font-size:.85rem;color:var(--gal-muted)}
.tgp-gal-field input[type=text],.tgp-gal-field select{width:100%;max-width:100%;padding:10px 12px;border:1px solid #c9cdd5;font:inherit;background:#fff;color:var(--gal-ink)}
.tgp-gal-field input[type=file]{max-width:100%;font:inherit}
.tgp-gal-field input:focus-visible,.tgp-gal-field select:focus-visible{outline:3px solid var(--gal-primary);outline-offset:1px}
.tgp-gal-send{border:0;background:var(--gal-primary);color:var(--gal-on-primary);font:inherit;font-weight:800;padding:11px 20px;cursor:pointer}
.tgp-gal-send:focus-visible{outline:3px solid var(--gal-primary);outline-offset:3px}

/* the large photo view */
.tgp-gal-lb{position:fixed;inset:0;z-index:100000;background:rgba(10,12,16,.94);display:flex;align-items:center;justify-content:center;padding:56px 64px 48px}
.tgp-gal-lb[hidden]{display:none}
.tgp-gal-lb figure{margin:0;max-width:100%;max-height:100%;display:flex;flex-direction:column;align-items:center;min-width:0}
.tgp-gal-lb img{display:block;max-width:100%;max-height:calc(100vh - 140px);max-height:calc(100dvh - 140px);width:auto;height:auto;object-fit:contain}
.tgp-gal-lb figcaption{color:#e8eaee;margin-top:10px;font-size:.95rem;text-align:center;max-width:60em}
.tgp-gal-lb-count{position:absolute;top:16px;left:16px;color:#c9cdd5;font-size:.9rem;font-weight:700}
.tgp-gal-lb button{position:absolute;width:48px;height:48px;border:0;border-radius:50%;background:rgba(255,255,255,.14);color:#fff;font-size:24px;line-height:1;cursor:pointer;display:grid;place-items:center;padding:0}
.tgp-gal-lb button:hover{background:rgba(255,255,255,.26)}
.tgp-gal-lb button:focus-visible{outline:3px solid #fff;outline-offset:2px}
.tgp-gal-lb-close{top:10px;right:10px}
.tgp-gal-lb-prev{left:10px;top:50%;transform:translateY(-50%)}
.tgp-gal-lb-next{right:10px;top:50%;transform:translateY(-50%)}
.tgp-gal-lb button[hidden]{display:none}
html.tgp-gal-lb-open{overflow:hidden}

/* phone */
@media (max-width:600px){
	.tgp-gal-page{padding:22px 16px 40px}
	.tgp-gal{--gal-gap:4px}
	.tgp-gal--grid .tgp-gal-items{grid-template-columns:repeat(2,minmax(0,1fr))}
	.tgp-gal--mosaic .tgp-gal-items{grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:120px}
	.tgp-gal--mosaic .tgp-gal-item.is-big,.tgp-gal--mosaic .tgp-gal-item.is-big.is-right{grid-column:1 / span 2}
	@supports (width:1cqi){
		.tgp-gal--mosaic .tgp-gal-items{grid-auto-rows:calc((100cqi - var(--gal-gap)) / 2 * .75)}
	}
	.tgp-gal--slideshow .tgp-gal-item{aspect-ratio:4/3}
	.tgp-gal--strip .tgp-gal-item{flex-basis:78%}
	.tgp-gal-arrow{width:38px;height:38px;font-size:19px}
	.tgp-gal--strip .tgp-gal-arrow{display:none}
	.tgp-gal-lb{padding:52px 8px 64px}
	.tgp-gal-lb-prev,.tgp-gal-lb-next{top:auto;bottom:8px;transform:none}
	.tgp-gal-lb-prev{left:calc(50% - 58px)}
	.tgp-gal-lb-next{right:calc(50% - 58px)}
}

@media (prefers-reduced-motion:reduce){
	.tgp-gal--slideshow .tgp-gal-items,.tgp-gal--strip .tgp-gal-items{scroll-behavior:auto}
	.tgp-gal-page *,.tgp-gal-lb *{transition:none!important;animation:none!important}
}
