.simple-gallery {
    --sg-cols-desktop: 4;
    --sg-cols-tablet: 2;
    --sg-cols-mobile: 1;
    --sg-gap: 10px;
    --sg-radius: 0px;
    --sg-lightbox-opacity: 0.92;
    --sg-row-height: 280px;
    --sg-masonry-target-width: 260px;
    --sg-row-max-height: 320px;
    --sg-feature-height: 560px;
    --sg-slide-basis-desktop: 25%;
    --sg-slide-basis-tablet: 50%;
    --sg-slide-basis-mobile: 100%;
    width: 100%;
    min-width: 0;
}

.simple-gallery-display {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
    gap: min(12px, var(--sg-gap));
}

.simple-gallery-viewport {
    position: relative;
    width: 100%;
    min-width: 0;
}

.simple-gallery-grid {
    width: 100%;
    min-width: 0;
}

.simple-gallery-item {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    line-height: inherit;
    text-align: left;
    text-decoration: none;
}

button.simple-gallery-item {
    cursor: zoom-in;
}

.sg-viewer-disabled .simple-gallery-item {
    cursor: default;
}

.simple-gallery-media {
    position: relative;
    display: block;
    width: 100%;
    overflow: hidden;
    border-radius: var(--sg-radius);
    background: #e8eaec;
    isolation: isolate;
}

.simple-gallery-media img {
    position: relative;
    z-index: 0;
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0;
    transition: transform 0.5s ease, opacity 0.35s ease;
}

.sg-ratio-square .simple-gallery-media {
    aspect-ratio: 1 / 1;
}

.sg-ratio-four-three .simple-gallery-media {
    aspect-ratio: 4 / 3;
}

.sg-ratio-sixteen-nine .simple-gallery-media {
    aspect-ratio: 16 / 9;
}

.sg-ratio-square .simple-gallery-media img,
.sg-ratio-four-three .simple-gallery-media img,
.sg-ratio-sixteen-nine .simple-gallery-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.simple-gallery-thumb-title {
    display: block;
    padding: 8px 2px 2px;
    color: inherit;
    font-weight: 600;
    line-height: 1.3;
}

/* Classic grid */
.sg-layout-grid .simple-gallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--sg-cols-desktop), minmax(0, 1fr));
    gap: var(--sg-gap);
}

/* Masonry. Native JavaScript measures complete rendered cards and packs them into
   the shortest column after responsive widths have been resolved. */
.sg-layout-masonry .simple-gallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--sg-cols-desktop), minmax(0, 1fr));
    gap: var(--sg-gap);
}

.sg-layout-masonry.sg-masonry-ready .simple-gallery-grid {
    position: relative;
    display: block;
    margin-inline: auto;
}

.sg-layout-masonry.sg-masonry-ready .simple-gallery-item {
    position: absolute;
    inset: 0 auto auto 0;
    box-sizing: border-box;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0;
    overflow: visible;
    will-change: transform;
}

.sg-layout-masonry.sg-masonry-measuring .simple-gallery-item {
    visibility: hidden;
    transition: none !important;
}

.sg-layout-masonry.sg-masonry-initialised:not(.sg-masonry-measuring) .simple-gallery-item {
    transition: transform 0.24s ease;
}

@media (prefers-reduced-motion: reduce) {
    .sg-layout-masonry.sg-masonry-initialised .simple-gallery-item {
        transition: none;
    }
}

/* Justified rows. JavaScript writes exact item dimensions. */
.sg-layout-justified .simple-gallery-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--sg-gap);
}

.sg-layout-justified .simple-gallery-item {
    flex: 0 0 auto;
}

.sg-layout-justified .simple-gallery-media,
.sg-layout-justified .simple-gallery-media img {
    width: 100%;
    height: 100%;
}

.sg-layout-justified .simple-gallery-media img {
    object-fit: cover;
}

/* Mosaic / Bento */
.sg-layout-mosaic .simple-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: clamp(110px, 12vw, 210px);
    grid-auto-flow: dense;
    gap: var(--sg-gap);
}

.sg-layout-mosaic .simple-gallery-item {
    height: 100%;
}

