/* Contact page — background, motion, interactive method picker */

.contact-page {
    position: relative;
    min-height: calc(100vh - 80px);
    overflow: hidden;
}

.contact-page__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse 120% 80% at 50% -20%, rgba(37, 99, 235, 0.18), transparent 55%),
        radial-gradient(ellipse 90% 60% at 100% 50%, rgba(13, 148, 136, 0.12), transparent 50%),
        radial-gradient(ellipse 80% 50% at 0% 80%, rgba(124, 58, 237, 0.08), transparent 45%),
        linear-gradient(165deg, #f8fafc 0%, #e0f2fe 38%, #f1f5f9 72%, #ffffff 100%);
    background-size: 100% 100%, 100% 100%, 100% 100%, 200% 200%;
    animation: contact-bg-shift 22s ease-in-out infinite;
}

.contact-page__bg::before,
.contact-page__bg::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.45;
    pointer-events: none;
    animation: contact-orb-float 18s ease-in-out infinite;
}

.contact-page__bg::before {
    width: min(420px, 55vw);
    height: min(420px, 55vw);
    top: -8%;
    right: -5%;
    background: rgba(37, 99, 235, 0.25);
    animation-delay: -4s;
}

.contact-page__bg::after {
    width: min(320px, 45vw);
    height: min(320px, 45vw);
    bottom: 5%;
    left: -8%;
    background: rgba(13, 148, 136, 0.2);
    animation-delay: -9s;
}

@keyframes contact-bg-shift {
    0%,
    100% {
        background-position:
            0% 0%,
            0% 0%,
            0% 0%,
            0% 50%;
    }
    50% {
        background-position:
            0% 0%,
            0% 0%,
            0% 0%,
            100% 80%;
    }
}

@keyframes contact-orb-float {
    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(-12px, 18px) scale(1.05);
    }
    66% {
        transform: translate(10px, -10px) scale(0.98);
    }
}

.contact-page__inner {
    position: relative;
    z-index: 1;
}

/* Extra motion layers (above base gradient, pointer‑parallax via --contact-mx / --contact-my on [data-contact-decor]) */
.contact-page__decor {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    --contact-mx: 0;
    --contact-my: 0;
    transform: translate3d(
        calc(var(--contact-mx) * 32px),
        calc(var(--contact-my) * 26px),
        0
    );
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

.contact-page__mesh {
    position: absolute;
    inset: -40%;
    opacity: 0.07;
    background-image:
        linear-gradient(rgba(37, 99, 235, 0.35) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.35) 1px, transparent 1px);
    background-size: 48px 48px;
    animation: contact-mesh-drift 28s linear infinite;
    transform: rotate(-8deg) translateZ(0);
}

@keyframes contact-mesh-drift {
    0% {
        transform: rotate(-8deg) translate3d(0, 0, 0);
    }
    100% {
        transform: rotate(-8deg) translate3d(-48px, -48px, 0);
    }
}

.contact-page__sparkles {
    position: absolute;
    inset: 0;
}

.contact-page__sparkle {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fff, rgba(37, 99, 235, 0.6));
    box-shadow: 0 0 12px rgba(96, 165, 250, 0.85);
    opacity: 0;
    animation: contact-sparkle 3.2s ease-in-out calc(var(--si) * 0.55s) infinite;
}

.contact-page__sparkle:nth-child(1) {
    top: 12%;
    left: 8%;
}

.contact-page__sparkle:nth-child(2) {
    top: 22%;
    right: 12%;
}

.contact-page__sparkle:nth-child(3) {
    top: 48%;
    left: 4%;
}

.contact-page__sparkle:nth-child(4) {
    top: 58%;
    right: 6%;
}

.contact-page__sparkle:nth-child(5) {
    bottom: 28%;
    left: 18%;
}

.contact-page__sparkle:nth-child(6) {
    bottom: 18%;
    right: 22%;
}

.contact-page__sparkle:nth-child(7) {
    top: 35%;
    left: 42%;
}

