/* Shared listing page for home sections */

html.section-locked,
body.section-locked {
    overflow: hidden;
    height: 100%;
}

.section-page {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.section-page > .navbar--home,
.section-page > .home-footer {
    flex-shrink: 0;
}

.section-page-main {
    --section-edge: 4.1rem;
    --section-header-height: 8rem;
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    display: grid;
    grid-template-columns: var(--section-edge) minmax(0, 1fr) var(--section-edge);
    grid-template-rows: minmax(0, 1fr);
    align-items: start;
    padding: 0;
    position: relative;
    container-type: size;
}

.section-page-main,
.section-project-grid {
    scrollbar-width: thin;
    scrollbar-color: rgba(112, 118, 138, 0.55) rgba(255, 255, 255, 0.04);
}

.section-page-main::-webkit-scrollbar,
.section-project-grid::-webkit-scrollbar {
    width: 0.5rem;
}

.section-page-main::-webkit-scrollbar-track,
.section-project-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-left: 1px solid var(--color-border, rgba(112, 118, 138, 0.12));
}

.section-page-main::-webkit-scrollbar-thumb,
.section-project-grid::-webkit-scrollbar-thumb {
    background: linear-gradient(
        180deg,
        rgba(112, 118, 138, 0.55) 0%,
        rgba(112, 118, 138, 0.35) 100%
    );
    border: 2px solid transparent;
    background-clip: padding-box;
    border-radius: 999px;
    transition: background 0.2s ease;
}

.section-page-main::-webkit-scrollbar-thumb:hover,
.section-project-grid::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(
        180deg,
        rgba(237, 219, 217, 0.45) 0%,
        rgba(112, 118, 138, 0.55) 100%
    );
    background-clip: padding-box;
}

.section-page-main::-webkit-scrollbar-thumb:active,
.section-project-grid::-webkit-scrollbar-thumb:active {
    background: rgba(237, 219, 217, 0.55);
    background-clip: padding-box;
}

.section-page-body {
    grid-column: 2;
    min-height: 90cqh;
    height: auto;
    margin-block: 5cqh;
    display: flex;
    flex-direction: column;
    position: relative;
    container-type: inline-size;
}

.section-page-header {
    width: 100%;
    margin: 0 0 clamp(0.75rem, 2.5vh, 1.5rem);
    flex-shrink: 0;
    padding-right: clamp(7.5rem, 14vw, 9.5rem);
}

.section-page-header-text {
    min-width: 0;
}

.section-back-link {
    position: fixed;
    top: calc(var(--navbar-height, 4.25rem) + clamp(1.25rem, 4vh, 2.5rem));
    right: 4.1rem;
    z-index: 20;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.25rem;
    font-size: clamp(0.8rem, 1.4vh, 0.95rem);
    font-weight: 500;
    color: var(--color-text-primary, #EDDBD9);
    text-decoration: none;
    border: 1px solid var(--color-border, rgba(112, 118, 138, 0.22));
    border-radius: 6px;
    background: rgba(14, 19, 25, 0.72);
    backdrop-filter: blur(12px) saturate(1.1);
    -webkit-backdrop-filter: blur(12px) saturate(1.1);
    box-shadow: none;
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
    cursor: pointer;
    margin: 0;
}

.section-back-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-text-primary, #EDDBD9);
    border-color: var(--color-border, rgba(112, 118, 138, 0.35));
    transform: translateY(-2px);
}

.section-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-accent, #71768A);
}

.section-page-title {
    font-size: clamp(1.75rem, 5.5vh, 3.75rem);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: var(--color-text-primary, #EDDBD9);
    margin-bottom: clamp(0.35rem, 1vh, 0.75rem);
}

.section-page-intro {
    max-width: 40rem;
    font-size: clamp(0.875rem, 1.8vh, 1.05rem);
    line-height: 1.65;
    color: var(--color-text-secondary, #71768A);
}

.section-project-grid {
    --para-top-start: 9%;
    --para-bottom-start: 0%;
    --para-text-inset: clamp(0.75rem, 2vw, 1rem);
    --para-inset: 0.065;
    --project-cols: 4;
    --project-gap: clamp(0.32rem, 0.65vw, 0.55rem);
    /* Row gap matches the *visual* side gap: CSS gap plus the parallelogram cut. */
    --slant-gap: calc(
        (100cqi - (var(--project-cols) - 1) * var(--project-gap))
        / var(--project-cols)
        * var(--para-inset)
    );
    /* Row height matches a two-row Professional Work layout; extra rows scroll. */
    --row-gap: calc(var(--project-gap) + var(--slant-gap));
    width: 100%;
    flex: none;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: var(--row-gap);
    padding-bottom: var(--row-gap);
}

.section-project-row {
    flex: none;
    height: calc((90cqh - var(--section-header-height) - var(--row-gap)) / 2);
    min-height: 0;
    display: grid;
    gap: var(--project-gap);
}

.section-project-row--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.section-project-row--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: calc(75% - (var(--project-gap) * 0.25));
    margin-inline: auto;
}

.section-project-row--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: calc(50% - (var(--project-gap) * 0.5));
    margin-inline: auto;
}

