/* ============================================
   STROYKT — визуализатор кровли Grand Line
   ============================================ */

html.stroykt-roof-viz-lock,
body.stroykt-roof-viz-lock {
    overflow: hidden !important;
}

.stroykt-roof-modal {
    --roof-color: #4a261c;

    position: fixed;
    inset: 0;
    z-index: 100500;

    display: none;
}

.stroykt-roof-modal.is-open {
    display: block;
}

.stroykt-roof-modal__backdrop {
    position: absolute;
    inset: 0;

    background: rgba(0, 0, 0, .55);
}

.stroykt-roof-modal__panel {
    position: absolute;
    top: 50%;
    left: 50%;

    display: flex;
    flex-direction: column;

    width: min(1080px, calc(100vw - 40px));
    max-height: calc(100vh - 40px);

    overflow: hidden;

    background: #fff;
    border-radius: 14px;

    transform: translate(-50%, -50%);

    box-shadow: 0 25px 80px rgba(0, 0, 0, .25);
}

.stroykt-roof-modal__header {
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;

    min-height: 62px;
    padding: 0 12px;

    border-bottom: 1px solid #ececec;
    background: #fff;
}

.stroykt-roof-modal__header strong {
    text-align: center;

    color: #222;
    font-size: 20px;
    line-height: 1.2;
}

.stroykt-roof-modal__back,
.stroykt-roof-modal__close {
    width: 44px;
    height: 44px;

    padding: 0;

    border: 0;
    background: transparent;

    color: #222;
    cursor: pointer;

    font-size: 30px;
    line-height: 44px;
}

.stroykt-roof-modal__close {
    font-size: 35px;
    font-weight: 300;
}

.stroykt-roof-modal__body {
    overflow-y: auto;
    overscroll-behavior: contain;
}

.stroykt-roof-preview {
    position: relative;

    overflow: hidden;

    background: #eee;
}

.stroykt-roof-preview__image {
    display: block;

    width: 100%;
    height: auto;
}

.stroykt-roof-preview__tint {
    position: absolute;

    pointer-events: none;

    background: var(--roof-color);

    mix-blend-mode: multiply;
    opacity: .62;

    transition: background-color .25s ease;
}

/*
 * Маски сделаны под house.jpg.
 * Это пилотный вариант: цвет накладывается только
 * на основные плоскости кровли.
 */
.stroykt-roof-preview__tint--main {
    inset: 0;

    clip-path: polygon(
        4% 30%,
        17% 22%,
        41% 12%,
        68% 12%,
        87% 22%,
        93% 31%,
        73% 31%,
        58% 28%,
        43% 27%,
        26% 33%,
        10% 38%
    );
}

.stroykt-roof-preview__tint--lower {
    inset: 0;

    clip-path: polygon(
        55% 52%,
        83% 47%,
        99% 55%,
        99% 64%,
        78% 59%,
        59% 60%
    );

    opacity: .48;
}

.stroykt-roof-preview__caption {
    position: absolute;
    left: 18px;
    bottom: 16px;

    display: flex;
    flex-wrap: wrap;
    gap: 6px;

    max-width: calc(100% - 36px);

    padding: 8px 12px;

    background: rgba(255, 255, 255, .94);
    border-radius: 8px;

    color: #333;
    font-size: 13px;

    box-shadow: 0 3px 12px rgba(0, 0, 0, .12);
}

.stroykt-roof-controls {
    padding: 20px;
}

.stroykt-roof-step + .stroykt-roof-step {
    margin-top: 22px;
}

.stroykt-roof-step h3 {
    display: flex;
    align-items: center;
    gap: 8px;

    margin: 0 0 12px;

    color: #222;
    font-size: 18px;
    font-weight: 700;
}

.stroykt-roof-step h3 span {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 25px;
    height: 25px;

    border-radius: 50%;

    background: #b31e3b;
    color: #fff;

    font-size: 13px;
}

