.sp-gallery { --gallery-accent: #262626; width: 100%; }
.sp-gallery *, .sp-gallery *::before, .sp-gallery *::after { box-sizing: border-box; }
.sp-gallery-stage { position: relative; aspect-ratio: 1; border: 0; border-radius: 0; overflow: hidden; background: transparent; }
.sp-gallery-open { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; touch-action: pan-y; cursor: zoom-in; color: #525252; }
.sp-gallery-open[data-placeholder] { cursor: default; }
.sp-gallery-main { width: 100%; height: 100%; object-fit: contain; padding: 0; user-select: none; }
.sp-gallery-origin { position: absolute; top: 12px; left: 12px; max-width: 48px; max-height: 32px; z-index: 1; pointer-events: none; }
.sp-gallery button { cursor: pointer; font: inherit; text-transform: none; letter-spacing: normal; margin: 0; appearance: none; }
.sp-gallery button:focus-visible, .sp-gallery-open:focus-visible { outline: 3px solid var(--gallery-accent); outline-offset: -3px; }
.sp-gallery .sp-gallery-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 1px solid #e5e5e5; border-radius: 50%; color: #262626; background: #fff; box-shadow: 0 2px 8px #0000000a; font-size: 30px; line-height: 1; z-index: 2; }
.sp-gallery-prev { left: 10px; }
.sp-gallery-next { right: 10px; }
.sp-gallery-thumbs { position: relative; display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 10px; scrollbar-width: none; -ms-overflow-style: none; }
.sp-gallery-thumbs::-webkit-scrollbar { display: none; }
.sp-gallery-thumbs button { position: relative; flex: 0 0 64px; height: 64px; padding: 0; border: 0; border-radius: 8px; background: transparent; opacity: .4; }
.sp-gallery-thumbs button[aria-current="true"] { opacity: 1; }
.sp-gallery-thumbs button[aria-current="true"]::after {
    content: "";
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: -7px;
    height: 2px;
    border-radius: 2px;
    background: var(--gallery-accent);
}
.sp-gallery-thumbs img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.sp-gallery-dialog { position: fixed; inset: 0; width: 100vw; max-width: none; height: 100vh; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: #fff; color: #262626; }
.sp-gallery-dialog::backdrop { background: #000000b3; }
.sp-gallery-dialog[open] { display: flex; flex-direction: column; }
.sp-gallery-dialog:not([open]) { display: none; }
.sp-gallery-bar { display: flex; align-items: center; gap: 8px; padding: 12px max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left)); border-bottom: 1px solid #e8e8e8; background: #fff; z-index: 3; }
.sp-gallery-caption { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.sp-gallery-bar button { display: grid; place-items: center; padding: 0 10px; flex-shrink: 0; min-width: 44px; height: 44px; border: 1px solid #e5e5e5; border-radius: 8px; background: #fafafa; color: #262626; font-size: 22px; }
.sp-gallery-bar button[data-reset] { min-width: 65px; font-size: 14px; }
.sp-gallery-bar button:disabled { opacity: .4; cursor: default; }
.sp-gallery-view { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; display: grid; place-items: center; cursor: zoom-in; }
.sp-gallery-view.is-zoomed { cursor: grab; }
.sp-gallery-view.is-zoomed:active { cursor: grabbing; }
.sp-gallery-view > img { width: 100%; height: 100%; min-height: 0; position: absolute; inset: 0; object-fit: contain; padding: 28px 56px 48px; user-select: none; transform-origin: center; }
.sp-gallery-image-error { padding: 24px; text-align: center; color: #737373; }
.sp-gallery [hidden] { display: none !important; }
@media (max-width: 575px) {
    .sp-gallery-caption { flex-basis: 100%; font-size: 13px; }
    .sp-gallery-bar { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
    .sp-gallery-view > img { padding: 16px 40px 48px; }
}

/* Component-local neutral controls; no theme icon font or brand palette needed. */
.sp-gallery { font-family: inherit; line-height: 1.5; isolation: isolate; }
.sp-gallery svg { display: block; width: 20px; height: 20px; flex-shrink: 0; }
.sp-gallery .sp-gallery-open { text-decoration: none; border: 0; box-shadow: none; }
.sp-gallery-main, .sp-gallery-thumbs img, .sp-gallery-view > img { display: block; max-width: none; max-height: none; border: 0; border-radius: 0; box-shadow: none; }
.sp-gallery-thumbs button { transition: opacity .2s ease; }
.sp-gallery-thumbs button[aria-current="true"] { box-shadow: none; }
.sp-gallery .sp-gallery-arrow, .sp-gallery-bar button { transition: opacity .15s ease, background-color .15s ease, box-shadow .15s ease; }
.sp-gallery-bar button[data-close] { margin-left: 8px; }
@media (hover: hover) and (pointer: fine) {
    .sp-gallery .sp-gallery-arrow { opacity: 0; pointer-events: none; }
    .sp-gallery-stage:hover > .sp-gallery-arrow,
    .sp-gallery-dialog:hover > .sp-gallery-arrow,
    .sp-gallery .sp-gallery-arrow:focus-visible { opacity: 1; pointer-events: auto; }
    .sp-gallery .sp-gallery-arrow:hover, .sp-gallery-bar button:not(:disabled):hover { background: #f0f0f0; box-shadow: 0 2px 10px #0000000d; }
    .sp-gallery-thumbs button:not([aria-current="true"]):hover { opacity: .75; }
}
@media (prefers-reduced-motion: reduce) {
    .sp-gallery button { transition: none; }
}
