/* Simple Image Popups — front end.
   Images ALWAYS render at their natural (uploaded) pixel size. */

html.sip-lock { overflow: hidden !important; }

.sip-popup { position: fixed; inset: 0; z-index: 2147483000; }
.sip-popup[hidden] { display: none !important; }

.sip-popup .sip-overlay {
	position: fixed; inset: 0;
	opacity: 0; transition: opacity .3s ease;
}

/* Scroll container: if the image is bigger than the screen, visitors scroll — it is never shrunk. */
.sip-popup .sip-wrap {
	position: fixed; inset: 0;
	display: flex;
	overflow: auto; -webkit-overflow-scrolling: touch;
	padding: 48px 24px; box-sizing: border-box;
}

.sip-popup .sip-box {
	position: relative;
	margin: auto;           /* safe centering: never cuts off oversized images */
	flex: 0 0 auto;
	line-height: 0;
	opacity: 0;
	transition: transform .34s cubic-bezier(.2,.8,.2,1), opacity .34s ease;
}

.sip-popup.sip-is-open .sip-overlay { opacity: 1; }
.sip-popup.sip-is-open .sip-box { opacity: 1; transform: none; }

/* ================= Stage & slides ================= */
/* The stage is sized (inline, in px) to the current image's natural size and
   smoothly resizes when the next slide has a different size. */
.sip-stage {
	position: relative;
	overflow: hidden;
	line-height: 0;
	--d: 1;
	transition: width var(--sip-speed, 0ms) cubic-bezier(.65,0,.35,1), height var(--sip-speed, 0ms) cubic-bezier(.65,0,.35,1);
}
.sip-stage .sip-slide {
	position: absolute; inset: 0;
	display: flex; align-items: center; justify-content: center;
	visibility: hidden;
	backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.sip-stage .sip-slide.is-active { visibility: visible; z-index: 2; }
.sip-stage .sip-slide.is-out { visibility: visible; z-index: 1; }

/* Natural size — override any theme rule like img { max-width:100% } */
.sip-popup .sip-img {
	display: block !important;
	width: auto !important; height: auto !important;
	max-width: none !important; max-height: none !important;
	min-width: 0 !important; min-height: 0 !important;
	margin: 0 !important; padding: 0 !important; border: 0 !important;
	box-shadow: none !important; border-radius: 0 !important;
	object-fit: initial !important;
	flex: 0 0 auto;
}
.sip-popup .sip-link { display: block; line-height: 0; flex: 0 0 auto; }

/* ================= Animations ================= */
.sip-stage .sip-slide.is-in, .sip-stage .sip-slide.is-out {
	animation-duration: var(--sip-speed, 700ms);
	animation-timing-function: cubic-bezier(.65,0,.35,1);
	animation-fill-mode: both;
}

/* Fade */
.sip-anim-fade .is-in, .sip-anim-kenburns .is-in { animation-name: sipFadeIn; }
.sip-anim-fade .is-out, .sip-anim-kenburns .is-out { animation-name: sipFadeOut; }
@keyframes sipFadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes sipFadeOut { from { opacity: 1; } to { opacity: 0; } }

/* Slide horizontal */
.sip-anim-slide .is-in  { animation-name: sipSlideIn; }
.sip-anim-slide .is-out { animation-name: sipSlideOut; }
@keyframes sipSlideIn  { from { transform: translateX(calc(var(--d) * 100%)); } to { transform: none; } }
@keyframes sipSlideOut { from { transform: none; } to { transform: translateX(calc(var(--d) * -100%)); } }

/* Slide vertical */
.sip-anim-slideup .is-in  { animation-name: sipSlideUpIn; }
.sip-anim-slideup .is-out { animation-name: sipSlideUpOut; }
@keyframes sipSlideUpIn  { from { transform: translateY(calc(var(--d) * 100%)); } to { transform: none; } }
@keyframes sipSlideUpOut { from { transform: none; } to { transform: translateY(calc(var(--d) * -100%)); } }

/* Zoom in */
.sip-anim-zoomin .is-in  { animation-name: sipZoomInIn; }
.sip-anim-zoomin .is-out { animation-name: sipZoomInOut; }
@keyframes sipZoomInIn  { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes sipZoomInOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: scale(1.25); } }

