/*
 * Direction artistique : Zéro VU. Le site est un cadran de VU-mètre éclairé, une main de cartes lui sert de graduation
 * et l'aiguille désigne le projet. La rareté d'une carte est un niveau sonore, porté par un seul signe : un potard.
 */
:root {
    color-scheme: light;
    --fond: #e4c681; /* beige terne, de la famille du beige du Dark */
    --cadran: #fbe4a6; /* plan de lecture */
    --encre: #1b1610;
    --encre-douce: #4f3f16;
    --sur-encre: #fbe4a6;
    --trait: #86651a;
    --crete: #9c1f12; /* zone rouge et Légendaire, nulle part ailleurs */
    --aiguille: #d42e1a;
    --rare: #0f4f5a;
    --epic: #7f1a4b;
    --commune: #4f3f16;
    --bakelite: #1f1a17; /* matière des objets : cartes, plaque, lecteur */
    --halo: #fff3c4;
    --anneau: #0f4f5a;
    --ombre-carte: 0 2px 0 #1b16104d, 0 10px 18px #1b161040;
    --aplat: 55%; /* part de la couleur de rareté quand elle gagne la fenêtre du booster */

    /* Les objets gardent leur éclairage : ces couleurs ne changent pas avec le thème */
    --bakelite-creux: #0f0c0a;
    --sur-bakelite: #f9e7b8;
    --sur-bakelite-douce: #cbb78e;
    --jaune: #f3c34b;
    --sur-jaune: #1b1610;
    --led-commune: #bfb296;
    --led-rare: #58bcc4;
    --led-epic: #f190b4;
    --led-crete: #ff5a3a;

    /* Temps empruntés aux instruments de mesure */
    --vu: 300ms; /* intégration d'un VU-mètre : toute course d'aiguille */
    --crete-retour: 1500ms; /* retour d'un crête-mètre */

    --font-display: "Anybody", "Arial Black", sans-serif;
    --font-texte: "Atkinson Hyperlegible Next", "Segoe UI", sans-serif;
    --font-onde: "Wavefont", monospace;
    --r-commande: 6px;
    --gutter: clamp(1rem, 4vw, 4rem);
    --top: 4rem;
    --nav: 0px;
}
[data-theme="dark"] {
    color-scheme: dark;
    --fond: #15110e;
    --cadran: #241c16;
    --encre: #f6dfa8;
    --encre-douce: #c2a976;
    --sur-encre: #15110e;
    --trait: #8d7750;
    --crete: #ff8a6b;
    --aiguille: #ff5a3a;
    --rare: #79c9cf;
    --epic: #f39dbd;
    --commune: #c2a976;
    --bakelite: #2e2620;
    --halo: #ff9d5a;
    --anneau: #79c9cf;
    --ombre-carte: 0 2px 0 #00000080, 0 10px 18px #00000099;
    --aplat: 26%;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top) + 1rem); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--encre); font: 400 1.0625rem/1.6 var(--font-texte); overflow-x: clip; }
