/* ===== RESET & VARIABLES ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #f7f6f3;
    --surface: #fff;
    --border: #e0ddd7;
    --text: #1a1a1a;
    --muted: #888;
    --accent: #1a1a1a;
    --font-head: 'Syne', sans-serif;
    --font-mono: 'DM Mono', monospace;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

html {
    font-family: var(--font-head);
    background-color: var(--bg);
    color: var(--text);
    scroll-behavior: smooth;
}

body { overflow-x: hidden; }

/* ===== NAV ===== */
nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.5rem 5rem;
    background: rgba(247, 246, 243, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.4s;
}
nav.scrolled { border-color: var(--border); }

.nav-logo {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -0.01em;
    color: var(--text);
}
nav ul { list-style: none; display: flex; gap: 3rem; align-items: center; }
nav ul a {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--muted);
    text-decoration: none;
    letter-spacing: 0.04em;
    transition: color 0.2s;
}
nav ul a:hover { color: var(--text); }

/* ===== HERO ===== */
#hero {
    min-height: 100vh;
    display: flex; align-items: flex-end;
    padding: 0 5rem 6rem;
    position: relative;
    border-bottom: 1px solid var(--border);
}
.hero-content { max-width: 800px; }

.hero-tag {
    font-family: var(--font-mono); font-size: 0.78rem;
    color: var(--muted); letter-spacing: 0.06em;
    margin-bottom: 1.5rem; display: block;
    opacity: 0; transform: translateY(12px);
    animation: reveal 0.7s var(--ease) 0.2s forwards;
}

h1 {
    font-size: clamp(4.5rem, 11vw, 9rem);
    font-weight: 800;
    line-height: 0.88;
    letter-spacing: -0.04em;
    margin-bottom: 2.5rem;
    opacity: 0; transform: translateY(20px);
    animation: reveal 0.9s var(--ease) 0.35s forwards;
}
.dot { color: var(--muted); }

.hero-sub {
    font-family: var(--font-mono); font-size: 0.85rem;
    color: var(--muted); line-height: 1.9;
    opacity: 0; transform: translateY(12px);
    animation: reveal 0.7s var(--ease) 0.6s forwards;
}

@keyframes reveal {
    to { opacity: 1; transform: translateY(0); }
}

.hero-scroll {
    position: absolute; bottom: 3rem; right: 5rem;
    opacity: 0; animation: reveal 1s var(--ease) 1.2s forwards;
}
.scroll-line {
    width: 1px; height: 80px;
    background: linear-gradient(to bottom, var(--border), transparent);
    animation: scrollDown 2.5s ease-in-out infinite;
}
@keyframes scrollDown {
    0% { transform: scaleY(0); transform-origin: top; }
    50% { transform: scaleY(1); transform-origin: top; }
    51% { transform: scaleY(1); transform-origin: bottom; }
    100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ===== SECTIONS COMMON ===== */
section { padding: 7rem 5rem; }
.section-label {
    font-family: var(--font-mono); font-size: 0.72rem;
    color: var(--muted); letter-spacing: 0.1em;
    text-transform: uppercase; margin-bottom: 3rem;
    display: block;
}
section > h2 {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800; letter-spacing: -0.03em;
    line-height: 1.05; margin-bottom: 4rem;
    color: var(--text);
}

/* ===== ABOUT ===== */
#about { border-bottom: 1px solid var(--border); }
.about-grid {
    display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 6rem; align-items: start;
}
.about-text h2 {
    font-size: clamp(1.8rem, 3.5vw, 2.6rem);
    font-weight: 800; letter-spacing: -0.03em;
    line-height: 1.1; margin-bottom: 2rem;
}
.about-text p {
    color: #555; line-height: 1.85; font-size: 1rem;
    margin-bottom: 1.2rem;
}
.about-text strong { color: var(--text); font-weight: 700; }

.about-card { border: 1px solid var(--border); }
.card-line {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem; gap: 1rem;
}
.card-line:last-child { border-bottom: none; }
.card-line .label {
    font-family: var(--font-mono); font-size: 0.72rem;
    color: var(--muted); letter-spacing: 0.06em;
    white-space: nowrap; flex-shrink: 0;
}
.card-line span:last-child { color: var(--text); font-weight: 500; text-align: right; }

/* ===== SKILLS ===== */
#skills { background: var(--surface); border-bottom: 1px solid var(--border); }
.skills-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1px;
    border: 1px solid var(--border);
    background: var(--border);
}
.skill-item {
    display: flex; flex-direction: column; align-items: center;
    gap: 1rem; padding: 2.5rem 1.5rem;
    background: var(--surface);
    transition: background 0.2s;
}
.skill-item:hover { background: var(--bg); }
.skill-logo {
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
}
.skill-logo img { width: 100%; height: 100%; object-fit: contain; }
.logo-placeholder {
    width: 44px; height: 44px;
    border: 1px dashed var(--border);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-mono); font-size: 0.6rem;
    color: var(--muted); letter-spacing: 0.05em;
}
.skill-name {
    font-family: var(--font-mono); font-size: 0.75rem;
    color: var(--muted); letter-spacing: 0.04em;
}