/* Zoom out */
.sip-anim-zoomout .is-in  { animation-name: sipZoomOutIn; }
.sip-anim-zoomout .is-out { animation-name: sipZoomOutOut; }
@keyframes sipZoomOutIn  { from { opacity: 0; transform: scale(1.4); } to { opacity: 1; transform: none; } }
@keyframes sipZoomOutOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: scale(.7); } }

/* 3D flips & cube need perspective and visible overflow */
.sip-stage.sip-anim-flip, .sip-stage.sip-anim-flipx, .sip-stage.sip-anim-cube { overflow: visible; perspective: 1600px; }

.sip-anim-flip .is-in  { animation-name: sipFlipIn; }
.sip-anim-flip .is-out { animation-name: sipFlipOut; }
@keyframes sipFlipIn  { 0%, 50% { transform: rotateY(calc(var(--d) * -90deg)); } 100% { transform: none; } }
@keyframes sipFlipOut { 0% { transform: none; } 50%, 100% { transform: rotateY(calc(var(--d) * 90deg)); } }

.sip-anim-flipx .is-in  { animation-name: sipFlipXIn; }
.sip-anim-flipx .is-out { animation-name: sipFlipXOut; }
@keyframes sipFlipXIn  { 0%, 50% { transform: rotateX(calc(var(--d) * 90deg)); } 100% { transform: none; } }
@keyframes sipFlipXOut { 0% { transform: none; } 50%, 100% { transform: rotateX(calc(var(--d) * -90deg)); } }

/* Cube */
.sip-anim-cube .is-in  { animation-name: sipCubeIn; }
.sip-anim-cube .is-out { animation-name: sipCubeOut; }
.sip-anim-cube[data-dir="next"] .is-in,  .sip-anim-cube[data-dir="prev"] .is-out { transform-origin: 0 50%; }
.sip-anim-cube[data-dir="next"] .is-out, .sip-anim-cube[data-dir="prev"] .is-in  { transform-origin: 100% 50%; }
@keyframes sipCubeIn  { from { transform: translateX(calc(var(--d) * 100%)) rotateY(calc(var(--d) * 90deg)); } to { transform: none; } }
@keyframes sipCubeOut { from { transform: none; } to { transform: translateX(calc(var(--d) * -100%)) rotateY(calc(var(--d) * -90deg)); } }

/* Blur dissolve */
.sip-anim-blur .is-in  { animation-name: sipBlurIn; }
.sip-anim-blur .is-out { animation-name: sipBlurOut; }
@keyframes sipBlurIn  { from { opacity: 0; filter: blur(18px); transform: scale(1.06); } to { opacity: 1; filter: blur(0); transform: none; } }
@keyframes sipBlurOut { from { opacity: 1; filter: blur(0); } to { opacity: 0; filter: blur(18px); } }

/* Wipe reveal */
.sip-anim-wipe .is-out { animation-name: sipHold; }
.sip-anim-wipe[data-dir="next"] .is-in { animation-name: sipWipeNext; }
.sip-anim-wipe[data-dir="prev"] .is-in { animation-name: sipWipePrev; }
@keyframes sipHold { from { opacity: 1; } to { opacity: 1; } }
@keyframes sipWipeNext { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0); } }
@keyframes sipWipePrev { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* Spin */
.sip-anim-rotate .is-in  { animation-name: sipRotateIn; }
.sip-anim-rotate .is-out { animation-name: sipRotateOut; }
@keyframes sipRotateIn  { from { opacity: 0; transform: rotate(calc(var(--d) * -15deg)) scale(.7); } to { opacity: 1; transform: none; } }
@keyframes sipRotateOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: rotate(calc(var(--d) * 15deg)) scale(.7); } }

