.casite-image-gallery.wp-block-gallery{display:grid;grid-template-columns:minmax(0,1fr);gap:12px;margin-block:24px}
.casite-image-gallery.wp-block-gallery>figure.wp-block-image{position:relative;width:100%!important;margin:0!important;display:flex;flex-direction:column;border:1px solid var(--wp--preset--color--border,#ddd);border-radius:8px;overflow:hidden;background:var(--wp--preset--color--surface,#fff);color:var(--wp--preset--color--contrast,#172d2c)}
.casite-image-gallery.wp-block-gallery>figure.wp-block-image img{display:block;width:100%;height:auto;aspect-ratio:4/3;object-fit:cover;cursor:zoom-in}
.casite-image-gallery.wp-block-gallery>figure.wp-block-image figcaption,.wp-block-image.casite-image figcaption{position:static!important;flex:0 0 auto;overflow:visible!important;background:var(--wp--preset--color--contrast,#172d2c)!important;color:var(--wp--preset--color--base,#fff)!important;padding:8px 10px;margin:0;max-height:none!important;font-family:var(--wp--preset--font-family--display);font-size:11.2px;font-weight:700;text-transform:uppercase;letter-spacing:.06em;text-align:center;border-top:1px solid var(--wp--preset--color--border,#ddd)}
.casite-image-gallery .casite-gallery-expand{position:absolute;right:8px;bottom:8px;width:44px;height:44px;border:1px solid #ffffff99;border-radius:8px;background:#111c;color:#fff;font-size:26px;cursor:pointer}
.casite-image-gallery[data-image-count="1"]{max-width:1024px!important;margin-inline:auto}
.casite-image-gallery[data-image-count="1"]>figure.wp-block-image img{aspect-ratio:auto 4/3;object-fit:contain}
@media(min-width:640px){.casite-image-gallery:not([data-image-count="1"]){grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(min-width:1280px){.casite-image-gallery:not([data-image-count="1"]):not([data-image-count="2"]){grid-template-columns:repeat(3,minmax(0,1fr))}}
.casite-image-viewer{inset:0;margin:0;width:100vw;max-width:none;height:100dvh;max-height:none;border:0;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);background:rgb(17 17 17 / 95%);backdrop-filter:blur(12px);color:#fff;box-sizing:border-box}
.casite-image-viewer[open]{display:flex;flex-direction:column}
.casite-image-viewer::backdrop{background:transparent}
.casite-image-viewer header{display:flex;align-items:center;gap:12px;min-height:64px;padding:12px 16px;border-bottom:1px solid #ffffff1a;box-sizing:border-box;background:#0006}
.casite-image-viewer h2{flex:1;min-width:0;text-align:center;font-size:clamp(16px,2vw,20px);line-height:1.4;max-height:25dvh;overflow:auto;overflow-wrap:anywhere;margin:0;color:inherit}
.casite-image-viewer button{display:grid;place-items:center;flex-shrink:0;width:48px;height:48px;border:1px solid #ffffff99;border-radius:8px;background:#0006;color:#fff;font-size:28px;cursor:pointer}
.casite-image-viewer header button{width:44px;height:44px}
.casite-image-viewer button:disabled{opacity:.4;cursor:default}
.casite-image-viewer button:focus-visible,.casite-gallery-expand:focus-visible{outline:2px solid var(--wp--preset--color--accent,#e7bd67);outline-offset:3px}
.casite-image-viewer-stage{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;overflow:auto;padding:16px 12px;touch-action:pan-y}
.casite-image-viewer-stage img{display:block;max-width:min(1152px,100%);max-height:70dvh;width:auto;height:auto;object-fit:contain;border-radius:8px;background:#000}
.casite-image-viewer nav{display:flex;min-height:80px;box-sizing:border-box;justify-content:center;align-items:center;gap:16px;padding:12px 16px;border-top:1px solid #ffffff1a;background:#0009}
.casite-image-viewer nav[hidden]{display:none}.casite-image-viewer nav span{min-width:80px;text-align:center}
@media print{.casite-image-viewer,.casite-gallery-expand{display:none!important}}
/* Gallery media uses full frames and thumbnails, not card dots/peek. */
.casite-media-carousel .casite-image-gallery,.editor-styles-wrapper .casite-image-gallery.casite-gallery-carousel{display:flex;flex-wrap:nowrap;gap:16px;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none;margin-block:24px 0}
.casite-media-carousel .casite-image-gallery::-webkit-scrollbar{display:none}
.casite-media-carousel .casite-image-gallery>figure.wp-block-image,.editor-styles-wrapper .casite-image-gallery.casite-gallery-carousel>figure.wp-block-image{flex:0 0 100%;min-width:0;scroll-snap-align:start}
.casite-media-counter{min-width:80px;text-align:center}
.casite-media-thumbnails{display:flex;gap:8px;overflow-x:auto;width:max-content;max-width:100%;margin:12px auto 0;padding:4px}
.casite-media-thumbnails button{flex:0 0 80px;width:80px;height:64px;padding:0;overflow:hidden;border:2px solid transparent;border-radius:8px;opacity:.65;cursor:pointer;background:transparent}
.casite-media-thumbnails button[aria-current="true"]{border-color:var(--wp--preset--color--primary);opacity:1}
.casite-media-thumbnails img{display:block;width:100%;height:100%;object-fit:cover}
.casite-media-thumbnails button:focus-visible{outline:2px solid var(--wp--preset--color--primary);outline-offset:2px}
.casite-media-thumbnails[hidden]{display:none}
@media print{.casite-media-carousel .casite-image-gallery{display:grid;overflow:visible}.casite-media-thumbnails{display:none!important}}

.casite-gallery-frame{position:relative;overflow:hidden;flex-shrink:0}
.casite-gallery-expand{display:grid;place-items:center}

.casite-media-thumbnails{box-sizing:border-box;scrollbar-width:none}.casite-media-thumbnails::-webkit-scrollbar{display:none}
/* Native editor has no rendered count attribute; derive the same sparse rules. */
.editor-styles-wrapper .casite-image-gallery:not(:has(>figure.wp-block-image:nth-of-type(2))){grid-template-columns:minmax(0,1fr);max-width:1024px!important;margin-inline:auto}
.editor-styles-wrapper .casite-image-gallery:not(:has(>figure.wp-block-image:nth-of-type(2)))>figure.wp-block-image img{aspect-ratio:auto 4/3;object-fit:contain}
@media(min-width:1280px){.editor-styles-wrapper .casite-image-gallery:has(>figure.wp-block-image:nth-of-type(2)):not(:has(>figure.wp-block-image:nth-of-type(3))){grid-template-columns:repeat(2,minmax(0,1fr))}}

.casite-image-viewer-stage img[hidden],.casite-image-viewer-stage p[hidden]{display:none}
.casite-media-thumbnails button{color:inherit}
.casite-media-thumbnails button[aria-current="true"]{border-color:currentColor}
.casite-media-thumbnails button:focus-visible{outline-color:currentColor}

/* Standalone native Image: normal content flow, shared caption and optional viewer. */
.casite-image-error{margin:0;padding:24px;background:var(--wp--preset--color--surface,#fff);color:var(--wp--preset--color--contrast,#172d2c);text-align:center}
.wp-block-image.casite-image{box-sizing:border-box;overflow:hidden;border:1px solid var(--wp--preset--color--border,#ddd);border-radius:4px;background:var(--wp--preset--color--surface,#fff);margin-block:24px}
.wp-block-image.casite-image img{display:block;width:100%;height:auto;aspect-ratio:auto;object-fit:contain}
/* Core resolves dimensions after load; reserve the reference fallback until then. */
.editor-styles-wrapper .wp-block-image.casite-image img:not([width]):not([height]):not([style*="aspect-ratio"]){aspect-ratio:4/3;object-fit:contain}
.wp-block-image.casite-image.alignwide{max-width:1024px!important}
.casite-single-image.casite-image-gallery:not(.alignwide):not(.alignfull){max-width:var(--wp--style--global--content-size,768px)!important}
.casite-single-image.casite-image-gallery>figure.casite-image{box-sizing:border-box;max-width:100%}
.casite-single-image[data-image-count="1"]>figure.casite-image img:not([style*="aspect-ratio"]){aspect-ratio:auto}

/* A gallery in a Team biography is embedded content, not a page section. */
.casite-team-biography .casite-gallery-section,
.editor-styles-wrapper.post-type-casite_team .casite-gallery-section{padding:0;margin-inline:0;width:100%;max-width:100%}
/* Optional native heading turns an embedded gallery into the profile gallery section. */
:is(.casite-team-biography,.editor-styles-wrapper.post-type-casite_team) .casite-gallery-section:has(> .wp-block-heading){margin-block-start:16px;border-top:1px solid var(--wp--preset--color--border,#ded8cf);padding-top:24px}
:is(.casite-team-biography,.editor-styles-wrapper.post-type-casite_team) .casite-gallery-section > .wp-block-heading{font-size:18px;line-height:28px;font-weight:700;letter-spacing:-.025em;text-transform:uppercase;margin:0;padding:0;border:0}
:is(.casite-team-biography,.editor-styles-wrapper.post-type-casite_team) .casite-gallery-section:has(> .wp-block-heading) > .casite-image-gallery{margin-block:16px 0}

/* Reference gallery card feedback; media frame clips scale without moving captions. */
:is(.casite-image-gallery.wp-block-gallery>figure.wp-block-image,.wp-block-image.casite-image){box-shadow:0 1px 2px 0 rgb(0 0 0 / .05);transition:border-color .15s,box-shadow .15s}
:is(.casite-image-gallery.wp-block-gallery>figure.wp-block-image,.wp-block-image.casite-image):hover{border-color:var(--wp--preset--color--primary,#16685e);box-shadow:0 4px 6px -1px rgb(0 0 0 / .1),0 2px 4px -2px rgb(0 0 0 / .1)}
:is(.casite-image-gallery.wp-block-gallery>figure.wp-block-image,.wp-block-image.casite-image) img{transition:transform .3s}
:is(.casite-image-gallery.wp-block-gallery>figure.wp-block-image,.wp-block-image.casite-image):hover img{transform:scale(1.02)}
@media(min-width:640px){.casite-image-gallery .casite-gallery-expand{right:12px;bottom:12px}}
@media(prefers-reduced-motion:reduce){:is(.casite-image-gallery.wp-block-gallery>figure.wp-block-image,.wp-block-image.casite-image),:is(.casite-image-gallery.wp-block-gallery>figure.wp-block-image,.wp-block-image.casite-image) img{transition:none}}

@media(min-width:640px){.casite-image-viewer header{padding-inline:24px}.casite-image-viewer-stage{padding:24px 32px}}
/* The editor shows a bounded rail with a visible next item; visitor focus is unchanged. */
.editor-styles-wrapper .casite-image-gallery.casite-gallery-carousel{scrollbar-width:auto;align-items:flex-start}
.editor-styles-wrapper .casite-image-gallery.casite-gallery-carousel>figure.wp-block-image{flex-basis:min(85%,520px)!important;max-width:520px!important;align-self:flex-start;justify-content:flex-start}
.editor-styles-wrapper .casite-image-gallery.casite-gallery-carousel>figure.wp-block-image img{height:auto!important;max-height:none;aspect-ratio:4/3;object-fit:cover;flex:none}

/* Owner-directed contrast refinement; preserve component geometry. */
:is(.casite-background-dark,.casite-background-brand,.casite-component-background.is-style-casite-section-dark,.casite-component-background.is-style-casite-section-brand) .wp-block-image.casite-image figcaption,:is(.casite-background-dark,.casite-background-brand,.casite-component-background.is-style-casite-section-dark,.casite-component-background.is-style-casite-section-brand) .casite-image-gallery.wp-block-gallery>figure.wp-block-image figcaption{background:#fff!important;color:#172d2c!important}