h1, h2, h3, h4, p, ul, ol, dl, dd { margin: 0; padding: 0; font-size: inherit; font-weight: inherit; }
ul, ol { list-style: none; }
img, svg, iframe { display: block; max-width: 100%; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { padding: 0; border: 0; border-radius: 0; background: none; cursor: pointer; text-align: inherit; }
:focus-visible { outline: 3px solid var(--anneau); outline-offset: 3px; }
::selection { background: var(--encre); color: var(--sur-encre); }

/* ---------- En-tête ---------- */

.top { position: sticky; top: 0; z-index: 70; display: flex; align-items: center; gap: 0.5rem 1.5rem; height: var(--top); padding-inline: var(--gutter); background: var(--fond); border-bottom: 2px solid var(--encre); overflow: clip; }
/* --name va de 0 à 1 quand le nom passe du titre à la bannière (app.js) : il monte de sous le bord en rapetissant */
.top__name { display: grid; align-items: center; margin-right: auto; font: 800 1.125rem/1 var(--font-display); font-variation-settings: "wdth" 92; text-decoration: none; white-space: nowrap; }
.top__name > * { grid-area: 1 / 1; }
/* DTF s'efface pendant que le nom se dévoile de gauche à droite : il s'étend à mesure que le grand titre sort de l'écran */
.top__short { opacity: calc(1 - var(--name, 1) * 6); } /* parti avant que « David » ne le recouvre */
.top__full { clip-path: inset(-0.25em calc((1 - var(--name, 1)) * 100%) -0.25em 0); }
/* Les réseaux : à gauche du menu dans la bannière, et dans le contact */
.socials { display: flex; margin: 0 0.25rem 0 -0.75rem; } /* un peu d'air avant le menu */
.social { display: grid; place-items: center; width: 2.5rem; height: 2.75rem; color: var(--encre-douce); }
.social:hover { color: var(--encre); }
.social:focus-visible { outline-offset: -3px; }
.social svg { width: 1.375rem; height: 1.375rem; fill: currentColor; }
.nav { display: flex; flex: none; align-self: stretch; gap: 1.5rem; }
.nav__link { display: flex; align-items: center; font: 650 1rem/1 var(--font-display); font-variation-settings: "wdth" 88; text-decoration: none; white-space: nowrap; color: var(--encre-douce); }
.nav__link:hover, .nav__link[aria-current] { color: var(--encre); }
.nav__link[aria-current] { box-shadow: inset 0 -4px 0 var(--encre); }
/* Le labo audio s'ouvre sur une autre page : un petit module en bakélite, dont l'écran s'allume au survol */
.nav__lab { align-self: center; display: flex; flex: none; align-items: center; gap: 0.625rem; min-height: 2.75rem; padding: 0 0.875rem 0 0.375rem; border-radius: var(--r-commande); background: var(--bakelite); color: var(--sur-bakelite); font: 650 1rem/1 var(--font-display); font-variation-settings: "wdth" 92; text-decoration: none; white-space: nowrap; }
.nav__screen { width: 2.75rem; height: 1.875rem; border-radius: 4px; background: var(--bakelite-creux); overflow: hidden; }
.nav__screen path { fill: none; stroke: var(--led-rare); stroke-width: 2; transform: translateX(22px) scaleY(0.25); transform-origin: 0 12px; transition: transform 0.35s, stroke 0.35s; }
.nav__lab:is(:hover, :focus-visible) .nav__screen path { stroke: var(--led-crete); animation: scope 0.9s linear infinite; }
.nav__lab:hover { box-shadow: 0 0 0 2px var(--led-crete); }
@keyframes scope { from { transform: translateX(0) scaleY(0.8); } to { transform: translateX(22px) scaleY(0.8); } }
/* Thème et langue : le même interrupteur à deux positions */
.theme, .lang { display: flex; padding: 3px; border-radius: var(--r-commande); box-shadow: inset 0 0 0 2px var(--encre); }
:is(.theme, .lang) button { display: grid; place-items: center; width: 2.5rem; min-height: 2.375rem; border-radius: 4px; font: 650 0.9375rem/1 var(--font-display); font-variation-settings: "wdth" 88; }
:is(.theme, .lang) button[aria-pressed="true"] { color: var(--sur-encre); }
/* Le curseur glisse d'un choix à l'autre, et le choix fait s'anime. :root.is-ready (theme.js) : le curseur ne glisse pas au chargement. .is-switching : posée au clic, elle anime le nouveau choix. */
:is(.theme, .lang) { position: relative; isolation: isolate; }
:is(.theme, .lang)::before { content: ""; position: absolute; z-index: -1; inset: 3px auto 3px 3px; width: calc(50% - 3px); border-radius: 4px; background: var(--encre); }
:is(.theme, .lang):has(> :last-child[aria-pressed="true"])::before { translate: 100% 0; }
:root.is-ready :is(.theme, .lang)::before { transition: translate 0.35s cubic-bezier(0.3, 1.4, 0.5, 1); }
:root.is-ready .theme button, :root.is-ready .lang button { transition: color 0.25s; }
.theme.is-switching [data-set-theme="light"][aria-pressed="true"] svg { animation: sun-in 0.6s cubic-bezier(0.3, 1.4, 0.5, 1); }
.theme.is-switching [data-set-theme="dark"][aria-pressed="true"] svg { animation: moon-in 0.6s cubic-bezier(0.3, 1.4, 0.5, 1); }
.lang.is-switching button[aria-pressed="true"] { animation: switch-pop 0.4s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes sun-in { from { rotate: -90deg; scale: 0.6; } }
@keyframes moon-in { from { rotate: 40deg; scale: 0.6; } 60% { rotate: -12deg; } }
@keyframes switch-pop { from { scale: 0.7; } }
@media (prefers-reduced-motion: reduce) { :root.is-ready :is(.theme, .lang)::before, :is(.theme, .lang) * { transition: none !important; animation: none !important; } }
.theme svg { width: 1.375rem; height: 1.375rem; }
.theme + .lang { margin-left: -0.75rem; } /* les deux interrupteurs vont ensemble */

/* ---------- Titres, liens et boutons ---------- */

.title { font: 850 clamp(2.25rem, 5vw, 3.75rem)/0.95 var(--font-display); font-variation-settings: "wdth" 112; letter-spacing: -0.01em; text-wrap: balance; }
.underink { font-weight: 650; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.underink:hover { text-decoration-thickness: 4px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem; padding: 0 1.25rem; border-radius: var(--r-commande); background: var(--encre); color: var(--sur-encre); box-shadow: inset 0 0 0 2px var(--encre); font: 650 1rem/1 var(--font-display); font-variation-settings: "wdth" 92; transition: background-color 0.12s, color 0.12s; }
.btn:hover { background: transparent; color: var(--encre); }
.btn:active { translate: 0 1px; }
.btn .icon { width: 1.25rem; height: 1.25rem; margin-right: 0.5rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn { text-decoration: none; }
.reveal { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.875rem; }
.btn--line { background: transparent; color: var(--encre); }
.btn--line:hover { background: var(--encre); color: var(--sur-encre); }
.btn--plate { background: var(--sur-bakelite); color: #1f1a17; box-shadow: inset 0 0 0 2px var(--sur-bakelite); }
.btn--plate:hover { background: transparent; color: var(--sur-bakelite); }
.btn--plate:focus-visible, .btn--plate-line:focus-visible { outline-color: var(--led-rare); }
.btn--plate-line { background: transparent; color: var(--sur-bakelite); box-shadow: inset 0 0 0 2px var(--sur-bakelite); }
.btn--plate-line:hover { background: var(--sur-bakelite); color: #1f1a17; }

/* ---------- Sections ---------- */

.sheet { padding: clamp(3rem, 8vh, 5rem) var(--gutter); }
.sheet > .title { margin-bottom: 1.5rem; }
.sheet > .title:has(+ .lead) { margin-bottom: 0.75rem; }
.lead { max-width: 40rem; margin-bottom: 2rem; font-size: 1.25rem; line-height: 1.4; color: var(--encre-douce); } /* sous-titre d'une section */
#skills, #career, #timeline { padding-top: 0; }

/* Filtres : un sélecteur d'entrée posé sur un rail, au-dessus de la grille qu'il trie. Pas des boutons d'action :
   ni fond ni cadre, un voyant qui s'allume et un trait qui se pose sur le rail. */
.filters { display: flex; flex-wrap: wrap; gap: 0 1.75rem; margin-bottom: 1.25rem; border-bottom: 2px solid var(--trait); }
.filters button { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; padding: 0 0.125rem; font: 650 1rem/1 var(--font-display); font-variation-settings: "wdth" 88; color: var(--encre-douce); transition: color 0.15s, box-shadow 0.15s; }
.filters button::before { content: ""; flex: none; width: 0.5rem; height: 0.5rem; border-radius: 50%; box-shadow: inset 0 0 0 1.5px currentColor; transition: background-color 0.15s, box-shadow 0.15s; }
.filters button:hover { color: var(--encre); box-shadow: inset 0 -2px 0 var(--encre-douce); }
.filters button[aria-pressed="true"] { color: var(--encre); box-shadow: inset 0 -4px 0 var(--encre); }
.filters button[aria-pressed="true"]::before { background: var(--aiguille); box-shadow: 0 0 0.375rem var(--aiguille); }
.filters button:focus-visible { outline-offset: 2px; }

/* ---------- Contact ---------- */

.contact { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; padding-bottom: clamp(5rem, 14vh, 8rem); background: var(--bakelite); color: var(--sur-bakelite); }
.contact :focus-visible { outline-color: var(--led-rare); }
.contact > .title { margin: 0; }
.socials--contact { margin: 0 0 0 -0.5625rem; }
.socials--contact .social { color: var(--sur-bakelite-douce); }
.socials--contact .social:hover { color: var(--sur-bakelite); }
.contact__text { max-width: 34rem; font-size: 1.25rem; line-height: 1.4; }
.contact__email { margin-block: clamp(0.5rem, 3vh, 2rem); text-decoration: none; }
.contact__email:hover { color: var(--jaune); }
.stretch { display: block; font-family: var(--font-display); font-weight: 750; line-height: 1; letter-spacing: -0.01em; }
.stretch__line { display: block; width: max-content; white-space: nowrap; }
.contact__copyright { margin-top: 2rem; font-size: 0.9375rem; color: var(--sur-bakelite-douce); }

@media (max-width: 88rem) {
    .nav { gap: 1rem; }
}
@media (max-width: 84.25rem) {
    .nav__link--wide { display: none; } /* la bannière, puis la barre du bas, n'ont pas la place de tous les liens */
}
@media (max-width: 75rem) {
    .top { column-gap: 1rem; }
    .theme + .lang { margin-left: -0.375rem; }
    /* Le nom sur deux lignes laisse la place aux réseaux */
    .top__name { font-size: 0.875rem; font-variation-settings: "wdth" 76; }
    .top__full { width: min-content; white-space: normal; }
    .top__full span { white-space: nowrap; }
    .top__short { font-size: 1.125rem; }
    .socials { margin: 0 0.125rem 0 -0.5rem; }
    .social { width: 1.625rem; }
    .social svg { width: 1.25rem; height: 1.25rem; }
}
/* La navigation passe en bas dès que la bannière n'a plus la place de ses cinq liens et du labo */
@media (max-width: 62.5rem) {
    :root { --nav: 3.25rem; --top: 3.5rem; }
    body { padding-bottom: calc(var(--nav) + env(safe-area-inset-bottom, 0px)); }
    .top { column-gap: 0.5rem; padding-inline: 1rem; }
    /* La navigation passe en bas, sous le pouce */
    .nav { position: fixed; inset: auto 0 0; z-index: 70; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; height: calc(var(--nav) + env(safe-area-inset-bottom, 0px)); background: var(--cadran); border-top: 2px solid var(--encre); }
    .nav__link { justify-content: center; min-width: 0; padding: 0 0.25rem env(safe-area-inset-bottom, 0px); font-size: 0.875rem; font-variation-settings: "wdth" 74; white-space: normal; text-align: center; }
    .nav__link[aria-current] { box-shadow: inset 0 4px 0 var(--encre); }
    .nav__lab { align-self: stretch; justify-content: center; gap: 0.375rem; min-width: 0; min-height: 0; margin: 0.25rem; padding: 0 0.375rem; margin-bottom: calc(0.25rem + env(safe-area-inset-bottom, 0px)); font-size: 0.875rem; font-variation-settings: "wdth" 74; }
    .nav__screen { display: block; flex: none; width: 1.5rem; height: 1.25rem; }
}
@media (max-width: 30rem) {
    .nav__lab::before { content: ""; flex: none; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--led-rare); } /* plus la place pour l'écran : un voyant */
    .nav__screen { display: none; }
}
@media (max-width: 54rem) {
    :is(.theme, .lang) button[aria-pressed="true"] { display: none; } /* un seul bouton : celui de l'autre choix */
    :is(.theme, .lang)::before { display: none; }
    .is-switching:is(.theme, .lang) button { animation: switch-pop 0.4s cubic-bezier(0.3, 1.6, 0.5, 1); } /* le bouton qui apparaît après un choix */
    .theme + .lang { margin-left: 0; }
    .filters { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scrollbar-width: none; }
    .filters button { flex: none; }
}
@media (max-width: 23.5rem) {
    .social { width: 1.5rem; }
    /* Cinq cases dans la barre du bas : le texte se resserre, le labo passe sur deux lignes */
    .nav__link { padding-inline: 0.125rem; font-size: 0.8125rem; font-variation-settings: "wdth" 64; }
    .nav__lab { gap: 0.25rem; margin-inline: 0.125rem; padding-inline: 0.25rem; font-size: 0.8125rem; font-variation-settings: "wdth" 64; white-space: normal; line-height: 1; text-align: center; }
}
@media (max-width: 22rem) {
    .top__name { position: absolute; visibility: hidden; } /* plus la place : les réseaux restent à gauche */
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
