/* ========================================
   Leonard - Constellation des Tendances
   Custom Styles
======================================== */

/* ========================================
   Font Face - Vinci Sans
======================================== */
@font-face {
    font-family: 'Vinci Sans';
    src: url('../fonts/VinciSans.woff2') format('woff2'),
    url('../fonts/VinciSans.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vinci Sans';
    src: url('../fonts/VinciSans-Medium.woff2') format('woff2'),
    url('../fonts/VinciSans-Medium.woff') format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vinci Sans';
    src: url('../fonts/VinciSans-Bold.woff2') format('woff2'),
    url('../fonts/VinciSans-Bold.woff') format('woff');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vinci Sans Extra';
    src: url('../fonts/VinciSans-ExtraLight.woff2') format('woff2'),
    url('../fonts/VinciSans-ExtraLight.woff') format('woff');
    font-weight: 200;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vinci Sans';
    src: url('../fonts/VinciSans-Light.woff2') format('woff2'),
    url('../fonts/VinciSans-Light.woff') format('woff');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}



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

html {
    overflow: auto;
    scroll-behavior: smooth;
}

body {
    font-family: 'Vinci Sans', system-ui, sans-serif;
    background-color: #8B8B8B;
    color: white;
    overflow: auto;
    min-height: 100vh;
    /* Support for notch/safe areas */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Prevent pull-to-refresh on mobile */
body {
    overscroll-behavior-y: contain;
}

/* Prevent text selection on touch interactions */
.constellation-node {
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Animation scroll indicator */
@keyframes bounce-slow {
    0%, 100% {
        transform: translateY(0) scale(-1);
    }
    50% {
        transform: translateY(8px) scale(-1);
    }
}

.animate-bounce-slow {
    animation: bounce-slow 1.5s ease-in-out infinite;
}

/* Désactiver les interactions sur les éléments sans lien */
.constellation-node.no-link {
    pointer-events: none;
}

/* ========================================
   Sections
======================================== */
.section-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: #9F9BA1;
}

.section-screen.hidden,
#introduction.hidden {
    display: none !important;
}

#introduction {
    display: block;
    position: relative;
    background-color: #8B8B8B;
}

#constellation {
    display: block;
}

#conclusion {
    display: flex;
    align-items: center;
}

/* ========================================
   Loader
======================================== */
.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#loader.hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease-out;
}

/* ========================================
   Introduction Shapes
======================================== */
.intro-shape {
    position: absolute;
    background: linear-gradient(135deg, #4A7CC9 0%, #6B4C9A 50%, #D64C7E 100%);
    opacity: 0.8;
}

.intro-shape.shape-1 {
    width: 80px;
    height: 200px;
    top: 10%;
    left: 10%;
    border-radius: 40px;
    transform: rotate(-15deg);
}

.intro-shape.shape-2 {
    width: 60px;
    height: 60px;
    top: 20%;
    left: 5%;
    border-radius: 8px;
}

.intro-shape.shape-3 {
    width: 200px;
    height: 50px;
    top: 15%;
    right: 10%;
    border-radius: 25px;
}

.intro-shape.shape-4 {
    width: 180px;
    height: 40px;
    top: 25%;
    right: 5%;
    border-radius: 20px;
}

.intro-shape.shape-5 {
    width: 120px;
    height: 120px;
    bottom: 15%;
    left: 8%;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
}

/* ========================================
   Constellation Section
======================================== */
#constellation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

#constellation-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#constellation-container svg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* Constellation interactive elements */
.constellation-node {
    cursor: pointer;
    transition: filter 0.3s ease, transform 0.3s ease;
}

.constellation-node:hover {
    filter: brightness(1.1);
}

.constellation-node.active {
    filter: brightness(1.1);
}

/* Effet "on" halo lumineux UNIQUEMENT sur niveau 3 */
.level-3-node.active {
    filter: brightness(1.1) drop-shadow(0 0 20px rgba(255, 255, 255, 0.8)) drop-shadow(0 0 40px rgba(255, 255, 255, 0.4));
}

/* ========================================
   Popins - Base Styles
======================================== */
.popin-card {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 30;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.popin-card.open {
    opacity: 1;
    pointer-events: auto;
}

/* ========================================
   Popin Level 1 - Style Brief
======================================== */
.popin-level1 {
    width: 320px;
    max-width: calc(100vw - 40px);
}

.popin-container {
    position: relative;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.15));
}

