/*   Image overlay. Only links explicitly marked data-photo-viewer opt in.   */
a[data-photo-viewer] {
    cursor: zoom-in;
}

a[data-photo-viewer]:focus-visible {
    outline: 3px solid #7d5329;
    outline-offset: 5px;
}

html.st-photo-viewer-open {
    overflow: hidden;
}

.st-photo-viewer {
    --st-photo-clearance: 176px;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-width: none;
    max-height: none;
    box-sizing: border-box;
    margin: 0;
    padding: 64px 48px 40px;
    border: 0;
    background: transparent;
    color: #fff;
    font: 14px/1.45 Arial, Helvetica, sans-serif;
    text-align: center;
    overflow: auto;
    overscroll-behavior: contain;
}

.st-photo-viewer:not([open]) {
    display: none;
}

.st-photo-viewer[open] {
    display: flex;
    align-items: center;
    justify-content: center;
}

.st-photo-viewer::backdrop {
    background: radial-gradient(ellipse at center, rgba(35, 42, 51, .50) 0%, rgba(12, 16, 23, .65) 68%, rgba(3, 5, 9, .76) 100%);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    animation: st-photo-fade-in 180ms ease-out;
}

.st-photo-viewer__figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 100%;
    margin: 0;
    animation: st-photo-arrive 180ms ease-out;
}

.st-photo-viewer__image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100vh - var(--st-photo-clearance));
    max-height: calc(100dvh - var(--st-photo-clearance));
    object-fit: contain;
    background: #fff;
    border: 0;
    border-radius: 5px;
    box-shadow: 0 24px 90px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .14);
}

.st-photo-viewer__image[hidden] {
    display: none;
}

.st-photo-viewer[aria-busy="true"] .st-photo-viewer__image {
    visibility: hidden;
}

.st-photo-viewer__caption {
    max-width: 660px;
    color: #f2f3f5;
    font-size: 14px;
    font-weight: normal;
    letter-spacing: .02em;
}

.st-photo-viewer__controls {
    position: absolute;
    top: 20px;
    right: 24px;
    margin: 0;
    padding: 0;
}

.st-photo-viewer__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 44px;
    padding: 8px 18px;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 999px;
    background: rgba(255, 255, 255, .09);
    color: #fff;
    font: inherit;
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease;
}

.st-photo-viewer__close:hover {
    background: rgba(255, 255, 255, .2);
    border-color: rgba(255, 255, 255, .6);
}

.st-photo-viewer__close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 4px;
}

.st-photo-viewer__close-icon {
    font-size: 25px;
    font-weight: normal;
    line-height: 1;
}

.st-photo-viewer__hint {
    position: absolute;
    right: 20px;
    bottom: 20px;
    left: 20px;
    margin: 0;
    color: #b9bfc9;
    font-size: 12px;
    text-indent: 0;
    pointer-events: none;
}

.st-photo-viewer__hint kbd {
    margin: 0 3px;
    padding: 2px 5px;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 4px;
    font: inherit;
}

.st-photo-viewer__status {
    margin: 0;
    color: #e2e5e9;
    text-indent: 0;
}

.st-photo-viewer__status[hidden] {
    display: none;
}

