.stack-section {
    padding: 118px 0 112px;
    background: #fbfbfd;
}

.stack-explorer {
    display: grid;
    grid-template-columns: minmax(520px, 1.15fr) minmax(340px, 0.85fr);
    gap: 52px;
    align-items: stretch;
}

.stack-explorer__visual {
    position: relative;
    min-height: 540px;
    overflow: hidden;
    border: 1px solid rgba(38, 31, 62, 0.085);
    border-radius: 28px;
    background:
        radial-gradient(circle at 68% 34%, rgba(119, 74, 247, 0.14), transparent 31%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(245, 242, 251, 0.82));
    box-shadow: 0 28px 74px rgba(46, 32, 100, 0.075);
}

.stack-explorer__visual::before {
    position: absolute;
    inset: 0;
    content: "";
    opacity: 0.45;
    background-image:
        linear-gradient(rgba(91, 67, 157, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(91, 67, 157, 0.05) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(135deg, #000, transparent 82%);
}

.stack-explorer__axis {
    position: absolute;
    z-index: 1;
    left: 74px;
    top: 62px;
    bottom: 62px;
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(103, 62, 241, 0.34), transparent);
}

.stack-explorer__axis span {
    position: absolute;
    left: 50%;
    top: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #7b52f2;
    box-shadow: 0 0 12px rgba(123, 82, 242, 0.65);
    transform: translateX(-50%);
    animation: stack-axis-pulse 5s ease-in-out infinite;
}

.stack-slab {
    position: absolute;
    z-index: calc(10 - var(--stack-index));
    left: calc(92px + var(--stack-index) * 13px);
    right: calc(42px + var(--stack-index) * 8px);
    top: calc(56px + var(--stack-index) * 82px);
    display: grid;
    grid-template-columns: 45px minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    min-height: 82px;
    padding: 18px 24px;
    color: #242633;
    border: 1px solid rgba(39, 31, 62, 0.11);
    border-radius: 17px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(239, 235, 250, 0.9));
    box-shadow:
        0 18px 34px rgba(50, 34, 104, 0.08),
        0 1px 0 rgba(255, 255, 255, 0.9) inset;
    text-align: left;
    cursor: pointer;
    transform: skewX(-4deg) translateX(calc(var(--stack-index) * 3px));
    transform-origin: center;
    transition: transform 260ms ease, border-color 260ms ease, box-shadow 260ms ease, background 260ms ease;
}

.stack-slab > * {
    transform: skewX(4deg);
}

.stack-slab > span {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: #7f7890;
    border: 1px solid rgba(102, 62, 232, 0.13);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.7);
    font-size: 10px;
    font-weight: 700;
}

.stack-slab strong {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.025em;
}

.stack-slab small {
    color: #85818e;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.stack-slab:hover,
.stack-slab.is-active {
    z-index: 20;
    border-color: rgba(103, 62, 241, 0.35);
    background: linear-gradient(145deg, #ffffff, #ece5ff);
    box-shadow:
        0 24px 48px rgba(66, 40, 150, 0.15),
        0 0 28px rgba(112, 66, 245, 0.11);
    transform: skewX(-4deg) translateX(18px) translateY(-3px);
}

.stack-slab.is-active > span {
    color: #ffffff;
    border-color: #7045f3;
    background: linear-gradient(145deg, #8059ff, #5530dc);
    box-shadow: 0 8px 20px rgba(91, 50, 218, 0.24);
}

.stack-detail {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 540px;
    padding: 50px 44px;
    border: 1px solid rgba(38, 31, 62, 0.085);
    border-radius: 28px;
    background:
        radial-gradient(circle at 90% 10%, rgba(126, 80, 255, 0.16), transparent 28%),
        linear-gradient(160deg, #17131f 0%, #211735 58%, #121018 100%);
    color: #ffffff;
    box-shadow: 0 28px 74px rgba(31, 20, 67, 0.18);
}

.stack-detail__top {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 30px;
}

.stack-detail__top > span {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid rgba(180, 148, 255, 0.22);
    border-radius: 12px;
    color: #c1aaff;
    background: rgba(255, 255, 255, 0.06);
    font-size: 11px;
    font-weight: 700;
}

.stack-detail__top small {
    color: #a89eb7;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.stack-detail h3 {
    max-width: 470px;
    font-size: 34px;
    font-weight: 500;
    line-height: 1.08;
    letter-spacing: -0.045em;
}

.stack-detail > p {
    max-width: 500px;
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    line-height: 1.7;
}

.stack-detail ul {
    display: grid;
    gap: 12px;
    margin-top: 31px;
    list-style: none;
}

.stack-detail li {
    position: relative;
    padding-left: 20px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 12px;
}

.stack-detail li::before {
    position: absolute;
    left: 0;
    top: 5px;
    width: 7px;
    height: 7px;
    content: "";
    border-radius: 50%;
    background: #a677ff;
    box-shadow: 0 0 10px rgba(166, 119, 255, 0.64);
}

.stack-detail__status {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 37px;
    padding-top: 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.48);
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.stack-detail__status span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #19c988;
    box-shadow: 0 0 12px rgba(25, 201, 136, 0.65);
}

@keyframes stack-axis-pulse {
    0%,
    100% {
        top: 0;
        opacity: 0.25;
    }
    50% {
        top: calc(100% - 7px);
        opacity: 1;
    }
}

@media (max-width: 1080px) {
    .stack-explorer {
        grid-template-columns: 1fr;
    }

    .stack-explorer__visual,
    .stack-detail {
        min-height: 520px;
    }

}

@media (max-width: 720px) {
    .stack-section {
        padding: 96px 0;
    }

    .stack-explorer__visual {
        min-height: 500px;
    }

    .stack-slab {
        left: calc(56px + var(--stack-index) * 8px);
        right: calc(18px + var(--stack-index) * 4px);
        top: calc(44px + var(--stack-index) * 84px);
        grid-template-columns: 38px minmax(0, 1fr);
        padding: 16px 18px;
    }

    .stack-slab small {
        display: none;
    }

    .stack-explorer__axis {
        left: 40px;
    }

    .stack-detail {
        min-height: auto;
        padding: 40px 28px;
    }

    .stack-detail h3 {
        font-size: 30px;
    }

}

@media (max-width: 500px) {
    .stack-explorer__visual {
        min-height: 470px;
    }

    .stack-slab {
        left: calc(40px + var(--stack-index) * 5px);
        right: 12px;
        top: calc(35px + var(--stack-index) * 82px);
    }

    .stack-explorer__axis {
        left: 28px;
    }

}

@media (prefers-reduced-motion: reduce) {
    .stack-explorer__axis span {
        animation: none;
    }
}