.sg-layout-mosaic .simple-gallery-media,
.sg-layout-mosaic .simple-gallery-media img {
    width: 100%;
    height: 100%;
}

.sg-layout-mosaic .simple-gallery-media img {
    object-fit: cover;
}

.sg-layout-mosaic .simple-gallery-item:nth-child(12n + 1),
.sg-layout-mosaic .simple-gallery-item:nth-child(12n + 8) {
    grid-column: span 2;
    grid-row: span 2;
}

.sg-layout-mosaic .simple-gallery-item:nth-child(12n + 4),
.sg-layout-mosaic .simple-gallery-item:nth-child(12n + 11) {
    grid-column: span 2;
}

/* Polaroid cards */
.sg-layout-polaroid .simple-gallery-grid {
    display: grid;
    grid-template-columns: repeat(var(--sg-cols-desktop), minmax(0, 1fr));
    gap: calc(var(--sg-gap) + 12px);
    padding: 10px;
}

.sg-layout-polaroid .simple-gallery-item {
    padding: 10px 10px 30px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff;
    color: #202124;
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.16);
    transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.sg-layout-polaroid.sg-card-tilt .simple-gallery-item:nth-child(4n + 1) { transform: rotate(-1.4deg); }
.sg-layout-polaroid.sg-card-tilt .simple-gallery-item:nth-child(4n + 2) { transform: rotate(1deg); }
.sg-layout-polaroid.sg-card-tilt .simple-gallery-item:nth-child(4n + 3) { transform: rotate(-0.6deg); }
.sg-layout-polaroid.sg-card-tilt .simple-gallery-item:nth-child(4n) { transform: rotate(1.5deg); }

.sg-layout-polaroid .simple-gallery-item:hover,
.sg-layout-polaroid .simple-gallery-item:focus-visible {
    z-index: 2;
    transform: translateY(-4px) rotate(0deg);
    box-shadow: 0 13px 28px rgba(0, 0, 0, 0.22);
}

.sg-layout-polaroid .simple-gallery-media {
    border-radius: min(var(--sg-radius), 6px);
}

.sg-layout-polaroid .simple-gallery-thumb-title {
    padding: 12px 2px 0;
    text-align: center;
    font-family: "Segoe Print", "Bradley Hand", cursive;
}

/* Featured image + thumbnail strip */
.sg-layout-featured .simple-gallery-viewport,
.sg-layout-featured .simple-gallery-grid {
    height: var(--sg-feature-height);
}

.sg-layout-featured .simple-gallery-grid {
    position: relative;
    overflow: hidden;
    border-radius: var(--sg-radius);
    background: #111;
}

.sg-layout-featured .simple-gallery-item {
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.sg-layout-featured .simple-gallery-item.is-active {
    z-index: 1;
    opacity: 1;
    pointer-events: auto;
}

.sg-layout-featured .simple-gallery-media,
.sg-layout-featured .simple-gallery-media img {
    width: 100%;
    height: 100%;
}

.sg-layout-featured .simple-gallery-media img {
    object-fit: contain;
}

.sg-layout-featured .simple-gallery-thumb-title {
    position: absolute;
    z-index: 3;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 18px 18px 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.76));
    color: #fff;
}

.sg-featured-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-bottom: 4px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.sg-featured-thumb {
    flex: 0 0 92px;
    height: 66px;
    padding: 0;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: max(2px, var(--sg-radius));
    background: #ddd;
    cursor: pointer;
    opacity: 0.68;
}

.sg-featured-thumb.is-active,
.sg-featured-thumb:hover,
.sg-featured-thumb:focus-visible {
    border-color: #f47a10;
    opacity: 1;
}

.sg-featured-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Carousel / filmstrip */
.sg-layout-carousel .simple-gallery-viewport {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
}

.sg-layout-carousel .simple-gallery-grid {
    display: flex;
    gap: var(--sg-gap);
}

.sg-layout-carousel .simple-gallery-item {
    flex: 0 0 var(--sg-slide-basis-desktop);
    scroll-snap-align: start;
}

/* Photo stack */
.sg-layout-stack .simple-gallery-viewport,
.sg-layout-stack .simple-gallery-grid {
    height: var(--sg-feature-height);
}

