/* ============================================
   LAYOUT — en-tête, sections, boutons, pied de page
   ============================================ */

/* ---------- En-tête ---------- */
#main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: rgba(17, 17, 17, 0.8);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.25);
    transition: transform 0.35s ease, opacity 0.35s ease;
}

/* Masqué sur le parcours d'ouverture et sur la vitrine des projets
   (js/controllers/navigation.js, js/controllers/showcase.js). */
html:is(.nav-hidden, .showcase-open) #main-nav {
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.35s ease, opacity 0.35s ease, visibility 0s linear 0.35s;
}

.nav-inner {
    height: var(--nav-height);
    padding: 0 var(--margin);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    min-width: 0;
}

.nav-status {
    display: none;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: 999px;
    border: 1px solid rgba(150, 150, 150, 0.35);
    font-family: var(--font-body);
    font-size: var(--text-xs);
    line-height: 16px;
    color: var(--on-surface-variant);
    white-space: nowrap;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs);
    border-radius: var(--radius-md);
    background: rgba(10, 10, 10, 0.6);
}

.nav-link {
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 24px;
    font-weight: 600;
    color: var(--on-surface-variant);
    white-space: nowrap;
    transition: background-color 0.2s, color 0.2s;
}

.nav-link:hover {
    background: var(--surface-high);
    color: var(--on-surface);
}

.nav-link.active {
    background: var(--aurora-button);
    background-size: 300% 100%;
    color: var(--on-primary-container);
    animation: aurora-shift var(--aurora-duration) ease-in-out infinite alternate;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.nav-gh {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius);
    background: var(--surface-high);
    font-family: var(--font-label);
    font-size: var(--text-xs);
    font-weight: 500;
    transition: background-color 0.2s;
}

.nav-gh .icon { font-size: var(--text-base); }
.nav-gh:hover { background: var(--surface-highest); }

#nav-toggle {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    background: var(--surface-high);
    align-items: center;
    justify-content: center;
}

@media (min-width: 1280px) {
    .nav-status { display: inline-flex; }
}

@media (max-width: 1023px) {
    #nav-toggle { display: flex; }

    .nav-links {
        position: absolute;
        top: var(--nav-height);
        left: var(--margin);
        right: var(--margin);
        flex-direction: column;
        align-items: stretch;
        padding: var(--space-sm);
        background: rgba(28, 28, 28, 0.96);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid var(--border-glass);
        border-radius: var(--radius-lg);
        box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    }

    .nav-link { padding: var(--space-sm) var(--space-md); }

    #main-nav.menu-open .nav-links {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

@media (max-width: 639px) {
    .nav-gh { display: none; }
}

/* ---------- Fond : aurore + réseau de neurones ---------- */
/* Ordre des couches : teintes des sections (fond du body, backdrop.js)
   → aurore → réseau de neurones → contenu. */

/* Aurore : de grandes nappes de lumière qui dérivent lentement. Des dégradés
   radiaux qui s'éteignent d'eux-mêmes plutôt qu'un filter: blur, bien plus
   coûteux ; seule la transformation est animée (composée par le GPU). */
.aurora {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.aurora-blob {
    position: absolute;
    width: 70vmax;
    height: 70vmax;
    border-radius: 50%;
    background: radial-gradient(closest-side, var(--blob-color), transparent);
    opacity: var(--blob-opacity, 0.18);
    will-change: transform;
    animation: aurora-drift var(--blob-duration, 11s) ease-in-out infinite alternate;
}

.aurora-1 {
    --blob-color: #ffffff;
    --blob-opacity: 0.07;
    top: -30vmax;
    left: -15vmax;
}

.aurora-2 {
    --blob-color: #9a9a9a;
    --blob-opacity: 0.1;
    --blob-duration: 9s;
    top: -20vmax;
    right: -25vmax;
    animation-delay: -3s;
    animation-direction: alternate-reverse;
}

.aurora-3 {
    --blob-color: #5c5c5c;
    --blob-opacity: 0.16;
    --blob-duration: 12s;
    bottom: -35vmax;
    left: 10vmax;
    animation-delay: -6s;
}

.aurora-4 {
    --blob-color: #d6d6d6;
    --blob-opacity: 0.06;
    --blob-duration: 10s;
    bottom: -30vmax;
    right: -20vmax;
    animation-delay: -2s;
    animation-direction: alternate-reverse;
}

@keyframes aurora-drift {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(8vmax, 6vmax, 0) scale(1.12); }
    100% { transform: translate3d(-6vmax, 10vmax, 0) scale(0.95); }
}

/* Réseau de neurones fixe derrière toute la page (js/controllers/neural.js). */
.neural-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

main, #footer { position: relative; z-index: 2; }

/* Curseur « neurone » (js/controllers/cursor.js) : seulement à la souris. */
.has-neural-cursor,
.has-neural-cursor * { cursor: none; }

.has-neural-cursor :is(input, textarea, [contenteditable="true"]) { cursor: text; }

.cursor-dot,
.cursor-ring,
.cursor-wave {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    pointer-events: none;
    border-radius: 50%;
}

.cursor-dot {
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    background: var(--secondary);
    box-shadow: 0 0 10px 1px rgba(189, 189, 189, 0.6);
}

/* L'élément ne fait que se déplacer (transform posé par cursor.js) ; le cercle
   visible est son ::before. Un scale sur l'élément lui-même multiplierait
   aussi sa translation : l'anneau partirait loin du curseur. */
.cursor-ring {
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    transition: opacity 0.2s;
}

.cursor-ring::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1.5px solid rgba(242, 242, 242, 0.55);
    transition: scale 0.25s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.25s ease,
                background-color 0.25s ease,
                box-shadow 0.25s ease;
}