.contact-page__sparkle:nth-child(8) {
    bottom: 40%;
    right: 38%;
}

@keyframes contact-sparkle {
    0%,
    100% {
        opacity: 0;
        transform: scale(0.4);
    }
    35% {
        opacity: 1;
        transform: scale(1);
    }
    65% {
        opacity: 0.35;
        transform: scale(0.85);
    }
}

.contact-page__waves {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: min(38%, 280px);
    pointer-events: none;
}

.contact-page__wave {
    position: absolute;
    left: -15%;
    width: 130%;
    height: 100%;
    border-radius: 45% 55% 0 0 / 80% 80% 0 0;
    opacity: 0.55;
}

.contact-page__wave--a {
    bottom: -35%;
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.11) 0%, rgba(37, 99, 235, 0.02) 100%);
    animation: contact-wave-sway-a 14s ease-in-out infinite;
}

.contact-page__wave--b {
    bottom: -48%;
    background: linear-gradient(180deg, rgba(13, 148, 136, 0.1) 0%, transparent 100%);
    animation: contact-wave-sway-b 18s ease-in-out infinite reverse;
}

@keyframes contact-wave-sway-a {
    0%,
    100% {
        transform: translate3d(0, 0, 0) rotate(-0.5deg);
    }
    50% {
        transform: translate3d(-3%, 4px, 0) rotate(0.8deg);
    }
}

@keyframes contact-wave-sway-b {
    0%,
    100% {
        transform: translate3d(0, 0, 0) rotate(0.4deg);
    }
    50% {
        transform: translate3d(4%, 6px, 0) rotate(-0.6deg);
    }
}

.contact-page__float-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.35;
    animation: contact-float-orb 12s ease-in-out infinite;
}

.contact-page__float-orb--1 {
    width: min(200px, 35vw);
    height: min(200px, 35vw);
    top: 35%;
    right: -5%;
    background: rgba(129, 140, 248, 0.45);
    animation-delay: -2s;
}

.contact-page__float-orb--2 {
    width: min(160px, 28vw);
    height: min(160px, 28vw);
    bottom: 15%;
    left: -6%;
    background: rgba(56, 189, 248, 0.4);
    animation-delay: -6s;
}

@keyframes contact-float-orb {
    0%,
    100% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    33% {
        transform: translate3d(-14px, 20px, 0) scale(1.08);
    }
    66% {
        transform: translate3d(12px, -12px, 0) scale(0.95);
    }
}

/* Masthead */
.contact-page__masthead {
    text-align: center;
    margin-bottom: 1.75rem;
    animation: contact-reveal-up 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.contact-page__masthead .page-head--contact {
    margin-bottom: 0;
    margin-inline: auto;
    max-width: 520px;
}

.contact-page__lead {
    max-width: 36rem;
    margin: 0.75rem auto 0;
    font-size: 0.95rem;
    color: var(--color-text-muted, #64748b);
    line-height: 1.55;
    animation: contact-reveal-up 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}

@keyframes contact-reveal-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card shell */
.contact-page__card {
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow:
        0 4px 6px -1px rgba(15, 23, 42, 0.06),
        0 18px 40px -12px rgba(37, 99, 235, 0.12);
    animation: contact-reveal-up 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both;
    overflow: hidden;
}

.contact-page__card .card-body {
    padding: 2rem 1.75rem;
}

@media (min-width: 576px) {
    .contact-page__card .card-body {
        padding: 2.25rem 2.5rem;
    }
}

/* Method picker — centered, colorized cards */
.contact-method-fieldset {
    border: none;
    padding: 0;
    margin: 0 0 1.75rem;
}

.contact-method-legend {
    float: left;
    width: 100%;
    text-align: center;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--color-text, #0f172a);
    margin-bottom: 1rem;
    padding: 0;
}

.contact-method-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    gap: 1rem;
    clear: both;
}

.contact-method-ripple {
    position: absolute;
    left: var(--rx, 50%);
    top: var(--ry, 50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0) 72%);
    transform: translate(-50%, -50%) scale(0);
    animation: contact-method-ripple 0.58s ease-out forwards;
    pointer-events: none;
    z-index: 4;
    mix-blend-mode: overlay;
}