.sg-layout-stack .simple-gallery-grid {
    position: relative;
    perspective: 1200px;
}

.sg-layout-stack .simple-gallery-item {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(82%, 980px);
    height: calc(var(--sg-feature-height) - 42px);
    transform: translate(-50%, -50%) scale(0.84) rotate(0deg);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.42s ease, opacity 0.42s ease;
}

.sg-layout-stack .simple-gallery-item.is-active {
    z-index: 5;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
    opacity: 1;
    pointer-events: auto;
}

.sg-layout-stack .simple-gallery-item.is-before {
    z-index: 3;
    transform: translate(-54%, -50%) scale(0.92) rotate(-3deg);
    opacity: 0.56;
}

.sg-layout-stack .simple-gallery-item.is-after {
    z-index: 4;
    transform: translate(-46%, -50%) scale(0.92) rotate(3deg);
    opacity: 0.7;
}

.sg-layout-stack .simple-gallery-media,
.sg-layout-stack .simple-gallery-media img {
    width: 100%;
    height: 100%;
}

.sg-layout-stack .simple-gallery-media img {
    object-fit: contain;
}

/* Coverflow */
.sg-layout-coverflow .simple-gallery-viewport,
.sg-layout-coverflow .simple-gallery-grid {
    height: var(--sg-feature-height);
}

.sg-layout-coverflow .simple-gallery-viewport {
    overflow: hidden;
    perspective: 1400px;
}

.sg-layout-coverflow .simple-gallery-grid {
    position: relative;
    transform-style: preserve-3d;
}

.sg-layout-coverflow .simple-gallery-item {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(66%, 900px);
    height: calc(var(--sg-feature-height) - 44px);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.72);
    transition: transform 0.45s ease, opacity 0.45s ease, filter 0.45s ease;
}

.sg-layout-coverflow .simple-gallery-item.is-active {
    z-index: 5;
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) translateZ(80px) scale(1);
    filter: none;
}

.sg-layout-coverflow .simple-gallery-item.is-before {
    z-index: 3;
    opacity: 0.62;
    transform: translate(-92%, -50%) rotateY(38deg) scale(0.78);
    filter: brightness(0.68);
}

.sg-layout-coverflow .simple-gallery-item.is-after {
    z-index: 4;
    opacity: 0.72;
    transform: translate(-8%, -50%) rotateY(-38deg) scale(0.78);
    filter: brightness(0.75);
}

.sg-layout-coverflow .simple-gallery-media,
.sg-layout-coverflow .simple-gallery-media img {
    width: 100%;
    height: 100%;
}

.sg-layout-coverflow .simple-gallery-media img {
    object-fit: contain;
}

/* Full-width slideshow */
.sg-layout-slideshow .simple-gallery-viewport,
.sg-layout-slideshow .simple-gallery-grid {
    height: var(--sg-feature-height);
}

.sg-layout-slideshow .simple-gallery-grid {
    position: relative;
    overflow: hidden;
    border-radius: var(--sg-radius);
    background: #111;
}

.sg-layout-slideshow .simple-gallery-item {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.55s ease;
}

.sg-layout-slideshow .simple-gallery-item.is-active {
    z-index: 1;
    opacity: 1;
    pointer-events: auto;
}

.sg-layout-slideshow .simple-gallery-media,
.sg-layout-slideshow .simple-gallery-media img {
    width: 100%;
    height: 100%;
}

.sg-layout-slideshow .simple-gallery-media img {
    object-fit: contain;
}

.sg-layout-slideshow .simple-gallery-thumb-title {
    position: absolute;
    z-index: 3;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 24px 20px 14px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
    color: #fff;
}

/* Style navigation */
.sg-style-arrow {
    position: relative;
    z-index: 10;
    flex: 0 0 44px;
    width: 44px;
    height: 64px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: rgba(20, 24, 28, 0.76);
    color: #fff;
    font-size: 34px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.sg-style-arrow:hover,
.sg-style-arrow:focus-visible {
    background: #f47a10;
    transform: scale(1.04);
}

.sg-style-dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
    margin-top: 11px;
}

