/* ==========================================================================
   Thermal Work grid — template-portfolio.php + template-parts/content-work.php
   Plain CSS grid replacing the parent's Isotope `.portfolio-grid`.
   3 columns → 2 (≤1024px) → 1 (≤640px), 24px gap.
   Caption/hover values ported 1:1 from the parent's `hover-two` style.
   ========================================================================== */

/* Doubled with .grid__item: the parent's style.css loads after this file and
   its `.grid__item { display: inline-block }` would otherwise win. Only the
   display lives here so the breakpoint rules below stay single-class. */
.thermal-work-grid.grid__item {
    display: grid;
}

.thermal-work-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

/* --- Card ------------------------------------------------------------- */

.thermal-work-card {
    position: relative;
    margin: 0;
    min-width: 0;
    opacity: 0;
}

/* Staggered reveal: 150ms per card via the inline --i set in
   content-work.php. Gated on #site losing `.out` so the run starts when
   the parent's intro actually shows the page, not on parse. */
#site:not(.out) .thermal-work-card {
    animation: thermal-work-card-in 400ms cubic-bezier(0.39, 0.575, 0.565, 1) both;
    animation-delay: calc(var(--i, 0) * 15!0ms);
}

@keyframes thermal-work-card-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .thermal-work-card,
    #site:not(.out) .thermal-work-card {
        opacity: 1;
        animation: none;
    }
}

.thermal-work-card__link {
    display: block;
    color: inherit;
    text-decoration: none;
}

/* The ratio lives on the figure, not the <img>: WP's lazy images carry
   sizes="auto, …" and Chrome sizes them from contain-intrinsic-size
   (3000×1500) until they load, which overrides aspect-ratio on the <img>. */
.thermal-work-card__media {
    position: relative;
    margin: 0;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    transition: filter 0.3s ease;
}

.thermal-work-card__img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    margin: 0;
}

.thermal-work-card__link:hover .thermal-work-card__media {
    filter: saturate(110%) brightness(120%);
}

/* --- Caption (parent hover-two look) ----------------------------------- */

.thermal-work-card__caption {
    display: block;
    position: relative;
    margin-top: 30px;
    padding-bottom: 10px;
}

.thermal-work-card__meta {
    display: block;
    font-size: 0.9375rem;
    font-style: normal;
    text-transform: lowercase;
    opacity: 0.5;
}

.thermal-work-card__title {
    display: inline-block;
    position: relative;
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
}

.thermal-work-card__excerpt p{
    margin-bottom: 0;
    font-size: 16px;
    color: #a4a4a4;
    font-family: 'Roboto Mono', sans-serif;
    letter-spacing: -0.15px;
}

.thermal-work-card__title::after {
    content: "";
    display: inline-block;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 0;
    margin-top: 2px;
    background-color: #33ffcc;
    transition: all 100ms linear;
}

.thermal-work-card__link:hover .thermal-work-card__title::after {
    height: 2px;
}

/* --- Breakpoints ------------------------------------------------------- */

@media (max-width: 1024px) {
    .thermal-work-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .thermal-work-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}