/* Bouton fermer la popin */
.popin-close {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.2s ease;
}

.popin-close:hover {
    background: white;
    color: #333;
    transform: scale(1.1);
}

/* Partie haute violette */
.popin-header {
    display: flex;
    justify-content: flex-end;
    position: relative;
    z-index: 2;
    margin-bottom: -1px; /* Éviter le gap entre header et body */
}

.popin-header-inner {
    background: white;
    padding: 14px 18px;
    /* Coins: haut-gauche arrondi, haut-droit arrondi, bas-droit carré (collé au body), bas-gauche avec encoche */
    border-radius: 20px 20px 0 0;
    width: 50%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    position: relative;
}

/* Encoche concave en bas à gauche du header */
.popin-header-inner::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -20px;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle at top left, transparent 20px, white 20px);
}

.popin-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

/* Partie basse blanche */
.popin-body {
    background: white;
    padding: 20px 24px 24px 24px;
    border-radius: 20px 0 20px 20px;
    position: relative;
    z-index: 1;
}

.popin-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #4A4A6A;
    text-transform: uppercase;
    line-height: 1.2;
    margin-bottom: 14px;
    letter-spacing: 0.02em;
}

.popin-separator {
    width: 100%;
    height: 1px;
    background: #4A4A6A;
    margin-bottom: 14px;
    opacity: 0.25;
}

.popin-text {
    color: #6B6B8A;
    font-size: 1.15rem;
    line-height: 1.2;
}

/* ========================================
   Popin Level 3 - Small Style
======================================== */
.popin-small {
    width: 280px;
    max-width: calc(100vw - 40px);
    right: 20px;
    top: auto;
    bottom: 120px;
    transform: translateY(0) translateX(120%);
}

.popin-small.open {
    transform: translateY(0) translateX(0);
}

.popin-small .popin-content {
    padding: 40px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

/* ========================================
   Conclusion Shapes
======================================== */
.outro-shape {
    position: absolute;
    background: linear-gradient(135deg, #4A7CC9 0%, #6B4C9A 50%, #D64C7E 100%);
    opacity: 0.6;
}

.outro-shape.shape-1 {
    width: 100px;
    height: 250px;
    top: 10%;
    right: 5%;
    border-radius: 50px;
}

.outro-shape.shape-2 {
    width: 150px;
    height: 150px;
    bottom: 20%;
    right: 10%;
    border-radius: 50%;
    background: linear-gradient(180deg, #4A7CC9 0%, transparent 100%);
}

.outro-shape.shape-3 {
    width: 80px;
    height: 80px;
    bottom: 10%;
    right: 25%;
    border-radius: 50% 0 50% 50%;
    transform: rotate(45deg);
}

/* ========================================
   Introduction Steps
======================================== */
#intro-scroll-container {
    position: relative;
}

#intro-pinned {
    background-color: #8B8B8B;
}

/* SVG intro animation container */
#intro-svg-container {
    z-index: 5;
}

#intro-svg {
    will-change: transform, opacity;
    transform-origin: center center;
    flex-shrink: 0;
}

#intro-step1,
#intro-step2,
#intro-step3 {
    will-change: opacity, transform;
}

#intro-lines svg line {
    will-change: stroke-dashoffset;
}

/* ========================================
   Animations
======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

/* ========================================
   Touch Feedback - Mobile interactions
======================================== */
.constellation-node:active {
    filter: brightness(1.2);
}

.constellation-node.touch-active {
    filter: brightness(1.15);
    transition: filter 0.1s ease;
}

/* Disable hover on touch devices */
@media (hover: none) and (pointer: coarse) {
    .constellation-node:hover {
        filter: none;
    }

    .constellation-node.active:hover {
        filter: brightness(1.1);
    }
}

/* ========================================
   Responsive - Mobile First Approach
======================================== */