/* ===== PROJECTS ===== */
#projects { border-bottom: 1px solid var(--border); }
.projects-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}
.project-card {
    display: flex; flex-direction: column;
    border: 1px solid var(--border);
    text-decoration: none; color: inherit;
    background: var(--surface);
    transition: border-color 0.25s, transform 0.3s var(--ease);
}
.project-card:hover {
    border-color: var(--text);
    transform: translateY(-3px);
}

.project-img {
    width: 100%; aspect-ratio: 16/9;
    overflow: hidden; background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: relative;
}
.project-img img {
    width: 100%; height: 100%; object-fit: cover;
    display: block;
    transition: transform 0.4s var(--ease);
}
.project-card:hover .project-img img { transform: scale(1.03); }

/* Placeholder visible uniquement si l'image n'existe pas */
.img-placeholder {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-mono); font-size: 0.72rem;
    color: var(--muted); letter-spacing: 0.08em;
    border: 1px dashed var(--border);
}
.project-img img ~ .img-placeholder { display: none; }
.project-img img:not([src]), .project-img img[src=""] { display: none; }

.project-body {
    padding: 1.75rem;
    display: flex; flex-direction: column; gap: 0.75rem; flex: 1;
}
.project-num {
    font-family: var(--font-mono); font-size: 0.7rem;
    color: var(--muted); letter-spacing: 0.08em;
}
.project-body h3 {
    font-size: 1.2rem; font-weight: 700;
    letter-spacing: -0.02em; line-height: 1.2;
}
.project-body p {
    color: #666; font-size: 0.88rem; line-height: 1.7; flex: 1;
}
.project-tags {
    display: flex; gap: 0.4rem; flex-wrap: wrap;
    margin-top: 0.25rem;
}
.project-tags span {
    font-family: var(--font-mono); font-size: 0.68rem;
    color: var(--muted); border: 1px solid var(--border);
    padding: 0.2rem 0.55rem; letter-spacing: 0.04em;
}
.project-link {
    font-family: var(--font-mono); font-size: 0.75rem;
    color: var(--muted); letter-spacing: 0.04em;
    margin-top: 0.5rem;
    transition: color 0.2s;
}
.project-card:hover .project-link { color: var(--text); }

/* ===== CONTACT ===== */
#contact { border-bottom: 1px solid var(--border); }
.contact-inner { max-width: 560px; }
.contact-inner h2 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800; letter-spacing: -0.04em;
    line-height: 1; margin-bottom: 1.5rem;
}
#contact p {
    color: #666; line-height: 1.8; font-size: 1rem;
    margin-bottom: 2.5rem;
}
.contact-link {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--text);
    padding-bottom: 2px;
    transition: opacity 0.2s;
    letter-spacing: 0.02em;
}
.contact-link:hover { opacity: 0.5; }

/* ===== FOOTER ===== */
footer {
    padding: 2rem 5rem;
    display: flex; justify-content: space-between; align-items: center;
    color: var(--muted);
    font-family: var(--font-mono); font-size: 0.72rem;
    letter-spacing: 0.04em;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
    .skills-grid { grid-template-columns: repeat(3, 1fr); }
    .projects-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
    nav { padding: 1.2rem 2rem; }
    nav ul { gap: 2rem; }
    section, #hero, footer { padding-left: 2rem; padding-right: 2rem; }
    #hero { padding-bottom: 4rem; }
    .hero-scroll { right: 2rem; }
    .about-grid { grid-template-columns: 1fr; gap: 3rem; }
    .projects-grid { grid-template-columns: 1fr; }
    .skills-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
    nav ul li:not(:last-child) { display: none; }
    .skills-grid { grid-template-columns: repeat(3, 1fr); }
}


.img-caption {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 1rem;
    line-height: 1.5;
    border-left: 1px solid var(--border);
    padding-left: 1rem;
}

.gallery-item {
    margin-bottom: 4rem;
}

.gallery-item img {
    width: 100%;
    display: block;
    border: 1px solid var(--border);
}

/* ===== PROJECT PAGES SPECIFIC (Grille de Détails 2x2) ===== */
.project-page nav {
    background: var(--bg);
}

.project-header {
    padding: 12rem 5rem 4rem;
    max-width: 1200px;
    margin: 0 auto;
}

.project-meta {
    display: flex;
    gap: 4rem;
    margin-top: 3rem;
    border-top: 1px solid var(--border);
    padding-top: 2rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.meta-item .label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--muted);
    text-transform: uppercase;
}

.meta-item span:not(.label) {
    font-size: 0.9rem;
    font-weight: 600;
}

