/* Wallet: coded leather + CSS Amex on oil alpine scene */

.wallet-scene {
    position: relative;
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    margin-top: 1rem;
    min-height: 820px;
    overflow: hidden;
    isolation: isolate;
    color-scheme: light;
    background-color: #3a4a3c;
    background-image: url('wallet-scene-oil.png');
    background-size: cover;
    background-position: center 45%;
    background-repeat: no-repeat;
    user-select: none;
    -webkit-user-select: none;
}

.wallet-scene::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 85% 60% at 50% 38%, rgba(255, 210, 140, 0.22), transparent 68%),
        radial-gradient(ellipse 50% 40% at 70% 20%, rgba(180, 210, 255, 0.14), transparent 60%),
        linear-gradient(180deg, rgba(50, 60, 80, 0.22) 0%, transparent 30%, transparent 60%, rgba(90, 55, 25, 0.14) 100%);
}

.wallet-scene::after {
    content: '';
    position: absolute;
    inset: -30%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.45;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 140px 140px;
    animation: grain-drift 0.7s steps(4) infinite;
}

.wallet-grain {
    position: absolute;
    inset: -25%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.4;
    mix-blend-mode: soft-light;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.55' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
    background-size: 240px 240px;
    animation: grain-drift-alt 1.1s steps(3) infinite;
}

@media (prefers-reduced-motion: reduce) {
    .wallet-scene::after,
    .wallet-grain {
        animation: none;
    }
}

.wallet-stage {
    position: relative;
    z-index: 2;
    isolation: isolate;
    display: grid;
    place-items: center;
    min-height: 820px;
    width: 100%;
    padding: 200px 1.5rem 3rem;
    overflow: hidden;
    background: transparent;
}

.wallet {
    position: relative;
    width: min(420px, 78vw);
    aspect-ratio: 1.42 / 1;
    isolation: isolate;
    /* box-shadow instead of filter:drop-shadow — CSS filters force the
       stitch SVG (and leather) through an extra raster pass that softens
       fine thread detail on mobile WebKit. */
    box-shadow: 0 24px 40px rgba(8, 12, 10, 0.4);
}

/* Leather face styles live in leather.css */

/* ——— Card peek / hover / eject ——— */

.wallet-card {
    position: absolute;
    left: 8%;
    width: 84%;
    aspect-ratio: 1.586 / 1;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    transform-style: preserve-3d;
    transition:
        transform 280ms cubic-bezier(0.22, 0.82, 0.28, 1),
        -webkit-mask-size 280ms cubic-bezier(0.22, 0.82, 0.28, 1),
        mask-size 280ms cubic-bezier(0.22, 0.82, 0.28, 1);
    will-change: transform;
    -webkit-tap-highlight-color: transparent;
    isolation: isolate;
    -webkit-mask-image: linear-gradient(#000 0 0);
    mask-image: linear-gradient(#000 0 0);
    -webkit-mask-size: 100% 30%;
    mask-size: 100% 30%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: top center;
    mask-position: top center;
}

.wallet-card--amex {
    top: 0;
    left: 8%;
    width: 84%;
    transform: translate3d(0, 4%, 2px);
    z-index: 3;
}

/* Amex parked (leather-only). Keep markup for later; hide every reveal state. */
.wallet-card--amex,
.wallet-card--amex.is-lifted,
.wallet-card--amex.is-out,
.wallet-card--amex:hover,
.wallet-card--amex:focus,
.wallet-card--amex:focus-visible,
.wallet-card--amex:active,
.wallet .amex {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transform: none !important;
    z-index: -1 !important;
}

@media (hover: hover) and (pointer: fine) {
    .wallet-card--amex:hover:not(.is-out),
    .wallet-card--amex.is-lifted:not(.is-out) {
        transform: translate3d(0, -10%, 10px);
        -webkit-mask-size: 100% 48%;
        mask-size: 100% 48%;
        z-index: 6;
    }

    .wallet-card:hover:not(.is-out) .amex,
    .wallet-card.is-lifted:not(.is-out) .amex {
        box-shadow:
            0 1px 0 rgba(255, 255, 255, 0.5) inset,
            0 16px 30px rgba(12, 12, 12, 0.3),
            0 4px 10px rgba(12, 12, 12, 0.16);
    }
}

.wallet-card--amex.is-out {
    transform: translate3d(0, -48%, 14px);
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    z-index: 5;
}

.wallet-card.is-out .amex {
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.5) inset,
        0 24px 42px rgba(10, 10, 10, 0.34);
}

.wallet-card:focus-visible {
    outline: 2px solid rgba(255, 250, 240, 0.75);
    outline-offset: 4px;
}

/* ——— CSS Amex Platinum ——— */

.amex {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 14px;
    transform-style: preserve-3d;
    background: #c4c6cb;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.55) inset,
        0 10px 22px rgba(15, 15, 15, 0.24);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

.amex__edge {
    position: absolute;
    inset: 0;
    border-radius: 14px;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.4),
        inset 0 -2px 3px rgba(0, 0, 0, 0.18),
        inset 0 2px 2px rgba(255, 255, 255, 0.3);
    pointer-events: none;
    z-index: 6;
}

.amex__art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 14px;
}

.wallet-hint {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 1rem;
    z-index: 2;
    margin: 0;
    text-align: center;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    color: rgba(255, 250, 240, 0.78);
    text-shadow: 0 1px 2px rgba(20, 20, 20, 0.45);
    pointer-events: none;
}

@media (max-width: 640px) {
    .wallet-scene,
    .wallet-stage {
        min-height: 640px;
    }

    .wallet-scene {
        background-position: center 48%;
    }

    .wallet-scene::after {
        opacity: 0.24;
    }

    .wallet-grain {
        opacity: 0.3;
    }

    .wallet-stage {
        padding: 140px 0.75rem 2.25rem;
    }

    .wallet {
        width: min(340px, 88vw);
    }

    .wallet-card {
        min-height: 44px;
    }

    .wallet-hint {
        font-size: 0.78rem;
        padding: 0 0.75rem;
    }
}

@media (max-width: 400px) {
    .wallet-scene,
    .wallet-stage {
        min-height: 540px;
    }

    .wallet-stage {
        padding: 112px 0.6rem 1.75rem;
    }

    .wallet {
        width: min(300px, 90vw);
    }
}

@media (prefers-reduced-motion: reduce) {
    .wallet-card {
        transition-duration: 1ms;
    }
}
