/* ==========================================================================
   INTERACTIVE KEYPAD COMPONENT
   ========================================================================== */

.interactive-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4rem;
    margin-top: 4rem;
    flex-wrap: wrap;
}

.keypad {
    position: relative;
    aspect-ratio: 400 / 310;
    display: flex;
    place-items: center;
    width: clamp(280px, 35vw, 400px);
    margin: 0;
    -webkit-tap-highlight-color: transparent;
    transition-property: translate, transform;
    transition-duration: 0.26s;
    transition-timing-function: ease-out;
    transform-style: preserve-3d;
    opacity: 1;
    flex-shrink: 0;
}

.key {
    transform-style: preserve-3d;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    outline: none;
}

.key[data-pressed='true'],
.key:active {
    .key__content {
        translate: 0 calc(var(--travel, 20) * 1%);
    }
}

.key__content {
    width: 100%;
    display: inline-block;
    height: 100%;
    transition: translate 0.12s ease-out;
    container-type: inline-size;
}

.key__mask {
    width: 100%;
    height: 100%;
    display: inline-block;
}

.key__text {
    height: 46%;
    width: 86%;
    position: absolute;
    font-size: 12cqi;
    z-index: 21;
    top: 5%;
    left: 0;
    color: hsl(0 0% 94%);
    translate: 8% 10%;
    transform: rotateX(36deg) rotateY(45deg) rotateX(-90deg) rotate(0deg);
    text-align: left;
    padding: 1ch;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.keypad__single {
    position: absolute;
    width: 40.5%;
    left: 54%;
    bottom: 36%;
    height: 46%;
    clip-path: polygon(
        0 0,
        54% 0,
        89% 24%,
        100% 70%,
        54% 100%,
        46% 100%,
        0 69%,
        12% 23%,
        47% 0%
    );
    mask: url(https://assets.codepen.io/605876/keypad-single.png?format=auto&quality=86) 50% 50% / 100% 100%;
}

.keypad__single--left {
    left: 29.3%;
    bottom: 54.2%;
}

.keypad__single .key__text {
    font-size: 18cqi;
    width: 52%;
    height: 62%;
    translate: 45% -16%;
}

.keypad__single img {
    top: 0;
    opacity: 1;
    width: 96%;
    position: absolute;
    left: 50%;
    translate: -50% 1%;
    filter: hue-rotate(calc(var(--hue, -43) * 1deg))
        saturate(var(--saturate, 1.3)) brightness(var(--brightness, 1.0));
}

.keypad__double {
    position: absolute;
    background: transparent;
    width: 64%;
    height: 65%;
    left: 6%;
    bottom: 17.85%;
    clip-path: polygon(
        34% 0,
        93% 44%,
        101% 78%,
        71% 100%,
        66% 100%,
        0 52%,
        0 44%,
        7% 17%,
        30% 0
    );
    mask: url(https://assets.codepen.io/605876/keypad-double.png?format=auto&quality=86) 50% 50% / 100% 100%;
}

.keypad__double img {
    top: 0;
    opacity: 1;
    width: 99%;
    position: absolute;
    left: 50%;
    translate: -50% 1%;
    filter: hue-rotate(calc(var(--hue, -43) * 1deg))
        saturate(var(--saturate, 1.3)) brightness(var(--brightness, 1.0));
}

.keypad__base {
    position: absolute;
    bottom: 0;
    width: 100%;
}

.keypad img {
    transition: translate 0.12s ease-out;
    width: 100%;
}

/* Keypad Mobile Responsive */
@media (max-width: 768px) {
    .interactive-row {
        flex-direction: column;
        gap: 2rem;
        align-items: center;
    }
    
    .keypad {
        width: clamp(200px, 60vw, 300px);
        margin: 0;
    }
    
    .key__text {
        font-size: 10cqi;
    }
    
    .keypad__single .key__text {
        font-size: 14cqi;
    }
}

@media (max-width: 1024px) {
    .interactive-row {
        gap: 2rem;
    }
    
    .keypad {
        width: clamp(240px, 40vw, 350px);
    }
}