.section-project-row--1 {
    grid-template-columns: 1fr;
    width: calc(25%);
    margin-inline: auto;
}

/* Parallelogram project cards — same geometry as home hero */
.section-project-card {
    position: relative;
    height: 100%;
    min-height: 0;
    opacity: 0;
    translate: 0 12px;
    transition:
        opacity 0.65s ease,
        translate 0.65s ease;
}

.section-project-card-link {
    display: block;
    width: 100%;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.section-project-grid.is-visible .section-project-card {
    opacity: 1;
    translate: 0 0;
}

.section-project-card-inner {
    position: absolute;
    inset: 0;
    clip-path: polygon(9% 0, 100% 0, 91% 100%, 0% 100%);
    border: 1px solid var(--color-border, rgba(112, 118, 138, 0.35));
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    overflow: hidden;
    cursor: default;
    transition:
        border-color 0.35s ease,
        box-shadow 0.35s ease;
}

.section-project-card:hover .section-project-card-inner {
    border-color: rgba(237, 219, 217, 0.28);
    box-shadow:
        0 28px 56px rgba(0, 0, 0, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.section-project-card-link:focus-visible .section-project-card-inner {
    border-color: rgba(237, 219, 217, 0.45);
    box-shadow:
        0 0 0 2px rgba(237, 219, 217, 0.25),
        0 28px 56px rgba(0, 0, 0, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.section-project-card-media {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.03);
}

.section-project-card-media.is-gradient {
    background: linear-gradient(160deg, var(--card-from, #4a6fa5) 0%, var(--card-to, #2f4a73) 100%);
}

.section-project-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-project-card:hover .section-project-card-image {
    transform: scale(1.05);
}

.section-project-card-scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        165deg,
        rgba(0, 0, 0, 0.08) 0%,
        rgba(0, 0, 0, 0.45) 100%
    );
    opacity: 1;
    transition:
        opacity 0.4s ease,
        background 0.4s ease;
}

.section-project-card:hover .section-project-card-scrim {
    background: linear-gradient(
        160deg,
        color-mix(in srgb, var(--card-from, #EDDBD9) 18%, transparent) 0%,
        color-mix(in srgb, var(--card-to, #EDDBD9) 22%, transparent) 100%
    );
    opacity: 0.82;
}

.section-project-card-title {
    position: absolute;
    top: clamp(0.7rem, 2.2vh, 1.25rem);
    left: calc(var(--para-top-start) + var(--para-text-inset));
    right: var(--para-text-inset);
    margin: 0;
    font-size: clamp(0.95rem, 2.4vh, 1.35rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: #f5f0ee;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    z-index: 1;
    transition: transform 0.35s ease;
}

.section-project-card:hover .section-project-card-title {
    transform: translateY(-2px);
}

@media (max-width: 1100px) {
    .section-page-main {
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        align-items: start;
    }

    .section-page-body {
        min-height: 0;
        margin-block: 0;
        padding: clamp(1rem, 2.5vh, 2rem) 0;
    }

    .section-page-header {
        padding-right: 0;
        padding-top: 3rem;
    }

    .section-back-link {
        top: calc(var(--navbar-height, 4.25rem) + clamp(0.75rem, 2vh, 1.25rem));
        right: clamp(1.2rem, 4vw, 2rem);
    }

    .section-project-grid {
        --project-cols: 2;
        flex: none;
    }

    .section-project-row {
        flex: none;
        height: auto;
    }

    .section-project-card {
        aspect-ratio: 5 / 3;
        height: auto;
    }

    .section-project-row--4,
    .section-project-row--3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }
}

@media (max-width: 640px) {
    .section-project-grid {
        --project-cols: 1;
        --slant-gap: 0px;
    }

    .section-project-row--4,
    .section-project-row--3 {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .section-project-card {
        aspect-ratio: 16 / 10;
    }
}
