/* ============================================================
   Portfolio Luc VALETTE : style.css (squelette)
   Fondations seulement : variables des deux themes, remise a zero,
   header, footer, responsive de base. La mise en forme du hero,
   des cartes et des sections viendra avec index.php.
   ============================================================ */

/* ------------------------------------------------------------
   Variables de couleur
   Theme SOMBRE par defaut (identite du site).
   Theme CLAIR applique via [data-theme="light"].
   Valeurs reprises telles quelles du compte rendu.
   ------------------------------------------------------------ */
:root {
    --c-page:          #0a0a0a;
    --c-header:        #111111;
    --c-card:          #161616;
    --c-input:         #1e1e1e;
    --c-title:         #f0f0f0;
    --c-body:          #b0b0b0;
    --c-muted:         #707070;
    --c-border-1:      #1e1e1e;
    --c-border-2:      #2a2a2a;
    --c-border-3:      #3a3a3a;
    --c-accent:        #4ade80;
    --c-accent-bg:     #0d2818;
    --c-accent-border: #22543d;
    --c-tag-bg:        #1a1a1a;
    --c-tag-text:      #888888;
    --c-tag-border:    #2a2a2a;

    /* Jetons non colores, communs aux deux themes */
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
    --maxw: 1080px;
    --radius: 6px;
    --header-h: 4rem;
}

:root[data-theme="light"] {
    --c-page:          #f8f8f8;
    --c-header:        #ffffff;
    --c-card:          #ffffff;
    --c-input:         #f0f0f0;
    --c-title:         #1a1a1a;
    --c-body:          #555555;
    --c-muted:         #888888;
    --c-border-1:      #eeeeee;
    --c-border-2:      #dddddd;
    --c-border-3:      #cccccc;
    --c-accent:        #16a34a;
    --c-accent-bg:     #ecfdf5;
    --c-accent-border: #86efac;
    --c-tag-bg:        #f0f0f0;
    --c-tag-text:      #555555;
    --c-tag-border:    #dddddd;
}

/* ------------------------------------------------------------
   Remise a zero et base
   ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-h); /* la nav fixe ne masque pas la cible */
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

body {
    margin: 0;
    background: var(--c-page);
    color: var(--c-body);
    font-family: var(--font-sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3 {
    color: var(--c-title);
    line-height: 1.2;
    margin: 0 0 0.5em;
}

a { color: var(--c-accent); }

img { max-width: 100%; height: auto; display: block; }

.site-main {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 2.5rem 1.25rem;
}

/* ------------------------------------------------------------
   Header fixe
   ------------------------------------------------------------ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--c-header);
    border-bottom: 1px solid var(--c-border-1);
}

.header-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    min-height: var(--header-h);
    padding: 0.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.brand {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.03em;
    color: var(--c-accent);
    text-decoration: none;
}

.main-nav {
    display: flex;
    gap: 1.25rem;
    margin-right: auto; /* pousse les actions vers la droite */
}

.main-nav a {
    color: var(--c-body);
    text-decoration: none;
    font-size: 0.95rem;
}

.main-nav a:hover { color: var(--c-title); }

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-cv {
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--c-accent);
    background: var(--c-accent-bg);
    border: 1px solid var(--c-accent-border);
    border-radius: var(--radius);
    white-space: nowrap;
}

.lang-toggle {
    padding: 0.35rem 0.55rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--c-muted);
    border: 1px solid var(--c-border-2);
    border-radius: var(--radius);
}

.lang-toggle:hover { color: var(--c-title); }

.theme-toggle {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    color: var(--c-title);
    background: none;
    border: 1px solid var(--c-border-2);
    border-radius: var(--radius);
}

.theme-toggle:hover { border-color: var(--c-border-3); }

/* Focus clavier visible partout */
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--c-accent);
    outline-offset: 2px;
}

/* ------------------------------------------------------------
   Footer
   ------------------------------------------------------------ */
.site-footer {
    border-top: 1px solid var(--c-border-1);
    background: var(--c-header);
    color: var(--c-muted);
}