@keyframes st-photo-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes st-photo-arrive {
    from { opacity: 0; transform: translateY(8px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 600px) {
    .st-photo-viewer { --st-photo-clearance: 204px; padding: 68px 12px 48px; }
    .st-photo-viewer__controls { top: 12px; right: 12px; }
    .st-photo-viewer__caption { font-size: 13px; }
    .st-photo-viewer__hint { right: 12px; bottom: 16px; left: 12px; }
}

@media (max-height: 480px) {
    .st-photo-viewer { --st-photo-clearance: 128px; padding-top: 56px; padding-bottom: 24px; }
    .st-photo-viewer__controls { top: 8px; right: 12px; }
    .st-photo-viewer__figure { gap: 8px; }
    .st-photo-viewer__hint { display: none; }
}

@media (pointer: coarse) {
    /* Keep controls legible even on legacy pages without a mobile viewport tag. */
    .st-photo-viewer__close { min-height: clamp(44px, 12vw, 120px); font-size: clamp(14px, 3.5vw, 36px); }
    .st-photo-viewer__caption { font-size: clamp(14px, 3.5vw, 36px); }
    .st-photo-viewer__hint { font-size: clamp(12px, 3vw, 30px); }
    .st-photo-viewer__keyboard-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .st-photo-viewer::backdrop, .st-photo-viewer__figure { animation: none; }
    .st-photo-viewer__close { transition: none; }
}

/* Optional modular gallery. All rules are scoped away from the single-photo viewer. */
.st-photo-gallery { padding: 24px; }
.st-photo-gallery *, .st-photo-gallery *::before, .st-photo-gallery *::after { box-sizing: border-box; }
.st-photo-gallery [hidden] { display: none !important; }
.st-gallery-panel { width: min(1180px, 100%); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); overflow: auto; overscroll-behavior: contain; background: #f5f3ef; color: #203044; border-radius: 16px; box-shadow: 0 24px 90px #0005; text-align: left; }
.st-gallery-header { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 24px; background: #fff; border-bottom: 1px solid #dedbd5; }
.st-photo-gallery .st-gallery-title { margin: 0; padding: 0; color: #203044; font: bold 22px/1.2 Arial, Helvetica, sans-serif; text-align: left; text-indent: 0; }
.st-gallery-header form { margin: 0; padding: 0; }
.st-photo-gallery .st-gallery-button { display: inline-block; width: auto; min-height: 44px; margin: 0; padding: 9px 16px; border: 1px solid #c2cbd5; border-radius: 24px; background: #fff; color: #203b5d; font: inherit; text-align: center; white-space: nowrap; cursor: pointer; }
.st-photo-gallery .st-gallery-button:hover { background: #e8edf3; }
.st-photo-gallery .st-gallery-button[aria-pressed="true"] { background: #203b5d; color: #fff; border-color: #203b5d; }
.st-photo-gallery button:focus-visible { outline: 3px solid #b87728; outline-offset: 3px; }
.st-photo-gallery button:disabled { opacity: .45; cursor: default; }
.st-gallery-overview { padding: 22px 24px 28px; }
.st-photo-gallery p { text-indent: 0; font: inherit; }
.st-gallery-intro { margin: 0 0 18px; }
.st-gallery-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.st-gallery-count { margin: 16px 0; color: #566577; }
.st-photo-gallery .st-gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; }
.st-gallery-grid li { min-width: 0; margin: 0; padding: 0; }
.st-photo-gallery .st-gallery-tile { display: flex; flex-direction: column; width: 100%; height: 100%; padding: 0; border: 1px solid #dfe2e5; border-radius: 10px; overflow: hidden; background: #fff; color: #203b5d; font: inherit; text-align: left; cursor: zoom-in; }
.st-gallery-tile:hover { box-shadow: 0 5px 18px #20304426; }
.st-photo-gallery .st-gallery-tile img { display: block; width: 100%; height: 190px; margin: 0; padding: 12px; border: 0; background: #080b10; object-fit: contain; }
.st-gallery-tile span { padding: 12px; }
.st-gallery-detail { padding: 16px 24px 24px; }
.st-gallery-detail figure { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 14px 0; }
.st-photo-gallery .st-gallery-image { display: block; width: 100%; height: max(100px, calc(100vh - 320px)); height: max(100px, calc(100dvh - 320px)); max-height: 650px; margin: 0; border: 0; border-radius: 6px; object-fit: contain; background: #080b10; }
.st-gallery-detail[aria-busy="true"] .st-gallery-image { visibility: hidden; }
.st-gallery-caption { max-width: 100%; text-align: center; overflow-wrap: anywhere; }
.st-gallery-navigation { display: flex; align-items: center; justify-content: center; gap: 18px; }
.st-gallery-position { white-space: nowrap; }
@media (max-width: 600px) {
    .st-photo-gallery { padding: 12px; }
    .st-gallery-panel { max-height: calc(100dvh - 24px); border-radius: 12px; }
    .st-gallery-header { padding: 12px; gap: 8px; }
    .st-photo-gallery .st-gallery-title { font-size: 18px; }
    .st-gallery-overview, .st-gallery-detail { padding: 16px 12px; }
    .st-photo-gallery .st-gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .st-photo-gallery .st-gallery-tile img { height: 160px; padding: 8px; }
    .st-photo-gallery .st-gallery-button { padding: 9px 12px; }
    .st-gallery-navigation { gap: 10px; }
}
@media (pointer: coarse) and (min-width: 601px) {
    /* Legacy product pages may have a desktop-sized layout viewport on phones. */
    .st-photo-gallery { font-size: clamp(14px, 2.8vw, 28px); }
    .st-photo-gallery .st-gallery-title { font-size: clamp(22px, 3vw, 30px); }
    .st-photo-gallery .st-gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-height: 480px) {
    .st-photo-gallery { padding: 8px; }
    .st-gallery-panel { max-height: calc(100dvh - 16px); }
    .st-gallery-header { padding: 8px 12px; }
    .st-photo-gallery .st-gallery-title { font-size: 16px; }
    .st-photo-gallery .st-gallery-button { min-height: 36px; padding: 6px 12px; font-size: 14px; }
    .st-gallery-detail { padding: 8px 12px; }
    .st-gallery-detail figure { margin: 6px 0; gap: 6px; }
    .st-photo-gallery .st-gallery-image { height: max(48px, calc(100dvh - 300px)); }
    .st-gallery-caption, .st-gallery-position { font-size: 13px; }
}
