:root {
    --portfolio-section-gap: clamp(4rem, 6vw, 7rem);
    --cta-padding-top: 0;
    --cta-padding-bottom: var(--portfolio-section-gap);
}

.portfolio-section-gap {
    width: 100%;
    height: var(--portfolio-section-gap);
    flex-shrink: 0;
}

/* ======================
   WORK HERO
   ====================== */
.work-hero {
    padding-top: var(--hero-padding-top, clamp(6.5rem, 10vw, 9.5rem));
    padding-bottom: 0;
    background-color: #05010a;
}

.work-header-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto var(--section-header-mb);
}

.work-main-title {
    margin-bottom: 30px;
    color: #fff;
}

.work-subtitle {
    font-size: 18px;
    line-height: 1.7;
    color: #888;
}

/* ======================
   PROJECT GRID
   ====================== */

.blog-categories-nav .blog-cat-link {
    text-decoration: none;
}

.blog-categories-nav .blog-cat-link:hover,
.blog-categories-nav .blog-cat-link:focus,
.blog-categories-nav .blog-cat-link:active,
.blog-categories-nav .blog-cat-link.active {
    text-decoration: none;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

/* 5 cards: row1 = 3, row2 = 2 centered */
.project-grid:has(.project-card:nth-child(5):last-child) {
    grid-template-columns: repeat(6, 1fr);
}

.project-grid:has(.project-card:nth-child(5):last-child) .project-card {
    grid-column: span 2;
}

.project-grid:has(.project-card:nth-child(5):last-child) .project-card:nth-child(4) {
    grid-column: 2 / span 2;
}

.project-grid:has(.project-card:nth-child(5):last-child) .project-card:nth-child(5) {
    grid-column: 4 / span 2;
}

/* ======================
   CARD — UNIFIED DARK THEME
   ====================== */
.project-card {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.07);
    transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1),
                border-color 0.35s ease,
                box-shadow 0.35s ease;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.project-card a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* --- Visual / Logo Area --- */
.card-top {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    flex-shrink: 0;
    background: #0c0817;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

/* Subtle gradient at bottom for logo cards */
.card-top::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 50%, rgba(5, 1, 10, 0.4) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Screenshot variant — image fills area edge-to-edge */
.card-top.card-screenshot {
    padding: 0;
    display: block;
}

.card-top.card-screenshot > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s ease;
}

/* Client logos — centred & contained */
.client-logo,
.portfolio-card-logo {
    max-width: 65% !important;
    max-height: 65% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
    object-position: center;
    display: block !important;
    margin: auto !important;
    opacity: 1 !important;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    z-index: 2;
}

/* Fallback project title if no logo */
.card-fallback-title {
    color: #ffffff;
    font-weight: 800;
    font-size: 20px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0;
    padding: 0 16px;
    text-align: center;
    line-height: 1.4;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    z-index: 2;
}

/* --- Details Area --- */
.card-bottom {
    padding: 22px 26px 26px;
    background: transparent;
    display: flex;
    flex-direction: column;
    flex: 1;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.card-bottom h3 {
    font-size: 20px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 10px;
    letter-spacing: -0.4px;
}

.card-bottom p {
    font-size: 14px;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 20px;
    flex: 1;
}

/* CTA label */
.view-project {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--purple-light, #A594FD);
    font-size: 13px;
    font-weight: 700;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    width: 100%;
    background: none;
    border-radius: 0;
    transition: color 0.25s ease;
}

/* =====================
   HOVER — mouse only
   ===================== */
@media (hover: hover) {
    .project-card:hover {
        transform: translateY(-6px);
        border-color: rgba(165, 148, 253, 0.35);
        box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6),
                    0 0 25px rgba(99, 44, 155, 0.2);
    }

    .project-card:hover .portfolio-card-logo,
    .project-card:hover .client-logo {
        transform: scale(1.05);
    }

    .project-card:hover .card-fallback-title {
        transform: scale(1.04);
    }

    .project-card:hover .card-top.card-screenshot > img {
        transform: scale(1.06);
    }

    .project-card:hover .view-project {
        color: #ffffff;
    }
}

/* ======================
   1200px
   ====================== */
@media (max-width: 1200px) {
    .work-hero {
        padding-top: var(--hero-padding-top, clamp(6.5rem, 10vw, 9.5rem));
    }

    .project-grid {
        gap: 24px;
    }
}

