/* ================================================
   PROJECT EXHIBITION GRID
   ================================================ */

.work-section {
    position: relative;
    padding: var(--spacing-xl) 0;
    overflow: visible;
}

.work-carousel-container {
    position: relative;
    width: 100%;
    padding: 0.5rem 0 1rem;
}

.work-carousel {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(0.75rem, 1.4vw, 1.1rem);
    overflow: visible;
    padding: 0;
    counter-reset: project;
}

.work-carousel .work-item {
    --project-accent: #6e8fa4;

    counter-increment: project;
    width: 100%;
    min-height: clamp(280px, 36vw, 360px);
    height: auto;
    border-radius: 16px;
    border: 1px solid rgba(180, 198, 214, 0.24);
    background: linear-gradient(152deg, rgba(12, 17, 24, 0.94) 0%, rgba(7, 11, 16, 0.9) 55%, rgba(6, 10, 14, 0.94) 100%);
    overflow: hidden;
    position: relative;
    display: block;
    isolation: isolate;
    box-shadow: 0 22px 52px rgba(0, 0, 0, 0.42);
    transition: transform 0.45s cubic-bezier(0.22, 0.82, 0.2, 1), box-shadow 0.45s ease, border-color 0.45s ease;
}

.work-carousel .work-item::before {
    content: counter(project, decimal-leading-zero);
    position: absolute;
    top: 0.85rem;
    left: 0.85rem;
    z-index: 6;
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    font-weight: 600;
    color: rgba(231, 240, 249, 0.86);
    padding: 0.42rem 0.48rem;
    border-radius: 2px;
    background: rgba(7, 12, 18, 0.84);
    border: 1px solid rgba(171, 191, 209, 0.42);
}

.work-carousel .work-item::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    border: 1px solid rgba(203, 219, 232, 0.18);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.work-carousel .work-item:hover,
.work-carousel .work-item:focus-visible,
.work-carousel .work-item.in-view {
    width: 100%;
    height: auto;
    transform: translateY(-6px);
    box-shadow: 0 34px 70px rgba(0, 0, 0, 0.5);
    border-color: rgba(201, 218, 232, 0.34);
}

.work-carousel .work-item:hover::after,
.work-carousel .work-item:focus-visible::after,
.work-carousel .work-item.in-view::after {
    opacity: 1;
}

.work-carousel .work-item:focus-visible {
    outline: 2px solid rgba(211, 225, 238, 0.48);
    outline-offset: 4px;
}

.work-carousel .work-item,
.work-carousel .work-item:hover {
    border-radius: 16px;
}

.work-carousel .work-visual {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    overflow: hidden;
    background: #0a1119;
}

.work-carousel .work-item:hover .work-visual {
    border-radius: inherit;
}

.work-carousel .work-visual::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(9, 12, 17, 0.05) 0%, rgba(9, 12, 17, 0.12) 36%, rgba(9, 12, 17, 0.52) 78%, rgba(9, 12, 17, 0.78) 100%);
}

.work-carousel .work-visual::before {
    content: none;
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    opacity: 0;
    background: none;
    transition: opacity 0.35s ease;
}

.work-carousel .work-item:hover .work-visual::before,
.work-carousel .work-item.in-view .work-visual::before {
    opacity: 0;
}

.work-carousel .project-slideshow {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
    overflow: hidden;
}

.work-carousel .work-item:hover .project-slideshow {
    border-radius: inherit;
}

.work-carousel .slideshow-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    opacity: 0;
    transform: none;
    transition: opacity 0.65s ease;
    border-radius: 0;
    filter: brightness(1.05) saturate(1.08) contrast(1.06);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.work-carousel .slideshow-image.active {
    opacity: 1;
    transform: none;
}

.work-carousel .visual-pattern {
    display: none;
}

.work-carousel .visual-pattern .pattern-element {
    position: absolute;
    opacity: 0.4;
    animation: exhibitionGlyphs 16s ease-in-out infinite;
    filter: none;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.work-carousel .visual-pattern .pattern-element:nth-child(1) {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    top: 8%;
    left: 4%;
}

.work-carousel .visual-pattern .pattern-element:nth-child(2) {
    width: 34px;
    height: 34px;
    border-radius: 4px;
    bottom: 12%;
    right: 8%;
    animation-delay: 2.8s;
}

.work-carousel .visual-pattern .pattern-element:nth-child(3) {
    width: 0;
    height: 0;
    border-left: 17px solid transparent;
    border-right: 17px solid transparent;
    border-bottom: calc(34px * 0.8660254) solid rgba(216, 201, 155, 0.48);
    top: 34%;
    left: 42%;
    animation-delay: 5.4s;
}

.work-carousel .pattern-1 .pattern-element:nth-child(1) { background: rgba(105, 138, 160, 0.55); }
.work-carousel .pattern-1 .pattern-element:nth-child(2) { background: rgba(122, 154, 176, 0.4); }
.work-carousel .pattern-2 .pattern-element:nth-child(1) { background: rgba(135, 99, 111, 0.55); }
.work-carousel .pattern-2 .pattern-element:nth-child(2) { background: rgba(156, 117, 128, 0.4); }
.work-carousel .pattern-3 .pattern-element:nth-child(1) { background: rgba(165, 144, 96, 0.5); }
.work-carousel .pattern-3 .pattern-element:nth-child(2) { background: rgba(146, 129, 84, 0.42); }
.work-carousel .pattern-4 .pattern-element:nth-child(1) { background: rgba(96, 124, 141, 0.52); }
.work-carousel .pattern-4 .pattern-element:nth-child(2) { background: rgba(109, 143, 163, 0.4); }
.work-carousel .pattern-5 .pattern-element:nth-child(1) { background: rgba(125, 106, 137, 0.52); }
.work-carousel .pattern-5 .pattern-element:nth-child(2) { background: rgba(112, 95, 122, 0.42); }
.work-carousel .pattern-6 .pattern-element:nth-child(1) { background: rgba(161, 124, 99, 0.53); }
.work-carousel .pattern-6 .pattern-element:nth-child(2) { background: rgba(146, 111, 87, 0.42); }

@keyframes exhibitionGlyphs {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(8deg); }
}

