/* Déclaration de la police locale Bootzy TM (Dossier src/font/) */
@font-face {
    font-family: 'Bootzy TM';
    src: url('src/font/BootzyTM.otf') format('opentype'),
         url('src/font/BootzyTM.ttf') format('truetype'),
         url('src/font/BootzyTM.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Variables Thème Jour (Rose #ff8fab) */
:root {
    --bg-color: #ffffff;
    --text-primary: #222222;
    --text-title: #1a1a1a;
    --accent-color: #ff8fab;
    --btn-bg: #ff8fab;
    --btn-hover-bg: #ff7597;
    --btn-text: #ffffff;
    --btn-shadow: rgba(255, 143, 171, 0.3);
    --btn-shadow-hover: rgba(255, 143, 171, 0.45);
    --nav-link-color: #2b2b2b;
    --toolbar-bg: #f9f9fb;
    --border-color: #eaeaea;
    --dropdown-bg: #ffffff;
    --dropdown-border: rgba(0, 0, 0, 0.08);
    --gutter-mobile: max(20px, env(safe-area-inset-left));
    --gutter-mobile-right: max(20px, env(safe-area-inset-right));
}

/* Variables Thème Nuit (Jaune #fdd38b) */
body.dark-mode {
    --bg-color: #121214;
    --text-primary: #f0f0f0;
    --text-title: #ffffff;
    --accent-color: #fdd38b;
    --btn-bg: #fdd38b;
    --btn-hover-bg: #fcc263;
    --btn-text: #121214;
    --btn-shadow: rgba(253, 211, 139, 0.2);
    --btn-shadow-hover: rgba(253, 211, 139, 0.35);
    --nav-link-color: #e0e0e0;
    --toolbar-bg: #1c1c22;
    --border-color: #2a2a32;
    --dropdown-bg: #1b1b1f;
    --dropdown-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    overflow-x: clip;
}

body {
    font-family: 'Figtree', 'Montserrat', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Navbar */
.navbar {
    width: 100%;
    padding: 30px 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    background-color: var(--bg-color);
    z-index: 1000;
    transition: background-color 0.4s ease;
}

.home-icon {
    position: absolute;
    left: 50px;
    width: 28px;
    height: 28px;
    color: var(--nav-link-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1002;
    transition: transform 0.2s ease, color 0.3s ease;
}

.home-icon:hover {
    transform: scale(1.15);
    color: var(--accent-color);
}

.home-icon svg {
    width: 100%;
    height: 100%;
}

/* Bouton burger caché sur bureau */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--nav-link-color);
    padding: 6px;
    z-index: 1002;
}

.nav-panel {
    display: contents;
}

.nav-links {
    display: inline-flex;
    gap: 15px;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 700;
}

.nav-links a {
    text-decoration: none;
    color: var(--nav-link-color);
    transition: opacity 0.2s, color 0.3s ease;
}

.nav-links a:hover {
    opacity: 0.6;
}

.nav-links span {
    color: var(--accent-color);
    font-size: 1.2rem;
}

.nav-controls {
    position: absolute;
    right: 50px;
    display: flex;
    align-items: center;
    gap: 18px;
}

.control-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Figtree', sans-serif;
    font-size: 0.95rem;
    color: var(--nav-link-color);
    display: flex;
    align-items: center;
    gap: 4px;
}

.lang-option {
    opacity: 0.4;
    font-weight: 700;
}

.lang-option.active {
    opacity: 1;
    color: var(--accent-color);
}

.lang-divider {
    opacity: 0.3;
}

.theme-icon {
    font-size: 1.3rem;
    color: var(--accent-color);
}

/* Zone Principale */
.main-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding-top: 90px;
    padding-bottom: 80px;
    width: 100%;
}

/* Scène 3D centrée */
.scene {
    perspective: 1200px;
    cursor: grab;
    user-select: none;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.scene:active {
    cursor: grabbing;
}

/* Carte 3D */
.card-3d {
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.1s ease-out;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 280px;
    min-height: 400px;
}

.card-3d.is-dragging {
    transition: none;
}

/* Faces Avant & Arrière */
.card-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 16px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.22);
    display: flex;
    justify-content: center;
    align-items: center;
}

.card-face img {
    display: block;
    max-height: 75vh;
    max-width: 75vw;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 16px;
    pointer-events: none;
}

.card-front {
    transform: rotateY(0deg) translateZ(1px);
}

.card-back {
    transform: rotateY(180deg) translateZ(1px);
}

/* Barre de Zoom VERTICALE positionnée à droite avec espace par rapport au bord */
.zoom-toolbar {
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    background: var(--toolbar-bg);
    border: 1px solid var(--border-color);
    padding: 20px 12px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    z-index: 50;
}

.zoom-icon {
    font-size: 1.1rem;
}

#zoomRange {
    writing-mode: vertical-lr;
    direction: rtl;
    appearance: slider-vertical;
    width: 8px;
    height: 120px;
    accent-color: var(--accent-color);
    cursor: pointer;
}

