/* ==========================================================================
   Ludo — feuille de styles
   Direction : blanc, noir, beaucoup d’air, une seule police (Figtree).
   Aucune dépendance, aucun build. Modifier les variables ci-dessous suffit
   pour changer l’identité visuelle du site.
   ========================================================================== */

@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("fonts/figtree-latin.woff2") format("woff2");
}

:root {
  --bg: #ffffff;
  --ink: #0a0a0a;
  --ink-soft: #3c3c3c;
  --muted: #737373;
  --line: #ececec;
  --line-strong: #dcdcdc;
  --accent: #1a7f37;

  --font: "Figtree", "Avenir Next", Avenir, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --max-width: 46rem;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --header-height: 4.25rem;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 1rem);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--ink);
  color: #fff;
}

h1, h2, h3, p, ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
  flex: none;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 0.25rem;
}

/* Sections atteintes par un lien interne : focus sans cadre. */
[tabindex="-1"]:focus {
  outline: none;
}

.wrap {
  width: min(calc(100% - 2 * var(--gutter)), var(--max-width));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: #fff;
  font-size: 0.875rem;
  border-radius: 999px;
  transform: translateY(-200%);
  transition: transform 0.2s var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   En-tête
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: var(--header-height);
}

.wordmark {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 1.75rem);
  font-size: 0.875rem;
  color: var(--muted);
}

.nav a {
  position: relative;
  padding-block: 0.75rem;
  transition: color 0.2s var(--ease);
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.5rem;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s var(--ease);
}

.nav a:hover {
  color: var(--ink);
}

.nav a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.nav-github {
  display: flex;
  align-items: center;
  color: var(--ink);
}

.nav-github::after {
  display: none;
}

.nav-github svg {
  opacity: 0.75;
  transition: opacity 0.2s var(--ease), transform 0.25s var(--ease);
}

.nav-github:hover svg {
  opacity: 1;
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Intro
   -------------------------------------------------------------------------- */

.hero {
  padding-top: clamp(4rem, 12vh, 8rem);
  padding-bottom: clamp(3.5rem, 9vh, 6rem);
}

/* Entrée douce de la page, sans JS bloquant. */
.js .intro > * {
  animation: intro-rise 0.9s var(--ease) both;
}

.js .intro > *:nth-child(1) { animation-delay: 0.06s; }
.js .intro > *:nth-child(2) { animation-delay: 0.14s; }
.js .intro > *:nth-child(3) { animation-delay: 0.24s; }
.js .intro > *:nth-child(4) { animation-delay: 0.34s; }

@keyframes intro-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h1 {
  font-size: clamp(4.25rem, 21vw, 9.5rem);
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.05em;
}

.period {
  color: var(--ink);
}

/* Alias sous le grand titre : même famille, plus discret. */
.hero-alias {
  margin-top: 1rem;
  font-family: var(--mono);
  font-size: clamp(0.875rem, 1.6vw, 1rem);
  letter-spacing: 0.03em;
  color: var(--muted);
}

.lede {
  max-width: 44ch;
  margin-top: 1.75rem;
  font-size: clamp(1.125rem, 2.2vw, 1.375rem);
  line-height: 1.45;
  letter-spacing: -0.012em;
  color: var(--ink-soft);
}

.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 2.5rem;
}

/* Boutons et liens */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.8125rem 1.375rem;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  transform: translate3d(var(--mx, 0px), var(--my, 0px), 0);
  transition: background 0.25s var(--ease), transform 0.25s var(--ease);
  will-change: transform;
}

.btn svg {
  transition: transform 0.3s var(--ease);
}

.btn:hover {
  background: #262626;
  transform: translate3d(var(--mx, 0px), calc(var(--my, 0px) - 1px), 0);
}

.btn:hover svg {
  transform: translate(2px, -2px);
}

.btn:active {
  transform: translate3d(var(--mx, 0px), var(--my, 0px), 0) scale(0.98);
}

.text-link {
  position: relative;
  font-size: 0.9375rem;
  font-weight: 500;
  padding-bottom: 0.15rem;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
  transition: opacity 0.2s var(--ease);
}

.text-link:hover {
  opacity: 0.6;
}

