/* ==========================================================================
   VansCode - feuille de style principale
   Rayons : cartes 16px, champs 12px, boutons/chips en pilule.
   Couches (z-index) : fond 0 | contenu 1 | nav 50 | progression 60 | toast 70
   ========================================================================== */

:root {
    --font: 'Space Grotesk', system-ui, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
    --radius: 16px;
    --radius-sm: 12px;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --nav-h: 68px;
}

[data-theme="dark"] {
    --bg: #0a0d14;
    --surface: #10151f;
    --surface-2: #161d2a;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #e8ecf3;
    --muted: #9aa4b5;
    --accent: #2bb3ff;
    --accent-soft: rgba(43, 179, 255, 0.12);
    --accent-ink: #04121c;
    --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
    --grid-line: rgba(255, 255, 255, 0.035);
    color-scheme: dark;
}

[data-theme="light"] {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --surface-2: #eef2f7;
    --border: rgba(13, 20, 32, 0.09);
    --border-strong: rgba(13, 20, 32, 0.18);
    --text: #0d1420;
    --muted: #4b5567;
    --accent: #0072c6;
    --accent-soft: rgba(0, 114, 198, 0.1);
    --accent-ink: #ffffff;
    --shadow: 0 20px 50px -24px rgba(16, 40, 80, 0.25);
    --grid-line: rgba(13, 20, 32, 0.045);
    color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.1; letter-spacing: -0.02em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 6px;
}

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section { padding: 112px 24px; }
.section__title { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 40px; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: fixed; top: 12px; left: 12px; z-index: 80;
    background: var(--accent); color: var(--accent-ink);
    padding: 8px 16px; border-radius: 999px; font-weight: 600;
    transform: translateY(-200%); transition: transform 0.2s;
}
.skip-link:focus { transform: translateY(0); }

/* ---------- Fond ---------- */
.bg-grid {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 75%);
}

/* Halo qui suit la souris (position pilotée en JS via --mx / --my) */
.bg-glow {
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background: radial-gradient(600px circle at var(--mx, 70%) var(--my, 20%), var(--accent-soft), transparent 60%);
    transition: background 0.2s linear;
}

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

/* Barre de progression de lecture */
.progress {
    position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60;
    background: var(--accent);
    transform: scaleX(0); transform-origin: left;
}

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 14px 24px; border-radius: 999px;
    font: 600 0.95rem/1 var(--font); white-space: nowrap;
    border: 1px solid transparent; cursor: pointer;
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}
.btn:active { transform: scale(0.97); }
.btn--sm { padding: 10px 18px; font-size: 0.875rem; }
.btn--block { width: 100%; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { box-shadow: 0 10px 30px -10px var(--accent); }
.btn--ghost { border-color: var(--border-strong); color: var(--text); background: transparent; }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn i { transition: transform 0.3s var(--ease); }
.btn:hover i { transform: translateX(3px); }
.btn[disabled] { opacity: 0.7; cursor: progress; }

.icon-btn {
    display: inline-grid; place-items: center;
    width: 44px; height: 44px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text); font-size: 1.15rem; cursor: pointer;
    transition: border-color 0.25s ease, color 0.25s ease, transform 0.3s var(--ease);
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

.link {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--accent); font-weight: 600; font-size: 0.9rem;
    background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
    transition: background-size 0.35s var(--ease);
}
.link:hover { background-size: 100% 1px; }

/* ---------- Navigation ---------- */
.nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 50;
    height: var(--nav-h);
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    transition: transform 0.4s var(--ease), background-color 0.4s ease;
}
.nav.is-hidden { transform: translateY(-100%); }
.nav__inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }

.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; }
.logo__mark {
    display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
    background: var(--accent-soft); color: var(--accent);
    font: 700 0.8rem var(--mono);
}

.nav__links { display: flex; gap: 32px; }
.nav__links a {
    position: relative; color: var(--muted); font-weight: 500; font-size: 0.95rem;
    transition: color 0.25s ease;
}
.nav__links a::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px;
    background: var(--accent); border-radius: 2px;
    transform: scaleX(0); transform-origin: left; transition: transform 0.35s var(--ease);
}
.nav__links a:hover, .nav__links a.is-active { color: var(--text); }
.nav__links a.is-active::after, .nav__links a:hover::after { transform: scaleX(1); }

.nav__actions { display: flex; align-items: center; gap: 10px; }
.nav__burger { display: none; }

