/* The tour and viewer deliberately use a neutral, photo-led surface. */
dialog.cs-gallery-dialog {
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  overscroll-behavior: none;
  box-shadow: none;
  color: #222;
  background: #fff;
  font: 400 14px/1.5 "DM Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}
dialog.cs-gallery-dialog::backdrop { background: #fff; }
dialog.cs-gallery-viewer, dialog.cs-gallery-viewer::backdrop { color: #fff; background: #000; }
.cs-gallery-dialog button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.cs-gallery-dialog button:hover { filter: none; }
.cs-gallery-dialog button:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
.cs-gallery-dialog svg { display: block; width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.cs-gallery-toolbar, .cs-gallery-viewer-toolbar {
  position: absolute;
  inset: 0 0 auto;
  height: 64px;
  z-index: 2;
  display: flex;
  align-items: center;
  padding: 10px 20px;
  background: #fff;
}
.cs-gallery-back { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 8px 10px; border-radius: 24px; white-space: nowrap; }
.cs-gallery-back:hover { background: #f4f4f4; }
.cs-gallery-tour-title { position: absolute; left: 50%; transform: translateX(-50%); margin: 0; font: 500 14px/1.5 "DM Sans", sans-serif; letter-spacing: 0; white-space: nowrap; }
.cs-gallery-tour-title span { margin-left: 6px; color: #717171; font-weight: 400; }
.cs-gallery-scroll { height: 100%; width: 100%; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scroll-behavior: auto; padding: 100px 24px 40px; -webkit-overflow-scrolling: touch; }
.cs-gallery-grid { display: grid; width: 100%; max-width: 742px; margin: 0 auto; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cs-gallery-tile { position: relative; display: block; min-width: 0; padding: 0; aspect-ratio: 3 / 2; border-radius: 0; overflow: hidden; background: #eee !important; }
.cs-gallery-tile:nth-child(3n + 1) { grid-column: 1 / -1; }
.cs-gallery-tile img { display: block; width: 100%; height: 100%; max-width: none; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 0; }
.cs-gallery-tile:hover img { filter: brightness(.96); }
.cs-gallery-dialog .cs-gallery-tile:focus-visible { outline: 3px solid #fff; outline-offset: -6px; box-shadow: inset 0 0 0 3px #222; }
.cs-gallery-tile.cs-gallery-tile-error::after { content: attr(data-error-label); position: absolute; inset: 0; padding: 12px; display: grid; place-items: center; color: #555; font-size: 13px; }
.cs-gallery-tile.cs-gallery-tile-error img { visibility: hidden; }
.cs-gallery-viewer-toolbar { height: 112px; padding: 24px 40px; align-items: flex-start; background: #000; }
.cs-gallery-viewer-toolbar .cs-gallery-back { margin-top: 10px; }
.cs-gallery-viewer .cs-gallery-back:hover { background: #222; }
.cs-gallery-count { position: absolute; top: 45px; left: 50%; transform: translateX(-50%); margin: 0; font-size: 14px; line-height: 24px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cs-gallery-stage { position: absolute; inset: 112px 80px; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; touch-action: pan-y pinch-zoom; }
.cs-gallery-photo { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.cs-gallery-load-state { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 15px; padding: 24px; text-align: center; color: #ddd; }
.cs-gallery-load-message { margin: 0; font-size: 14px; }
.cs-gallery-spinner { width: 28px; height: 28px; border: 2px solid #555; border-top-color: #fff; border-radius: 50%; animation: cs-gallery-spin .8s linear infinite; }
@keyframes cs-gallery-spin { to { transform: rotate(360deg); } }
.cs-gallery-dialog .cs-gallery-retry { min-width: 100px; min-height: 44px; border: 1px solid #888; border-radius: 6px; padding: 9px 18px; }
.cs-gallery-retry:hover { background: #222; }
.cs-gallery-dialog .cs-gallery-arrow { position: absolute; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border: 1.5px solid #888; border-radius: 50%; background: #000; }
.cs-gallery-arrow:hover { background: #222 !important; border-color: #fff; }
.cs-gallery-prev { left: 27px; }
.cs-gallery-next { right: 27px; }
.cs-gallery-caption { position: absolute; inset: auto 104px 0; height: 112px; padding: 24px 0 20px; margin: 0; text-align: center; font: 400 14px/1.45 "DM Sans", sans-serif; overflow: auto; overscroll-behavior: contain; }
@media (max-width: 600px) {
  .cs-gallery-toolbar { height: 60px; padding: 8px 10px; }
  .cs-gallery-back { gap: 3px; padding: 8px 5px; font-size: 13px !important; }
  .cs-gallery-tour-title { left: 50%; right: auto; transform: translateX(-50%); font-size: 13px; }
  .cs-gallery-tour .cs-gallery-back-qualifier { display: none; }
  .cs-gallery-tour-title span { margin-left: 3px; }
  .cs-gallery-scroll { padding: 60px 0 24px; }
  .cs-gallery-viewer-toolbar { height: 64px; padding: 8px 10px; }
  .cs-gallery-viewer-toolbar .cs-gallery-back { margin: 0; }
  .cs-gallery-count { top: 20px; left: 50%; right: auto; transform: translateX(-50%); font-size: 14px; }
  .cs-gallery-stage { inset: 64px 0 84px; }
  .cs-gallery-photo { max-height: calc(100dvh - 240px); }
  .cs-gallery-dialog .cs-gallery-arrow { top: auto; bottom: 100px; width: 44px; height: 44px; transform: none; }
  .cs-gallery-prev { left: calc(50% - 56px); }
  .cs-gallery-next { right: calc(50% - 56px); }
  .cs-gallery-caption { inset: auto 24px 20px; height: auto; max-height: 66px; padding: 0; text-align: left; }
}
@media (max-width: 359px) {
  .cs-gallery-viewer .cs-gallery-back { min-width: 44px; }
  .cs-gallery-viewer .cs-gallery-back span { display: none; }
}
@media (max-height: 500px) {
  .cs-gallery-viewer-toolbar { height: 64px; padding: 8px 20px; }
  .cs-gallery-viewer-toolbar .cs-gallery-back { margin: 0; }
  .cs-gallery-count { top: 20px; }
  .cs-gallery-stage { inset: 70px 80px 88px; }
  .cs-gallery-caption { height: 88px; padding-top: 16px; }
}
@media (max-width: 600px) and (max-height: 500px) {
  .cs-gallery-stage { inset: 64px 0 148px; }
  .cs-gallery-photo { max-height: 100%; }
  .cs-gallery-dialog .cs-gallery-arrow { bottom: 84px; }
  .cs-gallery-caption { height: auto; max-height: 56px; padding: 0; bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .cs-gallery-spinner { animation: none; }
}
