.impl-service-gallery,
.impl-service-video {
    width: 100%;
    margin: 0 auto clamp(32px, 5vw, 60px);
}

.impl-service-gallery {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: clamp(8px, 2vw, 20px);
    max-width: 920px;
}

.impl-service-gallery__thumb {
    position: relative;
    display: block;
    aspect-ratio: 830 / 600;
    overflow: hidden;
    border: 1px solid #dce7e3;
    border-radius: 8px;
    background: #f4f7f6;
    cursor: zoom-in;
}

.impl-service-gallery__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.impl-service-gallery__thumb::after {
    content: "";
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: #31554a;
    background:
        linear-gradient(currentColor, currentColor) center / 12px 2px no-repeat,
        linear-gradient(currentColor, currentColor) center / 2px 12px no-repeat,
        rgba(255, 255, 255, 0.94);
}

.impl-service-video {
    max-width: 810px;
    text-align: center;
}

.impl-service-video .impl-service-video__title {
    margin: 0 0 16px;
    font-size: clamp(18px, 2vw, 24px);
    line-height: 1.35;
}

.impl-service-video__screen {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 8px;
    background: #e1f0eb;
}

.impl-service-video__screen iframe,
.impl-service-video__play,
.impl-service-video__poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.impl-service-video__play {
    display: grid;
    place-items: center;
}

.impl-service-video__play[hidden] {
    display: none;
}

.impl-service-video__poster {
    object-fit: cover;
}

.impl-service-video__icon {
    z-index: 1;
    display: grid;
    place-items: center;
    width: clamp(48px, 8vw, 72px);
    aspect-ratio: 1;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 16px #0003;
}

.impl-service-video__icon::before {
    content: "";
    margin-left: 4px;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 15px solid #373737;
}

.impl-service-video__original {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-top: 4px;
    font-size: 14px;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.impl-service-gallery__thumb:focus-visible,
.impl-service-video__original:focus-visible,
.impl-service-gallery-dialog button:focus-visible {
    outline: 2px solid #3b7766;
    outline-offset: 3px;
}

.impl-service-video__play:focus-visible {
    outline: 3px solid #3b7766;
    outline-offset: -4px;
}

.impl-service-gallery-dialog {
    box-sizing: border-box;
    width: min(900px, calc(100% - 24px));
    max-width: none;
    max-height: calc(100% - 24px);
    margin: auto;
    padding: clamp(12px, 3vw, 24px);
    border: 0;
    border-radius: 12px;
    overflow: auto;
    background: #fff;
    color: #373737;
    font-family: inherit;
}

.impl-service-gallery-dialog::backdrop {
    background: rgba(23, 30, 28, 0.8);
}

.impl-service-gallery-dialog__heading,
.impl-service-gallery-dialog__controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.impl-service-gallery-dialog__heading {
    justify-content: space-between;
    margin-bottom: 12px;
}

.impl-service-gallery-dialog__heading h2 {
    margin: 0;
    text-align: left;
    font-size: clamp(18px, 2.4vw, 24px);
    line-height: 1.25;
}

.impl-service-gallery-dialog__controls {
    justify-content: center;
    margin-top: 12px;
}

.impl-service-gallery-dialog button {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border: 1px solid #9fcbbf;
    border-radius: 6px;
    background: #edf6f3;
    color: #31554a;
    font-size: 23px;
    line-height: 1;
    cursor: pointer;
}

.impl-service-gallery-dialog button:disabled {
    opacity: 0.45;
    cursor: default;
}

.impl-service-gallery-dialog__image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 830 / 600;
    max-height: min(60vh, 600px);
    max-height: min(60dvh, 600px);
    object-fit: contain;
    border-radius: 6px;
    background: #f4f7f6;
    touch-action: pan-y pinch-zoom;
}

.impl-service-gallery--many {
    grid-auto-flow: row;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.impl-service-media-block > .service_video_title,
.impl-service-media-block > h2,
.impl-service-media-block > h3 {
    margin: 0 auto 16px;
    text-align: center;
}

.impl-service-videos,
.impl-service-comparisons {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(16px, 3vw, 30px);
    max-width: 1040px;
    margin: 0 auto clamp(32px, 5vw, 60px);
}

.impl-service-videos .impl-service-video {
    width: auto;
    min-width: 0;
    margin: 0;
}

.impl-service-video__links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 20px;
}

.impl-service-video--fallback {
    padding: 14px 16px;
    border-radius: 8px;
    background: #edf6f3;
}

.impl-service-comparison {
    --comparison-position: 50%;
    position: relative;
    isolation: isolate;
    width: 100%;
    aspect-ratio: 3 / 2;
    margin: 0;
    overflow: hidden;
    border: 1px solid #dce7e3;
    border-radius: 8px;
    background: #f1f5f3;
}

.impl-service-comparison img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #f1f5f3;
}

.impl-service-comparison img.impl-service-comparison__after {
    clip-path: inset(0 0 0 var(--comparison-position));
}

.impl-service-comparison__before-label,
.impl-service-comparison__after-label {
    position: absolute;
    top: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(31, 41, 37, 0.82);
    color: #fff;
    font-size: 13px;
}

.impl-service-comparison__before-label {
    left: 8px;
}

.impl-service-comparison__after-label {
    right: 8px;
}

.impl-service-comparison__handle {
    position: absolute;
    inset: 0 auto 0 var(--comparison-position);
    width: 2px;
    transform: translateX(-50%);
    background: #fff;
    box-shadow: 0 0 5px #24352f;
}

.impl-service-comparison__handle::before {
    content: "↔";
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    transform: translate(-50%, -50%);
    border: 1px solid #9fcbbf;
    border-radius: 50%;
    background: #fff;
    color: #31554a;
    font-size: 20px;
}

.impl-service-comparison input[type="range"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: ew-resize;
}

.impl-service-comparison:focus-within {
    outline: 3px solid #3b7766;
    outline-offset: 3px;
}

@media (min-width: 850px) {
    .impl-service-videos,
    .impl-service-comparisons {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .impl-service-comparisons:has(> :only-child) {
        grid-template-columns: minmax(0, 680px);
        justify-content: center;
    }
}

@media (max-width: 520px) {
    .impl-service-gallery--many {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.impl-service-media-note {
    margin: 0 auto 24px;
    text-align: center;
}
