/* =====================================================
   Anatomie — Oriane Droubay
   Page layout fidèle aux specs Figma (1728px base)
   ===================================================== */

/* ─── Page Wrapper ──────────────────────────────────── */
.ana-page-wrapper {
    position: relative;
    width: 100%;
    background: #FFFFFF;
    overflow-x: hidden;
}

.ana-layout-container {
    position: relative;
    width: 1728px;
    height: 2902px;
    margin: 0 auto;
    background: #FFFFFF;
}

/* ─── HERO & PORTRAIT ───────────────────────────────── */
.ana-hero {
    position: absolute;
    width: 1728px;
    height: 770px;
    left: 0px;
    top: 0px;
    background-image: url('../12-%20Anatomie/Portrait%201.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    cursor: zoom-in;
}

/* Descriptif card */
.ana-descriptif {
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    padding: 25px 20px;
    position: absolute;
    width: 401px;
    height: auto;  /* Always grows to fit content */
    min-height: unset;
    left: 664px;
    top: 480px;
    background: #FFFFFF;
    border: 1px solid #000000;
    cursor: pointer;
    box-sizing: border-box;
    z-index: 50;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

.ana-descriptif-text {
    width: 100%;               /* Fill the card — no fixed pixel width */
    height: auto;              /* Never clip — always tall enough for all text */
    font-family: 'Source Code Pro', monospace;
    font-style: normal;
    font-weight: 400;
    font-size: 14px;
    line-height: 18px;
    color: #101010;
    text-align: left;
    margin: 0 0 15px 0;
    white-space: pre-line;
    flex: none;
    order: 0;
    align-self: stretch;
    flex-grow: 0;
    /* Do NOT set overflow: hidden — text must never be cut */
}

/* BOUTON TOUT VOIR */
.ana-bouton-tout-voir {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    gap: 113px;
    width: 22px;
    height: 13px;
    flex: none;
    order: 1;
    flex-grow: 0;
}

.ana-line-1 {
    display: none;
}

.ana-arrow {
    margin: 0 auto;
    width: 22px;
    height: 13px;
    transform: rotate(0deg);
    flex: none;
    order: 1;
    flex-grow: 0;
    transition: transform 0.3s ease;
}

.ana-arrow img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.ana-descriptif:hover .ana-arrow {
    transform: translateY(8px) rotate(0deg);
}

/* ─── ASYMMETRIC GRID ───────────────────────────────── */
.ana-img-card {
    position: absolute;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    /* Transition for parallax Y updates and scroll reveal opacity */
    transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
    opacity: 0;
    transform: translateY(calc(80px + var(--parallax-y, 0px))) scale(0.95);
    cursor: zoom-in;
}

.ana-img-card.visible {
    opacity: 1;
    transform: translateY(var(--parallax-y, 0px)) scale(1);
}

.ana-img-card.visible:hover {
    transform: scale(1.15) translateY(calc(var(--parallax-y, 0px) - 10px));
    box-shadow: 0 20px 40px rgba(16, 16, 16, 0.15);
    z-index: 10;
}

/* Corp Position 1 */
.ana-corp-position {
    width: 482px;
    height: 329px;
    left: 167px;
    top: 770px;
    background-image: url('../12-%20Anatomie/Corp-position%201.webp');
}

/* Corp 1 */
.ana-corp {
    width: 483px;
    height: 321px;
    left: 1157px;
    top: 801px;
    background-image: url('../12-%20Anatomie/Corp%201.webp');
}

/* Bouche 1 */
.ana-bouche {
    width: 497px;
    height: 329px;
    left: 246px;
    top: 1201px;
    background-image: url('../12-%20Anatomie/Bouche%201.webp');
}

/* Visage 1 */
.ana-visage {
    width: 484px;
    height: 318px;
    left: 1049px;
    top: 1245px;
    background-image: url('../12-%20Anatomie/Visage%201.webp');
}

/* Main 1 */
.ana-main {
    width: 466px;
    height: 321px;
    left: 147px;
    top: 1679px;
    background-image: url('../12-%20Anatomie/Main%201.webp');
}

/* Nez 1 */
.ana-nez {
    width: 497px;
    height: 328px;
    left: 1116px;
    top: 1636px;
    background-image: url('../12-%20Anatomie/Nez%201.webp');
}

/* ─── SÉLECTION AUTRES PROJETS ──────────────────────── */
.ana-others-section {
    position: absolute;
    left: 147px;
    top: 2081px;
    width: 1434px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ana-others-title {
    font-family: 'Source Code Pro', monospace;
    font-weight: 400;
    font-size: 16px;
    line-height: 20px;
    text-align: center;
    color: #101010;
    margin: 0 0 10px 0;
}

.ana-selection {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    width: 100%;
    height: 650px;
    border-radius: 8px;
    overflow: hidden;
    gap: 0;
}

.ana-selection-card {
    position: relative;
    width: 478px;
    height: 650px;
    overflow: hidden;
    flex-shrink: 0;
    text-decoration: none;
    cursor: pointer;
    display: block;
}

.ana-selection-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1), filter 0.4s ease;
}

.ana-selection-card:hover .ana-selection-bg {
    transform: scale(1.04);
    filter: brightness(0.9);
}

.ana-selection-label {
    position: absolute;
    top: 23px;
    right: 27px;
    font-family: 'Source Code Pro', monospace;
    font-weight: 400;
    font-size: 16px;
    line-height: 20px;
    color: #101010;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #101010;
    padding: 4px 10px;
    border-radius: 2px;
    z-index: 2;
    transition: background 0.3s ease, color 0.3s ease;
    white-space: nowrap;
}

.ana-selection-card:hover .ana-selection-label {
    background: #101010;
    color: #FFFFFF;
}

/* ─── Responsive Fluid Layouts (No global transform scale under 1024px) ─── */

/* 1. Laptops and smaller desktops (1025px to 1728px) */
/* 1. Tablets and laptops using dynamic centered scale (768px to 1728px) */
@media (min-width: 768px) and (max-width: 1728px) {
    .ana-page-wrapper {
        height: calc(2902px * (100vw / 1728px)) !important;
        overflow-x: hidden;
    }

    .ana-layout-container {
        position: absolute !important;
        left: 50% !important;
        transform: translateX(-50%) scale(calc(100vw / 1728px)) !important;
        transform-origin: top center !important;
        margin: 0 !important;
    }
}

/* ─── Tablet (768–1024px): let text reflow inside the scaled card ─── */
/* The whole layout is CSS-scaled at this breakpoint. The card dimensions
   scale proportionally, which is correct. We just ensure text wraps normally. */
@media (min-width: 768px) and (max-width: 1024px) {
    .ana-descriptif-text {
        width: 100% !important;           /* Fill scaled card width */
        white-space: normal !important;   /* Normal word-wrap — no pre-line */
        overflow: visible !important;
        height: auto !important;
        font-size: 14px !important;       /* Unchanged — scaling handles visual size */
        line-height: 18px !important;
    }
}

/* 2. Mobiles (up to 767px) */
@media (max-width: 767px) {
    .ana-page-wrapper {
        height: auto !important;
        overflow-x: hidden;
    }

    .ana-layout-container {
        transform: none !important;
        width: 100% !important;
        height: auto !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        padding: 40px 10px 80px !important;
        box-sizing: border-box !important;
        gap: 30px !important;
    }

    .ana-hero {
        position: relative !important;
        height: auto !important;         /* Let hero grow to contain the descriptif card */
        min-height: 85vh !important;
        width: 100% !important;
        top: auto !important;
        left: auto !important;
        margin-bottom: 0 !important;
        overflow: visible !important;    /* Card must not be clipped by hero */
    }

    .ana-descriptif {
        position: relative !important;      /* Normal flow — no absolute clipping */
        bottom: auto !important;
        left: auto !important;
        transform: none !important;
        width: calc(100% - 32px) !important;
        max-width: 420px !important;
        height: auto !important;
        padding: 20px 16px !important;
        box-sizing: border-box !important;
        background-color: #FFFFFF !important;
        border: 1px solid #101010 !important;
        border-radius: 0px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        margin: -60px auto 20px !important;  /* Slight overlap with hero bottom, then normal flow */
        z-index: 100 !important;
    }

    .ana-descriptif-text {
        width: 100% !important;
        height: auto !important;        /* Never clip text */
        overflow: visible !important;   /* Override any inherited overflow */
        text-align: center !important;
        font-size: 14px !important;     /* Keep text size identical to desktop */
        line-height: 18px !important;   /* Keep line height consistent */
        margin: 0 0 12px 0 !important;
        white-space: normal !important; /* Normal word-wrap — no pre-line that blocks reflow */
    }

    /* Stack layout for images like photography gallery */
    .ana-grid {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 30px !important;
        width: 100% !important;
        height: auto !important;
        margin: 0 auto !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
    }

    .ana-img-card {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        width: 100% !important;
        max-width: 500px !important;
        transform: none !important;
        opacity: 1 !important;
        border-radius: 0px !important;
        box-shadow: none !important;
        transition: none !important;
        touch-action: pan-y !important;
        background-size: contain !important;
        background-repeat: no-repeat !important;
        background-position: center !important;
        cursor: zoom-in !important;     /* Show it's clickable */
    }

    .ana-img-card.visible:hover {
        transform: none !important;
        box-shadow: none !important;
        z-index: 1 !important;
    }

    /* Exact aspect ratios to prevent any crop on phone */
    .ana-corp-position { aspect-ratio: 482 / 329 !important; }
    .ana-corp { aspect-ratio: 483 / 321 !important; }
    .ana-bouche { aspect-ratio: 497 / 329 !important; }
    .ana-visage { aspect-ratio: 484 / 318 !important; }
    .ana-main { aspect-ratio: 466 / 321 !important; }
    .ana-nez { aspect-ratio: 497 / 328 !important; }

    /* Selection Section */
    .ana-others-section {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        width: 100% !important;
        max-width: 500px !important;
        margin: 40px auto 0 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
    }

    .ana-selection {
        flex-direction: column !important;
        display: flex !important;
        gap: 16px !important;
        height: auto !important;
        border-radius: 0 !important;
    }

    .ana-selection-card {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 478 / 650 !important;
    }
}

/* =========================================
   LIGHTBOX GALERIE PLEIN ÉCRAN
   ========================================= */
.roca-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.roca-lightbox-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.roca-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.roca-lightbox-img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.roca-lightbox-close {
    position: absolute;
    top: -40px;
    right: -40px;
    color: #fff;
    font-size: 40px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 10px;
    line-height: 1;
    transition: transform 0.2s ease, color 0.2s ease;
}

.roca-lightbox-close:hover {
    transform: scale(1.1);
    color: #ccc;
}

.roca-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 40px;
    padding: 20px 15px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
    border-radius: 4px;
}

.roca-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.roca-lightbox-prev {
    left: -70px;
}

.roca-lightbox-next {
    right: -70px;
}

@media (max-width: 1024px) {
    .roca-lightbox-prev {
        left: 10px;
    }
    .roca-lightbox-next {
        right: 10px;
    }
    .roca-lightbox-close {
        top: -40px;
        right: 0px;
    }
    .roca-lightbox-img {
        max-width: 85vw;
        max-height: 85vh;
    }
}