/* ======================
   1100px — 2 col (tablet landscape only)
   min-width: 769px ensures it doesnt affect mobile
   ====================== */
@media (min-width: 769px) and (max-width: 1100px) {

    .project-grid,
    .project-grid:has(.project-card:nth-child(5):last-child) {
        grid-template-columns: repeat(2, 1fr) !important;
        width: 100%;
    }

    .project-grid:has(.project-card:nth-child(5):last-child) .project-card,
    .project-grid:has(.project-card:nth-child(5):last-child) .project-card:nth-child(4),
    .project-grid:has(.project-card:nth-child(5):last-child) .project-card:nth-child(5) {
        grid-column: span 1 !important;
    }
}

/* ======================
   1024px
   ====================== */
@media (max-width: 1024px) {
    .work-hero {
        padding-top: var(--hero-padding-top-tablet, clamp(5.5rem, 8.5vw, 7.5rem));
    }

    .work-header-content {
        margin-bottom: var(--section-header-mb);
    }

    .card-top {
        aspect-ratio: 16 / 9;
    }

    .card-bottom {
        padding: 20px 22px 24px;
    }
}

/* ======================
   768px — 1 col starts here
   ====================== */
@media (max-width: 768px) {
    .work-hero {
        padding-top: var(--hero-padding-top-mobile, clamp(5rem, 8vw, 6.5rem));
    }

    .work-header-content {
        margin-bottom: var(--section-header-mb);
    }

    .work-subtitle {
        font-size: 16px;
    }

    /* SINGLE COLUMN */
    .project-grid {
        grid-template-columns: 1fr !important;
        width: 100%;
        gap: 20px;
    }

    /* Reset 5-card layout */
    .project-grid:has(.project-card:nth-child(5):last-child) {
        grid-template-columns: 1fr !important;
    }

    .project-grid:has(.project-card:nth-child(5):last-child) .project-card,
    .project-grid:has(.project-card:nth-child(5):last-child) .project-card:nth-child(4),
    .project-grid:has(.project-card:nth-child(5):last-child) .project-card:nth-child(5) {
        grid-column: span 1 !important;
    }

    .card-top {
        aspect-ratio: 16 / 8;
    }

    .card-bottom {
        padding: 20px 22px 24px;
    }

    .card-bottom h3 {
        font-size: 20px;
    }

    .card-bottom p {
        font-size: 15px;
    }

    .view-project {
        font-size: 12px;
    }
}

/* ======================
   480px
   ====================== */
@media (max-width: 480px) {
    .work-hero {
        padding-top: clamp(4.5rem, 8vw, 6rem);
    }

    .work-header-content {
        margin-bottom: var(--section-header-mb);
    }

    .work-subtitle {
        font-size: 15px;
        line-height: 1.6;
    }

    .project-grid {
        width: 100%;
        gap: 16px;
    }

    .card-top {
        aspect-ratio: 16 / 9;
    }

    .card-bottom {
        padding: 18px 20px 22px;
    }

    .card-bottom h3 {
        font-size: 18px;
    }

    .card-bottom p {
        font-size: 14px;
        margin-bottom: 16px;
    }
}

/* ======================
   360px
   ====================== */
@media (max-width: 360px) {
    .work-hero {
        padding-top: clamp(4.5rem, 9vw, 6rem);
    }

    .project-grid {
        width: 100%;
    }

    .card-bottom {
        padding: 16px 18px 20px;
    }

    .card-bottom h3 {
        font-size: 17px;
    }

    .card-bottom p {
        font-size: 13px;
    }

    .view-project {
        font-size: 11px;
    }
}

/* ======================
   320px AND BELOW (ULTRA-SMALL)
   ====================== */
@media (max-width: 320px) {
    .project-grid {
        width: 100%;
        gap: 15px;
    }

    .card-top {
        aspect-ratio: 4 / 3;
    }

    .client-logo,
    .portfolio-card-logo {
        max-width: 80% !important;
    }

    .card-bottom {
        padding: 14px 16px 18px;
    }

    .card-bottom h3 {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .card-bottom p {
        font-size: 13px;
        line-height: 1.4;
        margin-bottom: 14px;
    }

    .view-project {
        font-size: 10px;
    }
}






/* ============================================================
    TRUSTED PARTNERS - PREMIUM RESPONSIVE
   ============================================================ */
.partners-section {
    padding-top: 10px;
    padding-bottom: 0;
    background: #05010a;
    overflow: hidden;
}

.partners-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: clamp(40px, 6vw, 80px);
}

