/* about page: builds on home.css (nav, footer, grid lines, titles),
   loaded after it on about.html only, everything scoped to body.about */

/* ---------- intro: name + bio on the left, portrait on the right ---------- */
.about .about-hero {
    display: grid;
    /* same split as the nav, so the portrait lines up under the nav links */
    grid-template-columns: var(--split) 1fr;
}

.about .about-hero-text {
    padding-bottom: 8vw;
}

.about .about-title {
    font-size: 1rem;
    line-height: 0.8;
    padding: 2.4vw 0 0.6vw;
}

/* "hey, i'm" stays lowercase, only the name is in caps */
.about .about-hello {
    font-size: 6.6vw;
    letter-spacing: -0.05em;
    text-transform: lowercase;
    padding-left: 2.8vw;
}

/* sized in vw so the name fills the left column at any screen size */
.about .about-name {
    font-size: 23.6vw;
    letter-spacing: -0.02em;
    margin-top: 0.8vw;
    padding-left: 0.6vw;
}

.about .about-bio {
    max-width: 52rem;
    padding: 4.4vw 2.8vw 0;
}

.about .about-bio p {
    margin: 0 0 1.4em;
    font-size: var(--ui-text);
    line-height: 1.2;
    letter-spacing: -0.03em;
}

.about .about-bio p:last-child {
    margin-bottom: 0;
}

/* the portrait sits at the bottom of its column, flush with the line below */
.about .about-portrait {
    display: flex;
    align-items: flex-end;
    border-left: var(--line);
}

.about .about-portrait-media {
    position: relative;
    width: 100%;
}

.about .about-portrait img {
    display: block;
    width: 100%;
    height: auto;
}

/* hover: a second photo fades in over the first, same as the project cards */
.about .about-portrait .about-portrait-hover {
    position: absolute;
    inset: 0;
    height: 100%;
    /* the photo is taller than the portrait, so trim the sky off the top instead of squashing it */
    object-fit: cover;
    object-position: center bottom;
    opacity: 0;
    transition: opacity 0.35s ease-in-out;
}

.about .about-portrait-media:hover .about-portrait-hover {
    opacity: 1;
}

/* ---------- gallery: three columns, each image keeps its own shape ---------- */
.about .gallery {
    scroll-margin-top: var(--nav-height);
}

.about .gallery-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: start;
    /* gaps match the margin around the edge, so the images read as one wall */
    --gallery-gap: 0.5rem;
    gap: var(--gallery-gap);
    padding: var(--gallery-gap);
}

.about .gallery-col {
    display: flex;
    flex-direction: column;
    gap: var(--gallery-gap);
}

/* each image is a button that opens the lightbox (js/gallery.js) */
.about .gallery-item {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    transition: transform 0.4s var(--spring);
}

/* hover: shrinks like the project cards, just much less */
.about .gallery-item:hover,
.about .gallery-item:focus-visible {
    transform: scale(0.985);
}

.about .gallery-item:focus-visible {
    outline: 1px solid var(--ink);
    outline-offset: 4px;
}

.about .gallery-col img {
    display: block;
    width: 100%;
    height: auto;
}

/* ---------- lightbox: clicked image centred over a darkened page ---------- */
/* no scrolling the page behind it while it's open */
html:has(.lightbox[open]) {
    overflow: hidden;
}

.about .lightbox {
    box-sizing: border-box;
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 4vh 4vw;
    border: none;
    background-color: rgba(18, 18, 18, 0.85);
    /* the dialog takes focus when it opens, no need for a ring around the whole screen */
    outline: none;
}

.about .lightbox::backdrop {
    background: transparent;
}

.about .lightbox[open] {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: lightbox-fade 0.3s ease-in-out both;
}

.about .lightbox img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    animation: lightbox-grow 0.3s var(--spring) both;
}

/* wide images: smaller than full width so they sit more like the tall ones */
.about .lightbox.is-landscape img {
    max-width: min(100%, 62vw);
}

/* closing: fades out and shrinks back down (js waits for this before closing) */
.about .lightbox.is-closing {
    animation: lightbox-fade-out 0.25s ease-in-out both;
}

.about .lightbox.is-closing img {
    animation: lightbox-shrink 0.25s ease-in-out both;
}

@keyframes lightbox-fade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes lightbox-grow {
    from {
        transform: scale(0.94);
    }

    to {
        transform: scale(1);
    }
}

@keyframes lightbox-fade-out {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes lightbox-shrink {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(0.94);
    }
}

@media (prefers-reduced-motion: reduce) {
    .about .gallery-item {
        transition: none;
    }

    .about .lightbox[open],
    .about .lightbox img {
        animation: none;
    }
}

/* ---------- tablet: bio under the name, portrait full width below ---------- */
@media (max-width: 55rem) {
    .about .about-hero {
        grid-template-columns: 1fr;
    }

    .about .about-hello {
        font-size: 11vw;
    }

    .about .about-name {
        font-size: 39vw;
    }

    .about .about-portrait {
        border-left: none;
    }
}

/* ---------- phone: gallery becomes a single column ---------- */
@media (max-width: 35rem) {
    .about .gallery-columns {
        grid-template-columns: 1fr;
    }

    /* the screen is already narrow, so wide photos can use the full width */
    .about .lightbox.is-landscape img {
        max-width: 100%;
    }

    /* the column wrappers drop away so every image stacks in one list */
    .about .gallery-col {
        display: contents;
    }

    .about .about-bio {
        padding: 2rem 1rem 0;
    }
}