/* Small Mobile (< 480px) */
@media (max-width: 480px) {
    .intro-shape {
        transform: scale(0.4);
    }

    .outro-shape {
        transform: scale(0.35);
    }

    /* Popin Level 1 mobile */
    .popin-level1 {
        right: 8px;
        left: 8px;
        width: auto;
        max-width: none;
        top: auto;
        bottom: 12px;
        max-height: 50vh;
        overflow-y: auto;
        transform: none;
    }

    .popin-header-inner {
        width: 45%;
        padding: 12px 14px;
    }

    .popin-body {
        padding: 16px 18px 18px 18px;
    }

    .popin-title {
        font-size: 0.8rem;
    }

    .popin-text {
        font-size: 0.7rem;
        max-height: 100px;
        overflow: auto;
    }

    /* Popin Level 3 mobile */
    .popin-small {
        right: 8px;
        left: 8px;
        width: auto;
        max-width: none;
        top: auto;
        bottom: 12px;
        max-height: 40vh;
        transform: none;
    }

    .popin-content {
        padding: 16px;
    }

    .popin-small h3 {
        font-size: 0.95rem;
    }

    .popin-small p {
        font-size: 0.8rem;
    }

    /* Bouton retour plus petit */
    #btn-back {
        top: 70px;
        left: 8px;
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    /* Bouton conclusion */
    #btn-to-conclusion {
        bottom: auto;
        top: 70px;
        right: 8px;
        padding: 8px 12px;
        font-size: 0.75rem;
    }
}

/* Standard Mobile (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .intro-shape {
        transform: scale(0.6);
    }

    .outro-shape {
        transform: scale(0.5);
    }

    /* Popin Level 1 */
    .popin-level1 {
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
        top: auto;
        bottom: 16px;
        max-height: 50vh;
        overflow-y: auto;
        transform: none;
    }

    /* Popin Level 3 */
    .popin-small {
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
        top: auto;
        bottom: 16px;
        max-height: 45vh;
        transform: none;
    }

    .popin-content {
        padding: 20px;
    }

    #btn-back {
        top: 80px;
        left: 12px;
    }

    #btn-to-conclusion {
        bottom: auto;
        top: 80px;
        right: 12px;
        font-size: 0.8rem;
    }
}

/* Tablet (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Popin Level 1 */
    .popin-level1 {
        width: 300px;
        right: 16px;
        max-height: 55vh;
        overflow-y: auto;
    }

    /* Popin Level 3 */
    .popin-small {
        width: 260px;
        right: 16px;
        bottom: 100px;
    }

    /* Intro images - réduites */
    #intro-img1 {
        width: 180px !important;
    }
    #intro-img1-1 {
        width: 280px !important;
    }
    #intro-img2 {
        width: 280px !important;
    }
    #intro-img3 {
        width: 420px !important;
    }

    /* Conclusion images */
    #conclusion .absolute img:nth-child(1) {
        width: 120px !important;
    }
    #conclusion .absolute img:nth-child(2) {
        width: 180px !important;
    }
    #conclusion .absolute img:nth-child(3) {
        width: 300px !important;
    }
}

/* Small Desktop (1025px - 1280px) */
@media (min-width: 1025px) and (max-width: 1280px) {
    /* Popin Level 1 - plus petite et bien positionnée */
    .popin-level1 {
        width: 280px;
        right: 16px;
    }

    /* Popin Level 3 */
    .popin-small {
        width: 240px;
        right: 16px;
    }

    /* Intro images - légèrement réduites */
    #intro-img1 {
        width: 220px !important;
    }
    #intro-img1-1 {
        width: 320px !important;
    }
    #intro-img2 {
        width: 340px !important;
    }
    #intro-img3 {
        width: 520px !important;
    }

    /* Conclusion images */
    #conclusion .absolute img:nth-child(1) {
        width: 150px !important;
    }
    #conclusion .absolute img:nth-child(2) {
        width: 220px !important;
    }
    #conclusion .absolute img:nth-child(3) {
        width: 380px !important;
    }
}

/* Large screens (> 1280px) - Default styles apply */

/* ========================================
   Mobile-specific UI adjustments
======================================== */
@media (max-width: 768px) {
    /* Header spacing */
    header {
        padding: 12px 16px;
    }

    /* Language switch smaller */
    #lang-switch {
        padding: 4px 10px;
        font-size: 0.75rem;
    }

    /* Intro text adjustments */
    #intro-step3 .max-w-2xl {
        padding-left: 16px;
        padding-right: 16px;
    }

    /* Touch-friendly tap targets (min 44px) */
    .constellation-node {
        min-width: 44px;
        min-height: 44px;
    }

    /* Conclusion section adjustments */
    #conclusion {
        padding: 60px 16px 20px;
    }

    #btn-back-to-constellation {
        top: 70px;
        left: 12px;
        padding: 8px 14px;
        font-size: 0.85rem;
    }
}

/* Landscape mobile orientation */
@media (max-height: 500px) and (orientation: landscape) {
    .popin-card {
        max-height: 70vh;
        bottom: 10px;
    }

    .popin-small {
        max-height: 65vh;
    }

    #btn-back,
    #btn-to-conclusion {
        top: 60px;
    }
}

