/* =============================================
   RESET & BASE
   ============================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "neue-haas-grotesk-display", sans-serif;
    overflow: hidden;
    background-color: #000000;
    color: #fff;
}

/* =============================================
   HEADER
   ============================================= */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 24px;
    pointer-events: none;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.header > * {
    pointer-events: auto;
}

.logo {
    height: 130px;
}

.logo img {
    height: 100%;
    width: auto;
    display: block;
}

/* =============================================
   FILTER SYSTEM
   ============================================= */
.filter-wrapper {
    position: relative;
}

.filter-toggle {
    padding: 10px 18px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    color: #fff;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: "neue-haas-grotesk-display", sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.filter-toggle::after {
    content: '▼';
    font-size: 10px;
    transition: transform 0.3s ease;
}

.filter-toggle.active::after {
    transform: rotate(180deg);
}

.filter-container {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 400px;
    background-color: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 12px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.filter-container.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    background-color: transparent;
    color: #fff;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: "neue-haas-grotesk-display", sans-serif;
    white-space: nowrap;
}

.filter-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.filter-btn.active {
    background-color: #fff;
    color: #000;
    border-color: #fff;
}

/* =============================================
   INSTRUCTIONS
   ============================================= */
.instructions {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 400;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    pointer-events: none;
    letter-spacing: -0.02em;
    mix-blend-mode: difference;
}

/* =============================================
   MAIN LAYOUT
   ============================================= */
.main-container {
    width: 100%;
    height: 100vh;
    display: flex;
    position: relative;
    overflow: hidden;
}

.scroll-container {
    cursor: grab;
    height: 100%;
    overflow: clip;
    flex: 1;
    display: flex;
    position: relative;
    touch-action: none; /* Empêche le navigateur de gérer le touch lui-même */
}

.scroll-container.dragging {
    cursor: grabbing;
}

.canvas {
    border-radius: 10px;
    flex: 1;
    display: flex;
    position: relative;
    overflow: visible;
}

/* =============================================
   PROJECT CARDS
   ============================================= */
.item {
    position: absolute;
    will-change: transform;
    transition: transform 0.1s ease-out, opacity 0.3s ease;
    perspective: 1000px;
    cursor: pointer;
}

.item.hidden {
    opacity: 0;
    pointer-events: none;
}

.item-card {
    width: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.item.flipped .item-card {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
}

.card-face.card-front {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-back {
    transform: rotateY(180deg);
    background-color: rgba(255, 255, 255, 0.088);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
    overflow: hidden;
}

.card-back-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-height: 0;
}

.item-image {
    width: 100%;
    height: 100%;
    overflow: clip;
    position: relative;
    filter: none;
    transform: none;
    border-radius: 12px;
}

.item-image img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    object-position: center;
    object-fit: cover;
    user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    pointer-events: none;
}

.back-title {
    font-family: 'Instrument Serif', serif;
    font-size: 24px;
    font-weight: normal;
    color: #fff;
    margin-bottom: 4px;
    line-height: 1.1;
}

.back-description {
    font-family: "neue-haas-grotesk-text", sans-serif;
    font-weight: 400;
    font-style: normal;
    font-size: 16px;
    color: #d4d4d8;
    line-height: 1.2;
}

.view-more-btn {
    width: 100%;
    padding: 8px;
    border: none;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #fff;
    color: #000;
    font-family: 'Instrument Serif', serif;
    flex-shrink: 0;
}

.view-more-btn:hover {
    background-color: #e5e7eb;
    transform: scale(1.02);
}

