main:has(.contact-reveal) {
    --contact-panel-background: #0B0D11;
}

.contact-reveal {
    position: relative;
    z-index: 0;
    display: grid;
    grid-template-rows: 1fr auto;
    min-height: 100dvh;
}

@media (prefers-reduced-motion: no-preference) {
    .contact-reveal:not(:has(:focus-visible, :target)) {
        position: sticky;
        /* Keep the heading at the top of the reveal when the panel is taller than the viewport. */
        inset-block: 0;
    }
}

.contact-reveal > .contact {
    position: relative;
    z-index: 5;
    padding: clamp(4rem, 10vw, 9rem) 10%;
    background: var(--contact-panel-background);
    color: var(--text-color-light);
    font-family: var(--font-quaternary);
}

.contact-background {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: clip;
    pointer-events: none;
}

.contact-background picture {
    position: absolute;
    inset: 0;
}

.contact-background img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.contact-reveal > .contact h2 {
    font-size: clamp(3rem, 6vw, 5.5rem);
    letter-spacing: -0.04em;
    line-height: 1;
    font-weight: 300;
}

.contact-reveal .contact-action {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: clamp(2rem, 5vw, 5rem);
    margin-top: 8rem;
}

.contact-reveal .contact-action .action-content {
    color: var(--text-color-light);
    cursor: pointer;
}

.contact-reveal .contact-action h3 {
    font-size: 1.1em;
    line-height: 1rem;
    font-weight: 300;
    text-wrap: balance;
}

.contact-reveal .contact-action .box {
    margin-top: 1.1rem;
    font-size: 0.93rem;
    font-weight: 100;
    letter-spacing: 0.01em;
}

.contact-reveal .contact-action .action-content:focus-visible {
    outline: 1px solid currentColor;
    outline-offset: 4px;
}

@media (prefers-reduced-motion: no-preference) {
    .contact[data-contact-entrance="pending"] :is(picture, h2, .action-content) {
        opacity: 0;
    }

    .contact[data-contact-entrance="visible"] .contact-background picture {
        animation: fade-up 0.95s var(--motion-ease-out) both;
    }

    .contact[data-contact-entrance="visible"] :is(h2, .action-content) {
        animation: fade-in 0.75s ease-out 0.15s both;
    }

    .contact[data-contact-entrance="visible"] .action-content {
        animation-delay: 0.25s;
    }

    .contact[data-contact-entrance="visible"] .action-content:nth-child(2) {
        animation-delay: 0.33s;
    }

    .contact[data-contact-entrance="visible"] .action-content:nth-child(3) {
        animation-delay: 0.41s;
    }

    .contact[data-contact-entrance] .action-content:focus-visible {
        opacity: 1;
        animation: none;
    }
}

.contact-reveal > footer {
    padding-block: clamp(2rem, 3vw, 3.5rem);
}

@media (max-width: 768px) {
    main:has(.contact-reveal) {
        overflow-x: clip !important;
    }

    .contact-reveal > .contact {
        padding-inline: 5%;
    }

    .contact-reveal .contact-action {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.75rem;
        margin-top: 4rem;
    }
}