/* ========================================
   Stars background effect
======================================== */
.stars-bg {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(2px 2px at 20px 30px, white, transparent),
        radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.5), transparent),
        radial-gradient(1px 1px at 90px 40px, white, transparent),
        radial-gradient(2px 2px at 160px 120px, rgba(255,255,255,0.7), transparent),
        radial-gradient(1px 1px at 230px 80px, white, transparent);
    background-repeat: repeat;
    background-size: 250px 150px;
    opacity: 0.3;
    pointer-events: none;
}

/* ========================================
   Utility classes
======================================== */
.text-gradient {
    background: linear-gradient(135deg, #4A7CC9, #6B4C9A, #D64C7E);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient-leonard {
    background: linear-gradient(135deg, #4A7CC9 0%, #6B4C9A 50%, #D64C7E 100%);
}

/* ========================================
   Low height screens (tablets landscape, small laptops)
======================================== */
@media (max-height: 700px) {
    /* Introduction - réduire l'espacement logo/titre */
    #intro-logo img {
        width: 180px !important;
    }

    #intro-content-2 h1 {
        font-size: 1.8rem !important;
        line-height: 1.2;
    }

    #intro-content-3 .pt-24,
    #intro-content-3 .md\:pt-32 {
        padding-top: 5rem !important;
        max-width: 400px !important;
    }

    #intro-content-3 p {
        font-size: 1.2rem !important;
        margin-bottom: 0.5rem !important;
        line-height: 1.4 !important;
    }

    #intro-content-3 .mb-10 {
        margin-bottom: 1rem !important;
    }

    #intro-content-3 button {
        padding: 0.5rem 1.5rem !important;
    }

    /* Conclusion - rendre scrollable et réduire les tailles */
    #conclusion {
        overflow-y: auto;
        align-items: flex-start !important;
        padding-top: 50px !important;
        padding-bottom: 20px !important;
    }

    #conclusion > .relative.z-10 {
        padding-top: 10px;
        padding-bottom: 20px;
    }

    #conclusion .mb-6 {
        margin-bottom: 0.5rem !important;
    }

    #conclusion .mb-8 {
        margin-bottom: 0.75rem !important;
    }

    #conclusion .mb-4 {
        margin-bottom: 0.25rem !important;
    }

    #conclusion p.text-base,
    #conclusion p.md\:text-2xl {
        font-size: 0.9rem !important;
        line-height: 1.35 !important;
    }

    /* Logo plus petit */
    #conclusion img[alt="Leonard"] {
        width: 120px !important;
    }

    /* Newsletter box */
    #conclusion .border {
        padding: 10px 12px !important;
        margin-bottom: 0.5rem !important;
    }

    #conclusion .border p {
        font-size: 0.8rem !important;
        margin-bottom: 0.5rem !important;
    }

    #conclusion .border input {
        padding: 0.4rem 0.75rem !important;
        font-size: 0.8rem !important;
    }

    /* Social links */
    #conclusion .flex.items-center.gap-4 p {
        font-size: 0.85rem !important;
    }

    /* Formes décoratives plus petites */
    #conclusion > .absolute.inset-0 img {
        transform: scale(0.5) !important;
    }

    .popin-title {
        font-size: 1.3rem;
    }

    .popin-text {
        font-size: 1rem;
    }
}

/* Very low height screens (under 550px) */
@media (max-height: 550px) {
    #intro-logo img {
        width: 150px !important;
    }

    #intro-content-2 h1 {
        font-size: 1.4rem !important;
    }

    #intro-content-3 .pt-24,
    #intro-content-3 .md\:pt-32 {
        padding-top: 2rem !important;
    }

    #intro-content-3 p {
        font-size: 0.8rem !important;
    }

    #conclusion p.text-base,
    #conclusion p.md\:text-2xl {
        font-size: 0.8rem !important;
    }

    /* Cacher les formes décoratives si trop petit */
    #conclusion > .absolute.inset-0.overflow-hidden {
        opacity: 0.3;
    }
}

@media (max-width: 500px) {
    #intro-content-3 {
        padding-top: 70px;
    }
}


.btn-back {
    top: 4.5rem;
    left: 1.5rem;
}



@media (max-height: 800px) {
    #intro-img3 {
        bottom: -60%;
        width: 500px;
    }
}