.work-carousel .work-info {
    position: absolute;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    padding: clamp(1rem, 2vw, 1.4rem);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 0.55rem;
    text-align: left;
    background: linear-gradient(180deg, rgba(8, 11, 16, 0) 0%, rgba(8, 11, 16, 0.2) 52%, rgba(8, 11, 16, 0.62) 84%, rgba(8, 11, 16, 0.86) 100%);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 0 0 16px 16px;
    opacity: 1;
    transition: transform 0.35s ease;
}

.work-carousel .work-info::before {
    content: '';
    width: 72px;
    height: 4px;
    border-radius: 1px;
    background: rgba(195, 210, 224, 0.58);
    margin-bottom: 0.35rem;
}

.work-carousel .work-item:hover .work-info,
.work-carousel .work-item.in-view .work-info {
    transform: translateY(-4px);
    border-radius: 0 0 16px 16px;
}

.work-carousel .work-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.work-carousel .work-year,
.work-carousel .work-role {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.52rem;
    border-radius: 999px;
    border: 1px solid rgba(179, 200, 217, 0.33);
    background: rgba(10, 16, 24, 0.7);
    color: rgba(223, 234, 245, 0.86);
    font-size: 0.66rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.work-carousel .work-role {
    border-color: rgba(179, 200, 217, 0.3);
}

.work-carousel .work-title {
    margin: 0;
    font-size: clamp(1rem, 1.7vw, 1.5rem);
    font-weight: 650;
    line-height: 1.12;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #edf4fb;
    max-width: 20ch;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}

.work-carousel .work-description {
    margin: 0;
    font-size: clamp(0.76rem, 0.95vw, 0.9rem);
    line-height: 1.45;
    color: rgba(212, 225, 238, 0.9);
    max-width: 36ch;
}

.work-carousel .work-open {
    margin-top: 0.15rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.42rem 0.7rem;
    border-radius: 3px;
    border: 1px solid rgba(177, 198, 214, 0.34);
    background: rgba(10, 16, 23, 0.75);
    color: rgba(233, 242, 251, 0.86);
    font-size: 0.68rem;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.work-carousel .work-open::after {
    content: '↗';
    font-size: 0.78rem;
}

.work-carousel .work-item.in-view .work-open,
.work-carousel .work-item:hover .work-open {
    border-color: rgba(186, 205, 220, 0.48);
    background: rgba(14, 20, 29, 0.84);
    color: #f2f7fc;
}

@media (min-width: 880px) {
    .work-carousel {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .work-carousel .work-item {
        min-height: clamp(260px, 24vw, 320px);
    }
}

@media (min-width: 640px) and (max-width: 879px) {
    .work-carousel {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .work-carousel .work-item,
    .work-carousel .work-item:hover {
        min-height: clamp(250px, 42vw, 320px);
        transform: none;
    }

    .work-carousel .work-item:hover .work-info,
    .work-carousel .work-item.in-view .work-info {
        transform: none;
    }
}

@media (max-width: 639px) {
    .work-carousel {
        gap: 0.75rem;
    }

    .work-carousel .work-item,
    .work-carousel .work-item:hover {
        min-height: min(116vw, 360px);
        border-radius: 14px;
    }

    .work-carousel .work-info,
    .work-carousel .work-item:hover .work-info,
    .work-carousel .work-item.in-view .work-info {
        border-radius: 0 0 14px 14px;
        padding: 0.85rem 0.9rem;
    }

    .work-carousel .visual-pattern {
        width: 82px;
        height: 82px;
        top: 0.7rem;
        right: 0.7rem;
    }

    .work-carousel .work-title {
        font-size: 1.06rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .work-carousel .work-item,
    .work-carousel .work-item:hover,
    .work-carousel .work-item.in-view {
        transform: none;
        transition: none;
    }

    .work-carousel .visual-pattern .pattern-element {
        animation: none;
    }

    .work-carousel .slideshow-image {
        transition: opacity 0.3s ease;
    }
}
