
@media only screen and (min-width: 0rem) {
    #portfolio {
        z-index: 1;
        position: relative;
        overflow: hidden;
        padding: var(--sectionPadding);
    }

    #portfolio .cs-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin: auto;
        max-width: 80rem;
        width: 100%;
        gap: clamp(3rem, 6vw, 4rem);
    }

    #portfolio .cs-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
        text-align: center;
    }

    #portfolio .cs-title, #portfolio .cs-text {
        max-width: 53.125rem;
    }

    #portfolio .cs-image-group {
        display: grid;
        grid-template-columns: repeat(12, 1fr);
        grid-template-rows: 1fr;
        margin: 0;
        width: 100%;
        padding: 0;
        gap: 1.25rem;
    }

    #portfolio .cs-link {
        display: flex;
        flex-direction: column;
        height: 100%;
        text-decoration: none;
    }

    #portfolio .cs-item {
        margin: 0;
        height: 100%;
        width: 100%;
        list-style: none;
        grid-column: span 12;
    }

    #portfolio .cs-item:hover .cs-h3, #portfolio .cs-item:hover .cs-desc {
        color: #fff;
    }

    #portfolio .cs-item:hover .cs-item-text {
        background-color: var(--primary);
    }

    #portfolio .cs-item:hover .cs-icon-wrapper {
        border-color: #fff;
    }

    #portfolio .cs-item:hover .cs-icon {
        filter: brightness(1000%) grayscale(1);
    }

    #portfolio .cs-picture {
        position: relative;
        display: block;
        margin: auto;
        height: clamp(21.5rem, 30vw, 26.25rem);
        width: 100%;
        overflow: hidden;
    }

    #portfolio .cs-picture img {
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        width: 100%;
        object-fit: cover;
    }

    #portfolio .cs-item-text {
        display: flex;
        flex-grow: 1;
        justify-content: space-between;
        align-items: center;
        background-color: #f7f7f7;
        padding: clamp(1rem, 2vw, 1.25rem) clamp(1rem, 2.8vw, 2.5rem);
        transition: background-color 0.3s;
        gap: 1rem;
    }

    #portfolio .cs-flex {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    #portfolio .cs-h3 {
        margin: 0;
        font-size: clamp(1.25rem, 1.8vw, 1.5625rem);
        line-height: 1.2em;
        color: #1a1a1a;
        transition: color 0.3s;
        text-align: left;
    }

    #portfolio .cs-desc {
        font-size: clamp(0.875rem, 1.2vw, 1rem);
        line-height: 1.5em;
        color: #1a1a1a;
        transition: color 0.3s;
    }

    #portfolio .cs-icon-wrapper {
        display: flex;
        flex-shrink: 0;
        justify-content: center;
        align-items: center;
        border: 1px solid #bababa;
        border-radius: 50%;
        height: 3rem;
        width: 3rem;
        transition: border-color 0.3s;
    }

    #portfolio .cs-icon {
        height: 0.75rem;
        width: auto;
        transition: filter 0.3s;
    }
}

@media only screen and (min-width: 37.5rem) {
    #portfolio .cs-item {
        grid-column: span 6;
    }
}

/* ===== Projects landing: category hub (two cards) ===== */
@media only screen and (min-width: 0rem) {
    #project-cats {
        padding: var(--sectionPadding);
        position: relative;
        z-index: 1;
    }

    #project-cats .cs-container {
        width: 100%;
        max-width: 80rem;
        margin: auto;
    }

    #project-cats .cs-content {
        max-width: 46rem;
        margin: 0 auto clamp(2.5rem, 5vw, 3.5rem);
        text-align: center;
    }

    #project-cats .cs-title {
        margin: 0 auto 1rem;
    }

    #project-cats .cs-text {
        margin: 0 auto;
    }

    #project-cats .cs-cat-group {
        margin: 0;
        padding: 0;
        list-style: none;
        display: grid;
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    #project-cats .cs-cat {
        list-style: none;
    }

    #project-cats .cs-cat-link {
        position: relative;
        display: block;
        min-height: 22rem;
        border-radius: 1rem;
        overflow: hidden;
        text-decoration: none;
    }

    #project-cats .cs-cat-pic {
        position: absolute;
        inset: 0;
        display: block;
    }

    #project-cats .cs-cat-pic img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.4s ease;
    }

    #project-cats .cs-cat-link:before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: 1;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.82) 10%, rgba(0, 0, 0, 0.35) 55%, rgba(0, 0, 0, 0.1) 100%);
        transition: background 0.3s ease;
    }

    #project-cats .cs-cat-link:hover .cs-cat-pic img {
        transform: scale(1.05);
    }

    #project-cats .cs-cat-body {
        position: relative;
        z-index: 2;
        min-height: 22rem;
        box-sizing: border-box;
        padding: clamp(1.5rem, 4vw, 2.5rem);
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-end;
    }

    #project-cats .cs-cat-count {
        font-family: "Oswald", Arial, sans-serif;
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: #fff;
        background-color: var(--primary);
        padding: 0.3rem 0.7rem;
        border-radius: 0.25rem;
        margin-bottom: 0.9rem;
    }

    #project-cats .cs-cat-name {
        font-size: clamp(1.5rem, 3vw, 2rem);
        font-weight: 900;
        line-height: 1.15;
        color: #fff;
        margin: 0 0 0.6rem;
    }

    #project-cats .cs-cat-desc {
        font-size: 0.9375rem;
        line-height: 1.5;
        color: #fff;
        opacity: 0.85;
        margin: 0 0 1.25rem;
        max-width: 26rem;
    }

    #project-cats .cs-cat-cta {
        font-family: "Oswald", Arial, sans-serif;
        font-size: 0.875rem;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        color: #fff;
        display: inline-flex;
        align-items: center;
        gap: 0.45rem;
        transition: gap 0.2s ease;
    }

    #project-cats .cs-cat-link:hover .cs-cat-cta {
        gap: 0.85rem;
    }
}

@media only screen and (min-width: 48rem) {
    #project-cats .cs-cat-group {
        grid-template-columns: 1fr 1fr;
    }
}
