/* Shared project photo frames/viewer; only Gallery layout rules below. */
.sm-photo-mode{padding-block:calc(40px * var(--sm-section-scale)) calc(64px * var(--sm-section-scale))}
.sm-gallery-intro{max-width:800px;margin:32px 0 40px}
.sm-gallery-intro h1{font-size:48px;line-height:54px;letter-spacing:-1px;margin:0 0 24px}
/* Use German word boundaries for long compound project titles. */
@media(max-width:599px){.sm-gallery-intro h1:lang(de){-webkit-hyphens:auto;hyphens:auto;hyphenate-limit-chars:12 6 6;overflow-wrap:break-word;text-wrap:balance}}
.sm-gallery-intro .sm-lead{margin:0}
.sm-gallery-cover{margin:0 0 40px}
.sm-gallery-cover figcaption{margin-top:12px;color:var(--sm-muted)}
.sm-photo-mode .sm-photo-grid.wp-block-gallery{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));gap:32px 24px;align-items:start;margin:0}
.sm-photo-mode .sm-photo-grid figure.wp-block-image{display:flex;flex-direction:column;width:auto!important;min-width:0;flex:none;margin:0;align-self:start}
.sm-photo-mode .sm-photo-grid figure.wp-block-image figcaption{position:static!important;background:none!important;color:var(--sm-muted)!important;text-align:left;max-height:none;padding:12px 0 0;margin:0;font-size:14px;line-height:22px;overflow-wrap:anywhere}
.sm-photo-description{display:block;margin-top:8px}
body:has(.sm-project-viewer) .wp-lightbox-overlay img{object-fit:contain!important}
body:has(.sm-project-viewer) .wp-lightbox-overlay :is(.wp-lightbox-close-button,.wp-lightbox-navigation-button):focus-visible{outline:3px solid #765f13;outline-offset:4px}
.sm-viewer-caption{position:absolute;z-index:1000001;bottom:16px;left:64px;right:64px;max-width:900px;margin:0 auto;padding:12px 20px;border-radius:6px;background:#1f211d;color:#fff;text-align:center;font-size:16px;line-height:24px;white-space:pre-line;max-height:18vh;overflow:auto;pointer-events:none}
.wp-lightbox-overlay:not(.active) .sm-viewer-caption{display:none}
@media(max-width:1099px){.sm-photo-mode .sm-photo-grid.wp-block-gallery{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:599px){.sm-photo-mode{padding-block:calc(28px * var(--sm-section-scale)) calc(48px * var(--sm-section-scale))}.sm-gallery-intro{margin:24px 0 32px}.sm-gallery-intro h1{font-size:clamp(34px,10vw,40px);line-height:1.15}.sm-gallery-intro .sm-lead{font-size:16px;line-height:25px}.sm-photo-mode .sm-photo-grid.wp-block-gallery{grid-template-columns:1fr;gap:28px}.sm-viewer-caption{left:12px;right:12px;bottom:12px;font-size:14px;line-height:21px;padding:10px;max-height:22vh}}
@media(prefers-reduced-motion:reduce){body:has(.sm-project-viewer) .wp-lightbox-overlay,body:has(.sm-project-viewer) .wp-lightbox-overlay *{animation:none!important;transition:none!important}}

/* Reserve caption/control space; native picture must remain wholly visible. */
body:has(.sm-project-viewer) .wp-lightbox-overlay:is(.active,.show-closing-animation) .lightbox-image-container{top:80px!important;left:160px!important;right:160px!important;bottom:var(--sm-viewer-reserve,140px)!important;width:auto!important;height:auto!important;transform:none!important}
body:has(.sm-project-viewer) .wp-lightbox-overlay:is(.active,.show-closing-animation) .lightbox-image-container figure{width:100%!important;height:100%!important;transform:none!important;background:transparent!important}
body:has(.sm-project-viewer) .wp-lightbox-overlay:is(.active,.show-closing-animation) .lightbox-image-container img{width:100%!important;height:100%!important;min-width:0!important;min-height:0!important;transform:none!important;object-fit:contain!important}
.sm-viewer-caption{z-index:4000000}
@media(max-width:959px){.sm-viewer-caption{bottom:64px}body:has(.sm-project-viewer) .wp-lightbox-overlay:is(.active,.show-closing-animation) .lightbox-image-container{left:12px!important;right:12px!important}}

.sm-viewer-caption{pointer-events:auto}
.sm-viewer-caption:focus-visible{outline:3px solid #d9b32c;outline-offset:-5px}

/* Frame tokens reflect Figma's Story, Gallery and cover slots, not file ratios. */
.sm-project-viewer{--sm-photo-grid-ratio:var(--sm-gallery-image-ratio,384 / 240);--sm-photo-cover-ratio:var(--sm-cover-image-ratio,620 / 570)}
.sm-project-viewer .sm-project-photo{width:100%;min-width:0;--sm-photo-frame-ratio:var(--sm-photo-grid-ratio)}
.sm-project-detail .sm-project-photo{--sm-photo-frame-ratio:var(--sm-story-image-ratio,610 / 470)}
.sm-project-detail .wp-block-gallery .sm-project-photo{--sm-photo-frame-ratio:var(--sm-photo-grid-ratio)}
.sm-project-viewer :is(.sm-project-cover,.sm-gallery-cover){--sm-photo-frame-ratio:var(--sm-photo-cover-ratio)}
.sm-project-viewer .sm-photo-frame{display:block;position:relative;width:100%;aspect-ratio:var(--sm-photo-frame-ratio);overflow:hidden;border-radius:var(--sm-radius,8px);background:var(--sm-sand)}
.sm-project-viewer .sm-gallery-cover .sm-photo-frame{max-height:640px}
.sm-project-viewer .sm-photo-frame>img{display:block;position:absolute;inset:0;width:100%!important;height:100%!important;max-width:none!important;max-height:none!important;min-width:0;min-height:0;aspect-ratio:auto!important;object-fit:cover!important;object-position:var(--sm-photo-position,50% 50%);border-radius:0}
.sm-project-viewer .sm-project-photo>figcaption{display:block;box-sizing:border-box;width:100%;position:static!important;padding:12px 0 0;margin:0;background:none!important;color:var(--sm-muted)!important;text-align:left;max-height:none;overflow-wrap:anywhere}
.sm-project-viewer .sm-photo-frame button{opacity:1!important;right:12px!important;top:12px!important;width:44px;height:44px;background:var(--sm-ink);color:#fff}
.sm-project-viewer .sm-photo-frame button:focus-visible{outline:3px solid #fff;outline-offset:-5px;box-shadow:inset 0 0 0 2px var(--sm-ink)}
.sm-project-viewer .sm-photo-original{font-size:14px;margin:8px 0}
/* Viewer nodes are outside the article: never inherit the cropped frame. */
body:has(.sm-project-viewer) .lightbox-image-container img{object-position:50% 50%!important;aspect-ratio:auto!important}

/* Opaque controls occupy reserved gutters, never conceal the complete image. */
body:has(.sm-project-viewer) .wp-lightbox-overlay :is(.wp-lightbox-close-button,.wp-lightbox-navigation-button){min-height:44px;box-sizing:border-box;padding:10px 12px!important;background:#fff!important;color:var(--sm-ink)!important;border:1px solid var(--sm-border)!important;border-radius:6px}

@media(max-width:767px){.sm-project-viewer{--sm-photo-grid-ratio:350 / 240}}

/* Photo-only zoom: clip movement to the existing frame; keep all controls outside it. */
body:has(.sm-project-viewer) .wp-lightbox-overlay.sm-zoom-ready{height:100dvh}
body:has(.sm-project-viewer) .wp-lightbox-overlay.sm-zoom-ready .lightbox-image-container{touch-action:none;user-select:none;-webkit-user-select:none;cursor:default}
body:has(.sm-project-viewer) .wp-lightbox-overlay.sm-zoom-ready .lightbox-image-container.sm-photo-zoomed{cursor:grab}
body:has(.sm-project-viewer) .wp-lightbox-overlay.sm-zoom-ready .lightbox-image-container.sm-photo-dragging{cursor:grabbing}
body:has(.sm-project-viewer) .wp-lightbox-overlay.sm-zoom-ready:is(.active,.show-closing-animation) .lightbox-image-container{top:calc(80px + env(safe-area-inset-top))!important}
body:has(.sm-project-viewer) .wp-lightbox-overlay.sm-zoom-ready:is(.active,.show-closing-animation) .lightbox-image-container img{transform:var(--sm-photo-transform,none)!important;transform-origin:center;will-change:transform;-webkit-user-drag:none}
.sm-zoom-ready .lightbox-image-container:focus-visible{outline:2px solid var(--sm-accent-text);outline-offset:2px}
.sm-viewer-zoom{position:absolute;z-index:5000000;top:calc(16px + env(safe-area-inset-top));left:calc(16px + env(safe-area-inset-left));display:flex;gap:6px;align-items:center;cursor:default}
.sm-viewer-zoom[hidden]{display:none}
.wp-lightbox-overlay .sm-viewer-zoom button{display:grid;place-items:center;min-width:44px;min-height:44px;padding:8px;background:#fff!important;color:var(--sm-ink);border:1px solid var(--sm-border);border-radius:6px;font:600 16px/1 Manrope,Arial,sans-serif;cursor:pointer;touch-action:manipulation}
.wp-lightbox-overlay .sm-viewer-zoom button:nth-child(2){min-width:60px;font-size:13px;font-variant-numeric:tabular-nums}
.wp-lightbox-overlay .sm-viewer-zoom button:disabled{color:var(--sm-muted);opacity:.5;cursor:default}
.wp-lightbox-overlay .sm-viewer-zoom button:enabled:hover{background:var(--sm-sand)!important}
.wp-lightbox-overlay .sm-viewer-zoom button:focus-visible{outline:3px solid var(--sm-accent-text);outline-offset:3px}
@media(max-width:359px){.sm-viewer-zoom{left:calc(12px + env(safe-area-inset-left));gap:4px}.wp-lightbox-overlay .sm-viewer-zoom button:nth-child(2){min-width:50px;padding-inline:4px;font-size:12px}}