/* Survol d'un élément cliquable : l'anneau s'éclaire, sans changer de taille. */
.cursor-ring.is-hovering::before {
    border-color: rgba(189, 189, 189, 0.95);
    background-color: rgba(189, 189, 189, 0.12);
    box-shadow: 0 0 14px rgba(189, 189, 189, 0.45);
}

/* Clic : l'anneau se resserre autour du point et s'illumine ; l'onde
   (.cursor-wave) part du point de clic. */
.cursor-ring.is-pressed::before {
    scale: 0.6;
    border-color: var(--secondary);
    background-color: rgba(189, 189, 189, 0.25);
    box-shadow: 0 0 18px rgba(189, 189, 189, 0.6);
    transition-duration: 0.12s;
}

.cursor-wave {
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    border: 1.5px solid var(--secondary);
    animation: cursor-wave 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cursor-wave {
    from { opacity: 0.8; scale: 0.4; }
    to { opacity: 0; scale: 2.6; }
}

.cursor-hidden .cursor-dot,
.cursor-hidden .cursor-ring,
.cursor-typing .cursor-dot,
.cursor-typing .cursor-ring { opacity: 0; }

main { padding-top: var(--nav-height); }

.section {
    position: relative;
    padding: var(--space-2xl) var(--margin);
}

/* Teinte de fond de chaque section. Les sections ne peignent pas leur fond :
   initBackdrop() relie toutes ces teintes en un seul dégradé sur la page, si bien
   que chaque passage d'une section à la suivante est un long fondu. Deux sections
   voisines n'ont jamais la même teinte, sinon le fondu disparaîtrait. */
#about { --tone: var(--surface-low); }
#projects { --tone: color-mix(in srgb, var(--surface-low) 93%, var(--primary-container)); }
#skills { --tone: var(--surface-lowest); }
.callout-section { --tone: var(--surface); }
#contact { --tone: color-mix(in srgb, var(--surface-low) 94%, var(--secondary-container)); }
#footer { --tone: var(--surface-lowest); }

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.section-head {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.section-head.split {
    gap: var(--space-sm);
}

.section-title {
    font-family: var(--font-display);
    font-size: 26px;
    line-height: 32px;
    font-weight: 500;
    letter-spacing: -0.02em;
}

.section-desc {
    max-width: 42rem;
    color: var(--on-surface-variant);
}

.section-aside {
    max-width: 28rem;
    font-family: var(--font-label);
    font-size: var(--text-xs);
    line-height: 18px;
    color: var(--outline);
}

@media (min-width: 768px) {
    .section-title { font-size: 32px; line-height: 40px; }
    .section-head.split {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
    }
}

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 24px;
    font-weight: 600;
    transition: background-color 0.2s, opacity 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn .icon { font-size: 20px; }
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--aurora-button);
    background-size: 300% 100%;
    color: var(--on-primary-container);
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.35), 0 0 32px rgba(189, 189, 189, 0.12);
    animation: aurora-shift var(--aurora-duration) ease-in-out infinite alternate;
}

