.ch-gallery { display: none; }

@media (max-width: 767px) {
  .ch-gallery {
    position: relative;
    display: block;
    margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px)))
      calc(-1 * max(16px, env(safe-area-inset-right, 0px)));
    background: #fff;
  }

  .cp-stage:has(+ .ch-gallery) { display: none; }

  .ch-gallery-frame {
    position: relative;
    aspect-ratio: 2 / 3;
    background: #fff;
  }

  .ch-gallery-panel { position: absolute; inset: 0; }
  .ch-gallery-empty:not(#ch-exterior) {
    background: linear-gradient(160deg, #222638, #3b435a);
    color: #fff;
  }

  #hdr[data-gallery-cover] {
    --fg: #fff;
    --bars: #fff;
    --sq-bg: transparent;
    --sq-bd: transparent;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  #hdr[data-gallery-cover]::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0 0 -24px;
    background: linear-gradient(180deg, rgba(4, 6, 15, .62), rgba(4, 6, 15, .4) 45%, transparent);
    pointer-events: none;
  }

  #hdr[data-gallery-cover] .l-white { display: block; }
  #hdr[data-gallery-cover] .l-blue { display: none; }
  #hdr[data-gallery-cover] :is(.burger, .callbtn) {
    color: #fff;
    border-color: transparent;
    background: transparent;
    filter: drop-shadow(0 1px 3px #111);
  }
  #hdr[data-gallery-cover] .logo { filter: drop-shadow(0 1px 4px #111); }
  .ch-gallery-panel[hidden] { display: none; }
  .ch-gallery-photos { display: flex; overflow: auto hidden; scrollbar-width: none; }
  .ch-gallery-photos[data-loop] {
    --gallery-peek: clamp(16px, 5vw, 24px);
    --gallery-gap: 4px;
    overflow: hidden;
    touch-action: pan-y;
  }

  .ch-gallery-track {
    display: flex;
    width: 100%;
    height: 100%;
    gap: var(--gallery-gap);
  }

  .ch-gallery-photos[data-loop] img {
    flex-basis: calc(100% - 2 * var(--gallery-peek));
    background-color: #f5f6fb;
  }

  .ch-gallery-arrow {
    position: absolute;
    z-index: 1;
    top: 50%;
    width: 44px;
    height: 44px;
    padding: 0;
    display: grid;
    place-items: center;
    transform: translateY(-50%);
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    cursor: pointer;
  }

  .ch-gallery-arrow[hidden] { display: none; }
  .ch-gallery-arrow[data-direction="-1"] { left: 4px; }
  .ch-gallery-arrow[data-direction="1"] { right: 4px; }

  .ch-gallery-arrow::before,
  .ch-gallery-arrow::after {
    content: "";
    grid-area: 1 / 1;
    pointer-events: none;
  }

  .ch-gallery-arrow::before {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(4, 6, 15, .48);
  }

  .ch-gallery-arrow::after {
    width: 6px;
    height: 6px;
    border-right: 1.5px solid;
    border-top: 1.5px solid;
    transform: translateX(-1px) rotate(45deg);
  }

  .ch-gallery-arrow[data-direction="-1"]::after {
    transform: translateX(1px) rotate(-135deg);
  }

  .ch-gallery-frame:has(#ch-exterior:not([hidden])) .ch-gallery-arrow {
    color: #0d0f33;
  }

  .ch-gallery-frame:has(#ch-exterior:not([hidden])) .ch-gallery-arrow::before {
    background: rgba(13, 15, 51, .09);
  }

  .ch-gallery-photos img {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 72px 17% 54px;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-drag: none;
  }

  .ch-gallery-photos--portrait img { object-fit: cover; padding: 0; }

  .ch-gallery-empty {
    display: grid;
    place-items: center;
    text-align: center;
    padding: 24px;
    color: #6a6e94;
    font: 600 14px/1.5 Montserrat, sans-serif;
  }

  .ch-gallery-tabs {
    position: absolute;
    z-index: 2;
    inset: auto 0 12px;
    isolation: isolate;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: min(82%, 360px);
    margin-inline: auto;
    padding: 3px;
    border-radius: 999px;
    background: rgba(242, 242, 246, .8);
    touch-action: pan-y;
    user-select: none;
  }

  .ch-gallery-tabs::before {
    content: "";
    position: absolute;
    inset: 3px auto 3px 3px;
    z-index: -1;
    width: calc((100% - 6px) / 3);
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(13, 15, 51, .12);
    transform: translateX(calc(var(--gallery-tab, 0) * 100%));
    transition: transform .2s ease-out;
    pointer-events: none;
  }

  .ch-gallery-tabs[data-dragging]::before { transition: none; }
  .ch-gallery-tabs button { touch-action: pan-y; }

  .ch-gallery-tabs button {
    border: 0;
    background: transparent;
    color: #454555;
    border-radius: 999px;
    min-height: 40px;
    padding: 0 4px;
    font: 600 11px/1 Montserrat, sans-serif;
    cursor: pointer;
  }

  .ch-gallery-tabs button[aria-selected="true"] { color: #000; font-weight: 700; }
  .ch-gallery-tabs button:focus-visible { outline: 2px solid #3347ff; outline-offset: -2px; }

  @media (prefers-reduced-motion: reduce) {
    .ch-gallery-tabs::before { transition: none; }
  }
}