[data-theme="dark"] .theme-icon--dark, [data-theme="light"] .theme-icon--light { display: none; }

.mobile-menu {
    display: flex; flex-direction: column; gap: 4px;
    padding: 12px 24px 24px; background: var(--bg); border-bottom: 1px solid var(--border);
}
.mobile-menu[hidden] { display: none; }
.mobile-menu a { padding: 12px 0; font-size: 1.1rem; font-weight: 500; border-bottom: 1px solid var(--border); }

/* ---------- Hero ---------- */
.hero {
    min-height: 100dvh;
    display: grid; grid-template-columns: 1.15fr 0.85fr; align-items: center; gap: 48px;
    padding-top: calc(var(--nav-h) + 40px); padding-bottom: 64px;
}

.badge {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 6px 14px; border-radius: 999px; margin-bottom: 28px;
    border: 1px solid var(--border); background: var(--surface);
    font-size: 0.85rem; color: var(--muted);
}
.badge__dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; position: relative; }
.badge__dot::after {
    content: ""; position: absolute; inset: 0; border-radius: 50%; background: #22c55e;
    animation: ping 2s var(--ease) infinite;
}
@keyframes ping { to { transform: scale(2.8); opacity: 0; } }

.hero__title { font-size: clamp(2.4rem, 5.4vw, 4.4rem); font-weight: 700; margin-bottom: 24px; }
.hero__title .line { display: block; overflow: hidden; padding-bottom: 0.08em; }
.hero-word { display: inline-block; }
.rotator { color: var(--accent); height: 1.18em; }
.rotator__word { display: inline-block; white-space: nowrap; }

.hero__sub { font-size: 1.15rem; color: var(--muted); max-width: 48ch; margin-bottom: 36px; }
.hero__sub strong { color: var(--text); font-weight: 600; }
.hero__ctas { display: flex; flex-wrap: wrap; gap: 14px; }

.hero__visual { display: flex; justify-content: center; }
.portrait { position: relative; width: min(380px, 80vw); aspect-ratio: 1; }
.portrait__img {
    position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover;
    border-radius: 50%; border: 1px solid var(--border-strong);
    background: var(--surface-2);
}
.portrait__ring {
    position: absolute; inset: -14px; border-radius: 50%;
    background: conic-gradient(from 0deg, var(--accent), transparent 30%, transparent 70%, var(--accent));
    mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
    animation: spin 8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Logos en orbite autour du portrait */
.orbit { position: absolute; inset: -46px; z-index: 2; animation: spin 40s linear infinite; }
.orbit li {
    position: absolute; top: 50%; left: 50%;
    width: 58px; height: 58px; margin: -29px;
    display: grid; place-items: center;
    background: var(--surface); border: 1px solid var(--border); border-radius: 50%;
    box-shadow: var(--shadow);
    transform: rotate(calc(var(--i) * 60deg)) translate(calc(min(380px, 80vw) / 2 + 46px)) rotate(calc(var(--i) * -60deg));
}
.orbit li img { width: 30px; height: 30px; animation: spin 40s linear infinite reverse; }

/* ---------- À propos ---------- */
.about__statement {
    font-size: clamp(1.5rem, 3.2vw, 2.4rem); font-weight: 500; line-height: 1.35;
    letter-spacing: -0.01em; max-width: 30ch; margin-bottom: 72px;
}
.about__statement .w { transition: color 0.2s; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin: 0; }
.stat { padding-top: 20px; border-top: 1px solid var(--border-strong); }
.stat dt { color: var(--muted); font-size: 0.95rem; }
.stat dd { margin: 6px 0 0; font: 600 clamp(2.4rem, 5vw, 3.6rem)/1 var(--mono); color: var(--accent); }

/* ---------- Stack (bento) ---------- */
.bento {
    display: grid; gap: 16px;
    grid-template-columns: repeat(3, 1fr);
    grid-template-areas:
        "front front back"
        "data tools tools";
}
.bento__cell {
    position: relative; overflow: hidden;
    padding: 28px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border);
    transition: border-color 0.3s ease, transform 0.4s var(--ease);
}
.bento__cell:hover { border-color: var(--border-strong); transform: translateY(-4px); }
.bento__cell--front { grid-area: front; background: linear-gradient(135deg, var(--accent-soft), transparent 60%), var(--surface); }
.bento__cell--back { grid-area: back; }
.bento__cell--data { grid-area: data; background: radial-gradient(circle at 100% 100%, rgba(71, 162, 72, 0.14), transparent 60%), var(--surface); }
.bento__cell--tools { grid-area: tools; }
.bento__cell h3 { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; margin-bottom: 6px; }
.bento__cell h3 i { color: var(--accent); }
.bento__cell > p { color: var(--muted); margin-bottom: 22px; }