.stroykt-roof-options {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.stroykt-roof-options--profiles .stroykt-roof-option {
    min-width: 115px;
}

.stroykt-roof-option {
    min-height: 44px;

    padding: 9px 16px;

    border: 1px solid #ddd;
    border-radius: 7px;

    background: #fff;
    color: #333;

    cursor: pointer;

    font: inherit;

    transition: border-color .2s ease,
                color .2s ease,
                box-shadow .2s ease;
}

.stroykt-roof-option:hover,
.stroykt-roof-option.is-active {
    border-color: #b31e3b;
    color: #a71935;

    box-shadow: inset 0 0 0 1px #b31e3b;
}

.stroykt-roof-profile-icon {
    display: block;

    margin-bottom: 3px;

    color: #555;
    letter-spacing: -4px;

    font-size: 18px;
    line-height: 1;
}

.stroykt-roof-colors {
    display: grid;
    grid-template-columns: repeat(5, minmax(95px, 1fr));
    gap: 10px;
}

.stroykt-roof-color {
    position: relative;

    display: flex;
    flex-direction: column;
    align-items: center;

    min-width: 0;

    padding: 8px 6px 10px;

    border: 1px solid #ddd;
    border-radius: 8px;

    background: #fff;
    color: #333;

    cursor: pointer;

    font: inherit;
}

.stroykt-roof-color.is-active {
    border-color: #b31e3b;

    box-shadow: inset 0 0 0 1px #b31e3b;
}

.stroykt-roof-color i {
    display: block;

    width: 100%;
    height: 48px;

    margin-bottom: 7px;

    border: 1px solid rgba(0, 0, 0, .14);
    border-radius: 6px;

    background: var(--swatch);
}

.stroykt-roof-color span {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
}

.stroykt-roof-color small {
    margin-top: 3px;

    color: #777;
    font-size: 11px;
    line-height: 1.15;
}

.stroykt-roof-modal__footer {
    padding: 12px 20px 18px;

    border-top: 1px solid #eee;
    background: #fff;
}

.stroykt-roof-modal__products {
    width: 100%;
    min-height: 52px;

    padding: 12px 18px;

    border: 0;
    border-radius: 7px;

    background: #b31e3b;
    color: #fff;

    cursor: pointer;

    font-size: 16px;
    font-weight: 700;

    transition: background .2s ease;
}

.stroykt-roof-modal__products:hover {
    background: #99162f;
}

/* ================================
   MOBILE
   ================================ */

@media (max-width: 767px) {

    .stroykt-roof-modal__backdrop {
        display: none;
    }

    .stroykt-roof-modal__panel {
        position: fixed;
        inset: 0;

        width: 100%;
        height: 100%;
        max-height: none;

        border-radius: 0;

        transform: none;
    }

    .stroykt-roof-modal__header {
        flex: 0 0 56px;

        min-height: 56px;
        padding: 0 6px;
    }

    .stroykt-roof-modal__header strong {
        font-size: 17px;
    }

    .stroykt-roof-modal__body {
        flex: 1 1 auto;
    }

    .stroykt-roof-preview__caption {
        left: 10px;
        bottom: 9px;

        max-width: calc(100% - 20px);

        padding: 6px 8px;

        font-size: 11px;
    }

    .stroykt-roof-controls {
        padding: 15px 13px 20px;
    }

    .stroykt-roof-step + .stroykt-roof-step {
        margin-top: 18px;
    }

    .stroykt-roof-step h3 {
        margin-bottom: 9px;

        font-size: 16px;
    }

    .stroykt-roof-step h3 span {
        width: 22px;
        height: 22px;

        font-size: 11px;
    }

    .stroykt-roof-options {
        flex-wrap: nowrap;

        overflow-x: auto;
        padding-bottom: 3px;

        scrollbar-width: none;
    }

    .stroykt-roof-options::-webkit-scrollbar {
        display: none;
    }

    .stroykt-roof-option {
        flex: 0 0 auto;

        min-height: 42px;

        padding: 8px 13px;

        white-space: nowrap;

        font-size: 13px;
    }

    .stroykt-roof-options--profiles .stroykt-roof-option {
        min-width: 88px;
    }

    .stroykt-roof-colors {
        display: flex;

        overflow-x: auto;
        gap: 8px;

        padding-bottom: 3px;

        scrollbar-width: none;
    }

    .stroykt-roof-colors::-webkit-scrollbar {
        display: none;
    }

    .stroykt-roof-color {
        flex: 0 0 88px;

        padding: 6px 5px 8px;
    }

    .stroykt-roof-color i {
        height: 43px;

        margin-bottom: 5px;
    }

    .stroykt-roof-color span {
        font-size: 11px;
    }

    .stroykt-roof-color small {
        font-size: 10px;
    }

    .stroykt-roof-modal__footer {
        flex: 0 0 auto;

        padding: 9px 12px 12px;

        box-shadow: 0 -5px 15px rgba(0, 0, 0, .06);
    }

    .stroykt-roof-modal__products {
        min-height: 50px;

        font-size: 15px;
    }
}

/* STROYKT: navigation chain like product card */
.stroykt-roof-modal__breadcrumb {
    flex: 0 0 auto;
    width: 100%;
    padding: 0;
    background: #fff;
    border-bottom: 1px solid #eeeeee;
}

.stroykt-roof-modal__breadcrumb-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 58px;
    padding: 10px 15px;
    margin: 0;
    border: 0;
    background: #fff;
    color: #999;
    font-family: inherit;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.2;
    cursor: pointer;
}

