/* 3D Scroll-Driven Physical Gift Voucher Showcase (CSS 3D, zero WebGL, iOS Safari-safe) */
.md-gift3d-card {
    --env-w: 396px;
    --env-h: 248px;
    --card-rise: 172px;
    position: relative;
    overflow: hidden;
    margin: 26px 0 10px;
    padding: 38px 42px;
    border-radius: var(--md-radius-card, 24px);
    background:
        radial-gradient(680px 420px at 78% 46%, rgba(164, 130, 224, 0.30) 0%, rgba(149, 61, 150, 0.14) 44%, rgba(149, 61, 150, 0) 74%),
        radial-gradient(540px 360px at 14% 92%, rgba(68, 114, 214, 0.24) 0%, rgba(56, 97, 198, 0) 72%),
        linear-gradient(135deg, #071026 0%, #0f1f44 52%, #19183b 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 22px 54px rgba(5, 16, 42, 0.24);
    color: #f8fafc;
    font-family: var(--md-font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}

.md-gift3d-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.md-gift3d-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 0.96fr) minmax(0, 1.04fr);
    align-items: center;
    gap: 32px 36px;
}

/* Copy column */
.md-gift3d-copy {
    min-width: 0;
}

.md-gift3d-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.11);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #f3e8f5;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.md-gift3d-pill-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #e18ee3;
    box-shadow: 0 0 10px rgba(225, 142, 227, 0.85);
}

.md-gift3d-heading {
    margin: 0 0 12px;
    color: #ffffff;
    font-family: var(--md-font-display, 'Bebas Neue Pro', 'Bebas Neue', sans-serif);
    font-size: clamp(2rem, 3.4vw, 2.85rem);
    font-weight: 700;
    line-height: 1.04;
    letter-spacing: 0.015em;
}

.md-gift3d-subcopy {
    margin: 0 0 20px;
    color: #d6e0ec;
    font-size: 15px;
    line-height: 1.58;
    max-width: 46ch;
}

.md-gift3d-features {
    list-style: none;
    margin: 0 0 24px;
    padding: 0;
    display: grid;
    gap: 10px;
}

.md-gift3d-features li {
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 14px;
    line-height: 1.4;
    color: #e8eef6;
}

.md-gift3d-feature-icon {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border-radius: var(--md-radius-anchor, 8px);
    background: rgba(149, 61, 150, 0.26);
    border: 1px solid rgba(225, 142, 227, 0.32);
    color: #f4caf6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.md-gift3d-feature-icon svg {
    width: 15px;
    height: 15px;
    display: block;
}

.md-gift3d-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 18px;
}

.md-gift3d-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 46px;
    padding: 0 20px;
    border-radius: var(--md-radius-panel, 12px);
    background: #953d96;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 10px 24px rgba(149, 61, 150, 0.42);
    transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

@media (hover: hover) and (pointer: fine) {
    .md-gift3d-cta:hover {
        color: #ffffff;
        background: #a848aa;
        transform: translateY(-1px);
        box-shadow: 0 14px 28px rgba(149, 61, 150, 0.52);
    }
}

.md-gift3d-cta:focus-visible {
    outline: 3px solid #f3c4f5;
    outline-offset: 2px;
    color: #ffffff;
}

.md-gift3d-availability {
    font-size: 12.5px;
    font-weight: 600;
    color: #a6b4c8;
    letter-spacing: 0.01em;
}

.md-gift3d-basket-cue {
    margin: 16px 0 0;
    padding: 10px 14px;
    border-radius: var(--md-radius-panel, 12px);
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.14);
    font-size: 13px;
    line-height: 1.45;
    color: #d8e2ef;
}

.md-gift3d-basket-cue strong {
    color: #ffffff;
    font-weight: 700;
}

.md-gift3d-basket-cue span {
    color: #f3c4f5;
    font-weight: 700;
}

/* 3D Stage column */
.md-gift3d-stage-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.md-gift3d-stage {
    position: relative;
    width: 100%;
    min-height: 444px;
    padding-top: 164px;
    padding-bottom: 36px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    perspective: 960px;
    cursor: default;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    border-radius: 20px;
    outline: none;
}

