/* Contact send v18 — 3D parcel pack, flight, delivered stamp */

.p4p-contact-form-shell {
    position: relative;
    min-height: 280px;
}

.p4p-contact-form-shell__body {
    transition: opacity 0.45s ease, transform 0.55s cubic-bezier(0.16, 1, 0.3, 1), filter 0.45s ease;
    transform-origin: center top;
}

.p4p-contact-form-shell.is-sending .p4p-contact-form-shell__body,
.p4p-contact-form-shell.is-delivered .p4p-contact-form-shell__body {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.94) translateY(-12px);
    filter: blur(6px);
    position: absolute;
    inset: 0;
    visibility: hidden;
}

.p4p-contact-form-shell.is-sending .p4p-contact-form__field input,
.p4p-contact-form-shell.is-sending .p4p-contact-form__field textarea,
.p4p-contact-form-shell.is-sending .p4p-contact-form__field select {
    pointer-events: none;
}

/* ── Send overlay ── */
.p4p-contact-send {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(1.25rem, 3vw, 2rem);
    border-radius: inherit;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.p4p-contact-send.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.p4p-contact-send__aurora {
    position: absolute;
    inset: -20%;
    background:
        radial-gradient(circle at 30% 40%, rgba(232, 168, 124, 0.18), transparent 45%),
        radial-gradient(circle at 70% 60%, rgba(167, 139, 250, 0.16), transparent 50%);
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
}

.p4p-contact-send.is-active .p4p-contact-send__aurora {
    opacity: 1;
}

.p4p-contact-send__phase {
    position: relative;
    z-index: 3;
    margin: 0.75rem 0 0;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #e8a87c;
    text-align: center;
    min-height: 1.2em;
    text-shadow: 0 0 20px rgba(232, 168, 124, 0.35);
}

/* ── 3D Parcel ── */
.p4p-contact-send__parcel-wrap {
    position: relative;
    z-index: 2;
    width: min(100%, 220px);
    height: 180px;
    perspective: 900px;
    margin: 0 auto;
}

.p4p-send-parcel {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.p4p-send-parcel__scene {
    position: relative;
    width: 120px;
    height: 120px;
    transform-style: preserve-3d;
    transform: rotateX(-18deg) rotateY(22deg);
}

.p4p-send-parcel__box {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 88px;
    height: 64px;
    margin-left: -44px;
    margin-top: -20px;
    transform-style: preserve-3d;
    transform: translateZ(0);
}

.p4p-send-parcel__face {
    position: absolute;
    border: 1px solid rgba(167, 139, 250, 0.35);
    background: linear-gradient(145deg, rgba(24, 18, 38, 0.95), rgba(10, 10, 18, 0.92));
    box-shadow: inset 0 0 20px rgba(167, 139, 250, 0.08);
}

.p4p-send-parcel__face--front {
    width: 88px;
    height: 64px;
    transform: translateZ(32px);
}

.p4p-send-parcel__face--back {
    width: 88px;
    height: 64px;
    transform: rotateY(180deg) translateZ(32px);
}

.p4p-send-parcel__face--left {
    width: 64px;
    height: 64px;
    transform: rotateY(-90deg) translateZ(44px);
    left: 0;
}

.p4p-send-parcel__face--right {
    width: 64px;
    height: 64px;
    transform: rotateY(90deg) translateZ(44px);
    right: 0;
}

.p4p-send-parcel__face--bottom {
    width: 88px;
    height: 64px;
    transform: rotateX(-90deg) translateZ(32px);
    top: 32px;
    background: linear-gradient(145deg, rgba(12, 10, 20, 0.98), rgba(6, 6, 12, 0.95));
}

.p4p-send-parcel__lid {
    position: absolute;
    width: 88px;
    height: 32px;
    left: 0;
    top: -32px;
    transform-origin: bottom center;
    transform: rotateX(78deg) translateZ(32px);
    background: linear-gradient(180deg, rgba(232, 168, 124, 0.22), rgba(24, 18, 38, 0.95));
    border: 1px solid rgba(232, 168, 124, 0.35);
    border-radius: 2px 2px 0 0;
    transition: transform 0.55s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.p4p-contact-send.is-sealed .p4p-send-parcel__lid,
.p4p-contact-send.is-flight .p4p-send-parcel__lid,
.p4p-contact-send.is-delivered .p4p-send-parcel__lid {
    transform: rotateX(0deg) translateZ(32px);
}

.p4p-send-parcel__doc {
    position: absolute;
    left: 50%;
    top: -72px;
    width: 72px;
    height: 88px;
    margin-left: -36px;
    border-radius: 6px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    transform: translateZ(48px) rotateX(8deg);
    transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.45s ease, top 0.65s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.p4p-send-parcel__doc span {
    display: block;
    height: 4px;
    margin: 12px 10px 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
}

.p4p-send-parcel__doc span:nth-child(2) { width: 85%; }
.p4p-send-parcel__doc span:nth-child(3) { width: 60%; }

.p4p-contact-send.is-packing .p4p-send-parcel__doc {
    top: -8px;
    transform: translateZ(20px) rotateX(64deg) scale(0.72);
    opacity: 0.35;
}

.p4p-contact-send.is-sealed .p4p-send-parcel__doc,
.p4p-contact-send.is-flight .p4p-send-parcel__doc,
.p4p-contact-send.is-delivered .p4p-send-parcel__doc {
    top: 8px;
    opacity: 0;
    transform: translateZ(8px) rotateX(90deg) scale(0.2);
}

.p4p-send-parcel__tape {
    position: absolute;
    width: 88px;
    height: 14px;
    left: 0;
    top: 24px;
    transform: translateZ(33px);
    background: linear-gradient(90deg, transparent, rgba(232, 168, 124, 0.55), transparent);
    opacity: 0;
    transition: opacity 0.35s ease 0.2s;
}

.p4p-contact-send.is-sealed .p4p-send-parcel__tape,
.p4p-contact-send.is-flight .p4p-send-parcel__tape {
    opacity: 1;
}

.p4p-send-parcel__seal {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(232, 168, 124, 0.5);
    color: #e8a87c;
    font-size: 0.45rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateZ(34px) scale(0);
    transition: transform 0.45s cubic-bezier(0.34, 1.4, 0.64, 1) 0.15s;
}

.p4p-contact-send.is-sealed .p4p-send-parcel__seal,
.p4p-contact-send.is-flight .p4p-send-parcel__seal {
    transform: translateZ(34px) scale(1);
}

.p4p-send-parcel__trail {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    border-radius: 50%;
    background: #e8a87c;
    box-shadow: 0 0 24px rgba(232, 168, 124, 0.8);
    opacity: 0;
    pointer-events: none;
}

.p4p-send-parcel__orbit {
    position: absolute;
    inset: -30px;
    border: 1px dashed rgba(167, 139, 250, 0.2);
    border-radius: 50%;
    transform: rotateX(72deg);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.p4p-contact-send.is-flight .p4p-send-parcel__orbit {
    opacity: 1;
    animation: p4pSendOrbit 1.1s linear infinite;
}

@keyframes p4pSendOrbit {
    to { transform: rotateX(72deg) rotateZ(360deg); }
}

.p4p-contact-send.is-flight .p4p-send-parcel__scene {
    animation: p4pSendFlight 0.95s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.p4p-contact-send.is-flight .p4p-send-parcel__trail {
    animation: p4pSendTrail 0.95s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes p4pSendFlight {
    0% {
        transform: rotateX(-18deg) rotateY(22deg) translate(0, 0) scale(1);
        opacity: 1;
    }
    40% {
        transform: rotateX(-28deg) rotateY(-18deg) translate(24px, -36px) scale(0.92);
    }
    100% {
        transform: rotateX(-42deg) rotateY(-48deg) translate(120px, -140px) scale(0.35);
        opacity: 0;
    }
}

@keyframes p4pSendTrail {
    0% { opacity: 0; box-shadow: 0 0 0 rgba(232, 168, 124, 0); }
    20% { opacity: 1; box-shadow: -20px 20px 40px rgba(232, 168, 124, 0.5), -40px 40px 60px rgba(167, 139, 250, 0.25); }
    100% { opacity: 0; transform: translate(100px, -120px) scale(2.5); box-shadow: -80px 80px 80px rgba(232, 168, 124, 0); }
}

.p4p-contact-send.is-delivered .p4p-contact-send__parcel-wrap {
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.35s ease, transform 0.45s ease;
    pointer-events: none;
}

.p4p-contact-send.is-delivered .p4p-contact-send__phase {
    opacity: 0;
}

/* ── Delivered stamp + check ── */
.p4p-contact-send__delivered {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.5rem;
    opacity: 0;
    transform: scale(0.88);
    pointer-events: none;
}

.p4p-contact-send.is-delivered .p4p-contact-send__delivered {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
    transition: opacity 0.5s ease 0.15s, transform 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.1s;
}

.p4p-send-stamp {
    position: relative;
    width: 96px;
    height: 96px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0) rotate(-24deg);
}

.p4p-contact-send.is-delivered .p4p-send-stamp {
    animation: p4pStampSlam 0.65s cubic-bezier(0.34, 1.45, 0.64, 1) 0.2s forwards;
}

@keyframes p4pStampSlam {
    0% { transform: scale(2.2) rotate(-24deg); opacity: 0; }
    55% { transform: scale(0.92) rotate(6deg); opacity: 1; }
    75% { transform: scale(1.06) rotate(-3deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.p4p-send-stamp__ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid rgba(16, 185, 129, 0.65);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12), inset 0 0 24px rgba(16, 185, 129, 0.15);
}

.p4p-send-stamp__burst {
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    border: 2px dashed rgba(232, 168, 124, 0.45);
    opacity: 0;
}

.p4p-contact-send.is-delivered .p4p-send-stamp__burst {
    animation: p4pStampBurst 0.8s ease 0.45s forwards;
}

@keyframes p4pStampBurst {
    0% { transform: scale(0.6); opacity: 0; }
    40% { opacity: 1; }
    100% { transform: scale(1.35); opacity: 0; }
}

.p4p-send-stamp__text {
    position: relative;
    z-index: 1;
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    color: #10b981;
    text-transform: uppercase;
}

.p4p-send-check {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    opacity: 0;
    transform: scale(0.5);
}

.p4p-contact-send.is-delivered .p4p-send-check {
    animation: p4pCheckPop 0.5s cubic-bezier(0.34, 1.4, 0.64, 1) 0.55s forwards;
}

.p4p-send-check svg circle {
    fill: none;
    stroke: rgba(16, 185, 129, 0.35);
    stroke-width: 2;
}

.p4p-send-check svg path {
    fill: none;
    stroke: #10b981;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
}

.p4p-contact-send.is-delivered .p4p-send-check svg path {
    animation: p4pCheckDraw 0.45s ease 0.75s forwards;
}

@keyframes p4pCheckPop {
    to { opacity: 1; transform: scale(1); }
}

@keyframes p4pCheckDraw {
    to { stroke-dashoffset: 0; }
}

.p4p-contact-send__title {
    font-family: var(--p4p-font-display, inherit);
    font-size: clamp(1.15rem, 2.5vw, 1.45rem);
    font-weight: 900;
    color: #fff;
    margin: 0 0 0.45rem;
    opacity: 0;
    transform: translateY(12px);
}

.p4p-contact-send__body {
    color: #94a3b8;
    font-size: 0.92rem;
    line-height: 1.55;
    margin: 0 0 1.25rem;
    max-width: 28ch;
    opacity: 0;
    transform: translateY(10px);
}

.p4p-contact-send.is-delivered .p4p-contact-send__title {
    animation: p4pSendTextIn 0.5s ease 0.65s forwards;
}

.p4p-contact-send.is-delivered .p4p-contact-send__body {
    animation: p4pSendTextIn 0.5s ease 0.78s forwards;
}

.p4p-contact-send__again {
    opacity: 0;
    transform: translateY(8px);
}

.p4p-contact-send.is-delivered .p4p-contact-send__again {
    animation: p4pSendTextIn 0.45s ease 0.92s forwards;
}

@keyframes p4pSendTextIn {
    to { opacity: 1; transform: translateY(0); }
}

/* ── Error state ── */
.p4p-contact-send__error {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.5rem;
    background: rgba(8, 6, 14, 0.92);
    border-radius: inherit;
}

.p4p-contact-send__error-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.4rem;
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    margin-bottom: 0.85rem;
    animation: p4pSendShake 0.55s ease;
}

@keyframes p4pSendShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

.p4p-contact-send__error h3 {
    color: #fca5a5;
    margin: 0 0 0.4rem;
    font-size: 1.05rem;
}

.p4p-contact-send__error p {
    color: #cbd5e1;
    margin: 0 0 1rem;
    font-size: 0.9rem;
    max-width: 32ch;
}

/* Submit button sending state */
.p4p-contact-form-shell.is-sending .p4p-contact-form__submit,
.p4p-contact-form-shell.is-sending .p4p-btn-transmit {
    pointer-events: none;
    opacity: 0.65;
}

.p4p-contact-form__submit.is-pulse {
    animation: p4pSubmitPulse 1.2s ease infinite;
}

@keyframes p4pSubmitPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(232, 168, 124, 0.35); }
    50% { box-shadow: 0 0 0 10px rgba(232, 168, 124, 0); }
}

/* Popup / home sizing */
.p4p-contact-popup .p4p-contact-form-shell {
    min-height: 320px;
}

.p4p-contact-popup .p4p-contact-send {
    border-radius: 16px;
}

.p4p-page--contact .p4p-command-center__form .p4p-contact-form-shell {
    min-height: 420px;
}

.p4p-command-center__form .p4p-contact-form-shell {
    min-height: 340px;
}

.p4p-command-center__form {
    overflow: visible;
}

/* Legacy success — hide when shell is used */
.p4p-contact-form-shell + .p4p-contact-success,
.p4p-contact-form-shell .p4p-contact-success {
    display: none;
}

@media (max-width: 560px) {
    .p4p-contact-send__parcel-wrap {
        height: 150px;
    }

    .p4p-send-parcel__scene {
        transform: rotateX(-14deg) rotateY(16deg) scale(0.88);
    }
}

html.p4p-reduced-motion .p4p-contact-send.is-flight .p4p-send-parcel__scene,
html.p4p-reduced-motion .p4p-contact-send.is-flight .p4p-send-parcel__trail,
html.p4p-reduced-motion .p4p-send-stamp,
html.p4p-reduced-motion .p4p-send-check {
    animation: none !important;
}

html.p4p-reduced-motion .p4p-contact-send.is-flight .p4p-send-parcel__scene {
    opacity: 0;
}

html.p4p-reduced-motion .p4p-contact-send.is-delivered .p4p-send-stamp {
    transform: scale(1) rotate(0);
    opacity: 1;
}

html.p4p-reduced-motion .p4p-contact-send.is-delivered .p4p-contact-send__title,
html.p4p-reduced-motion .p4p-contact-send.is-delivered .p4p-contact-send__body,
html.p4p-reduced-motion .p4p-contact-send.is-delivered .p4p-contact-send__again {
    opacity: 1;
    transform: none;
}