.footer-inner {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 1.5rem 1.25rem;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-links a {
    color: var(--c-muted);
    text-decoration: none;
    margin-left: 1rem;
}

.footer-links a:hover { color: var(--c-accent); }

/* ------------------------------------------------------------
   Responsive
   Repli simple pour l'instant : la nav passe sous le header sur
   petit ecran. Un vrai menu mobile (bouton hamburger) sera ajoute
   plus tard si necessaire.
   ------------------------------------------------------------ */
@media (max-width: 640px) {
    .header-inner {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    .main-nav {
        order: 3;
        width: 100%;
        margin-right: 0;
        gap: 1rem;
        overflow-x: auto;
        padding-bottom: 0.25rem;
    }
}

/* ============================================================
   Composants de page (index.php et project.php)
   ============================================================ */

/* --- Hero --- */
.hero {
    padding: 3rem 0 2.5rem;
    border-bottom: 1px solid var(--c-border-1);
}
.hero-name {
    font-size: clamp(2.2rem, 6vw, 3.4rem);
    letter-spacing: -0.01em;
    margin: 0 0 0.3rem;
}
.hero-role {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--c-accent);
    margin: 0 0 1rem;
}
.hero-tagline {
    max-width: 60ch;
    font-size: 1.1rem;
    color: var(--c-body);
    margin: 0 0 1.5rem;
}
.hero-links { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.hero-links a { color: var(--c-accent); font-weight: 600; font-size: 0.95rem; text-decoration: none; }
.hero-links a:hover { text-decoration: underline; }

/* --- Sections --- */
.section {
    padding: 2.5rem 0;
    border-bottom: 1px solid var(--c-border-1);
}
.section:last-of-type { border-bottom: none; }
.section-title { font-size: 1.5rem; margin: 0 0 1.5rem; }
.about-body { max-width: 70ch; }
.about-ai { color: var(--c-accent); font-weight: 600; }

/* --- Badge de categorie (fond a 15 pour cent de la couleur) --- */
.badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 100px;
    color: var(--cat, var(--c-accent));
    background: color-mix(in srgb, var(--cat, var(--c-accent)) 15%, transparent);
    border: 1px solid color-mix(in srgb, var(--cat, var(--c-accent)) 30%, transparent);
}

/* --- Tags --- */
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.75rem 0 0; padding: 0; }
.tag {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--c-tag-text);
    background: var(--c-tag-bg);
    border: 1px solid var(--c-tag-border);
    border-radius: 4px;
    padding: 0.15rem 0.45rem;
}

/* --- Cartes de projet --- */
.projects-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.projects-wide { margin-top: 1.25rem; }
.sides-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }

.card {
    display: flex;
    flex-direction: column;
    background: var(--c-card);
    border: 1px solid var(--c-border-1);
    border-radius: var(--radius);
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s ease;
}
.card:hover { border-color: var(--c-border-3); }
.card-media { aspect-ratio: 16 / 9; background: var(--c-accent-bg); }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 1rem 1.1rem 1.15rem; }
.card-body h3 { margin: 0.55rem 0 0.35rem; font-size: 1.1rem; }
.card-desc { margin: 0; font-size: 0.9rem; color: var(--c-body); }

/* carte large : image a gauche, texte a droite */
.projects-wide .card { flex-direction: row; }
.projects-wide .card-media { flex: 0 0 45%; aspect-ratio: auto; }
.projects-wide .card-body { display: flex; flex-direction: column; justify-content: center; }

/* --- Contact --- */
.contact-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.contact-list a { color: var(--c-accent); text-decoration: none; }
.contact-list a:hover { text-decoration: underline; }

/* --- Page projet --- */
.project { max-width: 820px; margin: 0 auto; }
.project-hero { padding: 1rem 0 1.5rem; }
.project-title { font-size: clamp(1.8rem, 4vw, 2.5rem); margin: 0.5rem 0; }
.project-lead { max-width: 65ch; font-size: 1.15rem; color: var(--c-body); }
.project-links { display: flex; gap: 0.75rem; margin-top: 1.25rem; }

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--c-title);
    border: 1px solid var(--c-border-2);
    border-radius: var(--radius);
}
.btn:hover { border-color: var(--c-border-3); }
.btn-accent { color: var(--c-accent); background: var(--c-accent-bg); border-color: var(--c-accent-border); }

.project-image { margin: 1.5rem 0; border: 1px solid var(--c-border-1); border-radius: var(--radius); overflow: hidden; }
.project-section { margin: 2rem 0; }
.project-section h2 { font-size: 1.25rem; margin: 0 0 0.6rem; }
.project-section p { color: var(--c-body); }

.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.gallery-item { background: var(--c-accent-bg); border: 1px solid var(--c-border-1); border-radius: var(--radius); overflow: hidden; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

.project-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--c-border-1);
}
.project-nav-home { color: var(--c-body); font-weight: 600; text-decoration: none; }
.project-nav-home:hover { color: var(--c-accent); }
.project-nav-sides { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.project-nav-prev, .project-nav-next { display: flex; flex-direction: column; text-decoration: none; }
.project-nav-next { text-align: right; }
.nav-dir { font-size: 0.75rem; color: var(--c-muted); }
.nav-name { color: var(--c-title); font-weight: 600; }
.project-nav-prev:hover .nav-name, .project-nav-next:hover .nav-name { color: var(--c-accent); }

/* --- Responsive : une colonne sur mobile --- */
@media (max-width: 720px) {
    .projects-grid, .sides-grid, .gallery { grid-template-columns: 1fr; }
    .projects-wide .card { flex-direction: column; }
    .projects-wide .card-media { flex-basis: auto; aspect-ratio: 16 / 9; }
}

/* Sections centrees : accueil, A propos, Contact */
.hero,
#about,
#contact {
    text-align: center;
}
.about-body {
    margin-left: auto;
    margin-right: auto;
}
.hero-links {
    justify-content: center;
}
.contact-list {
    align-items: center;
}

/* Accroche : largeur limitee et lignes equilibrees */
.hero-tagline {
    max-width: 46ch;
    margin-left: auto;
    margin-right: auto;
    text-wrap: balance;
}
