.cso-gallery-open { display: block; position: relative; cursor: zoom-in; }
.cso-gallery-open:focus-visible { outline: 3px solid #5b6a76; outline-offset: 4px; }
.cso-gallery-open__icon { position: absolute; right: 9px; bottom: 9px; display: grid; place-items: center; width: 32px; height: 32px; background: #ffffffed; color: #242c34; border: 1px solid #e0e8ef; pointer-events: none; }
.cso-gallery-open__icon svg { width: 18px; height: 18px; }
html.cso-gallery-modal-open { overflow: hidden; scrollbar-gutter: stable; }
.cso-gallery-viewer { width: min(1120px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); margin: auto; padding: 0; border: 1px solid #e3eaf0; border-radius: 3px; color: #1c242b; background: #fff; box-shadow: 0 18px 70px #07130c40; }
.cso-gallery-viewer::backdrop { background: #0e1c15c9; }
.cso-gallery-viewer [hidden] { display: none !important; }
.cso-gallery-viewer__surface { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: min(88vh, 900px); height: min(88dvh, 900px); min-height: 0; }
.cso-gallery-viewer__header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 20px; }
.cso-gallery-viewer__title { min-width: 0; margin: 0; font: 500 25px/1.2 var(--serif, Georgia, serif); letter-spacing: -.01em; overflow-wrap: anywhere; }
.cso-gallery-viewer__button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-width: 44px; min-height: 44px; padding: 10px 14px; border: 1px solid #b7c6d1; border-radius: 0; background: #fff; color: #1e262d; font: 600 13px/1.4 var(--sans, Arial, sans-serif); cursor: pointer; }
.cso-gallery-viewer__button:focus-visible,
.cso-gallery-viewer__original:focus-visible { outline: 3px solid #5b6a76; outline-offset: 3px; }
.cso-gallery-viewer__button:disabled { color: #89948d; border-color: #e7edf3; background: #f8fafb; cursor: default; }
.cso-gallery-viewer__close { flex: 0 0 auto; }
.cso-gallery-viewer__close-mark { font-size: 23px; font-weight: 400; line-height: 1; }
.cso-gallery-viewer__figure { display: flex; flex-direction: column; min-width: 0; min-height: 0; margin: 0; padding-inline: 20px; overflow: hidden; }
.cso-gallery-viewer__stage { position: relative; display: grid; flex: 1 1 auto; min-height: 0; background: #f8fafb; }
.cso-gallery-viewer__image { display: block; grid-area: 1 / 1; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.cso-gallery-viewer__loading { grid-area: 1 / 1; align-self: center; justify-self: center; max-width: 80%; margin: 0; padding: 12px 18px; color: #3e4a55; background: #fffffff0; font-size: 14px; line-height: 1.6; text-align: center; }
.cso-gallery-viewer__caption { flex: 0 0 auto; max-height: 6.4em; margin: 0; padding-block: 12px 4px; overflow-y: auto; overflow-wrap: anywhere; font-size: 14px; line-height: 1.6; color: #252e36; }
.cso-gallery-viewer__footer { padding: 10px 20px 16px; }
.cso-gallery-viewer__controls { display: grid; grid-template-columns: minmax(44px, 1fr) auto minmax(44px, 1fr); align-items: center; gap: 14px; }
.cso-gallery-viewer__previous { justify-self: start; }
.cso-gallery-viewer__next { justify-self: end; }
.cso-gallery-viewer__position { margin: 0; text-align: center; font-size: 13px; color: #3e4a55; }
.cso-gallery-viewer__original { display: flex; align-items: center; justify-content: center; min-height: 44px; width: fit-content; max-width: 100%; margin: 5px auto 0; font-size: 12px; line-height: 1.5; color: #3e4a55; text-decoration: underline; text-underline-offset: 3px; }
.cso-gallery-viewer__announcement { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 600px) {
  .cso-gallery-viewer { width: calc(100vw - 20px); max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); }
  .cso-gallery-viewer__surface { height: calc(100vh - 24px); height: calc(100dvh - 24px); }
  .cso-gallery-viewer__header { gap: 12px; padding: 12px; }
  .cso-gallery-viewer__title { font-size: 23px; }
  .cso-gallery-viewer__figure { padding-inline: 12px; }
  .cso-gallery-viewer__footer { padding: 8px 12px 12px; }
  .cso-gallery-viewer__caption { font-size: 13px; }
  .cso-gallery-viewer__button { padding-inline: 12px; }
  .cso-gallery-viewer__control-text { display: none; }
}
@media (max-height: 500px) and (min-width: 601px) {
  .cso-gallery-viewer__surface { height: calc(100vh - 24px); height: calc(100dvh - 24px); }
  .cso-gallery-viewer__header { padding-block: 8px; }
  .cso-gallery-viewer__footer { padding-block: 6px 8px; }
  .cso-gallery-viewer__original { margin-top: 0; }
}
@media (hover: hover) and (pointer: fine) {
  .cso-gallery-open:hover .cso-gallery-open__icon { color: #fff; background: #242c34; border-color: #242c34; }
  .cso-gallery-viewer__button:not(:disabled):hover { color: #fff; background: #242c34; border-color: #242c34; }
  .cso-gallery-viewer__original:hover { color: #1e262d; }
}
@media (prefers-reduced-motion: reduce) {
  .cso-gallery-viewer *, .cso-gallery-open * { animation: none !important; transition: none !important; }
}

.cso-gallery-viewer__actions { display: flex; align-items: center; flex: none; gap: 6px; }
.cso-gallery-viewer__button.cso-gallery-viewer__zoom { min-width: 44px; padding-inline: 9px; font-variant-numeric: tabular-nums; border-radius: 100px; }
.cso-gallery-viewer [data-gallery-zoom][aria-pressed="true"] { background: #302b27; color: #fff; border-color: #302b27; }
.cso-gallery-viewer [data-gallery-stage] { overflow: hidden; }
.cso-gallery-viewer [data-gallery-stage] .cso-gallery-viewer__image { object-fit: scale-down; }
.cso-gallery-viewer [data-gallery-stage][data-zoomable] .cso-gallery-viewer__image { cursor: zoom-in; }
.cso-gallery-viewer [data-gallery-stage][data-magnified] .cso-gallery-viewer__image { transform: scale(var(--detail-scale, 1)); cursor: zoom-out; touch-action: pinch-zoom; }
@media (prefers-reduced-motion: no-preference) {
  body[data-motion="true"] .cso-gallery-viewer [data-gallery-stage][aria-busy="false"] .cso-gallery-viewer__image { transition: transform .28s cubic-bezier(.18,.77,.25,1); }
}

@media screen and (min-width: 1100px) and (min-height: 560px) {
  body.cso-studio .cso-gallery-viewer {
    width: min(76rem, calc(100vw - 6rem));
    border: 1px solid #d6d0c8;
    border-radius: .85rem;
    color: #302a25;
    box-shadow: 0 20px 76px #19141138;
  }
  body.cso-studio .cso-gallery-viewer::backdrop { background: #25211dc9; }
  .cso-gallery-viewer__surface:has(> .cso-gallery-viewer__thumbnails:not([hidden])) {
    grid-template-columns: 6.5rem minmax(0, 1fr);
  }
  body.cso-studio .cso-gallery-viewer__header,
  body.cso-studio .cso-gallery-viewer__footer {
    grid-column: 1 / -1;
    padding: .72rem 1.5rem;
  }
  body.cso-studio .cso-gallery-viewer__header { border-bottom: 1px solid #e7e2dc; }
  body.cso-studio .cso-gallery-viewer__title { font-size: clamp(1.5rem, 2.4vw, 2.2rem); letter-spacing: -.018em; }
  body.cso-studio .cso-gallery-viewer__stage { background: #faf9f7; border-radius: .45rem; }
  body.cso-studio .cso-gallery-viewer__figure { padding: .9rem 1.5rem 0; }
  body.cso-studio .cso-gallery-viewer__caption {
    padding: .5rem 0 .38rem;
    font: 400 1.18rem/1.3 var(--serif, Georgia, serif);
    color: #463c33;
  }
  body.cso-studio .cso-gallery-viewer__button { border-color: #cfc7be; border-radius: 99px; }
  body.cso-studio .cso-gallery-viewer__button:not(:disabled):is(:hover,:focus-visible) { background: #302a25; color: white; }
  body.cso-studio .cso-gallery-viewer__footer { border-top: 1px solid #e7e2dc; }
  body.cso-studio .cso-gallery-viewer__original { margin-block: 0; min-height: 32px; }
  .cso-gallery-viewer__thumbnails {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: .9rem .7rem .9rem 1rem;
    border-right: 1px solid #e7e2dc;
    overflow-y: auto;
    scrollbar-width: thin;
    overscroll-behavior-y: contain;
  }
  .cso-gallery-viewer__thumbnails button {
    flex: 0 0 auto;
    width: min(4.1rem, 100%);
    height: 4.1rem;
    min-height: 0;
    display: grid;
    grid-template: minmax(0, 1fr) / minmax(0, 1fr);
    place-items: center;
    border: 1px solid #ded9d2;
    border-radius: .4rem;
    background: #fff;
    padding: 4px;
    cursor: pointer;
  }
  .cso-gallery-viewer__thumbnails button:is(:hover,[aria-current]) { border-color: #796352; }
  .cso-gallery-viewer__thumbnails button[aria-current] { box-shadow: inset 0 0 0 1px #796352; }
  .cso-gallery-viewer__thumbnails button:focus-visible { outline: 2px solid #554537; outline-offset: 2px; }
  .cso-gallery-viewer__thumbnails img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
}