.sg-style-dot {
    width: 10px;
    height: 10px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #aab1b8;
    cursor: pointer;
    transition: width 0.2s ease, background 0.2s ease;
}

.sg-style-dot.is-active {
    width: 28px;
    background: #f47a10;
}

/* White swipe and zoom */
.sg-hover-swipe .simple-gallery-media::before,
.sg-hover-swipe .simple-gallery-media::after {
    content: "";
    position: absolute;
    z-index: 2;
    top: -14%;
    bottom: -14%;
    pointer-events: none;
    transform: skewX(-18deg);
    will-change: left;
}

.sg-hover-swipe .simple-gallery-media::before {
    left: -78%;
    width: 52%;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.18) 28%, rgba(255,255,255,.48) 52%, rgba(255,255,255,.12) 76%, rgba(255,255,255,0));
    transition: left .64s cubic-bezier(.22,.61,.36,1);
}

.sg-hover-swipe .simple-gallery-media::after {
    left: -45%;
    width: 12%;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.72), rgba(255,255,255,0));
    transition: left .72s cubic-bezier(.22,.61,.36,1);
}

@media (hover: hover) {
    .sg-hover-swipe .simple-gallery-item:hover .simple-gallery-media::before,
    .sg-hover-swipe .simple-gallery-item:focus-visible .simple-gallery-media::before { left: 132%; }
    .sg-hover-swipe .simple-gallery-item:hover .simple-gallery-media::after,
    .sg-hover-swipe .simple-gallery-item:focus-visible .simple-gallery-media::after { left: 142%; }
    .sg-hover-swipe .simple-gallery-item:hover .simple-gallery-media img,
    .sg-hover-swipe .simple-gallery-item:focus-visible .simple-gallery-media img,
    .sg-hover-zoom .simple-gallery-item:hover .simple-gallery-media img,
    .sg-hover-zoom .simple-gallery-item:focus-visible .simple-gallery-media img { transform: scale(1.055); }
}

/* Shared full-size viewer */
.simple-gallery-lightbox[hidden] { display: none; }

.simple-gallery-lightbox {
    position: fixed;
    z-index: 100000;
    inset: 0;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) 58px;
    align-items: center;
    gap: 12px;
    padding: 24px;
    background: rgba(0, 0, 0, var(--sg-lightbox-opacity));
}


/* A one-image gallery does not need empty previous/next navigation columns. */
.simple-gallery-lightbox.sg-single-image-viewer {
    grid-template-columns: minmax(0, 1fr);
}

.simple-gallery-lightbox.sg-single-image-viewer .sg-stage {
    width: 100%;
    max-width: 100%;
}

.simple-gallery-lightbox.sg-single-image-viewer .sg-prev,
.simple-gallery-lightbox.sg-single-image-viewer .sg-next {
    display: none !important;
}

