.brick-object-gallery {
    --brick-gallery-ink: var(--text-primary, #2c2d43);
    --brick-gallery-accent: #af0017;
    color: var(--brick-gallery-ink);
}

.brick-gallery-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px 24px;
    margin: 22px 0 16px;
}

.brick-object-gallery .brick-gallery-heading h1,
.brick-object-gallery .brick-gallery-heading h2,
.brick-gallery-links { margin: 0; }

.brick-gallery-links,
.brick-gallery-dialog-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
}

.brick-gallery-catalog,
.brick-gallery-product,
.brick-gallery-brand { font-weight: 600; }

.brick-gallery-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin: 12px 0 24px;
}

section.brick-object-gallery { scroll-margin-top: 90px; }

.brick-object-gallery a:focus-visible,
.brick-object-gallery button:focus-visible {
    outline: 2px solid var(--brick-gallery-accent);
    outline-offset: 3px;
}

.brick-object-gallery .brick-gallery-covers,
.brick-gallery-photos {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin: 0 0 28px;
    padding: 0;
    list-style: none;
}

.brick-object-gallery .brick-gallery-covers li { margin: 0; }

.brick-object-gallery .brick-gallery-cover {
    display: block;
    overflow: hidden;
    height: 100%;
    border: 1px solid #dddde4;
    border-radius: 6px;
    color: var(--brick-gallery-ink);
    text-decoration: none;
}

.brick-gallery-cover:hover { border-color: var(--brick-gallery-accent); }

.brick-gallery-cover img,
.brick-gallery-photo img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #f3f2f0;
}

.brick-gallery-cover-label {
    display: grid;
    gap: 3px;
    padding: 11px 14px;
}

.brick-gallery-cover-label span,
.brick-gallery-model,
.brick-gallery-angle,
.brick-gallery-size { font-size: .88rem; color: #57586c; }
.brick-gallery-size { margin: 4px 0 0; }

.brick-gallery-back { margin-bottom: 18px; }
.brick-gallery-photos figure { margin: 0; }
.brick-gallery-photo { display: block; cursor: zoom-in; }
.brick-gallery-photo img { border-radius: 6px; }
.brick-gallery-photos figcaption { display: grid; gap: 5px; padding: 9px 0 3px; }

.brick-object-gallery .brick-gallery-dialog {
    box-sizing: border-box;
    width: min(950px, calc(100vw - 28px));
    max-height: calc(100dvh - 28px);
    padding: 48px 14px 14px;
    border: 0;
    border-radius: 8px;
    color: var(--brick-gallery-ink);
    background: white;
}

.brick-gallery-dialog::backdrop { background: rgb(25 25 34 / 78%); }

.brick-gallery-frame {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    align-items: center;
    gap: 6px;
}

.brick-gallery-frame-single { grid-template-columns: minmax(0, 1fr); }

.brick-gallery-frame img {
    width: 100%;
    height: min(67vh, 660px);
    object-fit: contain;
    display: block;
    background: #f3f2f0;
}

.brick-gallery-dialog button {
    width: 38px;
    height: 38px;
    border: 1px solid #dddde4;
    border-radius: 6px;
    background: white;
    color: var(--brick-gallery-ink);
    font: inherit;
    font-size: 1.45rem;
    cursor: pointer;
}

.brick-gallery-close { position: absolute; top: 7px; right: 13px; }
.brick-gallery-dialog-info { padding: 10px 4px 0; }
.brick-gallery-dialog-info p { margin: 0; flex-basis: 100%; }

@media (max-width: 740px) {
    .brick-object-gallery .brick-gallery-covers,
    .brick-gallery-photos { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .brick-gallery-cover-label { padding: 9px; }
    .brick-gallery-frame { grid-template-columns: 1fr 1fr; gap: 8px; }
    .brick-gallery-frame-single { grid-template-columns: minmax(0, 1fr); }
    .brick-gallery-frame img { grid-column: 1 / -1; grid-row: 1; height: auto; max-height: 54dvh; }
    .brick-gallery-frame button { justify-self: center; min-width: 44px; min-height: 44px; }
}
