/* ==========================================================
   JT MAISON — Featured Work Widget
   ========================================================== */

.jtm-work {
    width: 100%;
    margin: 0 auto;
    padding: 100px 10px;
    background: var(--jtm-white);
    box-sizing: border-box;
}

.jtm-work__header {
    margin-bottom: 40px;
    padding: 0 30px;
}

.jtm-work__subtitle {
    font-family: var(--jtm-font-ui);
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--jtm-dark);
    text-transform: uppercase;
    margin: 0 0 16px 0;
    font-weight: 500;
}

.jtm-work__title {
    font-family: var(--jtm-font-ui);
    font-size: clamp(32px, 5vw, 42px);
    font-weight: 500;
    color: var(--jtm-dark);
    line-height: 1.2;
    margin: 0;
}

/* Grid Layout (Desktop) */
.jtm-work__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px; /* Thin line between images */
}

/* Base Item Styling */
.jtm-work__item {
    position: relative;
    height: 400px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 30px;
    text-decoration: none;
    color: var(--jtm-white);
}

/* Item 3 takes full width */
.jtm-work__item--3 {
    grid-column: 1 / -1;
    height: 350px;
}

/* Background Image */
.jtm-work__bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.8s ease;
    z-index: 1;
    background-color: #eee; /* Fallback if no image */
}

/* Dark gradient overlay for text legibility */
.jtm-work__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 60%);
    z-index: 2;
    transition: opacity 0.3s;
}

/* Hover effects */
.jtm-work__item:hover .jtm-work__bg {
    transform: scale(1.05);
}

.jtm-work__item:hover .jtm-work__overlay {
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 70%);
}

/* Content */
.jtm-work__content {
    position: relative;
    z-index: 3;
}

.jtm-work__item-tag {
    display: inline-block;
    padding: 4px 8px;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
    font-family: var(--jtm-font-ui);
    font-size: 9px;
    letter-spacing: 0.1em;
    color: var(--jtm-white);
    margin-bottom: 16px;
}

.jtm-work__item-title {
    font-family: var(--jtm-font-ui);
    font-size: 24px;
    font-weight: 500;
    color: var(--jtm-white);
    margin: 0 0 8px 0;
}

.jtm-work__item-meta {
    font-family: var(--jtm-font-ui);
    font-size: 10px;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    margin: 0;
}

.jtm-work__item-link {
    display: block;
    margin-top: 16px;
    font-family: var(--jtm-font-ui);
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--jtm-white);
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.jtm-work__item:hover .jtm-work__item-link {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive Mobile (Carousel) */
@media (max-width: 768px) {
    .jtm-work {
        padding: 60px 0;
    }

    .jtm-work__header {
        padding-right: 24px;
        padding-left: 24px;
    }

    /* Convert grid to horizontal scroll snap container */
    .jtm-work__grid {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        gap: 16px;
        padding-bottom: 24px; /* Space for scrollbar */
        padding-right: 24px; /* End padding */
        
        /* Hide scrollbar for cleaner look (optional) */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .jtm-work__grid::-webkit-scrollbar {
        display: none;
    }

    .jtm-work__item {
        flex: 0 0 85vw; /* Almost full width so the next item peeks in */
        scroll-snap-align: start;
        height: 400px;
    }
    
    .jtm-work__item--3 {
        height: 400px; /* Keep all items same height on mobile */
    }

    /* Always show link on mobile */
    .jtm-work__item-link {
        opacity: 1;
        transform: translateY(0);
    }
}
