/* Contact section */

.contact-viewport {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    /* Clear the category label the content scrolls under, then a 2rem gap to the
       photo: label top pad (2rem) + label height + 2rem. */
    padding: calc(4rem + var(--category-label-size)) var(--content-inset) 2rem;
    box-sizing: border-box;
}

.contact-layout {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    max-width: 680px;
    min-height: 100%;
    margin: 0 auto;
}

/* --- Intro: photo + identity ------------------------------------------- */
.contact-intro {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.contact-photo-wrapper {
    width: 120px;
    height: 120px;
    border-radius: 40% 60% 65% 35% / 50% 35% 65% 50%;
    overflow: hidden;
    border: 1px solid var(--text-color);
    flex-shrink: 0;
    margin: 0 auto; /* centered on mobile */
}

.contact-photo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%);
    transition: filter 0.3s ease;
}

.contact-photo:hover {
    filter: grayscale(0%);
}

.contact-identity {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    text-align: left;
}

.contact-name {
    font-family: var(--font-heading);
    font-size: calc((clamp(1.8rem, 9vw, 2.8rem)) * var(--font-scale));
    font-weight: 400;
    margin: 0;
    line-height: 1;
    color: var(--text-color);
}

.contact-email {
    font-family: var(--font-body);
    font-size: calc((clamp(0.9rem, 3.5vw, 1.15rem)) * var(--font-scale));
    text-decoration: none;
    color: var(--text-color);
    display: block;
    position: relative;
    width: fit-content;
}

.contact-email::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: currentColor;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.25s ease;
}

.contact-email:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* --- Newsletter -------------------------------------------------------- */
/* A solid framed panel at every width, sitting above the socials. The page
   background + a hairline border invert automatically in dark mode. */
.contact-newsletter {
    padding: 1.5rem;
    background: var(--bg-color);
    border: 1px solid var(--text-color);
}

.contact-newsletter h3 {
    font-family: var(--font-heading);
    font-size: calc((0.8rem) * var(--font-scale));
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin: 0 0 0.6rem 0;
    font-weight: 400;
}

.contact-newsletter p {
    font-size: calc((clamp(1rem, 4vw, 1.2rem)) * var(--font-scale));
    margin: 0 0 1.25rem 0;
    line-height: 1.35;
}

.newsletter-form {
    display: flex;
    border-bottom: 1px solid var(--text-color);
    padding-bottom: 0.4rem;
}

.newsletter-form input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: calc((clamp(1rem, 4vw, 1.1rem)) * var(--font-scale));
    font-family: inherit;
    outline: none;
}

.newsletter-form input::placeholder {
    color: var(--text-color);
}

.newsletter-form button {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: calc((1.4rem) * var(--font-scale));
    cursor: pointer;
    padding: 0 0.25rem;
    transition: transform 0.2s ease;
}

.newsletter-form button:hover {
    transform: translateX(4px);
}

.newsletter-form button .ms-icon {
    font-size: calc((1.7rem) * var(--font-scale));
}

/* --- Social links ------------------------------------------------------ */
.contact-links {
    display: flex;
    align-items: center;
    /* Desktop: spread the labelled socials across the full width of the framed
       newsletter above them. The icon-only mobile view re-centres them below. */
    justify-content: space-between;
    gap: 1.5rem;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-color);
    text-decoration: none;
}

.contact-link svg {
    width: 24px;
    height: 24px;
    display: block;
    flex-shrink: 0;
}

.contact-link-label {
    font-family: var(--font-body);
    font-size: calc((1rem) * var(--font-scale));
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Mobile: icons only (link still labelled via aria-label). The newsletter →
   socials order and framing are shared with desktop, so nothing else diverges. */
@media (max-width: 768px) {
    .contact-link-label {
        display: none;
    }

    /* Icon-only: re-centre with a touch more room (the spread is desktop-only). */
    .contact-links {
        justify-content: center;
        gap: 2.5rem;
    }
}

/* --- Desktop: name/email left, photo right ----------------------------- */
/* Only the intro header reflows on wide screens; the newsletter and socials
   keep the same stacked, framed arrangement as mobile. */
@media (min-width: 769px) {
    .contact-intro {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
        gap: 2.5rem;
    }

    .contact-identity {
        order: 1;
    }

    .contact-photo-wrapper {
        order: 2;
        width: 150px;
        height: 150px;
        margin: 0;
    }
}