.techs { display: flex; flex-wrap: wrap; gap: 10px; }
.techs li {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px 8px 10px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--border);
    font-size: 0.9rem; font-weight: 500;
    transition: border-color 0.25s ease, transform 0.3s var(--ease);
}
.techs li:hover { border-color: var(--accent); transform: translateY(-2px); }
.techs img { width: 22px; height: 22px; }
[data-theme="dark"] .invert-dark { filter: invert(1); }

/* ---------- Projets ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin: -12px 0 32px; }
.chip {
    padding: 10px 18px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--border); background: var(--surface); color: var(--muted);
    font: 500 0.9rem var(--font);
    transition: all 0.25s ease;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }

.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* Carte projet : bordure illuminée sous le curseur (--px / --py) + inclinaison en JS */
.project {
    position: relative; display: flex; flex-direction: column;
    padding: 28px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border);
    transform-style: preserve-3d; will-change: transform;
}
.project::before {
    content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px;
    background: radial-gradient(260px circle at var(--px, 50%) var(--py, 50%), var(--accent), transparent 70%);
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude; -webkit-mask-composite: xor;
    opacity: 0; transition: opacity 0.3s ease; pointer-events: none;
}
.project:hover::before { opacity: 1; }
.project.is-hidden { display: none; }
.project--featured {
    grid-column: span 2;
    background: radial-gradient(circle at 90% 10%, rgba(37, 211, 102, 0.12), transparent 50%), var(--surface);
}
.project--featured h3 { font-size: 1.7rem; }
.project--featured p { font-size: 1.05rem; max-width: 52ch; }

.project__icon {
    width: 52px; height: 52px; border-radius: 14px; margin-bottom: 22px;
    display: grid; place-items: center; font-size: 1.5rem;
    color: var(--tint); background: color-mix(in srgb, var(--tint) 14%, transparent);
    transition: transform 0.4s var(--ease);
}
.project:hover .project__icon { transform: rotate(-8deg) scale(1.08); }
.project h3 { font-size: 1.25rem; margin-bottom: 10px; }
.project p { color: var(--muted); font-size: 0.95rem; margin-bottom: 20px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.tags li {
    font: 500 0.75rem var(--mono); color: var(--muted);
    padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border);
}
.project__links { display: flex; gap: 18px; margin-top: 18px; }

/* Activité GitHub */
.gh { margin-top: 48px; padding: 28px; border-radius: var(--radius); border: 1px dashed var(--border-strong); }
.gh__head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.gh__head h3 { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; }
.gh__list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.gh__item a {
    display: flex; flex-direction: column; gap: 6px; height: 100%;
    padding: 16px; border-radius: var(--radius-sm);
    background: var(--surface); border: 1px solid var(--border);
    transition: border-color 0.25s ease, transform 0.3s var(--ease);
}
.gh__item a:hover { border-color: var(--accent); transform: translateY(-3px); }
.gh__name { font: 500 0.95rem var(--mono); word-break: break-word; }
.gh__meta { display: flex; gap: 14px; font-size: 0.8rem; color: var(--muted); }
.gh__lang::before {
    content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--lang, var(--muted)); margin-right: 6px;
}
.gh__skeleton {
    height: 76px; border-radius: var(--radius-sm); background: var(--surface-2);
    position: relative; overflow: hidden;
}
.gh__skeleton::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
    transform: translateX(-100%); animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.gh__error { grid-column: 1 / -1; color: var(--muted); }