.sg-stage { min-width: 0; text-align: center; }
.sg-image-wrap { position: relative; display: inline-block; max-width: 100%; }
.sg-main { display: block; width: auto; height: auto; max-width: 100%; max-height: calc(100vh - 100px); margin: 0 auto; object-fit: contain; }
.sg-caption { min-height: 1.5rem; padding-top: 9px; color: #fff; font-weight: 600; line-height: 1.35; }
.sg-caption[hidden], .sg-captions-disabled .sg-caption { display: none !important; min-height: 0; padding-top: 0; }

.sg-close,
.sg-prev,
.sg-next {
    border: 0;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.sg-close:hover,
.sg-prev:hover,
.sg-next:hover,
.sg-close:focus-visible,
.sg-prev:focus-visible,
.sg-next:focus-visible { background: #f47a10; color: #fff; }

.sg-prev, .sg-next { width: 58px; height: 74px; padding: 0; font-size: 44px; line-height: 1; }
.sg-close { position: absolute; z-index: 3; top: 12px; right: 14px; width: 48px; height: 48px; padding: 0; font-size: 34px; line-height: 1; }

.sg-logo { position: absolute; z-index: 2; display: block; width: var(--sg-logo-width, 12%) !important; max-width: none !important; height: auto; opacity: var(--sg-logo-opacity, .85) !important; pointer-events: none; }
.sg-top-left { top: 3%; left: 3%; }
.sg-top-centre { top: 3%; left: 50%; transform: translateX(-50%); }
.sg-top-right { top: 3%; right: 3%; }
.sg-centre-left { top: 50%; left: 3%; transform: translateY(-50%); }
.sg-centre { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.sg-centre-right { top: 50%; right: 3%; transform: translateY(-50%); }
.sg-bottom-left { bottom: 3%; left: 3%; }
.sg-bottom-centre { bottom: 3%; left: 50%; transform: translateX(-50%); }
.sg-bottom-right { right: 1.5%; bottom: 3%; }

@media (max-width: 991.98px) {
    .sg-layout-masonry .simple-gallery-grid { grid-template-columns: repeat(var(--sg-cols-tablet), minmax(0, 1fr)); }
    .sg-layout-grid .simple-gallery-grid,
    .sg-layout-polaroid .simple-gallery-grid { grid-template-columns: repeat(var(--sg-cols-tablet), minmax(0, 1fr)); }
    .sg-layout-carousel .simple-gallery-item { flex-basis: var(--sg-slide-basis-tablet); }
    .sg-layout-mosaic .simple-gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .sg-layout-mosaic .simple-gallery-item:nth-child(12n + 1),
    .sg-layout-mosaic .simple-gallery-item:nth-child(12n + 8) { grid-column: span 2; grid-row: span 2; }
}

@media (max-width: 575.98px) {
    .simple-gallery-display { gap: 4px; }
    .sg-layout-masonry .simple-gallery-grid { grid-template-columns: repeat(var(--sg-cols-mobile), minmax(0, 1fr)); }
    .sg-layout-grid .simple-gallery-grid,
    .sg-layout-polaroid .simple-gallery-grid { grid-template-columns: repeat(var(--sg-cols-mobile), minmax(0, 1fr)); }
    .sg-layout-carousel .simple-gallery-item { flex-basis: var(--sg-slide-basis-mobile); }
    .sg-layout-mosaic .simple-gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 125px; }
    .sg-layout-mosaic .simple-gallery-item:nth-child(n) { grid-column: span 1; grid-row: span 1; }
    .sg-layout-mosaic .simple-gallery-item:nth-child(7n + 1) { grid-column: span 2; grid-row: span 2; }
    .sg-layout-featured .simple-gallery-viewport,
    .sg-layout-featured .simple-gallery-grid,
    .sg-layout-stack .simple-gallery-viewport,
    .sg-layout-stack .simple-gallery-grid,
    .sg-layout-coverflow .simple-gallery-viewport,
    .sg-layout-coverflow .simple-gallery-grid,
    .sg-layout-slideshow .simple-gallery-viewport,
    .sg-layout-slideshow .simple-gallery-grid { height: min(var(--sg-feature-height), 68vh); }
    .sg-layout-stack .simple-gallery-item,
    .sg-layout-coverflow .simple-gallery-item { height: calc(min(var(--sg-feature-height), 68vh) - 30px); }
    .sg-layout-coverflow .simple-gallery-item { width: 80%; }
    .sg-layout-coverflow .simple-gallery-item.is-before { transform: translate(-82%, -50%) rotateY(34deg) scale(.72); }
    .sg-layout-coverflow .simple-gallery-item.is-after { transform: translate(-18%, -50%) rotateY(-34deg) scale(.72); }
    .sg-style-arrow { flex-basis: 36px; width: 36px; height: 56px; font-size: 29px; }
    .simple-gallery-lightbox { grid-template-columns: 42px minmax(0, 1fr) 42px; gap: 4px; padding: 8px; }
    .sg-prev, .sg-next { width: 42px; height: 64px; font-size: 34px; }
    .sg-main { max-height: calc(100vh - 82px); }
}

@media (prefers-reduced-motion: reduce) {
    .simple-gallery-media img,
    .sg-hover-swipe .simple-gallery-media::before,
    .sg-hover-swipe .simple-gallery-media::after,
    .simple-gallery-item,
    .sg-style-arrow,
    .sg-close,
    .sg-prev,
    .sg-next { transition: none !important; scroll-behavior: auto !important; }
}
