/* ===== Portfolio page: tight grid of project tiles ===== */
.project-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
}

.project-card {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    /* shape of the tiles: try 3 / 2 or 4 / 3 for taller tiles */
    overflow: hidden;
    background: #111;
}

.project-card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* hover: tile fades to the page colour and the name appears */
.project-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--background);
    opacity: 0;
    transition: opacity .45s ease;
}

.project-card:hover::after,
.project-card:focus-visible::after {
    opacity: .9;
}

.project-title {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    text-align: center;
    font-size: clamp(15px, 1.5vw, 24px);
    font-weight: 300;
    letter-spacing: .03em;
    line-height: 1.25;
    color: var(--foreground);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .45s ease, transform .45s ease;
}

.project-card:hover .project-title,
.project-card:focus-visible .project-title {
    opacity: 1;
    transform: none;
}

/* phones/tablets have no hover: always show the name at the bottom */
@media (hover: none) {
    .project-card::after {
        opacity: 1;
        background: linear-gradient(to top, rgb(0 0 0 / .65), transparent 55%);
    }

    .project-title {
        opacity: 1;
        transform: none;
        align-items: flex-end;
        justify-content: flex-start;
        text-align: left;
        color: #fff;
        font-size: 14px;
    }
}

@media (max-width: 1100px) {
    .project-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .project-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .project-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Project page ===== */
.project-page {
    position: relative;
}

/* full-screen hero with video (or picture) in the background */
.project-hero {
    position: relative;
    height: calc(100svh - 83px);
    min-height: 460px;
    overflow: hidden;
    background: #0d0d0d;
    color: #fff;
}

.hero-media,
.hero-media img,
.hero-media video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-media video {
    opacity: 0;
    transition: opacity 1.2s ease;
}

.hero-media video.is-ready {
    opacity: 1;
}

.project-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    background: rgb(0 0 0 / .5);
    /* darkness over the video: 0 = none, 1 = black */
}

.hero-back {
    position: absolute;
    z-index: 2;
    top: 24px;
    left: max(52px, calc((100% - 1420px) / 2 + 52px));
    font-size: 12px;
    color: rgb(255 255 255 / .8);
}

.hero-back:hover {
    color: #fff;
}

.hero-text {
    position: absolute;
    z-index: 2;
    left: max(52px, calc((100% - 1420px) / 2 + 52px));
    bottom: 60px;
    width: min(560px, calc(100% - 104px));
    text-align: left;
    animation: heroIn 1.4s ease both;
}

.hero-text h1 {
    margin: 0 0 30px;
    font-size: clamp(30px, 3.6vw, 64px);
    font-weight: 300;
    line-height: 1.15;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.hero-text p {
    margin: 0;
    font-size: 13px;
    line-height: 2;
    letter-spacing: .07em;
    color: rgb(255 255 255 / .9);
}

.hero-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px 28px;
    margin: 30px 0 0;
    font-size: 10px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgb(255 255 255 / .7);
}

.hero-info dt,
.hero-info dd {
    display: inline;
    margin: 0;
}

.hero-info dt::after {
    content: ': ';
}

@keyframes heroIn {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* the photos slide up over the hero */
.project-body {
    position: relative;
    z-index: 1;
    background: var(--background);
    padding: 4px 24px 90px;
}

.masonry {
    display: flex;
    gap: 4px;
    align-items: flex-start;
}

.masonry-col {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.project-media {
    margin: 0;
    overflow: hidden;
    background: var(--secondary);
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 1s ease, transform 1s ease;
}

.project-media.in {
    opacity: 1;
    transform: none;
}

.project-media img,
.project-media video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-media.film {
    margin: 4px 0;
}

.project-media.film video {
    height: auto;
}

.project-media.is-embed iframe {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
}

.project-next {
    margin-top: 70px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 640px) {
    .project-hero {
        height: calc(100svh - 72px);
    }

    .hero-back {
        left: 23px;
        top: 18px;
    }

    .hero-text {
        left: 23px;
        bottom: 36px;
        width: calc(100% - 46px);
    }

    .project-body {
        padding: 4px 4px 60px;
    }
}

@keyframes heroInMobile {
    from {
        opacity: 0;
        transform: translate(-50%, calc(-50% + 18px));
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}