@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #2c3e50;
    --secondary-color: #f8f8f8;
    --text-color: #2c3e50;
    --overlay-color: rgba(255, 255, 255, 0.9);
    --hover-color: rgba(44, 62, 80, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #ffffff;
    background-image: url('../assets/commercialhome.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text-color);
    overflow-x: hidden;
    width: 100vw;
    min-height: 100vh;
    position: relative;
    isolation: isolate;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.6);
    z-index: -1;
    pointer-events: none;
}

/* Slider Styles */
.slider {
    position: relative;
    min-height: 100vh;
    background-color: transparent;
    padding-top: 80px;
    width: 100%;
}

.featured-project {
    height: calc(85vh - 80px);
    min-height: 400px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 100vw;
    padding: 0 20px;
    box-sizing: border-box;
}

/* Featured Project List Styles */
.featured-project .list {
    position: relative;
    width: 100%;
    height: 100%;
}

.featured-project .list .item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2%;
    box-sizing: border-box;
}

.featured-project .list .item.active {
    opacity: 1;
}

.featured-project .content {
    position: relative;
    z-index: 2;
    width: 50%;
    max-width: 600px;
    padding: clamp(20px, 4vw, 50px);
    padding-top: clamp(42px, 6vh, 78px);
}

.featured-project .category {
    color: var(--primary-color);
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 2px;
    font-size: clamp(0.7em, 1.5vw, 0.9em);
    margin-bottom: 10px;
}

.featured-project h1 {
    font-size: clamp(2em, 6vw, 4em);
    margin: 20px 0;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.1;
}

.featured-project .description {
    font-size: clamp(0.9em, 2vw, 1.1em);
    line-height: 1.6;
    margin-bottom: 30px;
    opacity: 0.9;
}

.featured-project .featured-image {
    width: 45%;
    max-width: 500px;
    height: min(70vh, 600px);
    position: relative;
    border-radius: 25px;
    overflow: hidden;
    flex-shrink: 0;
}

.featured-project .featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 25px;
}

.cta-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.cta-button {
    padding: clamp(10px, 2vw, 12px) clamp(20px, 4vw, 25px);
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-size: clamp(0.9em, 2vw, 1.1em);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.cta-button.primary {
    background-color: var(--primary-color);
    color: white;
}

.cta-button.secondary {
    background-color: var(--hover-color);
    color: var(--primary-color);
}

.cta-button:hover {
    transform: scale(1.05);
}

/* Projects Row */
.projects-row {
    padding: clamp(15px, 3vw, 20px) clamp(20px, 4vw, 50px);
    position: relative;
    background: rgba(255, 255, 255, 0.85);
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
}

.projects-row h2 {
    font-size: clamp(1.2em, 3vw, 1.5em);
    margin-bottom: 20px;
    color: var(--primary-color);
    text-align: center;
}

.thumbnail-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 0 clamp(30px, 8vw, 60px);
    box-sizing: border-box;
}

.thumbnail {
    display: flex;
    gap: clamp(15px, 3vw, 20px);
    padding: 20px 0;
    cursor: grab;
    user-select: none;
    position: relative;
    transition: transform 0.3s ease;
    width: fit-content;
}

.thumbnail:active {
    cursor: grabbing;
}

.thumbnail::-webkit-scrollbar {
    display: none;
}

.thumbnail::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.thumbnail::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.thumbnail::-webkit-scrollbar-thumb:hover {
    background: #34495e;
}

.thumbnail .item {
    min-width: clamp(160px, 15vw, 220px);
    width: clamp(160px, 15vw, 220px);
    height: clamp(100px, 10vw, 140px);
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    flex-shrink: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    color: inherit;
    display: block;
}

.thumbnail .item:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

.thumbnail .item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.thumbnail .item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.thumbnail .item:hover img {
    transform: scale(1.05);
}

.thumbnail .item-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: clamp(10px, 2vw, 15px);
    background: linear-gradient(to top, rgba(255,255,255,0.98), rgba(255,255,255,0.8));
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.thumbnail .item h3 {
    margin: 0 0 5px 0;
    font-size: clamp(0.9em, 2vw, 1.1em);
    color: var(--primary-color);
    font-weight: 600;
}

.thumbnail .item .category {
    font-size: clamp(0.7em, 1.5vw, 0.85em);
    color: #666;
    font-weight: 400;
}

.thumbnail .item.active {
    border: 3px solid var(--primary-color);
    transform: translateY(-8px);
    box-shadow: 0 10px 30px rgba(44, 62, 80, 0.2);
}

.arrows {
    position: absolute;
    top: 50%;
    width: 100%;
    left: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 20;
    padding: 0 10px;
}

.arrows button {
    background-color: rgba(255, 255, 255, 0.95);
    border: none;
    color: var(--primary-color);
    width: clamp(35px, 6vw, 45px);
    height: clamp(35px, 6vw, 45px);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    font-size: clamp(14px, 3vw, 18px);
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    border: 2px solid rgba(44, 62, 80, 0.1);
}

.arrows button:hover {
    background-color: var(--primary-color);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(44, 62, 80, 0.4);
    border-color: var(--primary-color);
}

.arrows button:active {
    transform: scale(0.95);
}

/* Responsive Design Breakpoints */

/* Large Desktop (1440px+) */
@media screen and (min-width: 1440px) {
    .featured-project .content {
        width: 45%;
        padding: 60px;
    }
    
    .featured-project .featured-image {
        width: 45%;
        max-width: 600px;
        height: min(80vh, 700px);
        overflow: visible;
    }
    
    .featured-project .featured-image img {
        width: 100%;
        height: auto;
        max-height: 100%;
        object-fit: contain;
        object-position: center;
        border-radius: 20px;
    }
    
    .thumbnail .item {
        min-width: 320px;
        width: 320px;
        height: 200px;
    }
}

/* Desktop (1024px - 1439px) */
@media screen and (max-width: 1439px) and (min-width: 1024px) {
    .slider {
        padding-top: 75px;
    }
    
    .featured-project {
        height: calc(85vh - 75px);
    }
    
    .thumbnail-container {
        padding: 0 50px;
    }
}

/* Fix Image Cropping for Medium-Large Screens (1023px - 1200px) */
@media screen and (min-width: 1023px) and (max-width: 1200px) {
    .featured-project .featured-image {
        width: 45%;
        max-width: 500px;
        height: min(70vh, 600px);
        overflow: visible;
    }
    
    .featured-project .featured-image img {
        width: 100%;
        height: auto;
        max-height: 100%;
        object-fit: contain;
        object-position: center;
    }
}

/* Square Image for Medium Screens (900px - 1022px) */
@media screen and (min-width: 900px) and (max-width: 1022px) {
    .featured-project .list .item {
        justify-content: space-between;
        align-items: center;
        gap: 30px;
        padding: 0 3%;
    }
    
    .featured-project .content {
        width: 50%;
        max-width: 450px;
        padding: clamp(20px, 3vw, 30px);
    }
    
    .featured-project .featured-image {
        width: 450px;
        height: 450px;
        max-width: 450px;
        max-height: 450px;
        flex-shrink: 0;
        overflow: visible;
    }
    
    .featured-project .featured-image img {
        width: 100%;
        height: auto;
        max-height: 100%;
        object-fit: contain;
        object-position: center;
        border-radius: 15px;
    }
    
    .featured-project h1 {
        font-size: clamp(2.2em, 5vw, 2.8em);
    }
    
    .featured-project .description {
        font-size: clamp(0.9em, 2vw, 1em);
    }
}

