/* ─── Trigger button ──────────────────────────────────────── */
.project-browse-btn {
    -webkit-appearance: none;
    appearance: none;
    font-family: inherit;
    font-size: 0.88rem;
    line-height: inherit;
    cursor: pointer;
}

/* ─── Modal shell ─────────────────────────────────────────── */
body.project-carousel-open {
    overflow: hidden;
}

.project-carousel {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.project-carousel[hidden] {
    display: none;
}

.project-carousel-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.82);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-carousel-panel {
    position: relative;
    width: min(92vw, 980px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--cream);
    border-radius: var(--radius-md);
    padding: 2.5rem 2rem 2rem;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transform: scale(0.94) translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.project-carousel.is-open .project-carousel-backdrop {
    opacity: 1;
}

.project-carousel.is-open .project-carousel-panel {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.project-carousel-title {
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--dark);
    margin-bottom: 1.25rem;
    text-align: center;
}

/* ─── Stage ───────────────────────────────────────────────── */
.project-carousel-stage {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-carousel-slides {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    max-height: 62vh;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background-color: var(--cream);
}

.carousel-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transform: scale(1.02);
    pointer-events: none;
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.carousel-slide.is-active {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.carousel-slide img,
.carousel-slide video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background-color: var(--cream);
}

/* ─── Prev / next ─────────────────────────────────────────── */
.project-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background-color: rgba(255, 255, 255, 0.9);
    color: var(--dark);
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.project-carousel-nav:hover,
.project-carousel-nav:focus-visible {
    background-color: #fff;
    transform: translateY(-50%) scale(1.08);
}

.project-carousel-prev {
    left: 0.75rem;
}

.project-carousel-next {
    right: 0.75rem;
}

.project-carousel-nav svg {
    width: 16px;
    height: 16px;
}

.project-carousel-nav[hidden] {
    display: none;
}

/* ─── Thumbnails ──────────────────────────────────────────── */
.project-carousel-thumbs {
    display: flex;
    gap: 0.6rem;
    margin-top: 1.25rem;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.project-carousel-thumbs[hidden] {
    display: none;
}

.carousel-thumb {
    position: relative;
    flex: 0 0 auto;
    width: 4.5rem;
    height: 3rem;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid transparent;
    padding: 0;
    cursor: pointer;
    background-color: #000;
    opacity: 0.6;
    transition: opacity 0.2s ease, border-color 0.2s ease;
}

.carousel-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.carousel-thumb-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.7rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

.carousel-thumb:hover,
.carousel-thumb:focus-visible {
    opacity: 0.85;
}

.carousel-thumb.is-active {
    opacity: 1;
    border-color: var(--dark);
}

/* ─── Close button ────────────────────────────────────────── */
.project-carousel-close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background-color: rgba(0, 0, 0, 0.06);
    color: var(--dark);
    cursor: pointer;
    transition: background-color 0.15s ease;
    z-index: 3;
}

.project-carousel-close svg {
    width: 14px;
    height: 14px;
    display: block;
}

.project-carousel-close:hover,
.project-carousel-close:focus-visible {
    background-color: rgba(39, 39, 39, 0.12);
}

.project-carousel-close:focus-visible,
.project-carousel-nav:focus-visible,
.carousel-thumb:focus-visible {
    outline: 2px solid var(--dark);
    outline-offset: 2px;
}

/* ─── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .project-carousel-backdrop,
    .project-carousel-panel,
    .carousel-slide,
    .project-carousel-nav,
    .carousel-thumb,
    .project-carousel-close {
        transition: none;
    }
}

/* ─── Small screens ───────────────────────────────────────── */
@media (max-width: 640px) {
    .project-carousel-panel {
        padding: 2.25rem 1rem 1.25rem;
    }

    .project-carousel-nav {
        width: 2.1rem;
        height: 2.1rem;
    }
}