@keyframes contact-method-ripple {
    to {
        transform: translate(-50%, -50%) scale(20);
        opacity: 0;
    }
}

.contact-method-card {
    position: relative;
    flex: 1 1 140px;
    max-width: 220px;
    min-height: 118px;
    margin: 0;
    padding: 1.15rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    border-radius: 16px;
    border: 2px solid transparent;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.07);
    transition:
        transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.28s ease,
        border-color 0.28s ease,
        background 0.28s ease;
    animation: contact-card-pop 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.contact-method-card:nth-child(1) {
    animation-delay: 0.2s;
}

.contact-method-card:nth-child(2) {
    animation-delay: 0.32s;
}

@keyframes contact-card-pop {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.contact-method-card--phone {
    --contact-accent: #0d9488;
    --contact-accent-soft: rgba(13, 148, 136, 0.12);
    --contact-icon-bg: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
}

.contact-method-card--email {
    --contact-accent: #4f46e5;
    --contact-accent-soft: rgba(79, 70, 229, 0.12);
    --contact-icon-bg: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

.contact-method-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
}

.contact-method-card:focus-within {
    outline: none;
}

.contact-method-card:has(input:focus-visible) {
    outline: 3px solid var(--color-primary, #2563eb);
    outline-offset: 3px;
}

.contact-method-card:focus-within::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 18px;
    border: 2px solid var(--contact-accent);
    pointer-events: none;
    opacity: 0.5;
}

/* .is-selected synced via JS for browsers without :has() */
.contact-method-card.is-selected {
    border-color: var(--contact-accent);
    background: linear-gradient(165deg, #fff 0%, var(--contact-accent-soft) 120%);
    box-shadow:
        0 8px 28px rgba(15, 23, 42, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
}

.contact-method-card--phone.is-selected {
    box-shadow: 0 10px 32px rgba(13, 148, 136, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.contact-method-card--email.is-selected {
    box-shadow: 0 10px 32px rgba(79, 70, 229, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.contact-method-card.is-selected .contact-method-icon {
    animation: contact-icon-pulse 2s ease-in-out infinite;
}

.contact-method-card input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    appearance: none;
}

.contact-method-card .contact-method-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
    background: var(--contact-icon-bg);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.contact-method-card--phone .contact-method-icon {
    box-shadow: 0 6px 18px rgba(13, 148, 136, 0.45);
}

.contact-method-card--email .contact-method-icon {
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.4);
}

.contact-method-card:hover .contact-method-icon {
    transform: scale(1.08) rotate(-3deg);
}

.contact-method-card--email:hover .contact-method-icon {
    transform: scale(1.08) rotate(3deg);
}

.contact-method-title {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--color-text, #0f172a);
}

.contact-method-card:has(input:checked) {
    border-color: var(--contact-accent);
    background: linear-gradient(165deg, #fff 0%, var(--contact-accent-soft) 120%);
    box-shadow:
        0 8px 28px rgba(15, 23, 42, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
}

.contact-method-card--phone:has(input:checked) {
    box-shadow: 0 10px 32px rgba(13, 148, 136, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.contact-method-card--email:has(input:checked) {
    box-shadow: 0 10px 32px rgba(79, 70, 229, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.contact-method-card:has(input:checked) .contact-method-icon {
    animation: contact-icon-pulse 2s ease-in-out infinite;
}

@keyframes contact-icon-pulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.04);
    }
}

/* Dynamic fields */
.contact-dynamic-fields {
    position: relative;
    min-height: 4.5rem;
    margin-bottom: 1rem;
}

.contact-field-panel {
    animation: contact-field-enter 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.contact-field-panel.is-hidden {
    display: none !important;
}

@keyframes contact-field-enter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form controls polish */
.contact-page__card .form-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text, #334155);
}

.contact-page__card .required-indicator {
    display: inline-block;
    min-width: 0.9em;
    margin-inline-start: 0.2rem;
    font-weight: 800;
    line-height: 1;
    transition: color 0.18s ease, transform 0.18s ease;
}

.contact-page__card .required-indicator.is-required {
    color: #dc2626;
}

.contact-page__card .required-indicator.is-filled {
    color: #16a34a;
    transform: translateY(-1px);
}

.contact-page__card .required-indicator.is-swap-animate {
    animation: contact-required-swap 0.26s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes contact-required-swap {
    0% {
        transform: scale(0.75) translateY(1px);
        opacity: 0.55;
    }
    100% {
        transform: scale(1) translateY(-1px);
        opacity: 1;
    }
}

.contact-page__card .form-control {
    border-radius: 12px;
    border: 1px solid var(--color-border, #e2e8f0);
    padding: 0.65rem 1rem;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.contact-page__card .form-control:focus {
    border-color: var(--color-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    transform: translateY(-1px);
}

.contact-page__card textarea.form-control {
    min-height: 140px;
}

.contact-page__submit {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.contact-page__submit .contact-submit__loading {
    display: none;
}

.contact-page__submit .contact-submit__idle,
.contact-page__submit .contact-submit__loading {
    align-items: center;
    justify-content: center;
}

#contactForm.is-submitting .contact-page__submit {
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 50%, #3b82f6 100%);
    box-shadow: 0 12px 26px rgba(37, 99, 235, 0.38);
    pointer-events: none;
}

#contactForm.is-submitting .contact-page__submit .contact-submit__idle {
    display: none;
}

#contactForm.is-submitting .contact-page__submit .contact-submit__loading {
    display: inline-flex;
    animation: contact-submit-breathe 1.1s ease-in-out infinite;
}

@keyframes contact-submit-breathe {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(0.985);
        opacity: 0.86;
    }
}

.contact-page__submit::after {
    content: '';
    position: absolute;
    top: -10%;
    bottom: -10%;
    left: -50%;
    width: 42%;
    background: linear-gradient(
        105deg,
        transparent 0%,
        rgba(255, 255, 255, 0.4) 45%,
        transparent 88%
    );
    transform: skewX(-16deg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.contact-page__submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.35);
}

.contact-page__submit:hover::after {
    opacity: 1;
    animation: contact-submit-shine 1.1s ease-in-out infinite;
}

@keyframes contact-submit-shine {
    0% {
        left: -60%;
    }
    100% {
        left: 140%;
    }
}

.contact-page__submit:active {
    transform: translateY(0);
}

.contact-page__submit:active::after {
    animation: none;
    opacity: 0.35;
}

@media (prefers-reduced-motion: reduce) {
    .contact-page__bg,
    .contact-page__bg::before,
    .contact-page__bg::after,
    .contact-page__decor,
    .contact-page__mesh,
    .contact-page__sparkle,
    .contact-page__wave,
    .contact-page__float-orb,
    .contact-method-card,
    .contact-method-card .contact-method-icon,
    .contact-method-card:has(input:checked) .contact-method-icon,
    .contact-page__masthead,
    .contact-page__lead,
    .contact-page__card,
    .contact-field-panel,
    .contact-page__submit::after {
        animation: none !important;
    }

    .contact-page__decor {
        transform: none !important;
        transition: none !important;
    }

    .contact-page__mesh {
        opacity: 0.04;
    }

    .contact-page__bg {
        background: linear-gradient(165deg, #f8fafc 0%, #e0f2fe 50%, #f1f5f9 100%);
    }

    .contact-page__card-body {
        transform: none !important;
    }

    .contact-method-card:hover {
        transform: none;
    }

    .contact-page__submit:hover {
        transform: none;
    }

    .contact-page__submit::after {
        opacity: 0 !important;
    }

    .contact-page__card .required-indicator.is-swap-animate,
    #contactForm.is-submitting .contact-page__submit .contact-submit__loading {
        animation: none !important;
    }
}
