/* PROJECTS — editorial, minimal, portfolio-focused. Large type index
   instead of a media grid; a floating preview follows the cursor. */

.projects-intro {
    padding:
        calc(var(--nav-h) + 5rem)
        calc(clamp(1.2rem, 6vw, 6rem) + var(--safe-right))
        2rem
        calc(clamp(1.2rem, 6vw, 6rem) + var(--safe-left));
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: end;
    gap: 1.5rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(247, 242, 232, .045), transparent 54%),
        var(--bg);
    min-height: min(560px, 64dvh);
    align-content: end;
}

.projects-intro p {
    text-transform: uppercase;
    letter-spacing: .16em;
    font-size: .78rem;
    color: var(--grey);
}

.projects-intro h1 {
    font-size: clamp(3.4rem, 11vw, 10rem);
    line-height: .82;
    margin-right: auto;
    text-wrap: balance;
}

.projects-intro__count {
    justify-self: end;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .8rem;
    color: var(--grey);
}

.project-index {
    padding:
        0
        calc(clamp(1.2rem, 6vw, 6rem) + var(--safe-right))
        calc(6rem + var(--safe-bottom))
        calc(clamp(1.2rem, 6vw, 6rem) + var(--safe-left));
}

.project-filters {
    position: sticky;
    top: calc(var(--nav-h) + .85rem);
    z-index: 20;
    display: flex;
    gap: .65rem;
    overflow-x: auto;
    padding:
        1rem
        calc(clamp(1.2rem, 6vw, 6rem) + var(--safe-right))
        1rem
        calc(clamp(1.2rem, 6vw, 6rem) + var(--safe-left));
    border-bottom: 1px solid var(--line);
    background: rgba(8, 8, 6, .72);
    backdrop-filter: blur(18px);
    scrollbar-width: none;
}

.project-filters::-webkit-scrollbar { display: none; }

.project-filters button {
    flex: 0 0 auto;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: var(--radius-ui);
    padding: 0 .9rem;
    color: var(--muted);
    font-size: .72rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    transition: background .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease);
}

.project-filters button:hover,
.project-filters button:focus-visible,
.project-filters button.is-active {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--bg);
}

.project-index__row {
    border-bottom: 1px solid var(--line);
    position: relative;
}

.project-index__row::before {
    content: "";
    position: absolute;
    inset: 0 calc(var(--page-x) * -1);
    background: linear-gradient(90deg, rgba(247, 242, 232, .055), transparent 42%);
    opacity: 0;
    pointer-events: none;
    transition: opacity .35s var(--ease);
}

.project-index__row:hover::before {
    opacity: 1;
}

.project-index__link {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 3rem minmax(0, 1.1fr) minmax(150px, .36fr) minmax(180px, .44fr) auto 2rem;
    align-items: center;
    gap: clamp(1rem, 3vw, 2.5rem);
    min-height: clamp(112px, 13vw, 170px);
    padding: clamp(1.2rem, 2.8vw, 2.4rem) 0;
    transition: opacity .35s var(--ease), padding .4s var(--ease), color .3s var(--ease);
}

.project-index:hover .project-index__link {
    opacity: .4;
}

.project-index__link:hover {
    opacity: 1;
    color: var(--accent);
    padding-left: clamp(.35rem, .9vw, .8rem);
}

.project-index__number {
    font-size: .85rem;
    color: var(--grey);
}

.project-index__title {
    font-family: 'Archivo', Arial, sans-serif;
    font-size: clamp(2.2rem, 7.6vw, 7.2rem);
    line-height: .88;
    letter-spacing: -.01em;
    transition: transform .45s var(--ease);
}

.project-index__link:hover .project-index__title {
    transform: translateX(.4em);
}

.project-index__category,
.project-index__services,
.project-index__year {
    text-transform: uppercase;
    letter-spacing: .1em;
    font-size: .8rem;
    color: var(--grey);
    white-space: nowrap;
}

.project-index__services {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-index__row.is-hidden {
    display: none;
}

.project-index__arrow {
    font-size: 1.4rem;
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity .35s var(--ease), transform .35s var(--ease);
}

.project-index__link:hover .project-index__arrow {
    opacity: 1;
    transform: translateX(0);
}

.project-index__preview {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 60;
    width: min(420px, 34vw);
    height: min(260px, 22vw);
    margin: -130px 0 0 2rem;
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    clip-path: inset(50% 50% 50% 50%);
    transition: opacity .35s var(--ease), clip-path .5s var(--ease);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.project-index__preview.is-active {
    opacity: 1;
    clip-path: inset(0% 0% 0% 0%);
}

.project-index__preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 900px) {
    .projects-intro {
        min-height: auto;
        padding-top: calc(var(--nav-h) + 3.5rem);
        padding-bottom: 1.6rem;
        display: grid;
        gap: .8rem;
        align-content: end;
    }
    .projects-intro h1 {
        font-size: clamp(2.25rem, 10vw, 3.6rem);
        line-height: .98;
    }
    .project-filters {
        flex-wrap: wrap;
        overflow: visible;
        gap: .55rem;
        padding-top: .85rem;
        padding-bottom: .85rem;
    }
    .project-filters button {
        min-height: 34px;
        padding: 0 .75rem;
        font-size: .66rem;
        letter-spacing: .1em;
    }
    .project-index__link {
        grid-template-columns: 2.4rem 1fr;
        grid-template-areas:
            "num title"
            ". cat"
            ". services"
            ". year";
        gap: .35rem 1rem;
        padding: 1.35rem 0;
    }
    .project-index__number { grid-area: num; }
    .project-index__title {
        grid-area: title;
        font-size: clamp(1.75rem, 8.3vw, 2.55rem);
        line-height: 1.05;
        overflow-wrap: anywhere;
    }
    .project-index__category { grid-area: cat; }
    .project-index__services {
        grid-area: services;
        max-width: none;
        white-space: normal;
        line-height: 1.45;
    }
    .project-index__year {
        grid-area: year;
        justify-self: start;
    }
    .project-index__arrow { display: none; }
    .project-index__preview { display: none; }
}