.stroykt-roof-modal__breadcrumb-arrow {
    color: #aaa;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
}

@media (max-width: 767px) {
    .stroykt-roof-modal__breadcrumb {
        flex: 0 0 58px;
    }

    .stroykt-roof-modal__breadcrumb-link {
        min-height: 58px;
    }
}
/* STROYKT: fix house image */
.stroykt-roof-preview {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #eee;
}

.stroykt-roof-preview__image {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-width: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}
@media (max-width: 767px) {
    .stroykt-roof-preview__image {
        width: 100% !important;
        height: auto !important;
        object-fit: cover;
    }
}
/* STROYKT: image layer order */
.stroykt-roof-preview__image {
    position: relative;
    z-index: 1;
}

.stroykt-roof-preview__tint {
    z-index: 2;
}

.stroykt-roof-preview__caption {
    z-index: 3;
}

/* =========================================================
   STROYKT FINAL CANVAS RENDERER
   ========================================================= */
.stroykt-roof-preview {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    overflow: hidden !important;
    background: #eee;
}

.stroykt-roof-preview__image {
    position: relative !important;
    z-index: 1 !important;
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-width: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.stroykt-roof-canvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 2 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none !important;
}

.stroykt-roof-preview__caption {
    position: absolute !important;
    left: 12px;
    bottom: 10px;
    z-index: 3 !important;
}

@media (max-width: 767px) {
    .stroykt-roof-preview__image {
        width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
    }

    .stroykt-roof-canvas {
        width: 100% !important;
        height: 100% !important;
    }

    .stroykt-roof-preview__image,
    .stroykt-roof-canvas {
        aspect-ratio: 1448 / 1086;
    }
}

/* =========================================================
   MATERIAL CATALOG UI
   ========================================================= */