/* ---------- Méthode ---------- */
.steps { position: relative; }
.steps__line {
    position: absolute; top: 27px; left: 28px; right: 28px; width: calc(100% - 56px); height: 4px;
    overflow: visible;
}
.steps__line line { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 1000; stroke-dashoffset: 0; }
.steps__list { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.step__icon {
    display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 22px;
    border-radius: 50%; background: var(--bg); border: 1px solid var(--accent);
    color: var(--accent); font-size: 1.4rem;
}
.step h3 { font-size: 1.2rem; margin-bottom: 8px; }
.step p { color: var(--muted); font-size: 0.95rem; max-width: 28ch; }

/* ---------- Contact ---------- */
.contact { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: start; }
.contact__intro .section__title { margin-bottom: 16px; }
.contact__intro > p { color: var(--muted); font-size: 1.1rem; margin-bottom: 32px; }

.channels { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.channels li { display: flex; align-items: center; gap: 10px; }
.channel {
    flex: 1; display: flex; align-items: center; gap: 16px;
    padding: 16px 18px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border);
    transition: border-color 0.25s ease, transform 0.35s var(--ease);
}
.channel:hover { border-color: var(--accent); transform: translateX(6px); }
.channel > i { font-size: 1.4rem; color: var(--accent); }
.channel span { display: flex; flex-direction: column; font-weight: 500; word-break: break-all; }
.channel small { color: var(--muted); font-size: 0.8rem; font-weight: 400; }
.socials { display: flex; gap: 10px; }

.form {
    display: flex; flex-direction: column; gap: 18px;
    padding: 32px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-weight: 500; font-size: 0.95rem; }
.field input, .field textarea {
    width: 100%; padding: 14px 16px; border-radius: var(--radius-sm);
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border-strong);
    font: 400 1rem var(--font); resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field input:focus, .field textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft);
}
.field.has-error input, .field.has-error textarea { border-color: #ef4444; }
.field__error { min-height: 1.2em; font-size: 0.85rem; color: #f87171; margin-top: -2px; }
[data-theme="light"] .field__error { color: #c62828; }
.form__status { min-height: 1.4em; font-size: 0.95rem; text-align: center; }
.form__status.is-ok { color: #22c55e; }
.form__status.is-err { color: #f87171; }
[data-theme="light"] .form__status.is-ok { color: #15803d; }
[data-theme="light"] .form__status.is-err { color: #c62828; }
.spin { animation: spin 0.9s linear infinite; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 40px 0; }
.footer__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; }
.footer__links { display: flex; gap: 24px; }
.footer__links a { color: var(--muted); transition: color 0.2s; }
.footer__links a:hover { color: var(--text); }
.footer p { color: var(--muted); font-size: 0.9rem; }

/* ---------- Toast ---------- */
.toast {
    position: fixed; left: 50%; bottom: 24px; z-index: 70;
    padding: 12px 20px; border-radius: 999px;
    background: var(--text); color: var(--bg); font-weight: 500;
    transform: translate(-50%, 150%); opacity: 0;
    transition: transform 0.4s var(--ease), opacity 0.4s ease;
}
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

/* ---------- État initial des animations (seulement si JS + mouvement autorisé) ---------- */
.anim .hero-in, .anim [data-reveal] { opacity: 0; }
.anim .hero-word { transform: translateY(110%); }
.anim .portrait { opacity: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .project-grid, .gh__list { grid-template-columns: repeat(2, 1fr); }
    .steps__list { grid-template-columns: repeat(2, 1fr); row-gap: 48px; }
    .steps__line { display: none; }
}

@media (max-width: 860px) {
    .nav__links, .nav__cta { display: none; }
    .nav__burger { display: inline-grid; }
    .hero { grid-template-columns: 1fr; text-align: left; padding-top: calc(var(--nav-h) + 48px); }
    .hero__visual { order: -1; margin: 40px 0 24px; }
    .portrait { width: min(240px, 60vw); }
    .orbit { inset: -34px; }
    .orbit li {
        width: 44px; height: 44px; margin: -22px;
        transform: rotate(calc(var(--i) * 60deg)) translate(calc(min(240px, 60vw) / 2 + 34px)) rotate(calc(var(--i) * -60deg));
    }
    .orbit li img { width: 22px; height: 22px; }
    .contact { grid-template-columns: 1fr; gap: 40px; }
    .bento { grid-template-columns: 1fr; grid-template-areas: "front" "back" "data" "tools"; }
}

@media (max-width: 640px) {
    .wrap { padding: 0 16px; }
    .section { padding: 80px 16px; }
    .project-grid, .gh__list, .steps__list { grid-template-columns: 1fr; }
    .project--featured { grid-column: auto; }
    .stats { grid-template-columns: 1fr; }
    .form { padding: 22px; }
    .hero__ctas .btn { flex: 1; }
    .nav__actions > a.icon-btn { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
