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

body {
    font-family: 'Poppins', sans-serif;
    background-color: #ffffff;
    color: #111;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 3.5vw 3vw 2.3vw 3vw; /* top right bottom left */
    width: 100%;
}

.logo {
    grid-column: 1;
    display: flex;
    align-items: center;
    justify-self: start;
}

.logo-img {
    height: 40px;
    display: block;
    object-fit: contain;
}

/* Fallback logic if image fails to load */
img[src=""] + .logo-text {
    display: block;
}
img:not([src=""]) + .logo-text {
    display: none;
}

.logo-text {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    display: none; 
}

.nav-menu {
    grid-column: 2;
    display: flex;
    justify-content: center;
}

.nav-menu ul {
    list-style: none;
    display: flex;
    gap: 3.5rem;
}

.nav-menu a {
    text-decoration: none;
    color: #333;
    font-size: 0.95rem;
    font-weight: 400;
    padding-bottom: 6px;
    transition: all 0.3s ease;
}

/* Swap text logic for 01, 02, 03, 04 */
.nav-menu a[data-main]::before {
    content: attr(data-main);
}
.nav-menu a[data-main]:hover::before,
.nav-menu .dropdown:hover > a[data-main]::before {
    content: attr(data-hover);
}
.nav-menu a[data-main].active::before {
    content: attr(data-hover);
}

.nav-menu a.active {
    border-bottom: 1px solid #111;
    color: #111;
}

.nav-menu a:not([data-main]):hover,
.nav-menu a[data-main]:hover {
    color: #666;
}

/* Main Content */
.portfolio-section {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Centre le contenu verticalement dans l'espace restant */
    padding: 0 3vw;
    width: 100%;
}

/* Slider */
.slider-container {
    position: relative;
    width: 100%;
    aspect-ratio: 2.58 / 1; /* Hauteur réduite de 9% (format plus panoramique) */
    overflow: hidden;
    display: flex;
    align-items: center;
    margin-top: 1.5vh; /* Descend légèrement l'ensemble */
    transform: translateY(1.5vh); /* S'aligner exactement sur .image-grid qui a le même translateY */
}

.slider-image-wrapper {
    width: 100%;
    height: 100%;
    background-color: #f4f4f4; /* Placeholder background */
}

.slider-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Arrow Buttons */
.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(230, 225, 220, 0.85); /* #E6E1DC avec 85% d'opacité */
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 4px; /* Slightly rounded */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background-color 0.3s ease;
}

.slider-btn:hover {
    background-color: #ffffff; /* Devient blanc pur au survol */
}

.slider-btn.prev {
    left: 12px; /* Décollé du bord de l'image */
}

.slider-btn.next {
    right: 12px; /* Décollé du bord de l'image */
}

/* Bottom Caption */
.portfolio-caption {
    text-align: center;
    font-size: 0.77rem; /* Augmenté de 10% */
    padding: 1.5vw 0 1vw;
    color: #111;
    font-weight: 300; /* Matching the ultra-light weight of the caption */
    letter-spacing: 0.03em;
}

/* Slider Indicators */
.slider-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding-bottom: 2vw;
}

.slider-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #d0d0d0;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.slider-dot:hover {
    background-color: #999;
}

.slider-dot.active {
    background-color: #111;
}

/* Navigation Dropdown */
.nav-menu .dropdown {
    position: relative;
    display: inline-block;
}

.nav-menu .dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 120px;
    z-index: 100;
    flex-direction: column;
    gap: 0.3rem; /* Override nav-menu ul default flex gap */
    padding-top: 0.5rem;
}

.nav-menu .dropdown:hover .dropdown-content {
    display: flex;
}

.nav-menu .dropdown-content li {
    display: block;
}

.nav-menu .dropdown-content a {
    display: block;
    width: max-content;
    padding-bottom: 0;
    color: #333;
    font-size: 0.75rem;
}

/* About Page Specific Styles */
.about-section {
    padding: 6vw 3vw 3vw 3vw;
    width: 100%;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.about-text {
    font-size: 1.4rem;
    font-weight: 500;
    line-height: 1.4;
    max-width: 70%;
    margin-bottom: 3.5rem;
}

.about-subtext {
    font-size: 0.85rem;
    color: #666;
    max-width: 35%;
    line-height: 1.6;
}

/* Contact Page Specific Styles */
.contact-section {
    padding: 6vw 3vw 3vw 3vw;
    width: 100%;
    flex-grow: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6rem;
}

.contact-left .contact-title {
    font-size: 2.2rem;
    font-weight: 500;
    line-height: 1.3;
    margin-bottom: 2rem;
    max-width: 90%;
}

.contact-left p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    color: #333;
}

.contact-info {
    margin-top: 2rem;
    font-size: 1rem;
    font-weight: 500;
}

.social-links {
    margin-top: 2rem;
}

