/* Creative Agency X — Homepage Section 09: The System */

.cax-system {
    --system-red: #F30101;
    --system-black: #000000;
    --system-white: #FFFFFF;
    width: 100%;
    background: var(--system-white);
    color: var(--system-black);
}

.cax-system,
.cax-system *,
.cax-system *::before,
.cax-system *::after {
    box-sizing: border-box;
}

.cax-system__inner {
    width: min(
        var(--site-width, 1600px),
        calc(100% - (var(--site-gutter, 24px) * 2))
    );
    height: clamp(590px, 80svh, 790px);
    margin-inline: auto;
    padding: clamp(18px, 1.8vw, 28px) clamp(24px, 2.4vw, 38px) clamp(16px, 1.6vw, 24px);
    border: 1px solid var(--system-black);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
}

.cax-system__header {
    display: grid;
    justify-items: center;
}

.cax-system__label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: "Epic Pro", Arial, Helvetica, sans-serif;
    font-size: var(--type-ui);
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
}

.cax-system__section-number,
.cax-system__slash {
    color: var(--system-red);
}

.cax-system__heading {
    margin: clamp(12px, 1.2vw, 18px) 0 0;
    text-align: center;
    letter-spacing: -.035em;
    text-transform: uppercase;
}

.cax-system__heading > span {
    display: block;
}

.cax-system__visual {
    width: min(88%, 1260px);
    min-height: 0;
    margin: clamp(8px, .8vw, 12px) auto 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px;
    gap: clamp(20px, 2vw, 32px);
}

.cax-system__layers {
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-rows: repeat(7, minmax(0, 1fr));
    gap: clamp(4px, .5vw, 8px);
    perspective: 1000px;
}

.cax-system__layer {
    position: relative;
    min-width: 0;
    min-height: 0;
    display: grid;
    place-items: center;
    isolation: isolate;
}

.cax-system__layer-surface {
    position: absolute;
    z-index: -1;
    inset: 2px clamp(2px, .2vw, 4px);
    background: var(--system-black);
    clip-path: polygon(6% 0, 94% 0, 100% 100%, 0 100%);
    transform:
        perspective(950px)
        rotateX(53deg)
        scaleX(calc(1 - (var(--layer-index) * .01)));
    transform-origin: center;
}

.cax-system__layer-surface::after {
    content: "";
    position: absolute;
    inset: auto 0 -5px;
    height: 6px;
    background: var(--system-black);
    opacity: .76;
}

.cax-system__layer-label {
    color: var(--system-white);
    font-family: Arial, Helvetica, sans-serif;
    font-size: var(--type-h5);
    font-weight: 700;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
}

.cax-system__depth {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    justify-items: center;
    color: var(--system-red);
    font-family: Arial, Helvetica, sans-serif;
    font-size: var(--type-ui-lg);
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
}

.cax-system__depth-line {
    position: relative;
    width: 2px;
    min-height: 0;
    margin-block: 8px;
    background: var(--system-red);
}

.cax-system__depth-line::before,
.cax-system__depth-line::after {
    content: "";
    position: absolute;
    left: 50%;
    width: 12px;
    aspect-ratio: 1;
    border: 3px solid var(--system-red);
    border-radius: 50%;
    background: var(--system-white);
    transform: translateX(-50%);
}

.cax-system__depth-line::before { top: -3px; }
.cax-system__depth-line::after { bottom: -3px; }

.cax-system__statement {
    margin: clamp(10px, 1vw, 14px) 0 0;
    text-align: center;
    font-family: Arial, Helvetica, sans-serif !important;
    font-size: var(--type-h5) !important;
    font-weight: 700;
    line-height: 1.12 !important;
    text-transform: uppercase;
}

.cax-system__statement > span {
    display: block;
}

@media (max-height: 820px) and (min-width: 901px) {
    .cax-system__inner {
        height: clamp(560px, 80svh, 630px);
        padding-block: 12px 10px;
    }

    .cax-system__heading { margin-top: 9px; }
    .cax-system__visual { margin-top: 6px; gap: 22px; }
    .cax-system__layers { gap: 3px; }
    .cax-system__statement { margin-top: 6px; }
}

@media (max-width: 900px) {
    .cax-system__inner {
        height: auto;
        padding: 30px 24px 34px;
        overflow: visible;
    }

    .cax-system__visual {
        width: 100%;
        margin-top: 26px;
        grid-template-columns: minmax(0, 1fr) 90px;
        gap: 18px;
    }

    .cax-system__layers {
        min-height: 470px;
        gap: 8px;
    }

    .cax-system__layer-surface {
        transform:
            perspective(850px)
            rotateX(42deg)
            scaleX(calc(1 - (var(--layer-index) * .008)));
    }

    .cax-system__statement {
        margin-top: 26px;
    }
}

@media (max-width: 600px) {
    .cax-system__inner {
        width: min(100% - 36px, var(--site-width, 1600px));
        padding: 26px 18px 30px;
    }

    .cax-system__header {
        justify-items: start;
    }

    .cax-system__heading {
        margin-top: 20px;
        text-align: left;
    }

    .cax-system__visual {
        margin-top: 28px;
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .cax-system__layers {
        min-height: 0;
        grid-template-rows: repeat(7, 58px);
        gap: 10px;
    }

    .cax-system__layer-surface {
        inset: 0;
        clip-path: polygon(3% 0, 97% 0, 100% 100%, 0 100%);
        transform:
            perspective(700px)
            rotateX(28deg)
            scaleX(calc(1 - (var(--layer-index) * .005)));
    }

    .cax-system__depth {
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-rows: auto;
        align-items: center;
        gap: 10px;
    }

    .cax-system__depth-line {
        width: auto;
        height: 2px;
        margin: 0;
    }

    .cax-system__depth-line::before,
    .cax-system__depth-line::after {
        top: 50%;
        left: auto;
        transform: translateY(-50%);
    }

    .cax-system__depth-line::before { left: -2px; }
    .cax-system__depth-line::after { right: -2px; bottom: auto; }

    .cax-system__statement {
        margin-top: 24px;
        text-align: left;
    }
}