.btn-primary:hover { box-shadow: 0 0 24px rgba(255, 255, 255, 0.55), 0 0 40px rgba(189, 189, 189, 0.25); }

.btn-light {
    background: var(--primary);
    color: var(--on-primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.btn-light:hover { opacity: 0.92; }

.btn-tonal {
    background: var(--surface-high);
    color: var(--on-surface);
}

.btn-tonal:hover { background: var(--surface-highest); }

.btn-dark {
    background: var(--surface-lowest);
    color: var(--on-surface);
}

.btn-dark:hover { background: var(--surface); }

.btn-ghost {
    background: var(--surface-low);
    color: var(--outline);
    font-family: var(--font-label);
    font-size: var(--text-xs);
    font-weight: 500;
}

.btn-ghost .icon { font-size: 18px; }
.btn-ghost:hover { background: var(--surface-container); color: var(--on-surface); }

/* ---------- Puces ---------- */
.chip {
    display: inline-flex;
    align-items: center;
    padding: 2px var(--space-xs);
    border-radius: var(--radius-sm);
    background: var(--surface-lowest);
    color: var(--outline);
    font-family: var(--font-label);
    font-size: var(--text-xs);
    line-height: 14px;
    white-space: nowrap;
}

.chip.accent { color: var(--accent, var(--primary)); }
.chip.ac { background: transparent; border: 1px dashed var(--outline-variant); }

/* ---------- Pied de page ---------- */
#footer {
    padding: var(--space-2xl) var(--margin) var(--space-xl);
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    text-align: center;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.footer-title {
    font-family: var(--font-display);
    font-size: 18px;
    line-height: 24px;
    font-weight: 600;
    color: var(--primary);
}

.footer-sub, .footer-copy {
    font-family: var(--font-label);
    font-size: var(--text-xs);
    line-height: 14px;
    color: var(--outline);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-sm) var(--space-md);
}

.footer-links a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-family: var(--font-label);
    font-size: var(--text-xs);
    font-weight: 500;
    color: var(--on-surface-variant);
    transition: color 0.2s;
}

.footer-links .icon { font-size: var(--text-base); }
.footer-links .hover-primary:hover { color: var(--primary); }
.footer-links .hover-secondary:hover { color: var(--secondary); }
.footer-links .hover-tertiary:hover { color: var(--tertiary); }

@media (min-width: 768px) {
    .footer-inner {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}

/* Transparence réduite (réglage système) : le verre devient opaque. */
@media (prefers-reduced-transparency: reduce) {
    #main-nav { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
    .nav-links { background: var(--surface-container); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* ---------- Intro (js/controllers/intro.js) ---------- */
/* Avant le premier affichage, la page reste cachée sous le fond. Filet de
   sécurité : si le script ne se lance pas, elle réapparaît d'elle-même. */
html.intro-pending { background: var(--surface-lowest); }
html.intro-pending body {
    visibility: hidden;
    animation: intro-failsafe 0s linear 3s forwards;
}

@keyframes intro-failsafe { to { visibility: visible; } }

html.intro-playing { overflow: hidden; }

.intro {
    position: fixed;
    inset: 0;
    z-index: 90; /* au-dessus de l'en-tête et de l'assistant, sous le curseur */
    visibility: visible;
    background: var(--surface-lowest);
    cursor: pointer;
    transition: opacity 600ms ease;
}

.intro.is-leaving { opacity: 0; pointer-events: none; }

.intro-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.intro-skip {
    position: absolute;
    z-index: 1;
    top: calc(6.4vh + var(--space-md));
    right: max(var(--margin), (100% - var(--max-width)) / 2);
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    min-height: 44px;
    padding: 0 var(--space-md);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(10, 10, 10, 0.6);
    font-family: 'IBM Plex Mono', var(--font-mono); /* police de l'intro */
    font-size: var(--text-xs);
    color: var(--outline);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.intro-skip .icon { font-size: 16px; }
.intro.is-leaving .intro-skip { opacity: 0; transition: opacity 0.15s; }
.intro-skip:hover,
.intro-skip:focus-visible { color: var(--on-surface); border-color: var(--outline-variant); }
