/* ---------- Works page (works.html) ----------
   Loaded after style.css, which supplies the wall, header, fonts and colors.
   Categories (NARRATIVE, COMMERCIAL…) each list years; each year has a row
   of square project tiles that wrap onto more lines when there are many. */

.works {
    --tile: clamp(5.5rem, 8.5vw, 9.5rem);    /* square tile size */
    --tile-gap: clamp(0.5rem, 1vw, 1rem);

    /* close to the screen's left edge, not boxed into a centered column */
    padding-inline: clamp(1rem, 3vw, 3rem);
    padding-bottom: clamp(3rem, 10vh, 7rem);
    color: var(--name-gold);
}

/* Category titles: all the same size, centered */
.works-category {
    margin-top: clamp(3rem, 9vh, 6rem);
}
.works-category:first-child {
    margin-top: clamp(1.5rem, 4vh, 3rem);    /* NARRATIVE sits right under the header */
}
.works-title {
    margin: 0 0 clamp(1.25rem, 3vh, 2.25rem);
    font-family: "Fraunces", Georgia, serif;
    font-weight: 900;
    font-size: clamp(2.25rem, 6vw, 5.5rem);   /* "AFTER EFFECTS PROJECTS" still fits one line on a computer */
    line-height: 1.05;
    letter-spacing: 0.02em;
    text-align: center;
    text-wrap: balance;                      /* long titles wrap evenly on phones */
    text-shadow: 0 0.04em 0.15em rgba(0, 0, 0, 0.6);
}

/* One year: the year on the left, then its tiles */
.works-year {
    display: flex;
    align-items: flex-start;
    gap: clamp(1.5rem, 3vw, 3rem);           /* space between the year and the tiles */
    margin-top: clamp(1.5rem, 4vh, 2.75rem);
}
/* The year: a bold label a little over half a tile tall, centered on the
   first row of tiles. Every year gets the same width, so every year's
   tiles start at exactly the same place (measured from the font: the
   widest year, "2024", is 2.88em with this spacing). */
.works-year-label {
    flex: none;
    box-sizing: content-box;
    width: 3.05em;                           /* room for the widest year */
    display: flex;
    align-items: center;
    height: var(--tile);
    margin: 0;
    font-family: "Fraunces", Georgia, serif;
    font-weight: 900;
    font-size: calc(var(--tile) * 0.75);
    line-height: 1;
    letter-spacing: 0.06em;
    text-shadow: 0 0.04em 0.15em rgba(0, 0, 0, 0.6);
}

.works-tiles {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;                         /* extra tiles drop to the next line */
    gap: var(--tile-gap);
}

/* A project tile: neutral placeholder until it has a thumbnail */
.works-tile {
    width: var(--tile);
    aspect-ratio: 1;
    padding: 0;
    border: 0;
    border-radius: 0.25rem;
    background: #7a7168;                     /* neutral taupe placeholder */
    box-shadow: 0 0.3rem 0.8rem rgba(0, 0, 0, 0.45);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
/* thumbnail: fills the square (trimmed to fit); if it doesn't load, the
   taupe square shows instead */
.works-tile {
    overflow: hidden;
}
.works-tile img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.works-tile:hover,
.works-tile:focus-visible {
    transform: translateY(-0.2rem);
    box-shadow:
        0 0 0 0.15rem var(--wordmark-gold),
        0 0.6rem 1.2rem rgba(0, 0, 0, 0.55);
}
.works-tile:focus-visible {
    outline: none;
}

/* Phones: each year sits above its tiles, three tiles per row. The year
   is a bold label about half a tile tall. */
@media (max-width: 575.98px) {
    .works-year {
        flex-direction: column;
        gap: 0.75rem;
    }
    .works-year-label {
        width: auto;                         /* above the tiles, so no shared width needed */
        height: auto;
        align-self: flex-start;
        font-size: 14vw;
    }
    .works-tiles {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }
    .works-tile {
        width: auto;
    }
}
