/* =========================================================
   Valentin Lebigot — V2
   ========================================================= */

/* Couleurs animables (transition fluide des barres) */
@property --c1 { syntax: "<color>"; inherits: true; initial-value: #02549d; }
@property --c2 { syntax: "<color>"; inherits: true; initial-value: #f7f4ca; }
@property --c3 { syntax: "<color>"; inherits: true; initial-value: #82201c; }

:root {
  --c1: #02549d;
  --c2: #f7f4ca;
  --c3: #82201c;

  --bg: #ffffff;   /* fond blanc sur tout le site */
  --paper: #ffffff;
  --ink: #161616;
  --ink-soft: #5c5c5c;
  --line: rgba(0, 0, 0, .09);

  --sidebar-w: 248px;
  --bar-w: 12px;
  --pad: clamp(20px, 2.6vw, 44px);   /* marge uniforme autour des galeries */

  --sans: "Montserrat", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --serif: "Playfair Display", Georgia, serif;

  --ease: cubic-bezier(.22, .9, .24, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --color-t: 1.1s var(--ease-io);

  transition: --c1 var(--color-t), --c2 var(--color-t), --c3 var(--color-t);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* typographie : jamais de césure, mots jamais coupés */
  -webkit-hyphens: none;
  hyphens: none;
  word-break: normal;
  overflow-wrap: normal;
}
img, video { display: block; max-width: 100%; }
/* retours à la ligne équilibrés : titres de longueurs égales, pas de mot seul en fin de paragraphe */
h1, h2, h3, .project__sub, .sidebar__title, .about__lead { text-wrap: balance; }
p, li, dd, dt { text-wrap: pretty; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--c1); color: #fff; }

.link-u {
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .45s var(--ease);
}
.link-u:hover { background-size: 100% 1px; }

/* ---------------------------------------------------------
   Intro
   --------------------------------------------------------- */
.intro {
  position: fixed; inset: 0; z-index: 100;
  display: flex;
  overflow: hidden;
  pointer-events: none;
}
.intro__col {
  flex: 0 0 auto;
  height: 100%;
  display: flex; flex-direction: column;
  /* sortie : remontée vers le haut */
  transition: transform .85s cubic-bezier(.76, 0, .24, 1);
  will-change: transform;
}
.intro__seg {
  flex: 1 1 0;
  min-height: 0;
  /* même ressort que les barres de la barre latérale */
  transition: flex-grow .9s cubic-bezier(.68, -0.35, .27, 1.35);
}

/* ---------------------------------------------------------
   Sidebar (desktop)
   --------------------------------------------------------- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--paper);
  z-index: 20;
  display: flex;
}
.sidebar__inner {
  flex: 1;
  display: flex; flex-direction: column;
  padding: 34px 26px 28px 30px;
  min-height: 0;
}
.sidebar__logo { display: block; width: 48px; }
.sidebar__logo img { width: 100%; height: auto; transition: transform .6s var(--ease); }
.sidebar__logo:hover img { transform: translateX(3px); }

/* Compteur 01 / 09 */
.sidebar__counter {
  /* frise verticale : précédent ↑, en cours, suivant ↓ */
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 34px;
  margin: 40px 0 18px;
  font-size: 11px; font-weight: 500; letter-spacing: .08em;
  font-variant-numeric: tabular-nums;
}
.sidebar__counter { transition: opacity .4s; }
.sidebar__counter.is-hidden { opacity: 0; }
.counter__current {
  display: inline-block; overflow: hidden; height: 1.6em;
  font-size: 22px; font-weight: 600; line-height: 1.6em; letter-spacing: 0;
}
.counter__roll { display: inline-block; }
.counter__roll.is-up   { animation: roll-up .55s var(--ease); }
.counter__roll.is-down { animation: roll-down .55s var(--ease); }
@keyframes roll-up   { from { transform: translateY(100%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes roll-down { from { transform: translateY(-100%); opacity: 0; } to { transform: none; opacity: 1; } }
.counter__sep { width: 1px; height: 18px; background: var(--ink); opacity: .25; transition: opacity .4s; }
/* numéros précédent / suivant : gris, cliquables */
.counter__step {
  font-size: 12px; font-weight: 500; letter-spacing: .04em;
  color: #a3a3a3;
  text-decoration: none;
  padding: 4px 2px;
  transition: color .3s, opacity .4s, transform .4s var(--ease);
}
.counter__prev:hover { color: var(--ink); transform: translateY(-2px); }
.counter__next:hover { color: var(--ink); transform: translateY(2px); }
.counter__step.is-off, .counter__sep.is-off { opacity: 0; pointer-events: none; }

/* Titre du projet courant */
.sidebar__title {
  margin: 0;
  font-size: 13px; font-weight: 600; line-height: 1.35;
  transition: opacity .35s, transform .5s var(--ease);
}
.sidebar__title em { display: block; font-family: var(--serif); font-weight: 400; font-size: 14px; color: var(--ink-soft); }
.sidebar__title.is-swap { opacity: 0; transform: translateY(8px); }
.sidebar__spacer { flex: 1; }

.sidebar__bottom { padding-top: 22px; }
.sidebar__nav { display: flex; gap: 18px; margin-bottom: 18px; }
.sidebar__nav a {
  position: relative;
  font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  text-decoration: none; color: #a3a3a3;   /* non sélectionné : gris */
  transition: color .3s;
}
.sidebar__nav a:hover, .sidebar__nav a.is-active { color: var(--ink); }   /* sélectionné : noir */

.socials { display: flex; gap: 14px; }
.socials a {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line);
  transition: background-color .3s, border-color .3s, transform .4s var(--ease);
}
.socials svg { width: 15px; height: 15px; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; transition: stroke .3s; }
.socials svg .fill { fill: var(--ink); stroke: none; }
.socials a:hover { background: var(--ink); border-color: var(--ink); transform: translateY(-2px); }
.socials a:hover svg { stroke: #fff; }
.socials a:hover svg .fill { fill: #fff; }

/* Barres colorées */
.colorbar {
  position: relative;
  width: var(--bar-w);
  display: flex; flex-direction: column;
}
.colorbar__seg {
  flex: 1 1 0;
  min-height: 0;
  transition: flex-grow 1.4s cubic-bezier(.68, -0.35, .27, 1.35);
}
.seg-1 { background: var(--c1); }
.seg-2 { background: var(--c2); }
.seg-3 { background: var(--c3); }

/* ---------------------------------------------------------
   Barre mobile
   --------------------------------------------------------- */
.mobilebar { display: none; }

/* ---------------------------------------------------------
   Main / projets
   --------------------------------------------------------- */
.main { margin-left: var(--sidebar-w); }

.project {
  padding: var(--pad);   /* même espace au-dessus et en dessous de chaque projet */
}
.project + .project { border-top: 1px solid var(--line); }

/* Galerie */
.gallery {
  --ratio: 1.4146;
  position: relative;
  width: min(100%, calc(100vh * var(--ratio)));   /* pleine largeur, limitée seulement par la hauteur d'écran */
  aspect-ratio: 1600 / 1131;
  margin: 0 auto;
  overflow: hidden;
  background: #ebe9e4;
  border-radius: 3px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.2s var(--ease-io);
}
.gallery.is-in { clip-path: inset(0 0 0 0); }

.gallery { background: transparent; }

/* Défilement latéral : les images sont côte à côte sur un rail.
   Au survol, l'image suivante (curseur à droite) ou précédente (curseur à
   gauche) dépasse de l'épaisseur de la ligne colorée (--peek). */
.gallery { --peek: var(--bar-w); }
.gallery__shift {
  height: 100%;
  /* apparition : la galerie sort d'un flou « verre dépoli » qui se dissipe vite */
  filter: blur(18px) saturate(170%);
  transition: transform .55s var(--ease), filter .75s cubic-bezier(.22, .9, .24, 1) .12s;
}
.gallery.is-in .gallery__shift { filter: none; }
/* voile blanc translucide du verre, qui s'efface en même temps que le flou */
.gallery::after {
  content: ""; position: absolute; inset: 0; z-index: 3;
  background: rgba(255, 255, 255, .4);
  pointer-events: none;
  transition: opacity .75s ease .12s;
}
.gallery.is-in::after { opacity: 0; }
.gallery.peek-next .gallery__shift { transform: translateX(calc(-1 * var(--peek))); }
.gallery.peek-prev .gallery__shift { transform: translateX(var(--peek)); }
.gallery__track {
  display: flex;
  height: 100%;
  transition: transform 1.05s cubic-bezier(.77, 0, .18, 1);
  will-change: transform;
}
.gallery__track.no-anim { transition: none; }
.slide {
  position: relative;
  flex: 0 0 100%;
  height: 100%;
  overflow: hidden;
  background: #ebe9e4;
}
.slide img, .slide video { width: 100%; height: 100%; object-fit: cover; }

/* Curseur galerie : flèche classique */
.gallery { cursor: default; }

/* Texte projet */
.project__info {
  width: min(100%, calc(100vh * 1.4146));
  margin: 28px auto 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 48px;
}
.project__title {
  margin: 0;
  font-size: clamp(22px, 2.1vw, 30px);
  font-weight: 600; line-height: 1.15; letter-spacing: -.01em;
}
.project__sub {
  margin: 4px 0 0;
  font-family: var(--serif); font-style: italic;
  font-size: clamp(19px, 1.7vw, 25px);
  line-height: 1.2;
  color: var(--ink);
}
.project__body p { margin: 0 0 14px; font-size: 13px; line-height: 1.65; color: #2b2b2b; }
.project__body a {
  text-decoration: none;
  background: linear-gradient(var(--c1), var(--c1)) 0 100% / 100% 1px no-repeat;
  transition: background-size .4s var(--ease), color .3s;
}
.project__body a:hover { background-size: 100% 100%; color: #fff; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
  font-size: 10.5px; font-weight: 500; letter-spacing: .02em;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--ink-soft);
}
.tags li::before { content: "#"; opacity: .5; }
.tags li { cursor: default; }   /* simples étiquettes, non cliquables */

/* Bouton « + / − » du volet (visible sur mobile uniquement) */
.project__toggle {
  display: none;
  position: relative; width: 36px; height: 36px; flex: none;
  border: 0; background: none; padding: 0; cursor: pointer;
}
.project__toggle i {
  position: absolute; left: 11px; top: 11px; width: 14px; height: 14px;
  transition: transform .5s var(--ease);
}
.project__toggle i::before, .project__toggle i::after {
  content: ""; position: absolute; left: 0; top: 50%; width: 100%; height: 1.5px;
  background: var(--ink); margin-top: -.75px;
}
.project__toggle i::after { transform: rotate(90deg); transition: transform .5s var(--ease); }
.project__info.is-open .project__toggle i { transform: rotate(180deg); }
.project__info.is-open .project__toggle i::after { transform: rotate(0); }

/* Apparitions au scroll */
.reveal, .project__head > *, .project__body > * {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}
.is-in .project__head > *, .is-in .project__body > *, .reveal.is-in { opacity: 1; transform: none; }
.is-in .project__head > :nth-child(2) { transition-delay: .08s; }
.is-in .project__body > :nth-child(1) { transition-delay: .16s; }
.is-in .project__body > :nth-child(2) { transition-delay: .26s; }

/* ---------------------------------------------------------
   À propos
   --------------------------------------------------------- */
.about {
  padding: var(--pad) var(--pad) 32px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.about__grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) 1.2fr;
  gap: clamp(32px, 5vw, 90px);
  max-width: 1240px;
  margin: 0 auto;
  align-items: start;
}
.about__photo {
  margin: 0;
  position: sticky; top: var(--pad);
  overflow: hidden; border-radius: 3px;
}
.about__photo img { width: 100%; height: auto; }   /* photo affichée telle quelle, sans effet */

.about__kicker {
  margin: 0 0 18px;
  font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-soft);
}
.about__lead {
  margin: 0 0 28px;
  font-size: clamp(22px, 2.3vw, 34px);
  font-weight: 500; line-height: 1.25; letter-spacing: -.015em;
}
.about__lead em { font-family: var(--serif); font-weight: 400; }
.about__text { max-width: 620px; }
.about__text p { margin: 0 0 14px; font-size: 14px; color: #2b2b2b; }

.contact { margin: 28px 0 44px; display: grid; gap: 4px; }
.contact a { text-decoration: none; font-size: 14px; font-weight: 500; }

/* Accordéons */
.accordion { border-top: 1px solid var(--line); }
.accordion details { border-bottom: 1px solid var(--line); }
.accordion summary {
  list-style: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 0;
  font-size: clamp(17px, 1.5vw, 21px); font-weight: 600; letter-spacing: -.01em;
  transition: padding .4s var(--ease);
}
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary:hover { padding-left: 8px; }
.accordion summary i {
  position: relative; width: 14px; height: 14px; flex: none;
  transition: transform .5s var(--ease);
}
.accordion summary i::before, .accordion summary i::after {
  content: ""; position: absolute; left: 0; top: 50%; width: 100%; height: 1.5px;
  background: var(--ink); margin-top: -.75px;
}
.accordion summary i::after { transform: rotate(90deg); transition: transform .5s var(--ease); }
.accordion details[open] summary i { transform: rotate(180deg); }
.accordion details[open] summary i::after { transform: rotate(0); }

.acc__body {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .55s var(--ease);
}
.acc__body > div { overflow: hidden; }
.accordion details.is-open .acc__body { grid-template-rows: 1fr; }
.acc__body > div > :last-child { margin-bottom: 26px; }

.cv-item { margin-bottom: 22px; }
.cv-item h3 { margin: 0; font-size: 14px; font-weight: 600; }
.cv-item h3 span { display: block; font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 16px; }
.cv-date { margin: 2px 0 6px; font-size: 11px; letter-spacing: .06em; color: var(--ink-soft); }
.cv-item p { margin: 0 0 6px; font-size: 13px; }
.cv-item ul li { position: relative; padding-left: 16px; font-size: 13px; color: #333; }
.cv-item ul li::before { content: ""; position: absolute; left: 0; top: .72em; width: 7px; height: 1px; background: var(--ink); }

.cv-list { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 8px 28px; font-size: 13px; }
.cv-list dt { font-weight: 600; }
.cv-list dd { margin: 0; color: #444; }

.footer {
  display: flex; justify-content: space-between; gap: 20px;
  max-width: 1240px; margin: 90px auto 0; padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 11px; letter-spacing: .04em; color: var(--ink-soft);
}
.footer a { text-decoration: none; }

/* ---------------------------------------------------------
   Tablette / mobile
   --------------------------------------------------------- */
@media (max-width: 900px) {
  :root { --pad: 20px; }

  .sidebar { width: 0; bottom: auto; background: none; z-index: 40; }
  .sidebar__inner {
    position: fixed; inset: 0;
    padding: 92px 28px 36px;
    /* effet verre dépoli façon iOS : translucide + flou de l'arrière-plan */
    background: rgba(255, 255, 255, .55);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    backdrop-filter: blur(28px) saturate(180%);
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .6);
    transform: translateY(-100%);
    transition: transform .7s var(--ease-io);
  }
  /* l'en-tête se fond dans le verre quand le menu est ouvert */
  body.menu-open .mobilebar { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
  body.menu-open .sidebar__inner { transform: none; }
  body.menu-open { overflow: hidden; }
  .sidebar__logo { display: none; }
  /* menu mobile : seulement « Projets » et « À propos », réseaux en bas */
  .sidebar__counter, .sidebar__title, .sidebar__spacer { display: none; }
  .sidebar__bottom { flex: 1; display: flex; flex-direction: column; padding-top: 12px; }
  .sidebar__nav { flex-direction: column; gap: 6px; margin: 0; }
  .sidebar__nav a {
    font-size: clamp(22px, 2.1vw, 30px); font-weight: 600; letter-spacing: -.01em; text-transform: none;   /* même taille que les titres de projets */
    opacity: 0; transform: translateY(16px);
    transition: opacity .5s var(--ease), transform .5s var(--ease), color .3s;
  }
  body.menu-open .sidebar__nav a { opacity: 1; transform: none; transition-delay: .25s; }
  body.menu-open .sidebar__nav a:nth-child(2) { transition-delay: .33s; }
  .socials { margin-top: auto; }

  /* barre colorée horizontale sous l'en-tête */
  .colorbar {
    position: fixed; left: 0; right: 0; top: 56px; z-index: 51;
    width: auto; height: 5px;
    flex-direction: row;
  }

  .mobilebar {
    display: flex; align-items: center; gap: 14px;
    position: fixed; top: 0; left: 0; right: 0; z-index: 50;
    height: 56px; padding: 0 16px 0 20px;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  /* logo centré dans l'en-tête, menu à droite */
  .mobilebar { justify-content: flex-end; }
  .mobilebar__logo { width: 36px; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
  .mobilebar__logo img { width: 100%; height: auto; }
  .burger {
    width: 40px; height: 40px; flex: none;
    border: 0; background: none; padding: 0; cursor: pointer;
    position: relative;
  }
  .burger span {
    position: absolute; left: 10px; right: 10px; height: 1.5px; background: var(--ink);
    transition: transform .45s var(--ease), top .45s var(--ease);
  }
  .burger span:nth-child(1) { top: 16px; }
  .burger span:nth-child(2) { top: 23px; }
  body.menu-open .burger span:nth-child(1) { top: 19.5px; transform: rotate(45deg); }
  body.menu-open .burger span:nth-child(2) { top: 19.5px; transform: rotate(-45deg); }

  .main { margin-left: 0; padding-top: 61px; }
  .project { min-height: 0; padding: 34px var(--pad) 46px; }
  .gallery, .project__info { width: 100%; min-width: 0; }
  .project__info { grid-template-columns: 1fr; gap: 0; margin-top: 18px; }

  /* volet : titre visible, description + hashtags derrière le « + » */
  .project__head { display: grid; grid-template-columns: 1fr auto; column-gap: 16px; align-items: center; cursor: pointer; }
  .project__head > :not(.project__toggle) { grid-column: 1; }
  .project__toggle { display: block; grid-column: 2; grid-row: 1 / span 2; }
  .project__more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .55s var(--ease); }
  .project__more > div { overflow: hidden; }
  .project__info.is-open .project__more { grid-template-rows: 1fr; }
  .project__more .project__body { padding-top: 14px; }

  .about__grid { grid-template-columns: 1fr; }
  .about__photo { position: relative; top: 0; max-width: 420px; }
  .cv-list { grid-template-columns: 1fr; gap: 0; }
  .cv-list dd { margin-bottom: 10px; }
  .footer { margin-top: 56px; }
}


@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
  .intro { display: none; }
}