.meta-item a {
    color: var(--text);
    text-decoration: underline;
}

/* --- Section Image Principale (Pleine Largeur du Conteneur) --- */
.project-hero-img-container {
    padding: 0 5rem;
    margin-bottom: 8rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.project-hero-img {
    width: 100%;
    border: 1px solid var(--border);
    overflow: hidden;
    position: relative; /* Pour l'overlay */
}

.project-hero-img img {
    width: 100%;
    display: block;
    transition: transform 0.6s var(--ease);
}

/* Effet au survol (Hero) */
.img-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s var(--ease);
}

.project-hero-img:hover img {
    transform: scale(1.05);
}

.project-hero-img:hover .img-overlay {
    opacity: 1;
}

.overlay-text {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: white;
    letter-spacing: 0.05em;
    transform: translateY(10px);
    transition: transform 0.4s var(--ease) 0.1s;
}

.project-hero-img:hover .overlay-text {
    transform: translateY(0);
}

/* --- Section Détails (Grille 2 Colonnes pour Texte + Galerie) --- */
.project-details {
    padding: 0 5rem 10rem;
    max-width: 1200px;
    margin: 0 auto;
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr 2fr; /* Texte à 1/3, Galerie à 2/3 pour la grille d'images */
    gap: 8rem;
    align-items: start;
}

/* Ajustements pour le texte */
.details-text h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    margin-top: 0;
}

.details-text p {
    color: #555;
    line-height: 1.8;
    margin-bottom: 2rem;
}

/* --- La Galerie de Détails (Grille 2x2) --- */
.details-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 colonnes égales */
    grid-template-rows: repeat(2, auto); /* 2 lignes auto */
    gap: 3rem; /* Espace entre les images de la grille */
}

.gallery-item {
    width: 100%;
}

.gallery-item img {
    width: 100%;
    border: 1px solid var(--border);
    display: block;
}

/* Légendes communes */
.img-caption {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.5;
    margin-top: 1rem;
    padding-left: 1rem;
    border-left: 1px solid var(--border);}

/* ===== LIGHTBOX ===== */
#lightbox {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(15, 15, 15, 0.92);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
}
#lightbox.active {
    opacity: 1; pointer-events: all;
}
.lb-inner {
    max-width: min(90vw, 1000px);
    width: 100%;
    transform: translateY(16px);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
#lightbox.active .lb-inner {
    transform: translateY(0);
}
.lb-img {
    width: 100%; display: block;
    border: 1px solid rgba(255,255,255,0.1);
    max-height: 80vh; object-fit: contain;
}
.lb-caption {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    line-height: 1.6;
    margin-top: 1.25rem;
    padding-left: 1rem;
    border-left: 1px solid rgba(255,255,255,0.15);
}
.lb-caption strong { color: rgba(255,255,255,0.85); }
.lb-close {
    position: fixed; top: 1.75rem; right: 2rem;
    background: none; border: none;
    color: rgba(255,255,255,0.5);
    font-size: 1.1rem; cursor: pointer;
    font-family: var(--font-mono);
    transition: color 0.2s;
    line-height: 1;
}
.lb-close:hover { color: #fff; }


/* ===== PORTRAIT & ABOUT UPDATED ===== */
.about-grid {
    display: grid;
    grid-template-columns: 220px 1fr 320px;
    grid-template-rows: auto;
    gap: 4rem;
    align-items: start;
}
.about-portrait {
    grid-column: 1;
    grid-row: 1;
    position: sticky;
    top: 6rem;
}
.about-portrait img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    object-position: top;
    filter: grayscale(20%);
    border: 1px solid var(--border);
    display: block;
}
.about-text {
    grid-column: 2;
    grid-row: 1;
}
.about-card {
    grid-column: 3;
    grid-row: 1;
}
.about-card a {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Lien CV dans le texte */
.cv-link {
    display: inline-block;
    margin-top: 1.75rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--text);
    padding-bottom: 2px;
    letter-spacing: 0.04em;
    transition: opacity 0.2s;
}
.cv-link:hover { opacity: 0.45; }

/* Lien CV dans la nav */
.nav-cv {
    border: 1px solid var(--border);
    padding: 0.3rem 0.85rem;
    color: var(--text) !important;
    transition: border-color 0.2s, color 0.2s;
}
.nav-cv:hover { border-color: var(--text); }

/* ===== RESPONSIVE ABOUT ===== */
@media (max-width: 1100px) {
    .about-grid {
        grid-template-columns: 180px 1fr;
        grid-template-rows: auto auto;
    }
    .about-portrait { grid-column: 1; grid-row: 1; position: static; }
    .about-text     { grid-column: 2; grid-row: 1; }
    .about-card     { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 700px) {
    .about-grid { grid-template-columns: 1fr; }
    .about-portrait { width: 140px; }
    .about-text { grid-column: 1; grid-row: 2; }
    .about-card { grid-row: 3; }
}