.partners-content {
    width: 40%;
    position: sticky;
    /* top: 120px; */
    /* Sticks the text while scrolling through logos on desktop */
}

.partners-title {
    margin-bottom: 25px;
    color: #fff;
}

.partners-title span {
    color: var(--purple-light, #A594FD);
}

.partners-subtitle {
    font-size: clamp(16px, 1.1vw, 18px);
    color: #888;
    line-height: 1.6;
    max-width: 480px;
}

/* THE GRID & TILES */
.partners-grid {
    width: 55%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(10px, 1.5vw, 20px);
}

.partner-tile {
    background: rgba(255, 255, 255, 0.02);
    /* Box shadow used as border for pixel-perfect alignment on all devices */
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    aspect-ratio: 1.5 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(15px, 2vw, 30px);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
}

.partner-tile img {
    max-width: 85%;
    max-height: 55%;
    object-fit: contain;
    /* Forces all logos to be uniform white */
    filter: brightness(0) invert(1);
    opacity: 0.4;
    transition: all 0.4s ease;
}

.partner-tile-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

/* MARQUEE GRID SYSTEM FOR > 6 LOGOS */
.partners-grid-marquee {
    width: 55%;
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 1.5vw, 20px);
}

.marquee-row-wrapper {
    width: 100%;
    overflow: hidden;
    position: relative;
    container-type: inline-size;
    mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
}

.marquee-track {
    display: flex;
    align-items: center;
    gap: clamp(10px, 1.5vw, 20px);
    width: max-content;
    will-change: transform;
}

.marquee-track-left {
    animation: partnerMarqueeLeft 30s linear infinite;
}

.marquee-track-right {
    animation: partnerMarqueeRight 30s linear infinite;
}

.marquee-track:hover {
    animation-play-state: paused;
}

.marquee-track .partner-tile {
    width: calc((100cqw - (2 * clamp(10px, 1.5vw, 20px))) / 3);
    flex: 0 0 calc((100cqw - (2 * clamp(10px, 1.5vw, 20px))) / 3);
    aspect-ratio: 1.5 / 1;
}

@keyframes partnerMarqueeLeft {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(-50% - (clamp(10px, 1.5vw, 20px) / 2))); }
}

@keyframes partnerMarqueeRight {
    0% { transform: translateX(calc(-50% - (clamp(10px, 1.5vw, 20px) / 2))); }
    100% { transform: translateX(0); }
}

/* --- HOVER EFFECTS --- */
@media (hover: hover) {
    .partner-tile:hover {
        background: rgba(165, 148, 253, 0.08);
        box-shadow: 0 0 0 1px rgba(165, 148, 253, 0.3), 0 20px 40px -10px rgba(0, 0, 0, 0.5);
        transform: translateY(-5px);
        z-index: 2;
    }

    .partner-tile:hover img {
        opacity: 1;
        transform: scale(1.05);
    }
}

/* ============================================================
    RESPONSIVE BREAKPOINTS
   ============================================================ */

/* Laptop / Small Desktop */
@media (max-width: 1100px) {
    .partners-wrapper {
        gap: 40px;
    }

    .partners-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tablet (Switch to Vertical) */
@media (max-width: 1024px) {
    .partners-wrapper {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .partners-content {
        width: 100%;
        position: static;
        /* Remove sticky on mobile */
        margin-bottom: 50px;
    }

    .partners-subtitle {
        margin: 0 auto;
    }

    .partners-grid,
    .partners-grid-marquee {
        width: 100%;
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Mobile Devices */
@media (max-width: 650px) {
    .partners-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .marquee-track .partner-tile {
        width: calc((100cqw - 12px) / 2);
        flex: 0 0 calc((100cqw - 12px) / 2);
    }

    .partner-tile {
        aspect-ratio: 1.4 / 1;
        padding: 20px;
    }
}

/* Ultra Small Devices (iPhone SE / Galaxy Fold) */
@media (max-width: 340px) {
    .partners-grid {
        grid-template-columns: 1fr;
        /* Single column for extreme narrowness */
    }

    .partners-title {
        font-size: 2rem;
    }
}