.stroykt-roof-modal .visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.stroykt-roof-modal .material-field {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.stroykt-roof-modal .material-field select {
    width: 100%;
    min-height: 46px;
    padding: 0 42px 0 13px;

    border: 1px solid #b9beb7;
    border-radius: 8px;
    background: #fff;
    color: inherit;

    font: inherit;
}

.stroykt-roof-modal .material-field select:focus-visible {
    border-color: #74645c;
    outline: 2px solid rgba(74, 38, 28, .24);
    outline-offset: 2px;
}

.stroykt-roof-modal .material-colors__list {
    display: block;
}

.stroykt-roof-modal .material-colors__primary,
.stroykt-roof-modal .material-colors__extra {
    display: grid;
    grid-template-columns: repeat(6, minmax(118px, 1fr));
    gap: 9px;
}

.stroykt-roof-modal .material-colors__more {
    margin-top: 9px;
}

.stroykt-roof-modal .material-colors__toggle {
    display: none;
}

.stroykt-roof-modal .material-color {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;

    min-width: 0;
    min-height: 46px;
    padding: 8px 10px;

    border: 1px solid #c5c9c3;
    border-radius: 8px;
    background: #fff;
    color: inherit;

    cursor: pointer;
    font: 600 13px/1.2 inherit;
}

.stroykt-roof-modal .material-color:hover {
    border-color: #74645c;
}

.stroykt-roof-modal .material-color:focus-visible {
    outline: 2px solid rgba(74, 38, 28, .24);
    outline-offset: 2px;
}

.stroykt-roof-modal .material-color.is-active {
    border-color: #4a261c;
    box-shadow: 0 0 0 2px rgba(74, 38, 28, .18);
}

.stroykt-roof-modal .material-color__swatch {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;

    border: 1px solid rgba(0, 0, 0, .2);
    border-radius: 50%;
}

@media (max-width: 767px) {
    .stroykt-roof-modal .material-colors__primary,
    .stroykt-roof-modal .material-colors__extra {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stroykt-roof-modal .material-color {
        min-height: 48px;
    }
}

/* =========================================================
   MODAL VIEWPORT LAYOUT
   ========================================================= */
.stroykt-roof-modal__panel {
    height: 85vh;
    max-height: 85vh;
}

.stroykt-roof-modal__header,
.stroykt-roof-modal__breadcrumb,
.stroykt-roof-modal__footer {
    flex: 0 0 auto;
}

.stroykt-roof-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    padding-bottom: 24px;
    overflow-y: auto;
    scroll-padding-bottom: 24px;
}

.stroykt-roof-modal__footer {
    position: sticky;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 5;
}

@media (min-width: 768px) {
    .stroykt-roof-modal__body {
        display: grid;
        grid-template-columns: minmax(0, 1.45fr) minmax(360px, .95fr);
        align-items: start;
    }

    .stroykt-roof-preview {
        align-self: start;
        justify-self: center;
        width: min(100%, calc(46vh * 1448 / 1086)) !important;
        height: auto !important;
        max-height: 46vh;
        aspect-ratio: 1448 / 1086;
    }

    .stroykt-roof-preview__image {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
    }

    .stroykt-roof-controls {
        min-width: 0;
        padding: 16px 18px 20px;
    }

    .stroykt-roof-step + .stroykt-roof-step {
        margin-top: 14px;
    }

    .stroykt-roof-step h3 {
        margin-bottom: 8px;
        font-size: 16px;
    }

    .stroykt-roof-modal .material-colors__primary,
    .stroykt-roof-modal .material-colors__extra {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .stroykt-roof-modal .material-color {
        min-height: 42px;
        padding: 6px 8px;
    }
}

@media (max-width: 767px) {
    .stroykt-roof-modal__panel {
        height: 100%;
        height: 100dvh;
        max-height: none;
    }

    .stroykt-roof-modal__body {
        display: block;
        padding-bottom: 28px;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        scroll-padding-bottom: 28px;
    }

    .stroykt-roof-preview {
        width: min(100%, calc(30vh * 1448 / 1086)) !important;
        height: auto !important;
        max-height: none;
        margin-right: auto;
        margin-left: auto;
        aspect-ratio: 1448 / 1086;
    }

    .stroykt-roof-preview__image {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
    }

    .stroykt-roof-controls,
    .stroykt-roof-step,
    .stroykt-roof-modal .material-colors__list {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .stroykt-roof-modal .material-colors__list {
        display: block !important;
    }

    .stroykt-roof-modal .material-colors__primary,
    .stroykt-roof-modal .material-colors__extra {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stroykt-roof-modal .material-colors__more {
        display: grid;
        grid-template-rows: 0fr;
        margin-top: 0;
        opacity: 0;
        pointer-events: none;

        transition: grid-template-rows .28s ease,
                    margin-top .28s ease,
                    opacity .2s ease;
    }

    .stroykt-roof-modal .material-colors__extra {
        min-height: 0;
        overflow: hidden;
    }

    .stroykt-roof-modal .material-colors__list.is-expanded .material-colors__more {
        grid-template-rows: 1fr;
        margin-top: 9px;
        opacity: 1;
        pointer-events: auto;
    }

    .stroykt-roof-modal .material-colors__toggle {
        display: block;
        width: 100%;
        min-height: 44px;
        margin-top: 10px;
        padding: 9px 12px;

        border: 1px solid #c5c9c3;
        border-radius: 8px;
        background: #fff;
        color: #4a261c;

        cursor: pointer;
        font: 700 13px/1.2 inherit;
    }

    .stroykt-roof-modal .material-colors__toggle[hidden] {
        display: none !important;
    }

    .stroykt-roof-modal .material-colors__toggle:focus-visible {
        outline: 2px solid rgba(74, 38, 28, .24);
        outline-offset: 2px;
    }
}