/* =============================================
   MODAL
   ============================================= */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.015);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 40px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: rgba(11, 11, 11, 0.655);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    position: relative;
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.9) translateY(50px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-body {
    padding: 50px 40px 40px 40px;
}

.modal-header {
    margin-bottom: 30px;
}

.modal-title {
    font-family: "neue-haas-grotesk-display", sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.modal-subtitle {
    font-family: "neue-haas-grotesk-display", sans-serif;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 20px;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 30px;
}

.modal-tag {
    padding: 6px 14px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 14px;
    color: #fff;
    font-family: "neue-haas-grotesk-display", sans-serif;
}

.modal-gallery {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    padding-bottom: 20px;
    max-height: 450px;
    touch-action: pan-x; /* Permet le swipe horizontal dans la galerie sur mobile */
    -webkit-overflow-scrolling: touch; /* Scroll fluide sur iOS */
}

.modal-gallery-item {
    flex: 0 0 auto;
    width: auto;
    height: 400px;
    scroll-snap-align: start;
}

.modal-gallery-item img {
    height: 100%;
    width: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
    border-radius: 12px;
}

.modal-gallery-item video {
    height: 100%;
    width: auto;
    object-fit: contain;
    border-radius: 12px;
}

.modal-video {
    min-width: 300px;
}

.modal-video iframe {
    border-radius: 12px;
}

.modal-gallery::-webkit-scrollbar {
    height: 8px;
}

.modal-gallery::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.modal-gallery::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

/* =============================================
   FULLSCREEN IMAGE VIEWER (mobile gallery)
   ============================================= */
.fullscreen-viewer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 300;
    background-color: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    touch-action: none;
}

.fullscreen-viewer.active {
    display: flex;
    opacity: 1;
}

.fullscreen-viewer img {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

.fullscreen-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.fullscreen-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    font-family: "neue-haas-grotesk-display", sans-serif;
}

/* =============================================
   RESPONSIVE - TABLET (max-width: 768px)
   ============================================= */
@media (max-width: 768px) {
    /* Header */
    .header {
        padding: 16px;
    }

    .logo {
        height: 90px;
    }

    /* Filter */
    .filter-toggle {
        padding: 8px 14px;
        font-size: 13px;
    }

    .filter-container {
        max-width: 300px;
    }

    .filter-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    /* Instructions */
    .instructions {
        font-size: 11px;
        padding: 10px 18px;
        bottom: 16px;
    }

    /* Cards — on réduit via un scale factor appliqué en JS,
       mais on ajuste aussi le texte du back */
    .back-title {
        font-size: 20px;
    }

    .back-description {
        font-size: 14px;
    }

    .view-more-btn {
        font-size: 14px;
        padding: 6px;
    }

    /* Modal */
    .modal {
        padding: 20px;
    }

    .modal-body {
        padding: 40px 24px 24px 24px;
    }

    .modal-title {
        font-size: 26px;
    }

    .modal-subtitle {
        font-size: 16px;
    }

    .modal-gallery {
        max-height: 350px;
    }

    .modal-gallery-item {
        height: 300px;
    }
}

/* =============================================
   RESPONSIVE - PHONE (max-width: 480px)
   ============================================= */
@media (max-width: 480px) {
    /* Header */
    .header {
        padding: 12px;
    }

    .logo {
        height: 60px;
    }

    /* Filter */
    .filter-container {
        max-width: 260px;
    }

    .filter-btn {
        padding: 5px 10px;
        font-size: 12px;
    }

    .instructions {
            font-size: 14px;
            /* était 16px */
            padding: 8px 14px;
            bottom: 12px;
            white-space: nowrap;
            mix-blend-mode: normal;
        }
    }

    /* Cards back face */
    .back-title {
        font-size: 24px;
    }

    .back-description {
        font-size: 16px;
    }

    .view-more-btn {
        font-size: 16px;
        padding: 6px;
    }

    .card-back {
        padding: 12px 14px;
    }

    /* Modal */
    .modal {
        padding: 10px;
    }

    .modal-content {
        border-radius: 16px;
    }

    .modal-body {
        padding: 36px 16px 16px 16px;
    }

    .modal-close {
        top: 12px;
        right: 12px;
        width: 34px;
        height: 34px;
        font-size: 20px;
    }

    .modal-title {
        font-size: 24px;
    }

    .modal-subtitle {
        font-size: 16px;
        margin-bottom: 14px;
    }

    .modal-tags {
        gap: 6px;
        margin-bottom: 20px;
    }

    .modal-tag {
        padding: 4px 10px;
        font-size: 14px;
    }

    .modal-gallery {
        max-height: 280px;
        gap: 8px;
    }

    .modal-gallery-item {
        height: 240px;
    }

    .modal-video {
        min-width: 260px;
    }