/* Card swipe: old card flies off on top, new one rises underneath */
.sip-stage.sip-anim-cards .sip-slide.is-out { z-index: 3; }
.sip-anim-cards .is-in  { animation-name: sipCardsIn; }
.sip-anim-cards .is-out { animation-name: sipCardsOut; }
@keyframes sipCardsIn  { from { opacity: .3; transform: scale(.86); } to { opacity: 1; transform: none; } }
@keyframes sipCardsOut { from { transform: none; } to { opacity: .4; transform: translateX(calc(var(--d) * -115%)) rotate(calc(var(--d) * -10deg)); } }

/* Ken Burns: fade + slow zoom while the slide is on screen */
.sip-anim-kenburns .sip-slide.is-active .sip-img,
.sip-anim-kenburns .sip-slide.is-out .sip-img {
	animation: sipKen calc(var(--sip-interval, 4000ms) + var(--sip-speed, 700ms) * 2) linear both;
}
.sip-anim-kenburns .sip-slide:nth-child(3n+1) .sip-img { transform-origin: 30% 40% !important; }
.sip-anim-kenburns .sip-slide:nth-child(3n+2) .sip-img { transform-origin: 70% 30% !important; }
.sip-anim-kenburns .sip-slide:nth-child(3n)   .sip-img { transform-origin: 50% 70% !important; }
@keyframes sipKen { from { transform: scale(1); } to { transform: scale(1.12); } }

/* Pause (mouse over) also freezes Ken Burns */
.sip-stage.is-paused .sip-img { animation-play-state: paused !important; }