/* Tablet Landscape (768px - 1023px) */
@media screen and (max-width: 1023px) and (min-width: 768px) {
    .slider {
        padding-top: 70px;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    .featured-project {
        height: 65vh;
        min-height: 400px;
        flex-direction: column;
        justify-content: center;
        gap: 20px;
        padding: 20px;
        flex-shrink: 0;
    }
    
    .featured-project .content,
    .featured-project .featured-image {
        width: 100%;
        max-width: 600px;
    }
    
    .featured-project .featured-image {
        height: 35vh;
        max-height: 280px;
    }
    
    .featured-project .content {
        text-align: center;
        padding: 20px;
    }
    
    .projects-row {
        flex-shrink: 0;
        height: 35vh;
        min-height: 250px;
        overflow: hidden;
    }
    
    .thumbnail-container {
        padding: 0 40px;
        height: 100%;
        display: flex;
        align-items: center;
    }
    
    .thumbnail {
        padding: 15px 0;
    }
    
    .thumbnail .item {
        min-width: 220px;
        width: 220px;
        height: 140px;
    }
}

/* Tablet Portrait & Large Mobile (900px and below) */
@media screen and (max-width: 900px) {
    .slider {
        padding-top: 60px;
    }
    
    .featured-project {
        height: auto;
        min-height: calc(80vh - 60px);
        flex-direction: column;
        justify-content: flex-start;
        gap: 20px;
        padding: 20px 15px;
    }
    
    .featured-project .list .item {
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        gap: 20px;
        padding: 0;
    }
    
    .featured-project .content {
        width: 100%;
        text-align: center;
        padding: 15px;
        order: 2;
        max-width: 100%;
    }
    
    .featured-project .featured-image {
        width: 100%;
        max-width: 400px;
        height: 35vh;
        max-height: 250px;
        margin: 0 auto;
        order: 1;
    }
    
    .cta-group {
        justify-content: center;
        gap: 10px;
    }
    
    .projects-row {
        padding: 15px 20px;
    }
    
    .thumbnail-container {
        padding: 0 30px;
    }
    
    .thumbnail {
        gap: 15px;
    }
    
    .thumbnail .item {
        min-width: 180px;
        width: 180px;
        height: 120px;
    }
    
    .arrows button {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
}

/* Mobile Vertical Layout (800px and below) */
@media screen and (max-width: 800px) {
    .thumbnail-container {
        padding: 0 20px !important;
        height: 60vh !important;
        max-height: 60vh !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        scroll-behavior: smooth !important;
    }
    
    .thumbnail {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
        padding: 20px 0 !important;
        width: 100% !important;
        height: auto !important;
        cursor: default !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        transform: none !important;
        transition: none !important;
    }
    
    .thumbnail .item {
        min-width: 60% !important;
        width: 60% !important;
        max-width: 300px !important;
        height: 150px !important;
        flex-shrink: 0 !important;
        border-radius: 15px !important;
        box-shadow: 0 6px 20px rgba(0,0,0,0.1) !important;
        margin: 0 !important;
        transform: none !important;
        transition: none !important;
    }
    
    .thumbnail .item-content {
        padding: 20px !important;
        background: linear-gradient(to top, rgba(255,255,255,0.98), rgba(255,255,255,0.9)) !important;
    }
    
    .thumbnail .item h3 {
        font-size: clamp(1.2em, 3.5vw, 1.5em) !important;
        margin-bottom: 10px !important;
        font-weight: 600 !important;
    }
    
    .thumbnail .item .category {
        font-size: clamp(0.9em, 2.5vw, 1em) !important;
        color: #666 !important;
    }
    
    /* Hide arrows on mobile since it's now vertical scroll */
    .arrows {
        display: none !important;
    }
    
    /* Override any grid layouts */
    .thumbnail {
        display: flex !important;
        grid-template-columns: none !important;
        grid-template-rows: none !important;
    }
    
    /* Override height-based media queries for width-based layout */
    .projects-row:not(.hidden) .thumbnail {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: none !important;
        grid-template-rows: none !important;
        gap: 20px !important;
        padding: 20px 0 !important;
        width: 100% !important;
        height: auto !important;
        align-items: center !important;
        transform: none !important;
        transition: none !important;
    }
    
    .projects-row:not(.hidden) .thumbnail .item {
        min-width: 60% !important;
        width: 60% !important;
        max-width: 300px !important;
        height: 150px !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
        transform: none !important;
        transition: none !important;
    }
    
    /* Force vertical scrolling and disable horizontal scrolling */
    .projects-row {
        overflow-x: hidden !important;
        overflow-y: auto !important;
        height: auto !important;
        min-height: 60vh !important;
    }
    
    .projects-row:not(.hidden) {
        overflow-x: hidden !important;
        overflow-y: auto !important;
        height: auto !important;
        min-height: 60vh !important;
    }
}

/* Show toggle button for 900px width and below */
@media screen and (max-width: 900px) {
    .thumbnail-toggle-container {
        display: block !important;
    }
    
    .close-projects-btn {
        display: block !important;
    }
    
    /* Hide projects row by default for 900px and below */
    .projects-row {
        height: 0 !important;
        min-height: 0 !important;
        flex-shrink: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        transition: all 0.5s ease !important;
        opacity: 0 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        z-index: 1002 !important;
        background: rgba(255, 255, 255, 1) !important;
    }
    
    .projects-row.hidden {
        height: 0 !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        opacity: 0 !important;
        display: none !important;
    }
    
    .projects-row:not(.hidden) {
        height: 100vh !important;
        min-height: 100vh !important;
        max-height: 100vh !important;
        opacity: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 60px 20px 20px 20px !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        overflow: hidden !important;
        background: rgba(255, 255, 255, 1) !important;
        z-index: 1002 !important;
    }
    
    .thumbnail-container {
        height: auto !important;
        width: 100% !important;
        max-width: 900px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        padding: 0 !important;
        overflow: hidden !important;
        z-index: 1004 !important;
        position: relative !important;
    }
    
    .thumbnail {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        grid-template-rows: repeat(2, 1fr) !important;
        gap: 25px !important;
        width: 100% !important;
        max-width: 900px !important;
        padding: 15px 0 !important;
        z-index: 1005 !important;
        position: relative !important;
    }
    
    .thumbnail .item {
        min-width: 250px !important;
        width: 100% !important;
        height: 220px !important;
        margin: 0 !important;
        z-index: 1006 !important;
        position: relative !important;
    }
}

/* Small Mobile (320px - 479px) */
@media screen and (max-width: 479px) {
    .slider {
        padding-top: 70px;
    }
    
    .featured-project {
        padding: 15px 10px;
        gap: 15px;
        flex-direction: column;
    }
    
    .featured-project .content {
        padding: 10px;
        order: 2;
        text-align: center;
    }
    
    .featured-project .featured-image {
        width: 100%;
        max-width: 100%;
        height: 40vh;
        max-height: 280px;
        margin: 0 auto;
        order: 1;
        border-radius: 15px;
    }
    
    .featured-project h1 {
        margin: 15px 0;
        font-size: clamp(1.8em, 5vw, 2.2em);
    }
    
    .featured-project .description {
        margin-bottom: 20px;
        font-size: clamp(0.85em, 2.5vw, 1em);
    }
    
    .cta-group {
        flex-direction: column;
        width: 100%;
    }
    
    .cta-button {
        width: 100%;
        justify-content: center;
    }
    
    .projects-row {
        padding: 20px 15px;
    }
    
    .projects-row h2 {
        font-size: clamp(1.3em, 4vw, 1.5em);
        margin-bottom: 25px;
    }
    
    .thumbnail-container {
        padding: 0 15px;
        max-height: 65vh;
        height: 60vh;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .thumbnail {
        gap: 15px;
        padding: 15px 0;
        align-items: center;
        display: flex;
        flex-direction: column;
    }
    
    .thumbnail .item {
        min-width: 60%;
        width: 60%;
        max-width: 300px;
        height: 150px;
        border-radius: 12px;
    }
    
    .thumbnail .item-content {
        padding: 15px;
    }
    
    .thumbnail .item h3 {
        font-size: clamp(1.1em, 3.5vw, 1.3em);
        margin-bottom: 8px;
    }
    
    .thumbnail .item .category {
        font-size: clamp(0.8em, 2.5vw, 0.9em);
    }
    
    .arrows button {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .arrows {
        padding: 0 5px;
    }
}

/* Very Small Mobile (max 319px) */
@media screen and (max-width: 319px) {
    .featured-project .content {
        padding: 8px;
    }
    
    .featured-project .featured-image {
        height: 35vh;
        max-height: 220px;
    }
    
    .thumbnail .item {
        min-width: 60%;
        width: 60%;
        max-width: 250px;
        height: 120px;
        border-radius: 10px;
    }
    
    .thumbnail-container {
        padding: 0 10px;
        max-height: 60vh;
        height: 55vh;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .thumbnail {
        gap: 12px;
        padding: 12px 0;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .thumbnail .item-content {
        padding: 12px;
    }
    
    .thumbnail .item h3 {
        font-size: clamp(1em, 3vw, 1.2em);
        margin-bottom: 6px;
    }
    
    .thumbnail .item .category {
        font-size: clamp(0.75em, 2.2vw, 0.85em);
    }
    
    .arrows button {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
}

/* Specific fix for 770px height screens */
@media screen and (min-height: 700px) and (max-height: 800px) and (min-width: 768px) {
    .slider {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    .featured-project {
        height: 60vh;
        min-height: 350px;
        flex-shrink: 0;
    }
    
    .featured-project .featured-image {
        height: 30vh;
        max-height: 250px;
    }
    
    .projects-row {
        height: 40vh;
        min-height: 200px;
        flex-shrink: 0;
        overflow: hidden;
    }
    
    .thumbnail-container {
        height: 100%;
        display: flex;
        align-items: center;
    }
}

/* Specific fix for 549px and below height screens */
@media screen and (max-height: 650px) {
    .slider {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        padding-top: 80px;
    }
    
    .featured-project {
        height: 100vh;
        min-height: 500px;
        flex-shrink: 0;
        margin-bottom: 0;
    }
    
    .featured-project .list .item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 20px;
        padding: 0 20px;
    }
    
    .featured-project .content {
        width: 55%;
        text-align: left;
        order: 1;
        padding: 20px;
    }
    
    .featured-project .featured-image {
        width: 40%;
        height: 60vh;
        max-height: 400px;
        order: 2;
    }
    
    .featured-project h1 {
        font-size: clamp(1.8em, 4vw, 2.5em);
        margin: 15px 0;
    }
    
    .featured-project .description {
        font-size: clamp(0.85em, 2vw, 1em);
        margin-bottom: 20px;
    }
    
    .projects-row {
        height: 0;
        min-height: 0;
        flex-shrink: 0;
        overflow: hidden;
        margin: 0;
        padding: 0;
        transition: all 0.5s ease;
        opacity: 0;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1002;
        background: rgba(255, 255, 255, 1);
        backdrop-filter: blur(10px);
    }
    
    .projects-row.hidden {
        height: 0 !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden;
        opacity: 0;
        display: none;
    }
    
    .projects-row:not(.hidden) {
        height: 100vh !important;
        min-height: 100vh !important;
        max-height: 100vh !important;
        opacity: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 60px 20px 20px 20px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        overflow: hidden;
        background: rgba(255, 255, 255, 1);
        z-index: 1002;
    }
    
    .close-projects-btn {
        position: absolute;
        top: 15px;
        right: 15px;
        background: none;
        border: none;
        font-size: 2.5em;
        color: #2c3e50;
        cursor: pointer;
        width: 50px;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: all 0.3s ease;
        z-index: 1003;
    }
    
    .close-projects-btn:hover {
        background-color: rgba(44, 62, 80, 0.1);
        transform: scale(1.1);
    }
    
    .close-projects-btn:active {
        transform: scale(0.95);
    }
    
    .thumbnail-container {
        height: auto;
        width: 100%;
        max-width: 900px;
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 0;
        overflow: hidden;
        z-index: 1004;
        position: relative;
    }
    
    .thumbnail {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(2, 1fr);
        gap: 25px;
        width: 100%;
        max-width: 900px;
        padding: 15px 0;
        z-index: 1005;
        position: relative;
    }
    
    .thumbnail .item {
        min-width: 250px;
        width: 100%;
        height: 220px;
        margin: 0;
        z-index: 1006;
        position: relative;
    }
    
    .thumbnail .item-content {
        padding: 15px;
    }
    
    .thumbnail .item h3 {
        font-size: clamp(1em, 2.5vw, 1.2em);
        margin-bottom: 8px;
    }
    
    .thumbnail .item .category {
        font-size: clamp(0.8em, 2vw, 0.9em);
    }
    
    /* Show toggle button for 549px and below height screens */
    .thumbnail-toggle-container {
        display: block;
    }
}

/* Specific fix for 650px-850px height screens - Vertical Layout */
@media screen and (min-height: 650px) and (max-height: 850px) {
    .slider {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        padding-top: 80px;
    }
    
    .featured-project {
        height: 100vh;
        min-height: 600px;
        flex-shrink: 0;
        margin-bottom: 0;
    }
    
    .featured-project .list .item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 20px;
        padding: 0 20px;
    }
    
    .featured-project .content {
        width: 55%;
        text-align: left;
        order: 1;
        padding: 20px;
    }
    
    .featured-project .featured-image {
        width: 40%;
        height: 60vh;
        max-height: 450px;
        order: 2;
    }
    
    .featured-project h1 {
        font-size: clamp(2em, 4vw, 3em);
        margin: 15px 0;
    }
    
    .featured-project .description {
        font-size: clamp(0.9em, 2vw, 1.1em);
        margin-bottom: 20px;
    }
    
    .projects-row {
        height: 0;
        min-height: 0;
        flex-shrink: 0;
        overflow: hidden;
        margin: 0;
        padding: 0;
        transition: all 0.5s ease;
        opacity: 0;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1002;
        background: rgba(255, 255, 255, 1);
    }
    
    .projects-row.hidden {
        height: 0 !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden;
        opacity: 0;
        display: none;
    }
    
    .projects-row:not(.hidden) {
        height: 100vh !important;
        min-height: 100vh !important;
        max-height: 100vh !important;
        opacity: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 60px 20px 20px 20px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        overflow: hidden;
        background: rgba(255, 255, 255, 1);
        z-index: 1002;
    }
    
    .close-projects-btn {
        position: absolute;
        top: 15px;
        right: 15px;
        background: none;
        border: none;
        font-size: 2.5em;
        color: #2c3e50;
        cursor: pointer;
        width: 50px;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: all 0.3s ease;
        z-index: 1003;
    }
    
    .close-projects-btn:hover {
        background-color: rgba(44, 62, 80, 0.1);
        transform: scale(1.1);
    }
    
    .close-projects-btn:active {
        transform: scale(0.95);
    }
    
    .thumbnail-container {
        height: calc(100vh - 80px);
        width: 100%;
        max-width: 1400px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 0;
        overflow: hidden;
        z-index: 1004;
        position: relative;
    }
    
    .thumbnail {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(2, 1fr);
        gap: 50px;
        width: 100%;
        max-width: 1300px;
        height: 100%;
        padding: 30px 0;
        z-index: 1005;
        position: relative;
        align-items: center;
    }
    
    .thumbnail .item {
        min-width: 350px;
        width: 100%;
        height: 100%;
        max-height: calc((100vh - 160px) / 2);
        margin: 0;
        z-index: 1006;
        position: relative;
        border-radius: 20px;
        overflow: hidden;
        box-shadow: 0 12px 35px rgba(0,0,0,0.15);
    }
    
    .thumbnail .item-content {
        padding: 15px;
    }
    
    .thumbnail .item h3 {
        font-size: clamp(1em, 2.5vw, 1.2em);
        margin-bottom: 8px;
    }
    
    .thumbnail .item .category {
        font-size: clamp(0.8em, 2vw, 0.9em);
    }
    
    /* Show toggle button for 650px-850px height screens */
    .thumbnail-toggle-container {
        display: block;
    }
    
    /* Enhanced thumbnail styling for 650px-850px height */
    .thumbnail .item img {
        width: 100%;
        height: 70%;
        object-fit: cover;
        border-radius: 15px 15px 0 0;
    }
    
    .thumbnail .item-content {
        padding: 25px;
        background: white;
        height: 30%;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .thumbnail .item h3 {
        font-size: clamp(1.4em, 3.5vw, 1.8em);
        margin-bottom: 10px;
        font-weight: 700;
        color: #2c3e50;
    }
    
    .thumbnail .item .category {
        font-size: clamp(1em, 2.5vw, 1.2em);
        color: #666;
        font-weight: 400;
    }
    
    /* Adjust projects row padding for better height fit */
    .projects-row:not(.hidden) {
        padding: 80px 20px 20px 20px;
    }
}

/* Specific fix for 667px height screens */
@media screen and (min-height: 600px) and (max-height: 700px) {
    .slider {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        padding-top: 80px;
    }
    
    .featured-project {
        height: 85vh;
        min-height: 500px;
        flex-shrink: 0;
        margin-bottom: 0;
    }
    
    .featured-project .featured-image {
        height: 45vh;
        max-height: 350px;
    }
    
    .projects-row {
        height: 15vh;
        min-height: 100px;
        flex-shrink: 0;
        overflow: hidden;
        margin-top: 0;
        transition: all 0.5s ease;
    }
    
    .projects-row.hidden {
        height: 0 !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden;
        opacity: 0;
    }
    
    .thumbnail-container {
        height: 100%;
        display: flex;
        align-items: center;
        padding: 0 30px;
    }
    
    .thumbnail {
        padding: 10px 0;
    }
    
    .thumbnail .item {
        min-width: 160px;
        width: 160px;
        height: 100px;
    }
    
    /* Show toggle button for 667px height screens */
    .thumbnail-toggle-container {
        display: block;
    }
}

/* Specific fix for 750px height screens */
@media screen and (min-height: 700px) and (max-height: 800px) {
    .slider {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        padding-top: 80px;
    }
    
    .featured-project {
        height: 100vh;
        min-height: 600px;
        flex-shrink: 0;
        margin-bottom: 0;
    }
    
    .featured-project .featured-image {
        height: 50vh;
        max-height: 400px;
    }
    
    .projects-row {
        height: 0;
        min-height: 0;
        flex-shrink: 0;
        overflow: hidden;
        margin: 0;
        padding: 0;
        transition: all 0.5s ease;
        opacity: 0;
    }
    
    .projects-row.hidden {
        height: 0 !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden;
        opacity: 0;
        display: none;
    }
    
    .projects-row:not(.hidden) {
        height: 20vh;
        min-height: 150px;
        opacity: 1;
        display: block;
    }
    
    .thumbnail-container {
        height: 100%;
        display: flex;
        align-items: center;
        padding: 0 40px;
    }
    
    .thumbnail {
        padding: 15px 0;
    }
    
    .thumbnail .item {
        min-width: 180px;
        width: 180px;
        height: 110px;
    }
    
    /* Show toggle button for 750px height screens */
    .thumbnail-toggle-container {
        display: block;
    }
}

/* Specific fix for 800px height screens */
@media screen and (min-height: 800px) and (max-height: 900px) {
    .slider {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        padding-top: 80px;
    }
    
    .featured-project {
        height: 85vh;
        min-height: 600px;
        flex-shrink: 0;
        margin-bottom: 0;
    }
    
    .featured-project .featured-image {
        height: 45vh;
        max-height: 400px;
    }
    
    .projects-row {
        height: 15vh;
        min-height: 150px;
        flex-shrink: 0;
        overflow: hidden;
        margin-top: 0;
        transition: all 0.5s ease;
    }
    
    .projects-row.hidden {
        height: 0 !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden;
        opacity: 0;
    }
    
    .thumbnail-container {
        height: 100%;
        display: flex;
        align-items: center;
        padding: 0 40px;
    }
    
    .thumbnail {
        padding: 15px 0;
    }
    
    .thumbnail .item {
        min-width: 200px;
        width: 200px;
        height: 120px;
    }
    
    /* Show toggle button for 800px height screens */
    .thumbnail-toggle-container {
        display: block;
    }
}

/* Landscape Orientation for Mobile */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .slider {
        padding-top: 60px;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    .featured-project {
        height: 60vh;
        min-height: 300px;
        flex-direction: row;
        align-items: center;
        gap: 15px;
        flex-shrink: 0;
    }
    
    .featured-project .content {
        width: 55%;
        text-align: left;
        order: 1;
        padding: 15px;
    }
    
    .featured-project .featured-image {
        width: 40%;
        height: 50vh;
        order: 2;
        max-height: 300px;
    }
    
    .projects-row {
        padding: 10px 20px;
        flex-shrink: 0;
        height: 40vh;
        min-height: 200px;
        overflow: hidden;
    }
    
    .thumbnail .item {
        height: 80px;
        min-width: 140px;
        width: 140px;
    }
    
    .thumbnail-container {
        padding: 0 25px;
        height: 100%;
        display: flex;
        align-items: center;
    }
    
    .thumbnail {
        padding: 10px 0;
    }
}

/* Very Small Screens */
@media screen and (max-width: 320px) {
    .featured-project .content {
        padding: 5px;
    }
    
    .thumbnail .item {
        min-width: 140px;
        width: 140px;
        height: 90px;
    }
    
    .thumbnail-container {
        padding: 0 20px;
    }
}

/* Thumbnail Toggle Button Styles */
.thumbnail-toggle-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1001;
    display: none;
}

.thumbnail-toggle-btn {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 20px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(44, 62, 80, 0.3);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.thumbnail-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 62, 80, 0.4);
}

.thumbnail-toggle-btn:active {
    transform: translateY(0);
}

.toggle-icon {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.thumbnail-toggle-btn.active .toggle-icon {
    transform: rotate(180deg);
}

.mobile-inline-toggle-btn {
    display: none;
}

/* Projects Row Hide/Show Animation */
.projects-row {
    transition: all 0.5s ease;
}

.projects-row.hidden {
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    opacity: 0;
}

/* Ensure thumbnails are never covered in responsive designs */
.projects-row:not(.hidden) .thumbnail-container,
.projects-row:not(.hidden) .thumbnail,
.projects-row:not(.hidden) .thumbnail .item {
    z-index: 1004 !important;
    position: relative !important;
}

/* Force larger sizes for under 650px height range */
@media screen and (max-height: 649px) {
    .projects-row:not(.hidden) .thumbnail-container {
        height: calc(100vh - 60px) !important;
        max-width: 1200px !important;
        overflow: visible !important;
    }
    
    .projects-row:not(.hidden) .thumbnail {
        max-width: 1100px !important;
        gap: clamp(20px, 3vh, 40px) !important;
        padding: clamp(10px, 1.5vh, 20px) 0 !important;
        height: auto !important;
        min-height: calc(100vh - 100px) !important;
    }
    
    .projects-row:not(.hidden) .thumbnail .item {
        min-width: 300px !important;
        height: clamp(200px, calc((100vh - 150px) / 2), 350px) !important;
        min-height: 200px !important;
        max-height: 350px !important;
        border-radius: 15px !important;
        box-shadow: 0 8px 25px rgba(0,0,0,0.1) !important;
    }
    
    .projects-row:not(.hidden) .thumbnail .item img {
        height: 70% !important;
        object-fit: cover !important;
    }
    
    .projects-row:not(.hidden) .thumbnail .item-content {
        padding: clamp(10px, 1.5vh, 20px) !important;
        height: 30% !important;
        min-height: 60px !important;
    }
    
    .projects-row:not(.hidden) .thumbnail .item h3 {
        font-size: clamp(1em, 2.2vw, 1.4em) !important;
        margin-bottom: clamp(3px, 0.8vh, 8px) !important;
    }
    
    .projects-row:not(.hidden) .thumbnail .item .category {
        font-size: clamp(0.8em, 1.8vw, 1em) !important;
    }
}

/* Optimized layout for 550px and below height */
@media screen and (max-height: 550px) {
    .projects-row:not(.hidden) {
        padding: 10px 20px !important;
        height: 100vh !important;
        overflow: hidden !important;
    }
    
    .projects-row:not(.hidden) .thumbnail-container {
        height: calc(100vh - 40px) !important;
        max-width: 1000px !important;
        overflow: visible !important;
        padding: 0 !important;
    }
    
    .projects-row:not(.hidden) .thumbnail {
        max-width: 900px !important;
        gap: clamp(15px, 2.5vh, 30px) !important;
        padding: clamp(8px, 1vh, 15px) 0 !important;
        height: auto !important;
        min-height: calc(100vh - 80px) !important;
        grid-template-columns: repeat(3, 1fr) !important;
        grid-template-rows: repeat(2, 1fr) !important;
    }
    
    .projects-row:not(.hidden) .thumbnail .item {
        min-width: 250px !important;
        height: clamp(160px, calc((100vh - 120px) / 2), 280px) !important;
        min-height: 160px !important;
        max-height: 280px !important;
        border-radius: 12px !important;
        box-shadow: 0 6px 20px rgba(0,0,0,0.08) !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    .projects-row:not(.hidden) .thumbnail .item img {
        height: 65% !important;
        object-fit: cover !important;
        border-radius: 12px 12px 0 0 !important;
    }
    
    .projects-row:not(.hidden) .thumbnail .item-content {
        padding: clamp(8px, 1vh, 15px) !important;
        height: 35% !important;
        min-height: 50px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
    }
    
    .projects-row:not(.hidden) .thumbnail .item h3 {
        font-size: clamp(0.9em, 2vw, 1.2em) !important;
        margin-bottom: clamp(2px, 0.5vh, 6px) !important;
        line-height: 1.2 !important;
    }
    
    .projects-row:not(.hidden) .thumbnail .item .category {
        font-size: clamp(0.75em, 1.6vw, 0.9em) !important;
        line-height: 1.1 !important;
    }
    
    /* Ensure close button is visible and accessible */
    .projects-row:not(.hidden) .close-projects-btn {
        top: 15px !important;
        right: 25px !important;
        width: 35px !important;
        height: 35px !important;
        font-size: 20px !important;
        z-index: 1003 !important;
    }
}

/* Force larger sizes for 650-850px height range */
@media screen and (min-height: 650px) and (max-height: 850px) {
    .projects-row:not(.hidden) .thumbnail-container {
        height: calc(100vh - 80px) !important;
        max-width: 1400px !important;
        overflow: visible !important;
    }
    
    .projects-row:not(.hidden) .thumbnail {
        max-width: 1300px !important;
        gap: clamp(30px, 4vh, 50px) !important;
        padding: clamp(15px, 2vh, 30px) 0 !important;
        height: auto !important;
        min-height: calc(100vh - 120px) !important;
    }
    
    .projects-row:not(.hidden) .thumbnail .item {
        min-width: 350px !important;
        height: clamp(280px, calc((100vh - 200px) / 2), 400px) !important;
        min-height: 280px !important;
        max-height: 400px !important;
        border-radius: 20px !important;
        box-shadow: 0 12px 35px rgba(0,0,0,0.15) !important;
    }
    
    .projects-row:not(.hidden) .thumbnail .item img {
        height: 70% !important;
        object-fit: cover !important;
    }
    
    .projects-row:not(.hidden) .thumbnail .item-content {
        padding: clamp(15px, 2vh, 25px) !important;
        height: 30% !important;
        min-height: 80px !important;
    }
    
    .projects-row:not(.hidden) .thumbnail .item h3 {
        font-size: clamp(1.2em, 2.5vw, 1.6em) !important;
        margin-bottom: clamp(5px, 1vh, 10px) !important;
    }
    
    .projects-row:not(.hidden) .thumbnail .item .category {
        font-size: clamp(0.9em, 2vw, 1.1em) !important;
    }
}

/* High DPI Screens */
@media screen and (-webkit-min-device-pixel-ratio: 2) {
    .featured-project .featured-image,
    .thumbnail .item {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Hide close button when projects row is hidden */
.projects-row.hidden .close-projects-btn {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Specific fix for 851px-900px height range to ensure projects-row visibility */
@media screen and (min-height: 851px) and (max-height: 900px) {
    .thumbnail-toggle-container {
        display: none !important;
    }
    
    .close-projects-btn {
        display: none !important;
    }
    
    /* Override conflicting styles from 800px-900px media query */
    .slider {
        min-height: auto !important;
        height: auto !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
        padding-top: 0 !important;
    }
    
    .featured-project {
        height: auto !important;
        min-height: 60vh !important;
        max-height: 70vh !important;
        flex-shrink: 0 !important;
        margin-bottom: 0 !important;
    }
    
    .featured-project .featured-image {
        height: auto !important;
        max-height: none !important;
    }
    
    /* Force projects row to be visible and properly sized */
    .projects-row {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
        position: relative !important;
        height: auto !important;
        min-height: 200px !important;
        max-height: none !important;
        overflow: visible !important;
        background: transparent !important;
        z-index: auto !important;
        margin-top: 20px !important;
        padding: 20px 0 !important;
        flex-shrink: 0 !important;
        transition: none !important;
    }
    
    .projects-row.hidden {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
        height: auto !important;
        min-height: 200px !important;
        margin: 20px 0 0 0 !important;
        padding: 20px 0 !important;
        overflow: visible !important;
    }
    
    .thumbnail-container {
        height: auto !important;
        display: flex !important;
        align-items: center !important;
        padding: 0 40px !important;
        max-width: 1200px !important;
    }
    
    .thumbnail {
        padding: 15px 0 !important;
        display: flex !important;
        flex-direction: row !important;
        gap: 20px !important;
        width: 100% !important;
        max-width: 900px !important;
        margin: 0 auto !important;
        justify-content: center !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
    }
    
    .thumbnail .item {
        min-width: 200px !important;
        width: 200px !important;
        height: 150px !important;
        border-radius: 15px !important;
        overflow: hidden !important;
        box-shadow: 0 8px 25px rgba(0,0,0,0.1) !important;
        flex-shrink: 0 !important;
    }
}

/* Hide toggle button and close button for 901px and above height */
@media screen and (min-height: 901px) {
    .thumbnail-toggle-container {
        display: none !important;
    }
    
    .close-projects-btn {
        display: none !important;
    }
    
    /* Ensure projects row is always visible */
    .projects-row {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
        position: relative !important;
        height: auto !important;
        overflow: visible !important;
        background: transparent !important;
        z-index: auto !important;
    }
    
    .projects-row.hidden {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
}

/* Unified full-window thumbnail overlay for all responsive devices */
body.projects-overlay-open {
    overflow: hidden;
}

.thumbnail-toggle-container {
    display: block !important;
    z-index: 1200 !important;
}

.projects-row {
    position: fixed !important;
    inset: 0 !important;
    z-index: 1100 !important;
    background: rgba(255, 255, 255, 0.98) !important;
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    margin: 0 !important;
    padding: 76px 20px 20px !important;
    overflow: hidden !important;
}

.projects-row:not(.hidden) {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    align-items: center !important;
    justify-content: center !important;
}

.projects-row.hidden {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    height: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
}

.projects-row .close-projects-btn {
    display: flex !important;
    position: absolute !important;
    top: 14px !important;
    right: 18px !important;
    z-index: 1201 !important;
}

.projects-row .thumbnail-container {
    width: 100% !important;
    max-width: 1200px !important;
    height: 100% !important;
    padding: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

.projects-row .thumbnail {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)) !important;
    gap: 16px !important;
    width: 100% !important;
    max-width: 1200px !important;
    padding: 8px 0 18px !important;
    transform: none !important;
}

.projects-row .thumbnail .item {
    min-width: 0 !important;
    width: 100% !important;
    height: clamp(140px, 22vw, 210px) !important;
    max-width: none !important;
}

.projects-row .arrows {
    display: none !important;
}

@media screen and (max-width: 700px) {
    .projects-row {
        padding: 66px 14px 14px !important;
    }

    .projects-row .thumbnail-container {
        max-width: 100% !important;
        padding: 0 !important;
    }

    .projects-row .thumbnail {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
        max-width: 100% !important;
    }

    .projects-row .thumbnail .item {
        width: 100% !important;
        height: min(48vh, 340px) !important;
        max-width: none !important;
    }

    .projects-row .thumbnail .item img {
        height: 72% !important;
        object-fit: cover !important;
    }

    .projects-row .thumbnail .item-content {
        min-height: 28% !important;
        padding: 14px !important;
    }
}

/* Use two-row multi-column showcase when height allows */
@media screen and (min-height: 546px) {
    .projects-row .thumbnail {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important;
        grid-template-rows: repeat(2, minmax(150px, 1fr)) !important;
        grid-auto-flow: column !important;
        gap: 16px !important;
        max-width: 1200px !important;
    }

    .projects-row .thumbnail .item {
        width: 100% !important;
        min-width: 0 !important;
        height: clamp(150px, 22vh, 230px) !important;
        max-width: none !important;
    }
}

/* Larger showcase cards for very large square/tall viewports */
@media screen and (min-width: 1100px) and (min-height: 1100px) {
    .projects-row {
        padding: 88px 34px 34px !important;
    }

    .projects-row .thumbnail-container {
        max-width: 1480px !important;
    }

    .projects-row .thumbnail {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
        grid-template-rows: repeat(2, minmax(210px, 1fr)) !important;
        gap: 24px !important;
        max-width: 1480px !important;
        padding: 16px 0 28px !important;
    }

    .projects-row .thumbnail .item {
        height: clamp(220px, 24vh, 320px) !important;
        border-radius: 16px !important;
    }

    .projects-row .thumbnail .item-content {
        padding: 18px !important;
    }

    .projects-row .thumbnail .item h3 {
        font-size: clamp(1.05rem, 1.1vw, 1.28rem) !important;
    }

    .projects-row .thumbnail .item .category {
        font-size: clamp(0.8rem, 0.85vw, 0.98rem) !important;
    }
}

/* Larger showcase images for wide + tall viewports */
@media screen and (min-width: 900px) and (min-height: 700px) {
    .projects-row .thumbnail {
        grid-template-columns: repeat(auto-fit, minmax(252px, 1fr)) !important;
        grid-template-rows: repeat(2, minmax(189px, 1fr)) !important;
        gap: 18px !important;
        max-width: 1320px !important;
    }

    .projects-row .thumbnail .item {
        height: clamp(210px, 27.3vh, 305px) !important;
        border-radius: 14px !important;
    }

    .projects-row .thumbnail .item img {
        height: 74% !important;
        object-fit: cover !important;
    }

    .projects-row .thumbnail .item-content {
        min-height: 26% !important;
        padding: 16px !important;
    }
}

/* Final close button design override for overlay UI */
.projects-row .close-projects-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: absolute !important;
    top: 14px !important;
    right: 16px !important;
    width: 42px !important;
    height: 42px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    background: rgba(44, 62, 80, 0.9) !important;
    color: #ffffff !important;
    font-size: 1.5rem !important;
    line-height: 1 !important;
    font-weight: 600 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22) !important;
    cursor: pointer !important;
    z-index: 1202 !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease !important;
}

.projects-row .close-projects-btn:hover {
    background: rgba(28, 42, 56, 0.95) !important;
    transform: translateY(-1px) scale(1.04) !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28) !important;
}

.projects-row .close-projects-btn:active {
    transform: scale(0.96) !important;
}

@media screen and (max-width: 480px) {
    .projects-row .close-projects-btn {
        width: 38px !important;
        height: 38px !important;
        font-size: 1.35rem !important;
        top: 12px !important;
        right: 12px !important;
    }
}

/* Keep featured image corners consistent across all breakpoints */
.featured-project .featured-image,
.featured-project .featured-image img {
    border-radius: 25px !important;
}

/* Medium-sized featured project scaling for large resolutions */
@media screen and (min-width: 1400px) and (min-height: 760px) {
    .featured-project {
        height: calc(88vh - 80px) !important;
        min-height: 520px !important;
        max-width: 1680px;
        margin: 0 auto;
    }

    .featured-project .list .item {
        padding: 0 3.5% !important;
        align-items: center !important;
    }

    .featured-project .content {
        width: 54% !important;
        max-width: 760px !important;
        max-height: min(78vh, 760px);
        padding: clamp(34px, 3.2vw, 56px) !important;
    }

    .featured-project .category {
        font-size: clamp(0.85rem, 0.9vw, 1rem) !important;
        letter-spacing: 2.4px !important;
    }

    .featured-project h1 {
        font-size: clamp(2.6rem, 3.8vw, 4.1rem) !important;
        margin: 16px 0 18px !important;
        line-height: 1.08 !important;
    }

    .featured-project .description {
        font-size: clamp(1rem, 1.18vw, 1.2rem) !important;
        line-height: 1.62 !important;
        max-width: 60ch;
        margin-bottom: 28px !important;
    }

    .featured-project .featured-image {
        width: 46% !important;
        max-width: 700px !important;
        max-height: min(80vh, 760px) !important;
        height: min(74vh, 720px) !important;
        overflow: hidden !important;
    }

    .featured-project .featured-image img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }
}

/* Ultra-large viewports (around 2000x2000 and above) */
@media screen and (min-width: 2000px) and (min-height: 2000px) {
    .featured-project {
        max-width: 2200px !important;
        min-height: 980px !important;
    }

    .featured-project .content {
        width: 56% !important;
        max-width: 1080px !important;
        max-height: 1200px !important;
        padding: clamp(52px, 3.2vw, 82px) !important;
        padding-top: clamp(70px, 7.2vh, 120px) !important;
    }

    .featured-project h1 {
        font-size: clamp(3.4rem, 3.8vw, 5.2rem) !important;
    }

    .featured-project .description {
        font-size: clamp(1.22rem, 1.35vw, 1.52rem) !important;
        max-width: 66ch !important;
    }

    .featured-project .featured-image {
        width: 44% !important;
        max-width: 980px !important;
        max-height: 1200px !important;
        height: min(72vh, 1120px) !important;
    }
}

/* Massive displays (around 3000x3000 and above) */
@media screen and (min-width: 3000px) and (min-height: 3000px) {
    .featured-project {
        max-width: 3200px !important;
        min-height: 1380px !important;
    }

    .featured-project .content {
        max-width: 1500px !important;
        max-height: 1700px !important;
        padding: clamp(72px, 3.6vw, 130px) !important;
        padding-top: clamp(95px, 8vh, 165px) !important;
    }

    .featured-project h1 {
        font-size: clamp(4.3rem, 4.1vw, 6.6rem) !important;
    }

    .featured-project .description {
        font-size: clamp(1.5rem, 1.5vw, 1.9rem) !important;
        max-width: 70ch !important;
    }

    .featured-project .featured-image {
        max-width: 1380px !important;
        max-height: 1700px !important;
        height: min(74vh, 1600px) !important;
    }
}

/* Final mobile stack override for most iPhone/Samsung devices */
@media screen and (max-width: 1024px) {
    .featured-project .list .item {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 14px !important;
        padding: 0 12px !important;
    }

    .featured-project .featured-image {
        order: 1 !important;
        width: 100% !important;
        max-width: 460px !important;
        height: min(42vh, 320px) !important;
        margin: 0 auto !important;
    }

    .featured-project .content {
        order: 2 !important;
        width: 100% !important;
        max-width: 540px !important;
        margin: 0 auto !important;
        text-align: center !important;
        padding: 10px 8px !important;
    }

    .featured-project .content .cta-group {
        order: 3 !important;
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        margin-top: 10px !important;
    }
}

/* iPhone-sized devices: move Show Projects button downward */
@media screen and (max-width: 480px) {
    .thumbnail-toggle-container {
        bottom: 0 !important;
    }
}

/* Global toggle behavior across all responsive devices */
.thumbnail-toggle-container {
    display: block !important;
}

.close-projects-btn {
    display: block !important;
}

.projects-row.hidden {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    overflow: hidden !important;
}

/* Keep thumbnail slider as overlay for desktop widths too */
@media screen and (min-width: 1002px) {
    .projects-row {
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        z-index: 1002 !important;
        background: rgba(255, 255, 255, 1) !important;
        display: none !important;
        opacity: 0 !important;
        overflow: hidden !important;
        padding: 70px 24px 24px !important;
        margin: 0 !important;
    }

    .projects-row:not(.hidden) {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        opacity: 1 !important;
    }

    .projects-row .thumbnail-container {
        width: 100% !important;
        max-width: 1200px !important;
        height: auto !important;
        padding: 0 40px !important;
        overflow: hidden !important;
    }
}

/* Keep Show Projects below View Project on mobile devices */
@media screen and (max-width: 1024px) {
    .thumbnail-toggle-container {
        position: static !important;
        inset: auto !important;
        bottom: auto !important;
        right: auto !important;
        left: auto !important;
        transform: none !important;
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        padding: 8px 12px 16px !important;
        margin-top: 8px !important;
        z-index: auto !important;
    }
}

@media screen and (max-width: 480px) {
    .thumbnail-toggle-container .thumbnail-toggle-btn {
        width: min(100%, 260px) !important;
        justify-content: center !important;
    }
}

/* Final layout stabilization overrides (desktop only) */
@media screen and (min-width: 1025px) {
    .slider {
        padding-bottom: 24px !important;
    }

    .featured-project {
        height: calc(100vh - 150px) !important;
        min-height: 520px !important;
        padding: 20px 28px 36px !important;
        overflow: visible !important;
    }

    .featured-project .list .item {
        align-items: flex-start !important;
        justify-content: space-between !important;
        gap: 28px !important;
        padding: 10px 2% 0 !important;
    }

    .featured-project .content {
        width: 52% !important;
        max-width: 700px !important;
        padding: 18px 10px 18px 0 !important;
    }

    .featured-project .description {
        display: block !important;
        max-width: 58ch !important;
        margin-bottom: 22px !important;
    }

    .featured-project .featured-image {
        width: 46% !important;
        max-width: 680px !important;
        height: min(64vh, 560px) !important;
    }

    .cta-group {
        margin-top: 6px !important;
    }
}

@media screen and (max-width: 767px) {
    .slider {
        padding-bottom: 22px !important;
    }

    .featured-project {
        min-height: calc(100vh - 170px) !important;
        padding: 16px 12px 30px !important;
        gap: 16px !important;
    }

    .featured-project .featured-image {
        height: min(30vh, 220px) !important;
        max-height: 220px !important;
    }

    .featured-project .content {
        padding: 8px 6px 14px !important;
    }

    .featured-project .description {
        margin-bottom: 16px !important;
    }

    .cta-group {
        margin-bottom: 8px !important;
    }

    .thumbnail-toggle-container {
        position: static !important;
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        padding: 10px 12px 24px !important;
        margin-top: 6px !important;
    }
}

/* Landscape centering fix for iPad and mobile devices */
@media screen and (max-width: 1366px) and (orientation: landscape) {
    .featured-project .list .item {
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 14px !important;
        padding: 0 12px 8px !important;
    }

    .featured-project .featured-image {
        width: 100% !important;
        max-width: 520px !important;
        margin: 0 auto !important;
    }

    .featured-project .content {
        width: 100% !important;
        max-width: 620px !important;
        margin: 0 auto !important;
        padding: 8px 10px 14px !important;
        text-align: center !important;
    }

    .featured-project .description {
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .featured-project .cta-group {
        justify-content: center !important;
    }
}

/* iPad landscape: keep Show Projects from covering CTA (e.g. 1024x768) */
@media screen and (max-width: 1366px) and (orientation: landscape) and (min-height: 600px) {
    .thumbnail-toggle-container {
        position: static !important;
        inset: auto !important;
        bottom: auto !important;
        right: auto !important;
        left: auto !important;
        transform: none !important;
        margin-top: 18px !important;
        padding: 12px 12px 26px !important;
        z-index: 1 !important;
    }
}

/* (No short-landscape text hiding) */

/* 812x375 landscape: prevent max-height 650px rules from forcing min-height/scroll */
@media screen and (max-width: 900px) and (orientation: landscape) and (max-height: 450px) {
    .slider {
        padding-top: 56px !important;
        min-height: 100vh !important;
    }

    .featured-project {
        height: calc(100vh - 120px) !important;
        max-height: calc(100vh - 120px) !important;
        min-height: 0 !important;
        overflow: hidden !important;
        flex-direction: row !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 14px !important;
        padding: 8px 12px 6px 12px !important;
    }

    .featured-project .list .item {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 12px !important;
        padding: 0 1.5% !important;
    }

    .featured-project .featured-image {
        order: 2 !important;
        width: 44% !important;
        max-width: 360px !important;
        height: min(56vh, 220px) !important;
        margin: 0 !important;
    }

    .featured-project .content {
        order: 1 !important;
        width: 56% !important;
        max-width: 520px !important;
        margin: 0 !important;
        text-align: left !important;
        padding: 2px 6px 0 0 !important;
    }

    .featured-project .category {
        margin-bottom: 2px !important;
        font-size: clamp(0.65rem, 1.5vw, 0.75rem) !important;
    }

    .featured-project h1 {
        margin: 6px 0 !important;
        font-size: clamp(1.4rem, 4vw, 2rem) !important;
        line-height: 1.1 !important;
    }

    .featured-project .description {
        margin-bottom: 8px !important;
        font-size: clamp(0.74rem, 1.7vw, 0.85rem) !important;
        line-height: 1.3 !important;
        display: -webkit-box !important;
        -webkit-box-orient: vertical !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
        overflow: hidden !important;
    }

    .cta-group {
        justify-content: flex-start !important;
        margin-top: 0 !important;
        margin-bottom: 2px !important;
    }

    .cta-button {
        padding: 8px 16px !important;
        font-size: 0.9rem !important;
    }

    .thumbnail-toggle-container {
        position: static !important;
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        padding: 4px 12px 8px 12px !important;
        margin-top: 4px !important;
        z-index: 0 !important;
    }
}

/* Final overlay fixes for tablets and phones */
@media screen and (max-width: 1024px) {
    .projects-row:not(.hidden) {
        display: block !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 64px 14px 16px !important;
    }

    .projects-row .thumbnail-container {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: calc(100vh - 90px) !important;
        overflow-y: visible !important;
        overflow-x: hidden !important;
        display: block !important;
        padding: 0 !important;
    }

    .projects-row .thumbnail {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-template-rows: none !important;
        grid-auto-flow: row !important;
        gap: 14px !important;
        width: 100% !important;
        max-width: 980px !important;
        padding: 0 0 20px !important;
        margin: 0 auto !important;
    }

    .projects-row .thumbnail .item {
        min-width: 0 !important;
        width: 100% !important;
        max-width: none !important;
        height: clamp(240px, 38vh, 360px) !important;
        margin: 0 !important;
    }

    .projects-row .thumbnail .item img {
        width: 100% !important;
        height: 80% !important;
        object-fit: cover !important;
    }

    .projects-row .thumbnail .item-content {
        min-height: 20% !important;
        padding: 10px 12px !important;
    }

    .projects-row .thumbnail .item h3 {
        font-size: 1rem !important;
        margin: 0 0 4px 0 !important;
    }

    .projects-row .thumbnail .item .category {
        font-size: 0.82rem !important;
    }
}

@media screen and (max-width: 700px) {
    .projects-row:not(.hidden) {
        padding: 62px 12px 14px !important;
    }

    .projects-row .thumbnail {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        max-width: 100% !important;
    }

    .projects-row .thumbnail .item {
        height: min(58vh, 420px) !important;
    }
}

/* Very narrow devices (e.g. 280x653) */
@media screen and (max-width: 320px) {
    .projects-row:not(.hidden) {
        padding: 58px 8px 10px !important;
    }

    .projects-row .thumbnail {
        gap: 10px !important;
        padding-bottom: 12px !important;
    }

    .projects-row .thumbnail .item {
        height: min(44vh, 250px) !important;
        border-radius: 10px !important;
    }

    .projects-row .thumbnail .item img {
        height: 78% !important;
    }

    .projects-row .thumbnail .item-content {
        padding: 8px 9px !important;
    }

    .projects-row .thumbnail .item h3 {
        font-size: 0.9rem !important;
    }

    .projects-row .thumbnail .item .category {
        font-size: 0.74rem !important;
    }
}

/* Phone-sized devices: match iPhone 5/SE thumbnail style */
@media screen and (min-width: 321px) and (max-width: 920px) {
    .projects-row:not(.hidden) {
        padding: 58px 10px 12px !important;
    }

    .projects-row .thumbnail {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
        max-width: 100% !important;
        padding-bottom: 14px !important;
    }

    .projects-row .thumbnail .item {
        height: min(46vh, 260px) !important;
        border-radius: 10px !important;
    }

    .projects-row .thumbnail .item img {
        height: 78% !important;
        object-fit: cover !important;
    }

    .projects-row .thumbnail .item-content {
        min-height: 22% !important;
        padding: 8px 10px !important;
    }

    .projects-row .thumbnail .item h3 {
        font-size: 0.95rem !important;
        margin: 0 0 4px 0 !important;
    }

    .projects-row .thumbnail .item .category {
        font-size: 0.76rem !important;
    }
}

/* Reduce gap between View Project and Show Projects on phones */
@media screen and (min-width: 321px) and (max-width: 920px) and (min-height: 600px) {
    .featured-project .content {
        padding-bottom: 4px !important;
    }

    .featured-project .description {
        margin-bottom: 10px !important;
    }

    .cta-group {
        margin-bottom: 0 !important;
    }

    .thumbnail-toggle-container {
        margin-top: 0 !important;
        padding: 2px 12px 10px !important;
    }
}

/* Ensure Show Projects button is visible on 812x375 landscape */
@media screen and (max-width: 900px) and (orientation: landscape) and (max-height: 450px) {
    .slider {
        padding-bottom: 52px !important;
    }

    .featured-project .content .cta-group {
        justify-content: flex-start !important;
    }

    .featured-project .content .mobile-inline-toggle-btn {
        align-self: flex-start !important;
    }

    .thumbnail-toggle-container {
        position: fixed !important;
        left: 50% !important;
        bottom: 8px !important;
        transform: translateX(-50%) !important;
        width: auto !important;
        margin-top: 0 !important;
        padding: 0 !important;
        z-index: 1201 !important;
    }

    .thumbnail-toggle-container .thumbnail-toggle-btn {
        padding: 8px 14px !important;
        font-size: 13px !important;
    }
}

/* Tighten spacing between View Project and Show Projects */
@media screen and (max-width: 1024px) {
    .featured-project .description {
        margin-bottom: 18px !important;
    }

    .featured-project .content .cta-group {
        margin-top: 6px !important;
        margin-bottom: 0 !important;
    }

    .thumbnail-toggle-container {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    .mobile-inline-toggle-btn {
        display: inline-flex !important;
        margin-top: 20px !important;
    }

    #thumbnail-toggle.thumbnail-toggle-container {
        display: none !important;
    }
}

/* Desktop widescreen balance (1920x1080, 2560x1440, 3440x1440) */
@media screen and (min-width: 1920px) and (max-height: 1600px) {
    .slider {
        padding-top: 72px !important;
    }

    .featured-project {
        height: calc(84vh - 72px) !important;
        min-height: 500px !important;
        max-width: 1680px !important;
        margin: 0 auto !important;
        padding: 12px 22px 18px !important;
    }

    .featured-project .list .item {
        gap: 20px !important;
        padding: 0 1.5% !important;
        align-items: center !important;
    }

    .featured-project .content {
        width: 50% !important;
        max-width: 720px !important;
        padding: 14px 6px 10px 0 !important;
    }

    .featured-project h1 {
        margin: 10px 0 12px !important;
        font-size: clamp(2.3rem, 2.8vw, 3.4rem) !important;
    }

    .featured-project .description {
        margin-bottom: 18px !important;
        font-size: clamp(0.95rem, 0.9vw, 1.08rem) !important;
        line-height: 1.5 !important;
        max-width: 54ch !important;
    }

    .featured-project .featured-image {
        width: 50% !important;
        max-width: 720px !important;
        height: min(60vh, 560px) !important;
    }
}

@media screen and (min-width: 2560px) and (max-height: 1600px) {
    .featured-project {
        max-width: 1860px !important;
        height: calc(82vh - 72px) !important;
        padding: 8px 20px 14px !important;
    }

    .featured-project .list .item {
        gap: 18px !important;
    }

    .featured-project .content {
        max-width: 760px !important;
    }

    .featured-project .featured-image {
        max-width: 760px !important;
        height: min(57vh, 560px) !important;
    }
}

@media screen and (min-width: 3200px) and (max-height: 1600px) {
    .featured-project {
        max-width: 2100px !important;
    }
}

/* Match 390x844-style thumbnail layout for tablet/phone portrait sizes */
@media screen and (max-width: 820px) and (min-width: 341px) {
    .projects-row:not(.hidden) {
        padding: 60px 10px 14px !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    .projects-row .thumbnail {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        max-width: min(100%, 620px) !important;
        margin: 0 auto !important;
        padding-bottom: 16px !important;
    }

    .projects-row .thumbnail .item {
        width: 100% !important;
        height: min(54vh, 440px) !important;
        border-radius: 12px !important;
    }

    .projects-row .thumbnail .item img {
        height: 82% !important;
        object-fit: cover !important;
    }

    .projects-row .thumbnail .item-content {
        min-height: 18% !important;
        padding: 8px 12px !important;
    }
}

/* iPad portrait (768x1024): larger, square-like thumbnail cards */
@media screen and (min-width: 700px) and (max-width: 820px) and (min-height: 900px) and (orientation: portrait) {
    .projects-row .thumbnail {
        max-width: min(100%, 700px) !important;
    }

    .projects-row .thumbnail .item {
        aspect-ratio: 1 / 1 !important;
        height: auto !important;
        max-height: min(72vh, 620px) !important;
    }

    .projects-row .thumbnail .item img {
        height: 84% !important;
    }

    .projects-row .thumbnail .item-content {
        min-height: 16% !important;
        padding: 8px 14px !important;
    }
}

/* 280x653 and ultra-narrow screens: reduce card/image scale to prevent overflow */
@media screen and (max-width: 320px) {
    .featured-project {
        height: auto !important;
        min-height: calc(100vh - 90px) !important;
        max-height: none !important;
        overflow: visible !important;
        padding-bottom: 14px !important;
    }

    .featured-project .list .item {
        align-items: flex-start !important;
    }

    .featured-project .featured-image {
        height: min(26vh, 170px) !important;
        max-height: 170px !important;
    }

    .featured-project .content .mobile-inline-toggle-btn {
        margin-top: 8px !important;
    }

    .projects-row:not(.hidden) {
        padding: 52px 14px 6px !important;
    }

    .projects-row:not(.hidden) .thumbnail-container {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    .projects-row:not(.hidden) .thumbnail {
        gap: 18px !important;
        padding-bottom: 8px !important;
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 auto !important;
        grid-template-columns: 1fr !important;
    }

    .projects-row:not(.hidden) .thumbnail .item {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        height: min(18vh, 105px) !important;
        border-radius: 7px !important;
    }

    .projects-row:not(.hidden) .thumbnail .item img {
        width: 100% !important;
        height: 76% !important;
        object-fit: cover !important;
    }

    .projects-row:not(.hidden) .thumbnail .item-content {
        min-height: 24% !important;
        padding: 4px 4px 2px !important;
        transform: translateY(4%) !important;
    }

    .projects-row:not(.hidden) .thumbnail .item h3 {
        font-size: 0.9rem !important;
        margin: 0 0 2px 0 !important;
        line-height: 1.15 !important;
    }

    .projects-row:not(.hidden) .thumbnail .item .category {
        font-size: 0.76rem !important;
        line-height: 1.15 !important;
    }
}

/* iPad portrait (768x1024): 2-column grid with clean image framing */
@media screen and (min-width: 700px) and (max-width: 820px) and (orientation: portrait) {
    .projects-row:not(.hidden) {
        padding: 66px 14px 16px !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    .projects-row .thumbnail-container {
        max-width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }

    .projects-row .thumbnail {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-template-rows: none !important;
        grid-auto-flow: row !important;
        gap: 14px !important;
        max-width: 760px !important;
        width: 100% !important;
        margin: 0 auto !important;
        padding: 0 0 16px !important;
    }

    .projects-row .thumbnail .item {
        aspect-ratio: 4 / 3 !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: hidden !important;
        border-radius: 12px !important;
    }

    .projects-row .thumbnail .item img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center center !important;
    }

    .projects-row .thumbnail .item-content {
        position: absolute !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        min-height: auto !important;
        padding: 10px 12px !important;
        background: linear-gradient(to top, rgba(255,255,255,0.96), rgba(255,255,255,0.78)) !important;
    }
}

/* Force 2 columns specifically for iPad-width portrait viewports */
@media screen and (min-width: 760px) and (max-width: 820px) and (orientation: portrait) {
    .projects-row .thumbnail {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-auto-flow: row !important;
        gap: 14px !important;
    }

    .projects-row .thumbnail .item {
        aspect-ratio: 4 / 3 !important;
        height: auto !important;
        max-height: none !important;
    }
}

/* Large desktop (1440x900 and above): add cards vertically, not side-scrolling */
@media screen and (min-width: 1440px) and (min-height: 900px) {
    .projects-row .thumbnail-container {
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    .projects-row .thumbnail {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(240px, 1fr)) !important;
        grid-template-rows: none !important;
        grid-auto-flow: row !important;
        gap: 18px !important;
        width: 100% !important;
        max-width: 1280px !important;
        margin: 0 auto !important;
        transform: none !important;
    }
}

/* Final hard override: iPad portrait must stay 2 columns */
@media screen and (min-width: 700px) and (max-width: 820px) and (orientation: portrait) {
    .projects-row:not(.hidden) .thumbnail-container {
        max-width: 820px !important;
        width: 100% !important;
    }

    body.projects-overlay-open .projects-row:not(.hidden) .thumbnail,
    .projects-row:not(.hidden) .thumbnail {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-auto-flow: row !important;
        grid-template-rows: none !important;
        gap: 14px !important;
        max-width: 820px !important;
        margin: 0 auto !important;
    }

    .projects-row:not(.hidden) .thumbnail .item {
        width: 100% !important;
        max-width: none !important;
        min-height: 260px !important;
        max-height: 420px !important;
    }

    .projects-row:not(.hidden) .thumbnail .item img {
        height: 100% !important;
        object-fit: cover !important;
    }
}

/* Final mobile scroll guarantee for Show Projects overlay */
@media screen and (max-width: 1024px) {
    .projects-row:not(.hidden) {
        height: 100vh !important;
        max-height: 100vh !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
        touch-action: pan-y !important;
    }

    .projects-row:not(.hidden) .thumbnail-container {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }
}

/* Mobile spacing tweak: move Show Projects upward toward View Project */
@media screen and (max-width: 1024px) and (min-height: 500px) {
    .thumbnail-toggle-container {
        margin-top: 0 !important;
        transform: translateY(-60%) !important;
    }
}

/* iPad landscape (1024x768): enforce rounded featured image corners */
@media screen and (min-width: 1000px) and (max-width: 1060px) and (min-height: 740px) and (max-height: 800px) and (orientation: landscape) {
    .featured-project .featured-image {
        border-radius: 25px !important;
        overflow: hidden !important;
    }

    .featured-project .featured-image img {
        border-radius: 25px !important;
    }
}

/* Hide toggle button when projects overlay is open */
body.projects-overlay-open .thumbnail-toggle-container {
    display: none !important;
}