.md-gift3d-control {
    position: absolute;
    inset: 0;
    z-index: 10;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: inherit;
    background: transparent;
    cursor: pointer;
    touch-action: manipulation;
}
.md-gift3d-control[hidden] { display: none; }
.md-gift3d-control:focus-visible {
    outline: 3px solid #f3c4f5;
    outline-offset: 4px;
}

/* Studio rim-light spotlight behind the matte-black envelope for crisp separation */
.md-gift3d-spotlight {
    position: absolute;
    left: 50%;
    top: 56%;
    width: calc(var(--env-w) * 1.48);
    height: calc(var(--env-h) * 1.68);
    transform: translate3d(-50%, -46%, 0);
    border-radius: 50%;
    background:
        radial-gradient(ellipse at 50% 54%,
            rgba(224, 232, 255, 0.34) 0%,
            rgba(196, 152, 232, 0.24) 38%,
            rgba(116, 134, 212, 0.11) 62%,
            rgba(15, 23, 52, 0) 78%);
    filter: blur(10px);
    pointer-events: none;
}

.md-gift3d-scene {
    position: relative;
    width: var(--env-w);
    height: var(--env-h);
    transform-style: preserve-3d;
    transform: rotateX(6deg) rotateY(168deg) rotateZ(-2deg);
    pointer-events: none;
}

/* The unbranded opening assembly is physically opposite the foil-marked cover. */
.md-gift3d-opening {
    position: absolute;
    inset: 0;
    transform: rotateY(180deg);
    transform-style: preserve-3d;
}
.md-gift3d-cover,
.md-gift3d-back,
.md-gift3d-front,
.md-gift3d-voucher {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Ground ambient shadow */
.md-gift3d-shadow {
    position: absolute;
    left: 4%;
    right: 4%;
    bottom: -30px;
    height: 36px;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(2, 5, 16, 0.78) 0%, rgba(2, 5, 16, 0) 72%);
    transform: translateZ(-32px);
    opacity: 0.8;
    pointer-events: none;
}

/* Layer 1: Envelope back panel + satin inner lining */
.md-gift3d-back {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: 7px;
    background:
        linear-gradient(180deg, #2b1834 0%, #171622 48%, #0e1017 100%);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        0 26px 48px rgba(0, 0, 0, 0.65);
    transform: translateZ(-5px);
}

/* Layer 2: Authentic printed white MY DINE gift voucher gliding out of the matte-black pocket */
.md-gift3d-voucher {
    position: absolute;
    left: 5%;
    right: 5%;
    bottom: 6%;
    height: 82%;
    z-index: 3;
    padding: 13px 14px 11px;
    border-radius: 3px;
    background: #ffffff;
    border: 1px solid #d4d8e0;
    box-shadow:
        0 18px 34px rgba(3, 8, 22, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.98);
    color: #0f172a;
    transform: translate3d(0, calc(-1 * var(--card-rise)), 2px);
}

.md-gift3d-voucher-sheet {
    height: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1.58fr) auto;
    gap: 10px;
    align-items: stretch;
}

.md-gift3d-voucher-left {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
}

.md-gift3d-voucher-meta {
    display: flex;
    flex-direction: column;
    gap: 3.5px;
}

.md-gift3d-voucher-line {
    display: block;
    font-size: 9.5px;
    line-height: 1.3;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.md-gift3d-voucher-line strong {
    font-weight: 700;
    color: #000000;
}

.md-gift3d-voucher-note {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 2px;
    font-size: 9.5px;
    line-height: 1.28;
    color: #111827;
}

.md-gift3d-voucher-note strong {
    font-weight: 700;
    color: #000000;
}

.md-gift3d-voucher-note span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.md-gift3d-voucher-social {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 7.5px;
    font-weight: 600;
    color: #4b5563;
    letter-spacing: 0.01em;
}

.md-gift3d-voucher-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding-left: 4px;
}

