/* Portfolio: the service pages' centered opening, followed by the existing stacks. */
body.projects-page main {
    padding-top: 0;
}

.projects-opening {
    position: relative;
    isolation: isolate;
    overflow: clip;
    padding-bottom: clamp(48px, 6vw, 88px);
}

.projects-orbits {
    position: absolute;
    z-index: -1;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    mask-image: linear-gradient(#000 0%, #000 55%, transparent 90%);
}

.projects-orbits span {
    position: absolute;
    top: 370px;
    left: 50%;
    width: 1160px;
    height: 1160px;
    transform: translate(-50%, -50%);
    border: 1px solid rgb(23 34 27 / 7%);
    border-radius: 50%;
}

.projects-orbits span + span {
    width: 1480px;
    height: 1480px;
}

.projects-page .projects-hero {
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    width: 100%;
    min-height: clamp(620px, 84svh, 820px);
    margin: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.projects-page .projects-hero .hero-copy {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(100%, 1080px);
    max-width: none;
    margin-inline: auto;
    padding: clamp(142px, 16vh, 158px) 28px 96px;
    text-align: center;
}

.projects-hero h1 {
    max-width: 22ch;
    line-height: 1.1;
    text-transform: uppercase;
    text-wrap: balance;
}

.projects-page .projects-hero .hero-description {
    max-width: 57ch;
    margin-top: 20px;
}

.projects-page .projects-hero .hero-actions {
    justify-content: center;
    margin-top: 25px;
}

.projects-overview {
    position: relative;
    width: min(1180px, calc(100% - var(--gutter) * 2));
    margin: -32px auto 0;
}

.projects-index {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: clamp(12px, 1.8vw, 24px);
}

.projects-index__item {
    min-width: 0;
    border-radius: 14px;
}

.projects-index__preview {
    display: block;
    overflow: hidden;
    aspect-ratio: 1.6;
    border: 1px solid rgb(23 34 27 / 9%);
    border-radius: 14px;
    background: var(--factory-surface);
    box-shadow: 0 6px 18px rgb(23 34 27 / 4%);
    transition:
        transform 240ms var(--ease),
        box-shadow 240ms var(--ease);
}

.projects-index__preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
}

.projects-index__item:is(:hover, :focus-visible) .projects-index__preview {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgb(23 34 27 / 10%);
}

.projects-index__identity {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.03em;
}

.projects-overview__note {
    max-width: 85ch;
    margin: 28px auto 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
    text-align: center;
    text-wrap: pretty;
}

.projects-page .portfolio-group {
    width: min(1320px, calc(100% - var(--gutter) * 2));
    margin-inline: auto;
    scroll-margin-top: 112px;
}

.projects-group-heading {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    align-items: end;
    gap: clamp(32px, 6vw, 88px);
    padding-block: clamp(44px, 5vw, 72px) 40px;
    border-top: 1px solid var(--line);
}

.projects-group-heading .scene-kicker {
    margin-bottom: 18px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.projects-group-heading .scene-heading {
    max-width: 19ch;
    text-wrap: balance;
}

.projects-group-heading__aside {
    max-width: 39ch;
}

.projects-group-heading__aside p {
    color: var(--muted);
    font-size: 16px;
    line-height: 1.65;
}

.projects-group-heading__aside .text-link {
    margin-top: 20px;
    font-size: 13px;
}

.projects-page .project-chapters {
    padding: 0 0 clamp(56px, 7vw, 100px);
}

/* Keep position, scale, scroll progress and reduced motion in immersive.css/editorial.js. */
.projects-page .project-chapter {
    grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
    gap: clamp(28px, 4vw, 56px);
    min-height: min(610px, calc(100svh - 140px));
    margin-bottom: 24px;
    padding: clamp(28px, 3.2vw, 44px);
    border: 1px solid rgb(23 34 27 / 7%);
    border-radius: clamp(24px, 3vw, 36px);
    background: var(--factory-surface);
    box-shadow: 0 -6px 28px rgb(23 34 27 / 4%);
    scroll-margin-top: 112px;
}

.projects-page .project-chapter--marea {
    background: #eef5f3;
}

.projects-page .project-chapter--casa-selva {
    background: #f4f2ed;
}

.projects-page .project-chapter--atlante {
    background: #edf2ed;
}

.projects-page .project-chapter__media {
    grid-column: 2;
    grid-row: 1;
    border: 1px solid rgb(23 34 27 / 9%);
    border-radius: 14px;
    background: var(--paper);
    box-shadow: 0 16px 40px rgb(23 34 27 / 8%);
}

.projects-page .project-chapter__media img {
    width: 100%;
    height: auto;
    max-height: min(470px, 58svh);
    object-fit: contain;
}

.projects-page .project-chapter__copy {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
}

.projects-page .project-chapter__copy h3 {
    font-size: clamp(32px, 3.7vw, 56px);
    font-weight: 600;
    line-height: 1.07;
    letter-spacing: -0.055em;
}

.projects-page .project-chapter__copy p {
    max-width: 36ch;
    margin-top: 20px;
    color: #515e55;
    font-size: 15px;
    line-height: 1.7;
    text-wrap: pretty;
}

.projects-page .project-chapter .hero-actions {
    margin-top: 28px;
}

.projects-page .project-chapter .hero-action {
    min-height: 48px;
    padding: 12px 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    font-size: 13px;
    font-weight: 600;
}

.projects-page .project-chapter .hero-action:is(:hover, :focus-visible) {
    border-color: var(--ink);
    background: var(--ink);
    color: var(--paper);
}

@media (max-width: 900px) {
    .projects-index {
        grid-template-columns: repeat(5, 190px);
        gap: 16px;
        margin: -8px -8px 0;
        padding: 8px 8px 16px;
        overflow-x: auto;
        scroll-snap-type: x proximity;
        scrollbar-width: thin;
        scrollbar-color: var(--line) transparent;
    }

    .projects-index__item {
        scroll-snap-align: start;
    }
}

@media (max-width: 800px) {
    .projects-group-heading {
        grid-template-columns: 1fr;
        gap: 24px;
        padding-bottom: 28px;
    }

    .projects-group-heading__aside {
        max-width: 50ch;
    }

    .projects-page .project-chapter {
        grid-template-columns: 1fr;
        gap: 24px;
        min-height: 0;
        padding: 22px;
    }

    .projects-page .project-chapter__media {
        grid-column: 1;
        grid-row: 1;
        width: 100%;
        max-width: 600px;
        justify-self: center;
        border-radius: 10px;
    }

    .projects-page .project-chapter__media img {
        max-height: 32svh;
    }

    .projects-page .project-chapter__copy {
        grid-row: 2;
    }

    .projects-page .project-chapter__copy p {
        max-width: 55ch;
        margin-top: 12px;
        font-size: 14px;
        line-height: 1.6;
    }

    .projects-page .project-chapter .hero-actions {
        margin-top: 20px;
    }
}

@media (max-width: 760px) {
    .projects-page .projects-hero {
        min-height: 0;
    }

    .projects-page .projects-hero .hero-copy {
        padding: calc(max(10px, env(safe-area-inset-top)) + 108px) 22px 48px;
    }

    .projects-hero .scene-kicker {
        font-size: 10px;
    }

    .projects-page .projects-hero .hero-description {
        max-width: 43ch;
        font-size: 16px;
    }

    .projects-page .projects-hero .hero-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 10px;
    }

    .projects-orbits span {
        top: 280px;
        width: 580px;
        height: 580px;
    }

    .projects-orbits span + span {
        width: 780px;
        height: 780px;
    }

    .projects-overview {
        margin-top: 0;
    }

    .projects-overview__note {
        margin-top: 18px;
        text-align: left;
    }
}

@media (max-width: 600px) {
    .projects-index {
        grid-template-columns: repeat(5, 160px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .projects-index {
        scroll-snap-type: none;
    }

    .projects-index__preview {
        transition: none;
    }

    .projects-index__item:is(:hover, :focus-visible) .projects-index__preview {
        transform: none;
    }
}