.social-links a {
    display: block;
    color: #111;
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.form-group input,
.form-group textarea {
    padding: 0.6rem;
    border: 1px solid #ccc;
    outline: none;
    font-family: inherit;
    font-size: 1rem;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.submit-btn {
    align-self: flex-start;
    padding: 0.7rem 2rem;
    background: transparent;
    border: 1.5px solid #111;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    background: #111;
    color: #fff;
}

/* Grid Page Specific Styles */
.grid-section {
    width: 100%;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 3vw;
}

.grid-wrapper {
    width: 100%;
    aspect-ratio: 2.58 / 1;
    display: flex;
    align-items: center; /* Centré verticalement par rapport à la zone */
    margin-top: 1.5vh;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    width: 100%;
    transform: translateY(1.5vh); /* Décale très légèrement, réduit de moitié */
}

.image-grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
    max-width: 800px; /* Prevent vignettes from becoming too large */
    margin: 0 auto;
}

.image-grid.cols-3 {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.image-grid.cols-3 .grid-item {
    width: calc(25% - 1.125rem);
}

/* Page 04 : 2 vignettes centrées (colonnes 2 et 3 sur 4) */
.image-grid.cols-2-center .grid-item:nth-child(1) {
    grid-column: 2;
}
.image-grid.cols-2-center .grid-item:nth-child(2) {
    grid-column: 3;
}

.grid-item {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.grid-item img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.grid-item-title {
    font-size: 0.95rem;
    font-weight: 400;
    color: #333;
    text-align: left;
}

.grid-caption-spacer {
    padding: 1.5vw 0 3vw;
    font-size: 0.77rem; 
    line-height: inherit;
    visibility: hidden;
}
.grid-caption-spacer::after {
    content: "\00A0"; 
}

/* =========================================================================
   MEDIA QUERIES - RESPONSIVE DESIGN (Smartphones & Tablettes)
   ========================================================================= */

/* Tablettes et petits ordinateurs (jusqu'à 1024px) */
@media (max-width: 1024px) {
    .nav-menu ul {
        gap: 1.5rem;
    }
    
    .about-text {
        max-width: 90%;
    }
    
    .about-subtext {
        max-width: 60%;
    }
}

/* Hamburger Menu Setup */
.menu-checkbox {
    display: none;
}

.hamburger {
    display: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    z-index: 1000;
}

.hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: #111;
    transition: all 0.3s ease;
}

/* Smartphones et petites tablettes (jusqu'à 768px), et mode paysage sur mobile */
@media (max-width: 768px), (max-height: 600px) and (orientation: landscape) {
    /* Header et Navigation */
    .header {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding: 7.5vw 4vw !important;
        position: relative;
    }
    
    .logo {
        justify-self: start;
    }

    .logo-img {
        margin-left: 0 !important;
    }
    
    .logo-img[src*="logo.png"] {
        height: 32px; /* 80% de la taille de base de 40px */
    }

    .logo-img[src*="cyril"] {
        height: 34px; 
        margin-left: 1.5vw !important; /* Décaler légèrement vers la droite */
        transform: translateY(-4px) !important; /* Remonter légèrement */
    }
    
    .hamburger {
        display: flex;
        margin-right: 1.5vw;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: #fff;
        padding: 0.8rem 0;
        box-shadow: 0 4px 6px rgba(0,0,0,0.05);
        z-index: 999;
    }

    .menu-checkbox:checked ~ .nav-menu {
        display: flex;
        flex-direction: column;
    }

    .nav-menu ul {
        flex-direction: column;
        align-items: center;
        gap: 0.6rem;
    }
    
    .nav-menu a {
        font-size: 0.85rem;
    }
    
    /* Mettre le texte des menus principaux en gras */
    .nav-menu > ul > li > a {
        font-weight: 600;
    }
    
    /* Ne plus afficher les numéros (01, 02...) sur mobile, afficher directement le texte descriptif */
    .nav-menu a[data-main]::before {
        content: attr(data-hover) !important;
    }
    
    .nav-menu .dropdown {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .nav-menu .dropdown-content {
        position: static;
        display: flex;
        box-shadow: none;
        padding-left: 0;
        padding-top: 0.2rem;
        padding-bottom: 0.2rem;
        align-items: center;
        gap: 0.15rem;
    }
    
    .nav-menu .dropdown-content a {
        font-size: 0.75rem; /* Réduire légèrement les sous-menus */
    }

    /* Fullscreen Portfolio Slider Layout */
    .portfolio-section {
        display: grid;
        grid-template-columns: 60px 1fr 60px;
        grid-template-rows: auto auto auto;
        padding: 0;
    }
    
    .slider-container {
        display: contents;
    }
    
    .slider-image-wrapper {
        grid-column: 1 / -1;
        grid-row: 1;
        height: 45vh;
        width: 100%;
        background-color: #f4f4f4;
        margin-top: 9.5vh !important;
    }
    
    .slider-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .slider-btn {
        position: static;
        transform: none;
        background: transparent;
        width: 100%;
        height: auto;
    }
    
    .slider-btn:hover {
        background: transparent;
    }
    
    .slider-btn.prev {
        grid-column: 1;
        grid-row: 2;
        left: auto;
    }
    
    .slider-btn.next {
        grid-column: 3;
        grid-row: 2;
        right: auto;
    }
    
    .portfolio-caption {
        grid-column: 2;
        grid-row: 2;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.5rem 0;
        font-size: 0.8rem;
        transform: none !important; /* Annule le transform de la vue desktop */
    }
    
    .slider-indicators {
        grid-column: 1 / -1;
        grid-row: 3;
        display: flex !important;
        padding-bottom: 1.5rem;
    }

    /* Grilles d'images (portfolio) */
    .image-grid {
        grid-template-columns: 1fr !important; /* 1 colonne (verticale) par défaut sur mobile portrait */
        gap: 1.5rem;
        transform: translateY(0) !important;
    }
    
    .image-grid.cols-3 {
        display: grid !important;
        grid-template-columns: 1fr !important;
    }
    
    .image-grid.cols-3 .grid-item {
        width: 100% !important; /* Reset la largeur du flex item puisqu'il devient un élément de grille */
    }
    
    .image-grid.cols-2-center .grid-item:nth-child(1) {
        grid-column: 1; 
    }
    .image-grid.cols-2-center .grid-item:nth-child(2) {
        grid-column: 2; 
    }
    
    .grid-wrapper {
        aspect-ratio: auto;
        height: auto;
        align-items: flex-start;
        margin-top: 0 !important;
    }
    
    .grid-item {
        gap: 0.5rem;
    }

    /* Page Contact */
    .contact-section {
        grid-template-columns: 1fr;
        gap: 3rem;
        padding-top: 2rem;
    }
    
    .contact-left .contact-title {
        max-width: 100%;
        font-size: 1.8rem;
    }
    
    /* Page À propos */
    .about-text {
        font-size: 1.1rem;
        max-width: 100%;
        margin-bottom: 2rem;
    }
    
    .about-subtext {
        max-width: 100%;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Ajustements spécifiques pour le mode paysage sur mobile (pour éviter le scroll) */
@media (max-height: 600px) and (orientation: landscape) {
    .header {
        height: 15vh !important;
        padding: 0 4vw !important; /* Centrage vertical automatique du flex */
        margin: 0 !important;
    }
    
    .logo-img[src*="logo.png"] {
        height: 24px !important; /* Plus petit */
    }
    
    .logo-img[src*="cyril"] {
        transform: translateY(0) !important; /* Descendre légèrement */
    }
    
    .hamburger {
        width: 26px;
        height: 20px;
        gap: 5px;
    }

    /* Si le menu est ouvert, prendre moins de place */
    .nav-menu {
        padding: 0.3rem 0;
    }
    .nav-menu ul {
        gap: 0.4rem;
    }
    .nav-menu a {
        font-size: 0.8rem;
    }
    
    .slider-image-wrapper {
        height: 70vh !important; 
        margin-top: 0 !important; /* Aucune marge, l'espacement est géré par la hauteur du header */
    }
    
    .portfolio-caption {
        height: 15vh !important; /* Même hauteur que le header (équilibre haut/bas parfait) */
        padding: 0 !important;
        font-size: 0.75rem !important;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .slider-btn {
        height: 15vh !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    .slider-btn svg {
        width: 24px;
        height: 24px;
    }

    .slider-indicators {
        position: absolute !important;
        top: 0 !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        height: 15vh !important;
        align-items: center !important;
        padding: 0 !important;
        z-index: 900 !important;
    }

    /* Grilles d'images (portfolio 2 et 3) */
    .image-grid,
    .image-grid.cols-3 {
        display: flex !important;
        flex-direction: row !important; /* Alignées horizontalement */
        width: 100% !important; /* Sur toute la largeur */
        max-width: none !important;
        margin: 8vh 0 0 0 !important; /* Descendre les vignettes (augmente marge haut, réduit bas) */
        gap: 1rem;
    }

    .grid-item {
        flex: 1; /* Remplissent équitablement l'espace */
        gap: 0.3rem;
    }

    .grid-item-title {
        font-size: 0.75rem; /* Réduire le texte du titre */
    }
}

/* Très petits écrans (jusqu'à 480px) */
@media (max-width: 480px) {
    .image-grid {
        grid-template-columns: 1fr !important;
    }
    
    .image-grid.cols-2-center .grid-item:nth-child(2) {
        grid-column: 1; /* Recentrer pour la vue 1 colonne */
    }

    .nav-menu ul {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
}