.md-gift3d-voucher-brand {
    font-family: var(--md-font-display, 'Bebas Neue Pro', 'Bebas Neue', sans-serif);
    font-size: 24px;
    font-weight: 700;
    line-height: 0.88;
    letter-spacing: 0.03em;
    color: #000000;
}

.md-gift3d-voucher-qr {
    width: 68px;
    height: 68px;
    padding: 4px;
    background: #ffffff;
    border: 1.5px solid #111111;
    display: flex;
    align-items: center;
    justify-content: center;
}

.md-gift3d-voucher-qr svg {
    width: 100%;
    height: 100%;
    display: block;
}

.md-gift3d-voucher-code {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #000000;
    font-variant-numeric: tabular-nums;
}

/* Layer 3: Matte-black front pocket with studio rim highlights & silver foil mark */
.md-gift3d-front,
.md-gift3d-cover {
    position: absolute;
    inset: 0;
    z-index: 4;
    border-radius: 7px;
    overflow: hidden;
    background:
        repeating-linear-gradient(
            125deg,
            rgba(255, 255, 255, 0.016) 0px,
            rgba(255, 255, 255, 0.016) 1px,
            transparent 1px,
            transparent 4px
        ),
        linear-gradient(155deg, #252833 0%, #171921 44%, #0f1118 100%);
    border: 1px solid rgba(255, 255, 255, 0.20);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.24),
        inset 0 -1px 0 rgba(0, 0, 0, 0.65),
        0 18px 36px rgba(0, 0, 0, 0.50);
    transform: translateZ(6px);
}

/* Subtle folded envelope paper seams */
.md-gift3d-front::before,
.md-gift3d-front::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.md-gift3d-front::before {
    background: linear-gradient(152deg, rgba(255, 255, 255, 0.065) 0%, rgba(255, 255, 255, 0) 48%);
    clip-path: polygon(0 0, 48% 54%, 0 100%);
}

.md-gift3d-front::after {
    background: linear-gradient(208deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 48%);
    clip-path: polygon(100% 0, 52% 54%, 100% 100%);
}

.md-gift3d-pocket-lip {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.08));
    pointer-events: none;
}

/* Live metallic sheen sweep across matte cardstock */
.md-gift3d-sheen {
    position: absolute;
    inset: -20% -40%;
    background: linear-gradient(
        112deg,
        rgba(255, 255, 255, 0) 34%,
        rgba(255, 255, 255, 0.12) 48%,
        rgba(243, 196, 245, 0.09) 52%,
        rgba(255, 255, 255, 0) 66%
    );
    transform: translateX(10%);
    pointer-events: none;
}

/* Signature bottom-right silver-foiled MY / DINE wordmark (matches real black envelope) */
.md-gift3d-foil-mark {
    position: absolute;
    right: 22px;
    bottom: 18px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-family: var(--md-font-display, 'Bebas Neue Pro', 'Bebas Neue', sans-serif);
    font-size: 29px;
    font-weight: 700;
    line-height: 0.84;
    letter-spacing: 0.05em;
    background: linear-gradient(
        125deg,
        #d8e0eb 0%,
        #ffffff 32%,
        #9aa8bc 54%,
        #f8fafc 76%,
        #c0ccdc 100%
    );
    background-size: 220% 220%;
    background-position: 50% 50%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.75));
    pointer-events: none;
}

/* Layer 4: 3D Hinged Top Flap (clean Z + z-index handoff at 90deg via .is-flap-open) */
.md-gift3d-flap-wrap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 56%;
    z-index: 6;
    transform-style: preserve-3d;
    transform: translateZ(8px);
    pointer-events: none;
}

.md-gift3d-card.is-flap-open .md-gift3d-flap-wrap {
    z-index: 1;
    transform: translateZ(-3px);
}

.md-gift3d-flap {
    position: relative;
    width: 100%;
    height: 100%;
    transform-origin: top center;
    transform-style: preserve-3d;
    transform: rotateX(180deg);
}