/* ================= Slideshow controls ================= */
.sip-popup .sip-arrow, .sip-popup .sip-dot {
	all: unset; box-sizing: border-box; cursor: pointer;
}
.sip-popup .sip-arrow {
	position: absolute; top: 50%; z-index: 5;
	width: 42px; height: 42px; margin-top: -21px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	background: rgba(0,0,0,.42); color: #fff;
	-webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
	opacity: .85; transition: opacity .2s, background .2s, transform .2s;
}
.sip-popup .sip-arrow:hover { opacity: 1; background: rgba(0,0,0,.62); }
.sip-popup .sip-prev { left: 12px; }
.sip-popup .sip-next { right: 12px; }
.sip-popup .sip-prev:active { transform: translateX(-2px); }
.sip-popup .sip-next:active { transform: translateX(2px); }
.sip-popup .sip-arrow:focus-visible, .sip-popup .sip-dot:focus-visible { outline: 3px solid #4c8bf5; outline-offset: 2px; }

.sip-popup .sip-dots {
	position: absolute; left: 50%; bottom: 12px; z-index: 5; transform: translateX(-50%);
	display: flex; gap: 6px; align-items: center;
	padding: 6px 9px; border-radius: 20px; background: rgba(0,0,0,.35);
	line-height: 0;
}
.sip-popup .sip-dot {
	width: 8px; height: 8px; border-radius: 8px;
	background: rgba(255,255,255,.55);
	transition: width .3s ease, background .3s ease;
}
.sip-popup .sip-dot.is-active { width: 22px; background: #fff; }

.sip-popup .sip-progress {
	position: absolute; left: 0; right: 0; top: 0; z-index: 5;
	height: 3px; background: rgba(255,255,255,.25); overflow: hidden;
}
.sip-popup .sip-progress i { display: block; height: 100%; width: 0; background: #fff; }

.sip-popup .sip-counter {
	position: absolute; left: 12px; top: 12px; z-index: 5;
	padding: 4px 10px; border-radius: 20px;
	background: rgba(0,0,0,.45); color: #fff;
	font: 600 12px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	letter-spacing: .03em;
}

/* Close button (reset theme button styles) */
.sip-popup .sip-close {
	all: unset;
	box-sizing: border-box;
	position: absolute; top: -14px; right: -14px; z-index: 6;
	width: 34px; height: 34px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	background: #fff; color: #111;
	box-shadow: 0 3px 12px rgba(0,0,0,.28);
	cursor: pointer;
	transition: transform .15s ease, background .15s ease;
}
.sip-popup .sip-close:hover { transform: scale(1.08); }
.sip-popup .sip-close:focus-visible { outline: 3px solid #4c8bf5; outline-offset: 2px; }
.sip-popup .sip-close svg { display: block; }

/* ================= Templates ================= */

/* 1: Classic Center */
.sip-tpl-1 .sip-overlay { background: rgba(0,0,0,.66); }
.sip-tpl-1 .sip-box { transform: scale(.9); }
.sip-tpl-1 .sip-stage { border-radius: 6px; box-shadow: 0 24px 70px rgba(0,0,0,.45); }

/* 2: Corner Slide-in (no overlay) */
.sip-tpl-2 { pointer-events: none; }
.sip-tpl-2 .sip-overlay { display: none; }
.sip-tpl-2 .sip-wrap {
	inset: auto 24px 24px auto;
	display: block; overflow: visible; padding: 0;
	pointer-events: none;
}
.sip-tpl-2 .sip-box { pointer-events: auto; transform: translateX(calc(100% + 48px)); }
.sip-tpl-2 .sip-stage { border-radius: 10px; box-shadow: 0 14px 40px rgba(0,0,0,.3); }

/* 3: Fullscreen Lightbox */
.sip-tpl-3 .sip-overlay {
	background: rgba(8,8,12,.93);
	-webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.sip-tpl-3 .sip-box { transform: none; transition: opacity .45s ease; }
.sip-tpl-3 .sip-wrap { padding: 72px 24px; }
.sip-tpl-3 .sip-close {
	position: fixed; top: 18px; right: 18px;
	width: 46px; height: 46px;
	background: rgba(255,255,255,.12); color: #fff;
	box-shadow: none;
}
.sip-tpl-3 .sip-close:hover { background: rgba(255,255,255,.24); }
.sip-tpl-3 .sip-close svg { width: 22px; height: 22px; }

/* 4: Bottom Drop-up */
.sip-tpl-4 .sip-overlay { background: rgba(0,0,0,.38); }
.sip-tpl-4 .sip-wrap { padding: 48px 0 0; }
.sip-tpl-4 .sip-box { margin: auto auto 0; transform: translateY(100%); }
.sip-tpl-4 .sip-stage { border-radius: 14px 14px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.25); }

/* 5: Top Drop-down (no overlay) */
.sip-tpl-5 { pointer-events: none; }
.sip-tpl-5 .sip-overlay { display: none; }
.sip-tpl-5 .sip-wrap {
	inset: 0 0 auto 0;
	justify-content: center;
	overflow: visible; padding: 0;
	pointer-events: none;
}
.sip-tpl-5 .sip-box { margin: 0 auto; pointer-events: auto; transform: translateY(-110%); }
.sip-tpl-5 .sip-stage { border-radius: 0 0 14px 14px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.sip-tpl-5 .sip-close { top: auto; bottom: -14px; }

.admin-bar .sip-tpl-5 .sip-wrap { top: 32px; }
@media (max-width: 782px) { .admin-bar .sip-tpl-5 .sip-wrap { top: 46px; } }

/* Respect reduced-motion preferences: everything becomes a quick fade */
@media (prefers-reduced-motion: reduce) {
	.sip-popup .sip-box, .sip-popup .sip-overlay { transition: opacity .01s linear !important; transform: none !important; }
	.sip-stage .sip-slide.is-in  { animation: sipFadeIn .2s linear both !important; transform: none !important; clip-path: none !important; }
	.sip-stage .sip-slide.is-out { animation: sipFadeOut .2s linear both !important; transform: none !important; }
	.sip-stage .sip-img { animation: none !important; }
	.sip-stage { transition: none !important; }
}
