.hero-contact-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4vw;
    visibility: hidden;
    pointer-events: none;
    transition: visibility 0s linear 0.42s;
    --hero-modal-panel-scale: 0.9;
    --hero-modal-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-contact-modal[hidden] {
    display: none;
}

.hero-contact-modal.is-open {
    visibility: visible;
    pointer-events: auto;
    transition: visibility 0s linear 0s;
}

.hero-contact-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(11, 31, 58, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    will-change: opacity, backdrop-filter;
    transition: opacity 0.42s ease;
}

.hero-contact-modal.is-open .hero-contact-modal__overlay {
    opacity: 1;
}

.hero-contact-modal__panel {
    position: relative;
    z-index: 1;
    width: min(94vw, 1160px);
    height: 38vw;
    overflow: hidden;
    border-radius: 1.5vw;
    background: #ffffff;
    box-shadow: 0 2vw 5vw rgba(0, 0, 0, 0.22);
    opacity: 0;
    filter: blur(4px);
    transform: translateY(1.2vw) scale(var(--hero-modal-panel-scale));
    transform-origin: center center;
    transition:
        transform 0.62s var(--hero-modal-ease),
        opacity 0.42s ease,
        filter 0.62s var(--hero-modal-ease);
}

.hero-contact-modal.is-open .hero-contact-modal__panel {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1);
}

.hero-contact-modal__close {
    position: absolute;
    top: 1.5vw;
    right: 1.5vw;
    z-index: 2;
    width: 3vw;
    height: 3vw;
    min-width: 44px;
    min-height: 44px;
    border: 1px solid var(--color-brand-primary);
    border-radius: 999px;
    background: transparent;
    color: var(--color-brand-primary);
    cursor: pointer;
    transition:
        transform 0.35s var(--ease-out-quart),
        background-color 0.25s ease,
        color 0.25s ease;
}

.hero-contact-modal__close:hover,
.hero-contact-modal__close:focus-visible {
    transform: rotate(90deg);
    background-color: var(--color-brand-primary);
    color: #ffffff;
}

.hero-contact-modal__close span,
.hero-contact-modal__close::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 45%;
    height: 2px;
    background: currentColor;
    content: '';
}

.hero-contact-modal__close span {
    transform: translate(-50%, -50%) rotate(45deg);
}

.hero-contact-modal__close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.hero-contact-modal__content {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 3vw;
    height: 100%;
    padding: 4vw;
    overflow: hidden;
}

.hero-contact-modal__intro {
    max-width: 18vw;
}

.hero-contact-modal__eyebrow {
    display: flex;
    align-items: center;
    gap: 0.8vw;
    margin-bottom: 0.6vw;
}

.hero-contact-modal__eyebrow-line {
    flex: 0 0 auto;
}

.hero-contact-modal__eyebrow-text {
    font-family: var(--font-body);
    font-size: var(--text-24);
    color: var(--color-brand-secondary);
}

.hero-contact-modal__title {
    font-family: var(--font-heading);
    font-size: clamp(40px, 3.4vw, 66px);
    font-weight: 400;
    line-height: 1.15;
    color: var(--color-brand-primary);
}

.hero-contact-modal__form-card {
    width: 100%;
    min-height: 0;
    padding: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: transparent;
}

.hero-contact-modal__form-card .contact-form-wrapper {
    min-height: 0;
}

.hero-contact-modal__form-card .contact-form-wrapper .wpcf7-form {
    gap: 0.35vw;
}

@media (max-width: 1025px) {
    .hero-contact-modal {
        padding: 6vw;
    }

    .hero-contact-modal__panel {
        width: 100%;
        height: 85vh;
        border-radius: 24px;
    }

    .hero-contact-modal__content {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
        gap: 32px;
        padding: 64px 40px 40px;
    }

    .hero-contact-modal__intro {
        max-width: 100%;
    }

    .hero-contact-modal__eyebrow {
        gap: 12px;
        margin-bottom: 12px;
    }

    .hero-contact-modal__close {
        top: 20px;
        right: 20px;
    }

    .hero-contact-modal__form-card .contact-form-wrapper .wpcf7-form {
        gap: 10px;
    }
}

@media (max-width: 540px) {
    .hero-contact-modal {
        align-items: center;
        padding: 16px;
    }

    .hero-contact-modal__panel {
        height: 85vh;
        max-height: 85vh;
        border-radius: 20px;
    }

    .hero-contact-modal__content {
        gap: 24px;
        padding: 72px 20px 28px;
    }

    .hero-contact-modal__eyebrow {
        margin-bottom: 8px;
    }

    .hero-contact-modal__eyebrow-text {
        font-size: 18px;
    }

    .hero-contact-modal__title {
        font-size: 36px;
    }

    .hero-contact-modal__form-card .contact-form-wrapper .wpcf7-form {
        gap: 8px;
    }
}

/* Small centered "thank you" toast shown after the hero modal form submits -
   the modal closes and this fades in over the page, then vanishes on its own. */
.hero-contact-modal-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 100001;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4vw;
    max-width: min(90vw, 420px);
    padding: 1.6vw 2vw;
    text-align: center;
    background: #ffffff;
    border-radius: 1vw;
    box-shadow: 0 1.2vw 3vw rgba(11, 31, 58, 0.28);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.92);
    transition:
        opacity 0.3s ease,
        transform 0.3s ease;
}

.hero-contact-modal-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.hero-contact-modal-toast__title {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1.2vw;
    color: var(--color-brand-primary);
    margin: 0;
}

.hero-contact-modal-toast__text {
    font-family: var(--font-body);
    font-size: 0.95vw;
    color: #333333;
    margin: 0;
}

@media (max-width: 1025px) {
    .hero-contact-modal-toast {
        gap: 8px;
        padding: 24px 28px;
        border-radius: 16px;
    }

    .hero-contact-modal-toast__title {
        font-size: 20px;
    }

    .hero-contact-modal-toast__text {
        font-size: 16px;
    }
}

@media (max-width: 540px) {
    .hero-contact-modal-toast {
        padding: 20px 22px;
        border-radius: 14px;
    }

    .hero-contact-modal-toast__title {
        font-size: 18px;
    }

    .hero-contact-modal-toast__text {
        font-size: 14px;
    }
}
