/* Tour page gallery: a stage with four different picture transitions (iris, diagonal wipe, blinds, drift). */
@property --tg-w { syntax: '<percentage>'; inherits: false; initial-value: 0%; }

.tgal { --tg-r: 6px; display: grid; gap: 14px; margin-bottom: clamp(28px, 5vw, 56px); }
.tg-stage { position: relative; aspect-ratio: 16 / 9; max-height: min(74vh, 760px); width: 100%; overflow: hidden; border-radius: var(--tg-r); background: #17130f; isolation: isolate; touch-action: pan-y; }
.tg-slide { position: absolute; inset: 0; margin: 0; overflow: hidden; visibility: hidden; }
.tg-slide.is-on { visibility: visible; z-index: 1; }
.tg-slide.is-in { visibility: visible; z-index: 2; }
.tg-bg, .tg-img { position: absolute; inset: 0; width: 100%; height: 100%; }
.tg-bg { object-fit: cover; filter: blur(28px) brightness(.55) saturate(1.1); transform: scale(1.25); }
.tg-img { object-fit: cover; }
.tg-slide.is-por .tg-img { object-fit: contain; }
.tg-slide:not(.is-por) .tg-bg { display: none; }
/* slow push-in on the picture that is on screen */
.tg-slide.is-on .tg-img, .tg-slide.is-in .tg-img { animation: tg-push 9s ease-out both; }
@keyframes tg-push { from { transform: scale(1); } to { transform: scale(1.06); } }
.tg-slide.is-por.is-on .tg-img, .tg-slide.is-por.is-in .tg-img { animation: none; }

.tg-cap { position: absolute; inset-inline: 0; bottom: 0; z-index: 4; padding: 54px clamp(16px, 3vw, 28px) clamp(16px, 2.6vw, 24px); background: linear-gradient(0deg, rgba(23, 19, 15, .72), transparent); color: #fff0e1; font-size: 1rem; line-height: 1.5; pointer-events: none; min-height: 0; }
.tg-cap:empty { display: none; }
.tg-cap { transition: opacity .35s; } .tg-cap.is-sw { opacity: 0; }

.tg-btn { position: absolute; top: 50%; z-index: 5; width: 48px; height: 48px; margin-top: -24px; display: grid; place-items: center; border-radius: var(--tg-r); background: rgba(255, 240, 225, .92); color: #231f20; transition: background .2s, transform .2s; }
.tg-btn:hover { background: #fff; } .tg-btn:active { transform: scale(.94); }
.tg-btn svg { width: 22px; height: 22px; }
.tg-prev { right: 14px; } .tg-next { left: 14px; }
.tg-prev svg { transform: scaleX(-1); }
.tg-bar { position: absolute; inset-inline: 0; bottom: 0; z-index: 6; height: 3px; background: rgba(255, 240, 225, .22); }
.tg-bar i { display: block; height: 100%; width: 100%; background: #fff0e1; transform-origin: right center; transform: scaleX(0); }
.tg-bar.is-run i { animation: tg-bar var(--tg-ms, 5500ms) linear forwards; }
@keyframes tg-bar { to { transform: scaleX(1); } }
.tg-meta { position: absolute; top: 14px; left: 14px; z-index: 5; display: flex; gap: 8px; align-items: center; }
.tg-count { padding: 5px 12px; border-radius: var(--tg-r); background: rgba(35, 31, 32, .66); color: #fff0e1; font-size: .95rem; font-variant-numeric: tabular-nums; direction: ltr; }
.tg-play { width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--tg-r); background: rgba(35, 31, 32, .66); color: #fff0e1; }
.tg-play svg { width: 16px; height: 16px; } .tg-play .i-play { display: none; } .tgal.is-paused .tg-play .i-play { display: block; } .tgal.is-paused .tg-play .i-pause { display: none; }
.tg-btn:focus-visible, .tg-play:focus-visible, .tg-th:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 5px #774b1a; }

.tg-thumbs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; scroll-snap-type: x proximity; }
.tg-th { flex: 0 0 auto; width: clamp(84px, 11vw, 124px); aspect-ratio: 4 / 3; border-radius: 4px; overflow: hidden; opacity: .5; border: 2px solid transparent; transition: opacity .25s, border-color .25s; scroll-snap-align: center; background: #17130f; }
.tg-th img { width: 100%; height: 100%; object-fit: cover; }
.tg-th:hover { opacity: .85; } .tg-th[aria-current="true"] { opacity: 1; border-color: #fff0e1; }

/* ---- the four transitions: the incoming slide (.is-in) is revealed on top of the current one ---- */
/* 1. iris: a circle opens from the point the visitor pressed (or the centre) */
.tg-slide.fx-iris.is-in { animation: tg-iris 1.05s var(--ease) both; }
@keyframes tg-iris { from { clip-path: circle(0% at var(--tg-x, 50%) var(--tg-y, 50%)); } to { clip-path: circle(150% at var(--tg-x, 50%) var(--tg-y, 50%)); } }
/* 2. diagonal wipe */
.tg-slide.fx-wipe.is-in { animation: tg-wipe 1s var(--ease) both; }
@keyframes tg-wipe { from { clip-path: polygon(100% 0, 100% 0, 100% 0, 100% 0); } to { clip-path: polygon(100% 0, 100% 100%, -40% 100%, 0 0); } }
.tg-slide.fx-wipe.is-rev.is-in { animation-name: tg-wipe-r; }
@keyframes tg-wipe-r { from { clip-path: polygon(0 0, 0 0, 0 0, 0 0); } to { clip-path: polygon(0 0, 0 100%, 140% 100%, 100% 0); } }
/* 3. blinds: vertical slats open */
.tg-slide.fx-blinds.is-in { animation: tg-blinds 1.1s var(--ease) both; -webkit-mask-image: repeating-linear-gradient(90deg, #000 0, #000 var(--tg-w), transparent var(--tg-w), transparent 12.5%); mask-image: repeating-linear-gradient(90deg, #000 0, #000 var(--tg-w), transparent var(--tg-w), transparent 12.5%); }
@keyframes tg-blinds { from { --tg-w: 0%; } to { --tg-w: 12.6%; } }
/* 4. drift: soft cross-fade with a push from slightly closer and a little blur */
.tg-slide.fx-drift.is-in { animation: tg-drift 1.2s ease both; }
@keyframes tg-drift { from { opacity: 0; filter: blur(10px); transform: scale(1.08); } to { opacity: 1; filter: blur(0); transform: scale(1); } }
.tg-slide.fx-fade.is-in { animation: tg-fade .5s ease both; } @keyframes tg-fade { from { opacity: 0; } to { opacity: 1; } }

/* without JavaScript the pictures simply sit in a grid */
.tgal:not(.is-js) .tg-stage { aspect-ratio: auto; max-height: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; background: none; }
.tgal:not(.is-js) .tg-slide { position: relative; visibility: visible; aspect-ratio: 4 / 3; border-radius: 4px; }
.tgal:not(.is-js) .tg-btn, .tgal:not(.is-js) .tg-meta, .tgal:not(.is-js) .tg-bar, .tgal:not(.is-js) .tg-thumbs { display: none; }

@media (max-width: 700px) {
  .tg-stage { aspect-ratio: 4 / 3; max-height: 70vh; }
  .tg-btn { width: 40px; height: 40px; margin-top: -20px; } .tg-prev { right: 8px; } .tg-next { left: 8px; }
  .tg-meta { top: 8px; left: 8px; }
  .tg-cap { font-size: .92rem; padding-top: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .tg-slide.is-on .tg-img, .tg-slide.is-in .tg-img { animation: none; }
  .tg-slide.is-in { animation: tg-fade .3s ease both !important; -webkit-mask-image: none !important; mask-image: none !important; clip-path: none !important; }
}
