html.ce-photo-locked { overflow: hidden; }
.ce-photo-dialog {
    --gallery-surface: #211b18;
    --gallery-accent: var(--ce-brand, #984d37);
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    color: #fff8f3;
    background: rgb(33 27 24 / 95%);
}
.ce-photo-dialog::backdrop { background: transparent; backdrop-filter: blur(5px); }
.ce-photo-frame {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-rows: auto minmax(0,1fr) auto;
    background: transparent;
}
.ce-photo-frame:fullscreen { background: var(--gallery-surface); }
.ce-photo-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: max(12px,env(safe-area-inset-top)) max(20px,env(safe-area-inset-right)) 10px max(20px,env(safe-area-inset-left));
}
.ce-photo-bar h2 { margin: 0; color: inherit; font-size: clamp(1rem,2.3vw,1.4rem); line-height: 1.2; overflow-wrap: anywhere; }
.ce-photo-tools { display: flex; gap: 8px; align-items: center; flex: 0 0 auto; }
.ce-photo-count { min-width: 3.1em; text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; }
.ce-gallery-button, .ce-gallery-all {
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgb(255 248 243 / 22%);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    color: #fff8f3;
    background: rgb(255 248 243 / 8%);
    cursor: pointer;
}
.ce-gallery-button[hidden], .ce-photo-thumbs[hidden], .ce-photo-stage img[hidden] { display: none; }
.ce-gallery-button:hover { background: rgb(255 248 243 / 18%); }
.ce-photo-dialog :is(button, a):focus-visible,
.ce-gallery-button:focus-visible,
.ce-gallery-all:focus-visible { outline: 2px solid #e4997b; outline-offset: 3px; }
.ce-photo-main {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0,1fr);
    padding: 0 clamp(53px,8vw,105px);
    min-height: 0;
}
.ce-photo-stage {
    position: relative;
    min-height: 0;
    min-width: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    cursor: zoom-in;
}
.ce-photo-stage.ce-photo-zoomed { cursor: grab; }
.ce-photo-stage.ce-photo-zoomed:active { cursor: grabbing; }
.ce-photo-stage img {
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: contain;
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.ce-photo-error { padding: 16px; text-align: center; }
.ce-photo-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; }
.ce-photo-previous { left: clamp(8px,3vw,32px); }
.ce-photo-next { right: clamp(8px,3vw,32px); }
.ce-photo-thumbs {
    display: flex;
    align-items: center;
    justify-self: center;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    gap: 8px;
    padding: 11px max(16px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));
    scrollbar-color: rgb(255 248 243 / 36%) transparent;
    scrollbar-width: thin;
}
.ce-photo-thumbs button {
    flex: 0 0 auto;
    border-radius: 8px;
    width: clamp(58px,8vw,92px);
    aspect-ratio: 4/3;
    border: 2px solid transparent;
    padding: 2px;
    background: transparent;
    cursor: pointer;
}
.ce-photo-thumbs button[aria-current="true"] { border-color: var(--gallery-accent); }
.ce-photo-thumbs img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 4px; }

.cv-detail-layout .cv-tour-mosaic.ce-photo-mosaic-enhanced {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0,2.7fr) minmax(0,1fr);
    grid-template-rows: repeat(3,minmax(0,1fr));
    grid-auto-flow: row;
    scroll-snap-type: none;
    gap: 9px;
    height: clamp(265px,36vw,460px);
}
.cv-detail-layout .cv-tour-mosaic.ce-photo-mosaic-enhanced > a:first-child { grid-column: 1; grid-row: 1 / -1; }
.cv-detail-layout .cv-tour-mosaic.ce-photo-mosaic-enhanced > a:nth-of-type(n+5) { display: none; }
.cv-detail-layout .cv-tour-mosaic.ce-photo-mosaic-enhanced:not(.ce-tour-mosaic-widgets):not(:has(> a:nth-of-type(2))) { grid-template-columns: 1fr; }
.cv-detail-layout .cv-tour-mosaic.ce-photo-mosaic-enhanced:has(> a:nth-of-type(2)):not(:has(> a:nth-of-type(3))) { grid-template-rows: 1fr; }
.cv-detail-layout .cv-tour-mosaic.ce-photo-mosaic-enhanced:has(> a:nth-of-type(3)):not(:has(> a:nth-of-type(4))) { grid-template-rows: repeat(2,minmax(0,1fr)); }
.cv-tour-mosaic.ce-photo-mosaic-enhanced img { border-radius: 10px; }
.ce-photo-mosaic-enhanced ~ .cv-more-photos { display: none; }
.ce-gallery-all {
    position: absolute;
    bottom: 11px;
    right: 11px;
    display: inline-flex;
    gap: 6px;
    align-items: center;
    width: auto;
    height: 36px;
    border-radius: 7px;
    padding: 0 10px;
    font-weight: 750;
    font-size: .83rem;
    background: rgb(33 27 24 / 88%);
}
.ce-gallery-all svg { width: 17px; height: 17px; }
.ce-gallery-expand-cover {
    position: absolute;
    top: 10px;
    inset-inline-start: calc(72.97% - 46px);
    width: 36px;
    height: 36px;
    border-radius: 7px;
    background: rgb(33 27 24 / 72%);
}
.ce-gallery-expand-cover svg { width: 19px; height: 19px; }
.ce-photo-mosaic-enhanced:not(.ce-tour-mosaic-widgets):not(:has(> a:nth-of-type(2))) .ce-gallery-expand-cover { inset-inline-start: auto; inset-inline-end: 10px; }
.ce-gallery-cover-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--ce-paper,#f8ede3);
    color: var(--ce-ink,#30251f);
    width: 38px;
    height: 38px;
}
.ce-gallery-cover-arrow:hover { background: #fff; }
.ce-gallery-cover-left { left: 9px; }
.ce-gallery-cover-right { right: calc(27.03% + 9px); }
@media (max-width: 640px) {
    .ce-photo-bar { padding-inline: max(10px,env(safe-area-inset-left)) max(10px,env(safe-area-inset-right)); }
    .ce-photo-tools { gap: 3px; }
    .ce-photo-tools .ce-gallery-button { width: 40px; height: 40px; }
    .ce-photo-main { padding-inline: 0; }
    .ce-photo-arrow { background: rgb(33 27 24 / 74%); }
    .cv-detail-layout .cv-tour-mosaic.ce-photo-mosaic-enhanced,
    .cv-detail-layout .cv-tour-mosaic.ce-photo-mosaic-enhanced:has(a) {
        grid-template-columns: repeat(3,minmax(0,1fr));
        grid-template-rows: minmax(0,1fr) 64px;
        height: clamp(240px,74vw,395px);
    }
    .cv-detail-layout .cv-tour-mosaic.ce-photo-mosaic-enhanced > a:first-child { grid-column: 1 / -1; grid-row: 1; }
    .cv-detail-layout .cv-tour-mosaic.ce-photo-mosaic-enhanced:not(.ce-tour-mosaic-widgets):not(:has(> a:nth-of-type(2))) { grid-template-rows: 1fr; }
    .ce-gallery-cover-arrow { top: calc((100% - 73px)/2); }
    .ce-gallery-cover-right { right: 9px; }
    .ce-gallery-all { bottom: 8px; right: 8px; }
    .ce-gallery-expand-cover { inset-inline-start: auto; inset-inline-end: 10px; }
}
