/* ==========================================================================
   Preview Follower — Cursor-following image preview on project list hover
   ========================================================================== */

.c2s-preview-section {
    background: var(--color-bg);
    padding-bottom: calc(var(--col) * 1.5);
}

/* Variant — uniquement sur les sous-pages projet (et pas sur la hub /projets) */
.c2s-preview-section--projet {
    padding-top: calc(var(--col) * 2);
}

.c2s-preview-section > .container:first-child + .container {
    padding-top: calc(var(--col) * 0.5);
}

.c2s-preview-section__title {
    font-size: var(--display-2xl);
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--color-heading);
    text-align: left;
}

.preview-container {
    width: 100%;
    padding-right: var(--col);
}

.preview-collection {
    width: 100%;
}

.preview-item__row {
    flex-flow: wrap;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    display: flex;
}

.preview-item__col {
    flex: 1;
}

.preview-item__col.is--large {
    max-width: 50%;
}

.preview-item__col.is--medium {
    max-width: 30%;
}

.preview-item__col.is--small {
    max-width: 20%;
}

.preview-container__label {
    color: var(--color-body-light);
    text-transform: uppercase;
    font-size: var(--12px-size);
    letter-spacing: 0.05em;
}

.preview-list {
    flex-flow: column;
    width: 100%;
    display: flex;
    position: relative;
}

.preview-item {
    width: 100%;
    transition: opacity var(--duration-fast) ease;
}

.preview-item__heading {
    margin: 0;
    font-size: var(--display-lg);
    font-weight: 400;
    line-height: 1;
    color: var(--color-heading);
}

.preview-item__text {
    margin: 0;
    font-size: var(--20px-size);
    font-weight: 400;
    line-height: 1.2;
    color: var(--color-body-light);
}

.preview-item__visual {
    aspect-ratio: 1 / 1.25;
    width: 20em;
    display: none;
    position: absolute;
    overflow: hidden;
}

.preview-follower [data-follower-visual] {
    display: block;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.preview-item__inner {
    border-top: 1px solid var(--color-border);
    width: 100%;
    padding-top: 2.5em;
    padding-bottom: 2.5em;
    display: block;
    text-decoration: none;
    color: inherit;
}

.preview-item__visual-img {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

.preview-follower {
    z-index: var(--z-overlay);
    aspect-ratio: 1 / 1.25;
    pointer-events: none;
    border-radius: 0.75em;
    justify-content: center;
    align-items: center;
    width: 20em;
    display: flex;
    position: fixed;
    inset: 0% auto auto 0%;
    overflow: hidden;
}

.preview-follower__label {
    z-index: 2;
    position: absolute;
    opacity: 0;
    translate: 0px 100%;
    transition: opacity 0.1s ease, translate 0.6s cubic-bezier(0.65, 0.1, 0, 1);
}

.preview-follower__label-span {
    background-color: var(--color-bg);
    color: var(--color-heading);
    border-radius: 0.25em;
    padding: 0.75em 1.25em;
    font-size: var(--16px-size);
    font-weight: 500;
    overflow: hidden;
}

.preview-follower__label-text {
    display: inline-block;
}

.preview-follower__inner {
    z-index: 2;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    display: flex;
    position: relative;
    opacity: 0;
    transform: scale(1);
    transform-origin: center center;
    transition: opacity 0.15s ease;
}


/* Desktop — hover states */
@media screen and (min-width: 992px) {
    .preview-item:last-of-type .preview-item__inner {
        border-bottom: 1px solid var(--color-border);
    }
}

@media (hover: hover) and (min-width: 992px) {
    body:has([data-follower-collection]:hover) .preview-follower__inner {
        opacity: 1;
        transform: scale(1);
    }

    body:has([data-follower-collection]:hover) .preview-follower__label {
        opacity: 1;
        translate: 0px 0%;
    }

    body:has(.preview-item:hover) .preview-item:not(:hover) {
        opacity: 0.5;
    }
}


/* Tablet (max 991px) */
@media screen and (max-width: 991px) {
    .preview-container {
        padding-right: 0;
    }

    .c2s-preview-section__title {
        font-size: var(--display-md);
    }

    .preview-item__row {
        grid-row-gap: 0.5em;
    }

    .preview-item__row.tablet--hide,
    .preview-item__col.is--small.tablet--hide {
        display: none;
    }

    .preview-item__col.is--large {
        flex: none;
        order: -1;
        width: 100%;
        max-width: none;
    }

    .preview-item__col.is--medium {
        order: -1;
        max-width: 80%;
    }

    .preview-item__col.is--small {
        text-align: right;
        max-width: 20%;
    }

    .preview-list {
        grid-column-gap: 1em;
        grid-row-gap: 4em;
        flex-flow: wrap;
    }

    .preview-item {
        width: calc(50% - 0.5em);
    }

    .preview-item__heading {
        font-size: var(--display-sm);
    }

    .preview-item__visual {
        border-radius: 0.75em;
        order: -1;
        width: 100%;
        margin-bottom: 1em;
        display: block;
        position: relative;
    }

    .preview-item__inner {
        border: none;
        flex-flow: column;
        padding-top: 0;
        padding-bottom: 0;
        display: flex;
    }

    .preview-follower {
        display: none;
    }
}


/* Mobile (max 767px) */
@media screen and (max-width: 767px) {
    .c2s-preview-section__title {
        font-size: var(--display-sm);
    }

    .preview-list {
        grid-row-gap: 3em;
    }

    .preview-item {
        width: 100%;
    }
}