.zoom-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
}

/* Bouton Réinitialiser vertical */
.reset-btn {
    background: none;
    border: none;
    font-family: 'Figtree', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-color);
    cursor: pointer;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    writing-mode: horizontal-tb;
    transition: opacity 0.2s ease;
}

.reset-btn:hover {
    opacity: 0.7;
}

/* Bouton Flottant Bas Droit (CV PDF) */
.bottom-actions {
    position: fixed;
    bottom: 30px;
    right: 50px;
    z-index: 100;
}

.btn-portfolio {
    display: inline-block;
    padding: 14px 36px;
    background-color: var(--btn-bg);
    color: var(--btn-text);
    border-radius: 50px;
    text-decoration: none;
    font-family: 'Figtree', sans-serif;
    font-weight: 800;
    font-size: 1.05rem;
    text-transform: lowercase;
    transition: transform 0.25s ease, background-color 0.3s ease, box-shadow 0.25s ease;
    box-shadow: 0 4px 15px var(--btn-shadow);
}

.btn-portfolio:hover {
    transform: scale(1.05);
    background-color: var(--btn-hover-bg);
    box-shadow: 0 6px 20px var(--btn-shadow-hover);
}

/* =========================================
   ADAPTABILITÉ MOBILE, MENU DÉROULANT & POLICE
   ========================================= */
@media (max-width: 900px) {
    .navbar {
        padding: max(18px, env(safe-area-inset-top)) var(--gutter-mobile-right) 18px var(--gutter-mobile);
        justify-content: space-between;
    }

    .home-icon {
        position: static;
        flex-shrink: 0;
        width: 26px;
        height: 26px;
    }

    .mobile-menu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-left: auto;
        flex-shrink: 0;
        width: 40px;
        height: 40px;
        border-radius: 10px;
        transition: background-color 0.2s ease, color 0.2s ease;
    }

    .mobile-menu-btn:hover {
        color: var(--accent-color);
    }

    .burger-lines,
    .burger-lines::before,
    .burger-lines::after {
        display: block;
        width: 22px;
        height: 2.5px;
        background-color: currentColor;
        border-radius: 2px;
        position: relative;
        transition: transform 0.25s ease, opacity 0.2s ease;
    }

    .burger-lines::before,
    .burger-lines::after {
        content: "";
        position: absolute;
        left: 0;
    }

    .burger-lines::before { top: -7px; }
    .burger-lines::after { top: 7px; }

    .mobile-menu-btn[aria-expanded="true"] .burger-lines {
        background-color: transparent;
    }
    .mobile-menu-btn[aria-expanded="true"] .burger-lines::before {
        top: 0;
        transform: rotate(45deg);
    }
    .mobile-menu-btn[aria-expanded="true"] .burger-lines::after {
        top: 0;
        transform: rotate(-45deg);
    }

    /* Menu déroulant ancré à droite sous le bouton */
    .nav-panel {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 14px;
        position: absolute;
        top: 100%;
        right: var(--gutter-mobile-right);
        left: auto;
        width: min(260px, calc(100vw - var(--gutter-mobile) - var(--gutter-mobile-right)));
        background-color: var(--dropdown-bg);
        border: 1px solid var(--dropdown-border);
        border-radius: 18px;
        padding: 18px 20px;
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.14);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
        z-index: 999;
    }

    .nav-panel.is-open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .nav-links {
        width: 100%;
        flex-direction: column;
        align-items: flex-end;
        gap: 12px;
        font-size: 1.05rem;
    }

    .nav-dot {
        display: none;
    }

    .nav-controls {
        position: static;
        width: 100%;
        justify-content: space-between;
        padding-top: 12px;
        border-top: 1px solid var(--dropdown-border);
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
        padding-top: 84px;
        padding-bottom: max(88px, calc(76px + env(safe-area-inset-bottom)));
        padding-left: var(--gutter-mobile);
        padding-right: var(--gutter-mobile-right);
    }

    .scene {
        padding: 12px;
    }

    .card-3d {
        min-width: 220px;
        min-height: 320px;
    }

    .card-face img {
        max-height: 55vh;
        max-width: 82vw;
    }

    /* Sur mobile, repasse la barre à l'horizontale en bas pour le confort tactile */
    .zoom-toolbar {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        flex-direction: row;
        margin-top: 12px;
        padding: 8px 15px;
        gap: 10px;
    }

    #zoomRange {
        writing-mode: horizontal-tb;
        direction: ltr;
        width: 90px;
        height: 8px;
        appearance: auto;
    }

    .reset-btn {
        padding-top: 0;
        padding-left: 10px;
        border-top: none;
        border-left: 1px solid var(--border-color);
    }

    .bottom-actions {
        right: var(--gutter-mobile-right);
        bottom: max(20px, env(safe-area-inset-bottom));
    }

    .btn-portfolio {
        padding: 12px 28px;
        font-size: 0.98rem;
    }
}