.md-gift3d-flap-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.md-gift3d-flap-face.is-front {
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    background: linear-gradient(180deg, #2d313e 0%, #1a1d26 62%, #13151d 100%);
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.5));
}

.md-gift3d-flap-face.is-front::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 16px;
    width: 28px;
    height: 28px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #ecc4ef 0%, #953d96 55%, #5d2160 100%);
    box-shadow:
        inset 0 1px 2px rgba(255, 255, 255, 0.52),
        0 3px 8px rgba(0, 0, 0, 0.6);
}

.md-gift3d-flap-face.is-back {
    /* Inverted polygon so after rotateX(180deg) around center it matches the exact hinged flap triangle */
    clip-path: polygon(0 100%, 100% 100%, 50% 0);
    transform: rotateX(180deg);
    background: linear-gradient(0deg, #1d182b 0%, #2f1c38 68%, #432450 100%);
}

/* Compact variant for Voucher Detail pages (PDP) */
.md-gift3d-card.is-compact {
    --env-w: 352px;
    --env-h: 220px;
    --card-rise: 148px;
    margin: 26px 0 8px;
    padding: 30px 34px;
}

.md-gift3d-card.is-compact .md-gift3d-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px 32px;
}

.md-gift3d-card.is-compact .md-gift3d-heading {
    font-size: clamp(1.6rem, 2.5vw, 2.15rem);
    margin-bottom: 8px;
}

.md-gift3d-card.is-compact .md-gift3d-subcopy {
    font-size: 14px;
    margin-bottom: 14px;
}

.md-gift3d-card.is-compact .md-gift3d-features {
    margin-bottom: 0;
    gap: 8px;
}

.md-gift3d-card.is-compact .md-gift3d-stage {
    min-height: 382px;
    padding-top: 142px;
    padding-bottom: 20px;
}

.md-gift3d-card.is-compact .md-gift3d-foil-mark {
    font-size: 25px;
    right: 19px;
    bottom: 15px;
}

.md-gift3d-card.is-compact .md-gift3d-voucher {
    padding: 10px 12px 9px;
}

.md-gift3d-card.is-compact .md-gift3d-voucher-brand {
    font-size: 20px;
}

.md-gift3d-card.is-compact .md-gift3d-voucher-qr {
    width: 58px;
    height: 58px;
    padding: 3px;
}

.md-gift3d-card.is-compact .md-gift3d-voucher-line,
.md-gift3d-card.is-compact .md-gift3d-voucher-note {
    font-size: 8.8px;
}

/* Tablet & Mobile */
@media (max-width: 991.98px) {
    .md-gift3d-card {
        padding: 28px 24px;
    }

    .md-gift3d-grid,
    .md-gift3d-card.is-compact .md-gift3d-grid {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .md-gift3d-stage-col {
        order: -1;
    }

    .md-gift3d-stage {
        min-height: 376px;
        padding-top: 138px;
    }
}

@media (max-width: 575.98px) {
    .md-gift3d-card,
    .md-gift3d-card.is-compact {
        --env-w: 296px;
        --env-h: 186px;
        --card-rise: 128px;
        padding: 22px 18px;
    }

    .md-gift3d-stage,
    .md-gift3d-card.is-compact .md-gift3d-stage {
        min-height: 332px;
        padding-top: 124px;
        padding-bottom: 16px;
    }

    .md-gift3d-foil-mark {
        font-size: 22px;
        right: 16px;
        bottom: 13px;
    }

    .md-gift3d-voucher {
        padding: 9px 10px 8px;
    }

    .md-gift3d-voucher-brand {
        font-size: 17px;
    }

    .md-gift3d-voucher-qr {
        width: 48px;
        height: 48px;
        padding: 3px;
    }

    .md-gift3d-voucher-line,
    .md-gift3d-voucher-note {
        font-size: 8px;
    }

    .md-gift3d-voucher-code {
        font-size: 7.5px;
    }

    .md-gift3d-cta {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .md-gift3d-step-dot { transition: none; }
}
