/* Reset et base */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: sans-serif; overflow: hidden; }

/* Dat.GUI fix */
.dg { color: #eee; font: 11px 'Lucida Grande', sans-serif; text-shadow: none; }
.dg.main { width: 300px !important; }
.close-button { width: 300px !important; }

/* Header */
header { background: #000; color: #fff; display: flex; align-items: center; padding: 10px 20px; position: relative; z-index: 1200; border-bottom: 1px dashed #fff; }
.header-left, .header-center, .header-right { flex: 0 0 auto; }
.header-center { flex: 1; text-align: center; }
.header-right { display: flex; align-items: center; gap: 20px; }

/* Logo */
header .logo img { height: 60px; width: auto; transition: height 0.3s ease; }

/* Navigation Desktop */
header nav ul { list-style: none; display: flex; gap: 20px; justify-content: center; align-items: center; }
header nav ul li a { color: #fff; text-decoration: none; font-weight: 500; }

/* Dropdown */
header nav ul li.dropdown { position: relative; }
header nav ul li.dropdown ul.dropdown-content { display: none; position: absolute; top: 100%; left: 0; background: #000; padding: 10px 0; list-style: none; min-width: 250px; text-align: left; z-index: 1100; }
header nav ul li.dropdown:hover ul.dropdown-content { display: block; }
header nav ul li.dropdown ul.dropdown-content li a { padding: 15px 15px; display: block; color: #fff; text-decoration: none; }
header nav ul li.dropdown ul.dropdown-content li a:hover { background: #333; }
header nav ul li.dropdown > a .submenu-icon { margin-left: 5px; font-size: 0.8em; }

/* Hover effects */
.header-center a:hover { border-bottom-style: solid; padding-bottom: 8px; border-width: 8px; border-color: #ffdd00; }
.header-center a { border-bottom-style: solid; padding-bottom: 8px; border-width: 8px; border-color: #2b2b2b; }

/* Mobile Menu */
.menu-toggle { display: none; font-size: 24px; cursor: pointer; }
.mobile-menu-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #000; color: #fff; display: none; flex-direction: column; z-index: 1500; padding: 20px; overflow-y: auto; }
.mobile-menu-overlay .menu-close { align-self: flex-end; font-size: 24px; cursor: pointer; }
.mobile-menu-overlay nav ul { list-style: none; display: flex; flex-direction: column; gap: 20px; margin-top: 40px; }
.mobile-menu-overlay li { padding: 4px; border-bottom-style: solid; border-width: 1px; border-color: #2b2b2b; }
.dropdown-content li { margin-bottom: 4px; padding: 8px; display: block; background-color: #2b2b2b; }
.mobile-menu-overlay nav ul li a { color: #fff; font-size: 20px; text-decoration: none; }
.mobile-menu-overlay nav ul li.dropdown { position: relative; }
.mobile-menu-overlay nav ul li.dropdown ul.dropdown-content { display: none; list-style: none; padding-left: 15px; margin-top: 10px; }
.mobile-menu-overlay nav ul li.dropdown.open ul.dropdown-content { display: block; }
.mobile-menu-overlay li.dropdown > a .submenu-icon { margin-left: 5px; font-size: 0.8em; }

/* Buy Me A Coffee */
header .buyme a img { height: 40px; }
.mobile-menu-overlay .buyme { margin-top: auto; text-align: center; }
.mobile-menu-overlay .buyme a img { height: 40px; }
.buyme-mobile a { display: block; padding: 4px; font-size: 22px; text-align: center; color: #000; text-decoration: none; background-color: #FFC107; margin-top: 8px; border-radius: 4px; font-weight: bold; }

/* Containers */
#guiContainer { position: absolute; top: 80px; right: 10px; z-index: 1000; background: rgba(255, 255, 255, 0.9); padding: 10px; border-radius: 5px; padding-bottom: 30px; }
#canvasContainer { position: absolute; top: 80px !important; left: 0; right: 0; bottom: 0; background: #fff; }

/* Responsive */
@media (min-width: 601px) {
  .mobile-menu-overlay { display: none !important; }
  .menu-toggle { display: none; }
  .header-center { display: block; }
}
@media (max-width: 600px) {
  header .logo img { height: 40px; }
  .header-center { display: none; }
  .header-right .buyme { display: none; }
  .menu-toggle { display: block; right: 20px; position: fixed; }
}

/* --- LAB HOME DESIGN --- */

/* Hero Section */
.lab-hero {
    text-align: center;
    padding: 80px 20px 60px;
    background: #fff;
}

.lab-hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -2px;
    margin-bottom: 10px;
    line-height: 1.1;
}

.lab-hero .highlight {
    color: transparent;
    background: linear-gradient(90deg, #000, #555);
    -webkit-background-clip: text;
    background-clip: text;
}

.lab-hero .subtitle {
    font-size: 1.2rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
    font-weight: 300;
}

/* Grille Wrapper */
.lab-grid-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px 100px;
}

/* La Bento Grid */
.bento-grid {
    display: grid;
    /* Responsive automatique : colonnes de min 350px */
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

/* La Carte */
.lab-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Effet Hover : La carte monte et l'ombre apparait */
.lab-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
    border-color: transparent;
}

/* Image container */
.card-image {
    height: 220px;
    position: relative;
    overflow: hidden;
    background: #f4f4f4;
}

.lab-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

/* Zoom image au hover */
.lab-card:hover .lab-thumb {
    transform: scale(1.05);
}

/* Badges */
.card-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.badge-tool { color: #000; border: 1px solid #000; }
.badge-exp { color: #666; border: 1px solid #ccc; }

/* Contenu Texte */
.card-content {
    padding: 25px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-content h2 {
    font-size: 1.4rem;
    margin-bottom: 10px;
    font-weight: 700;
    line-height: 1.3;
}

.card-content .description {
    font-size: 0.95rem;
    color: #777;
    margin-bottom: 20px;
    line-height: 1.6;
    flex-grow: 1; /* Pousse le lien vers le bas */
}

.read-more {
    font-size: 0.9rem;
    font-weight: 600;
    color: #000;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.lab-card:hover .read-more {
    opacity: 1;
}

/* Placeholder si pas d'image */
.no-image {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #ddd;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .lab-hero h1 { font-size: 2.5rem; }
    .lab-grid-wrapper { padding: 0 20px 60px; }
    .bento-grid { grid-template-columns: 1fr; } /* 1 colonne sur mobile */
}


body.page-home {
    overflow: auto !important;
}


/* --- INFO BUTTON & MODAL --- */

/* Le Bouton Flottant (i) */
#info-trigger {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 50px;
    height: 50px;
    background: #000;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    z-index: 2000; /* Au-dessus de tout */
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: transform 0.3s ease, background 0.3s;
}

#info-trigger:hover {
    transform: scale(1.1) rotate(10deg);
    background: #333;
}

/* L'Overlay (Fond sombre plein écran) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px); /* Effet de flou moderne */
    -webkit-backdrop-filter: blur(8px);
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

/* Quand la modale est active */
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* La Carte Modale (Boite blanche) */
.modal-card {
    background: #fff;
    width: 90%;
    max-width: 600px;
    max-height: 80vh; /* Max 80% de la hauteur de l'écran */
    border-radius: 12px;
    position: relative;
    padding: 40px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    overflow-y: auto; /* Scroll si le texte est trop long */
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

/* Bouton Fermer (X) */
.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #000;
}

/* Typographie de la modale */
.modal-body h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.8rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.modal-text {
    line-height: 1.6;
    color: #444;
    font-size: 1rem;
}

/* Ajustement Mobile */
@media (max-width: 600px) {
#info-trigger {
        bottom: 20px;
        left: 20px; /* Modification ici aussi */
        width: 45px;
        height: 45px;
    }
    .modal-card {
        padding: 25px;
        width: 95%;
    }
}