.text-link.small {
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section {
  padding-block: clamp(3.5rem, 8vh, 5.5rem);
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: clamp(2rem, 5vh, 3rem);
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 0.875rem;
}

.section-index {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

h2 {
  font-size: clamp(1.375rem, 2.6vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.025em;
}

/* --------------------------------------------------------------------------
   Applications
   -------------------------------------------------------------------------- */

.work {
  padding-block: 1.75rem;
  border-top: 1px solid var(--line);
}

.work:first-child {
  border-top: 0;
  padding-top: 0;
}

.work:last-child {
  padding-bottom: 0;
}

.work-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

h3 {
  font-size: clamp(1.25rem, 2.6vw, 1.5rem);
  font-weight: 500;
  letter-spacing: -0.025em;
}

.work-year {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.work p {
  max-width: 52ch;
  margin-top: 0.4375rem;
  font-size: 0.9688rem;
  line-height: 1.6;
  color: var(--muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 1rem;
}

.tags li {
  padding: 0.1875rem 0.625rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   À propos
   -------------------------------------------------------------------------- */

.about {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}

.about-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  perspective: 900px;
}

.portrait {
  width: 6rem;
  height: 7.5rem;
  object-fit: cover;
  object-position: 50% 15%;
  border-radius: 0.5rem;
  background: var(--line);
  flex: none;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease);
  will-change: transform;
}

.about-card.is-tilting .portrait {
  transition-duration: 0.18s;
  box-shadow: 0 20px 40px -26px rgba(0, 0, 0, 0.45);
}

.about-name {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.about-role {
  margin-top: 0.125rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--muted);
}

.about-handle {
  display: inline-block;
  margin-top: 0.375rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.footer-alias {
  color: var(--ink-soft);
}

.about-body p {
  max-width: 58ch;
  color: var(--ink-soft);
}

.about-body p + p {
  margin-top: 1.125rem;
}

.about-lead {
  font-size: clamp(1.25rem, 2.8vw, 1.5rem);
  line-height: 1.4;
  letter-spacing: -0.022em;
  color: var(--ink) !important;
}

.about-tags {
  margin-top: 1.75rem;
}

/* Compétences & expérience */

.parcours {
  display: grid;
  gap: 2.5rem;
  margin-top: 3.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--line);
}

.parcours-title {
  margin-bottom: 1.25rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.skill + .skill,
.xp li + li {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.skill h4,
.xp h4 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.skill p,
.xp p {
  margin-top: 0.3125rem;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--muted);
}

.xp {
  margin: 0;
  padding: 0;
  list-style: none;
}

.xp-link {
  display: inline-block;
  margin-top: 1.5rem;
}

/* --------------------------------------------------------------------------
   Contact
   -------------------------------------------------------------------------- */

.contact-lede {
  max-width: 16ch;
  text-wrap: balance;
  font-size: clamp(2rem, 6vw, 3.25rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.contact-copy {
  max-width: 44ch;
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.9688rem;
}

.contact-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 2rem;
}

/* --------------------------------------------------------------------------
   Pied de page
   -------------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: clamp(2rem, 6vh, 4rem);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  padding-block: 2rem 2.75rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.footer-note {
  order: 3;
  flex-basis: 100%;
}

/* --------------------------------------------------------------------------
   Ouverture animée
   « Ludo. » apparaît en très grand au centre, puis rétrécit jusqu’au grand
   titre. La classe est posée par le script de <head> ; sans JS, ou avec
   « Réduire les animations », la page s’affiche normalement.
   Seuls transform et opacity sont animés, pour rester fluide.
   -------------------------------------------------------------------------- */

html {
  scrollbar-gutter: stable;
}

.wordmark,
.nav {
  transition: opacity 0.8s var(--ease);
}

html.ouverture,
html.ouverture body {
  overflow: hidden;
}

html.ouverture .wordmark,
html.ouverture .nav {
  opacity: 0;
}

/* L’intro attend la fin de l’ouverture pour jouer son entrée. */
html.ouverture .intro > * {
  animation-play-state: paused;
}

/* Le gros mot devient le grand titre : celui-ci n’a pas d’entrée propre. */
html.ouverture #titre {
  visibility: hidden;
  animation: none;
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.splash-fond {
  position: absolute;
  inset: 0;
  background: var(--bg);
}

.splash-mot {
  position: relative;
  display: inline-block;
  font-size: clamp(6rem, 28vw, 16rem);
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.05em;
  white-space: nowrap;
  transform-origin: 0 0;
  will-change: transform;
}

.splash-lettre,
.splash .period {
  display: inline-block;
}

.splash-lettre {
  animation: splash-monte 0.8s var(--ease) both;
}

.splash-lettre:nth-child(2) { animation-delay: 0.1s; }
.splash-lettre:nth-child(3) { animation-delay: 0.2s; }
.splash-lettre:nth-child(4) { animation-delay: 0.3s; }

.splash .period {
  animation: splash-tombe 0.7s cubic-bezier(0.34, 1.4, 0.5, 1) 0.65s both;
}

/* Lettres posées : retour au texte continu avant la mesure du vol. */
.splash.pose .splash-lettre,
.splash.pose .period {
  display: inline;
  animation: none;
}

@keyframes splash-monte {
  from {
    opacity: 0;
    transform: translateY(0.28em);
  }
}

@keyframes splash-tombe {
  from {
    opacity: 0;
    transform: translateY(-0.45em);
  }
}

/* --------------------------------------------------------------------------
   Apparition au défilement
   -------------------------------------------------------------------------- */

.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Décalage léger pour les projets */
.work:nth-child(2) { transition-delay: 0.06s; }
.work:nth-child(3) { transition-delay: 0.12s; }

/* --------------------------------------------------------------------------
   Grands écrans
   -------------------------------------------------------------------------- */

@media (min-width: 48rem) {
  .about {
    grid-template-columns: 12.5rem 1fr;
    gap: 3.5rem;
  }

  .parcours {
    grid-template-columns: 1fr 1fr;
    gap: 3.5rem;
  }

  .about-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    position: sticky;
    top: calc(var(--header-height) + 2rem);
    align-self: start;
  }

  .portrait {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 5;
  }

  .footer-note {
    order: 0;
    flex-basis: auto;
  }
}

@media (min-width: 64rem) {
  :root {
    --max-width: 50rem;
  }
}

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */

@media (max-width: 30rem) {
  .nav {
    gap: 0.75rem;
    font-size: 0.75rem;
  }

  /* GitHub reste accessible depuis la section Contact. */
  .nav-github {
    display: none;
  }

  .section-head {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .hero-actions {
    gap: 1.25rem;
  }
}

/* --------------------------------------------------------------------------
   Accessibilité : mouvement réduit
   -------------------------------------------------------------------------- */

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }

  .js .intro > * {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

/* --------------------------------------------------------------------------
   Impression
   -------------------------------------------------------------------------- */

@media print {
  .site-header,
  .hero-actions,
  .contact-actions,
  .skip-link,
  .site-footer a {
    display: none;
  }

  body {
    font-size: 11pt;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }

  .js .intro > * {
    opacity: 1;
    transform: none;
    animation: none;
  }
}
