/* ==========================================================
   Portfolio | mise en page et sections
   ========================================================== */

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  transition: transform .6s var(--ease), background-color .4s, border-color .4s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: var(--line);
}
.nav.is-hidden { transform: translateY(-100%); }
@media (prefers-reduced-transparency: reduce) {
  .nav.is-scrolled { background: var(--bg); backdrop-filter: none; }
}
.nav__inner {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 600; letter-spacing: -0.02em; }
.brand__mark { width: 36px; height: 36px; flex: none; display: block; transition: transform .6s var(--ease); }
.brand__mark rect { fill: var(--accent); }
.brand__mark g { fill: none; stroke: var(--on-accent); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.brand:hover .brand__mark { transform: rotate(-8deg) scale(1.05); }
.nav__links { display: flex; gap: 4px; }
.nav__links a {
  position: relative;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  font-size: .93rem;
  color: var(--muted);
  transition: color .3s, background-color .3s;
}
.nav__links a:hover, .nav__links a.is-active { color: var(--text); background: var(--surface-2); }
.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 {
  position: fixed;
  inset: 72px 0 0 0;
  z-index: 49;
  padding: 32px var(--gutter);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
}
.mobile-menu[hidden] { display: none; }
.mobile-menu nav { display: grid; }
.mobile-menu nav a {
  font-size: clamp(2rem, 9vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  padding: 6px 0;
}
.mobile-menu .btn { width: 100%; }

@media (max-width: 960px) {
  .nav__links, .nav__cta { display: none; }
  .nav__burger { display: inline-grid; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: flex-end;
  padding: 104px 0 48px;
  overflow: hidden;
  isolation: isolate;
}
.hero__field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent);
  mask-image: linear-gradient(180deg, #000 55%, transparent);
}
.hero__inner { display: grid; gap: clamp(16px, 2.4vw, 32px); }
.hero__top { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.hero__term { font-family: var(--mono); font-size: clamp(.85rem, 1.2vw, 1rem); color: var(--text); white-space: nowrap; }
.hero__caret { color: var(--accent-ink); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.hero__name {
  margin: 0 0 0 -0.04em;
  display: flex;
  flex-wrap: wrap;
  column-gap: .22em;
  font-size: clamp(3.4rem, 13.4vw, 15rem);
  line-height: .86;
  letter-spacing: -0.06em;
  font-weight: 600;
}
.hero__word { display: inline-flex; overflow: hidden; padding-bottom: .06em; }
.k { display: inline-block; will-change: transform; font-variation-settings: "wght" var(--w, 600); font-weight: var(--w, 600); }

.hero__bottom {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: end;
  gap: clamp(20px, 3vw, 48px);
  padding-top: clamp(16px, 2vw, 28px);
  border-top: 1px solid var(--line);
}
.hero__lead { max-width: 40ch; color: var(--muted); }
.hero__ctas { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }

.hero__visual { margin: 0; width: clamp(120px, 12vw, 180px); }
.hero__frame {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
}
.hero__frame img {
  width: 100%;
  height: 115%;
  object-fit: cover;
  object-position: center top;
  will-change: transform;
}

@media (max-width: 1000px) {
  .hero__bottom { grid-template-columns: auto minmax(0, 1fr); }
  .hero__ctas { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 600px) {
  .hero { min-height: 100svh; padding-top: 96px; }
  .hero__name { font-size: 19.5vw; }
  .hero__bottom { grid-template-columns: 1fr; }
  .hero__visual { width: 112px; }
  .hero__ctas .btn { flex: 1 1 100%; }
}

/* ---------- Intro (une fois par session) ---------- */
.loader { display: none; }
.js .loader:not(.is-done) {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--gutter);
  background: var(--bg);
}
.reduced .loader, .skip-intro .loader { display: none !important; }
.loader__inner { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.loader__logo { width: 56px; height: 56px; }
.loader__logo rect { fill: var(--accent); }
.loader__logo g { fill: none; stroke: var(--on-accent); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.loader__count { font-family: var(--mono); font-size: clamp(4rem, 14vw, 12rem); line-height: .8; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.loader__bar { display: block; height: 2px; margin-top: 24px; background: var(--line); overflow: hidden; }
.loader__bar span { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }

/* ---------- Barre de progression ---------- */
.progress { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 60; pointer-events: none; }
.progress span { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }

/* ---------- Pastille curseur (projets) ---------- */
.chip {
  position: fixed;
  left: 0; top: 0;
  z-index: 70;
  width: 108px; height: 108px;
  margin: -54px 0 0 -54px;
  border-radius: 50%;
  display: grid;
  place-content: center;
  grid-auto-flow: column;
  gap: 4px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: .82rem;
  font-weight: 600;
  pointer-events: none;
  transform: scale(0);
  will-change: transform;
}
@media (hover: none), (pointer: coarse) { .chip { display: none; } }

/* ---------- Transitions entre pages ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .45s cubic-bezier(0.7, 0, 0.84, 0) both; }
::view-transition-new(root) { animation: vt-in .7s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-24px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(32px); } }
@media (prefers-reduced-motion: reduce) { ::view-transition-old(root), ::view-transition-new(root) { animation: none; } }

/* ---------- Marquee ---------- */
.stack { padding: 24px 0; border-block: 1px solid var(--line); }
.marquee { overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.marquee__track { display: flex; width: max-content; }
.marquee__list { display: flex; align-items: center; gap: clamp(40px, 6vw, 80px); padding: 0 clamp(20px, 3vw, 40px); margin: 0; list-style: none; }
.logo {
  display: block;
  width: 34px; height: 34px;
  background: var(--muted);
  -webkit-mask: var(--logo) center / contain no-repeat;
  mask: var(--logo) center / contain no-repeat;
  transition: background-color .3s;
}
.marquee__list li:hover .logo { background: var(--text); }

/* ---------- En-têtes de section ---------- */
.section-head {
  display: grid;
  gap: 24px;
  margin-bottom: clamp(48px, 7vw, 88px);
  max-width: 820px;
}

/* ---------- Expertises (cartes empilées) ---------- */
.expertises { padding: var(--section) 0 calc(var(--section) / 2); }
.stack-cards { display: grid; gap: 20px; }
.xp-card {
  position: sticky;
  top: 112px;
  min-height: min(440px, 62vh);
  padding: clamp(28px, 4vw, 56px);
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  display: grid;
  align-content: space-between;
  gap: 28px;
  transform-origin: center top;
  will-change: transform;
}
.xp-card {
  grid-template-columns: 1.3fr 1fr;
  grid-template-areas: "head icon" "body tags";
  column-gap: clamp(24px, 5vw, 80px);
}
.xp-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: var(--bg);
  opacity: var(--dim, 0);
  pointer-events: none;
  z-index: 2;
}
.xp-card__head { grid-area: head; display: grid; gap: 24px; }
.xp-card > p { grid-area: body; align-self: end; }
.xp-card > .tags { grid-area: tags; align-self: end; justify-content: flex-end; }
.xp-card__big {
  grid-area: icon;
  justify-self: end;
  font-size: clamp(6rem, 13vw, 11rem);
  line-height: 1;
  color: var(--line-strong);
}
.xp-card--3 .xp-card__big { color: rgba(16, 18, 11, .22); }
@media (max-width: 760px) {
  .xp-card { grid-template-columns: 1fr; grid-template-areas: "head" "body" "tags"; }
  .xp-card__big { display: none; }
  .xp-card > .tags { justify-content: flex-start; }
}
.xp-card__head i { font-size: 2.4rem; color: var(--accent-ink); }
.xp-card .h3 { font-size: clamp(1.8rem, 3.6vw, 3.2rem); letter-spacing: -0.04em; max-width: 18ch; }
.xp-card p { max-width: 56ch; color: var(--muted); font-size: 1.08rem; }
.xp-card--2 { background: var(--surface-2); }
.xp-card--3 { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.xp-card--3 p { color: rgba(16, 18, 11, .72); }
.xp-card--3 .xp-card__head i { color: var(--on-accent); }
.xp-card--3 .tags li { border-color: rgba(16, 18, 11, .25); }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.tags li {
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  font-size: .85rem;
}

/* ---------- Projets (défilement horizontal) ---------- */
.work { padding: calc(var(--section) / 2) 0 var(--section); overflow: hidden; }
.work__pin { display: flex; flex-direction: column; gap: clamp(32px, 4vw, 56px); min-height: 100dvh; justify-content: center; }
.work__intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.link-arrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 500;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 4px;
  transition: gap .4s var(--ease), border-color .3s;
}
.link-arrow:hover { gap: 14px; border-color: var(--text); }

.work__track {
  display: flex;
  gap: clamp(16px, 2vw, 28px);
  padding-inline: var(--gutter);
  width: max-content;
  will-change: transform;
}
.project { width: clamp(300px, 46vw, 680px); flex: none; display: grid; gap: 16px; }
.project__media {
  aspect-ratio: 4 / 3;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
}
.project__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.1s var(--ease); }
@media (min-width: 901px) { .work .project__media img { width: 116%; max-width: none; margin-left: -8%; } }
.project:hover .project__media img { transform: scale(1.04); }
.project__meta { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 14px; }
.project__meta h3 { font-size: 1.35rem; letter-spacing: -0.03em; }
.project__meta i { font-size: 1.3rem; transition: transform .5s var(--ease); }
.project:hover .project__meta i { transform: translate(3px, -3px); color: var(--accent-ink); }

.project--end {
  width: clamp(260px, 26vw, 360px);
  aspect-ratio: 3 / 4;
  align-self: start;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--on-accent);
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.project--end__label { font-size: clamp(1.8rem, 2.8vw, 2.6rem); font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.project--end__icon {
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--on-accent); color: var(--accent);
  font-size: 1.5rem;
  transition: transform .5s var(--ease);
}
.project--end:hover .project--end__icon { transform: rotate(-45deg); }

.work__progress span { display: block; height: 2px; background: var(--line); position: relative; overflow: hidden; }
.work__progress span::after {
  content: ""; position: absolute; inset: 0;
  background: var(--text);
  transform: scaleX(var(--p, 0));
  transform-origin: left;
}

@media (max-width: 900px) {
  .work__track { flex-direction: column; width: 100%; }
  .project, .project--end { width: 100%; }
  .project--end { aspect-ratio: auto; min-height: 220px; }
  .work__progress { display: none; }
}

/* ---------- À propos ---------- */
.about { padding: var(--section) 0; }
.about__manifesto {
  font-size: clamp(1.7rem, 3.8vw, 3.4rem);
  font-weight: 550;
  letter-spacing: -0.035em;
  line-height: 1.12;
  max-width: 24ch;
  margin-bottom: clamp(56px, 8vw, 112px);
}
.about__manifesto .w { opacity: .18; transition: opacity .2s linear; }
.reduced .about__manifesto .w { opacity: 1; }

.bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, minmax(220px, auto));
  gap: 16px;
}
.bento__cell {
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 28px;
  overflow: hidden;
}
.bento__cell--photo { grid-row: span 2; padding: 0; }
.bento__cell--photo img { width: 100%; height: 100%; object-fit: cover; object-position: top; filter: grayscale(1) contrast(1.05); transition: filter .8s var(--ease); }
.bento__cell--photo:hover img { filter: grayscale(0); }
.bento__cell--stat { display: flex; flex-direction: column; justify-content: space-between; gap: 20px; background: var(--surface-2); }
.stat__plus { font-size: .55em; vertical-align: top; margin-left: .04em; }
.stat { font-size: clamp(4rem, 8vw, 7rem); font-weight: 600; letter-spacing: -0.06em; line-height: .9; color: var(--accent-ink); }
.bento__cell--text { grid-column: span 2; display: grid; align-content: end; gap: 12px; }
.bento__cell--text p { max-width: 46ch; }
.bento__cell--accent {
  grid-column: span 2;
  background: var(--accent);
  color: var(--on-accent);
  border-color: transparent;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  font-size: 1.15rem;
  font-weight: 500;
}
.bento__cell--accent i { font-size: 2.2rem; }
.bento__cell--links { display: grid; align-content: stretch; gap: 0; padding: 0; background: var(--bg-2); }
.bento__cell--links a {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 0 28px;
  font-weight: 500;
  transition: background-color .3s;
}
.bento__cell--links a + a { border-top: 1px solid var(--line); }
.bento__cell--links a:hover { background: var(--surface-2); }
.bento__cell--links i { font-size: 1.3rem; }

@media (max-width: 1000px) {
  .bento { grid-template-columns: repeat(2, 1fr); grid-template-rows: none; }
  .bento__cell--photo { grid-row: span 1; aspect-ratio: 4 / 5; }
  .bento__cell--text, .bento__cell--accent { grid-column: span 2; }
  .bento__cell--links { min-height: 160px; }
}
@media (max-width: 600px) {
  .bento { grid-template-columns: 1fr; }
  .bento__cell--text, .bento__cell--accent { grid-column: auto; }
}

/* ---------- Méthode ---------- */
.method { padding: var(--section) 0; background: var(--bg-2); }
.method__grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(40px, 8vw, 120px); }
.method__aside { position: sticky; top: 120px; align-self: start; display: grid; gap: 32px; justify-items: start; }
.steps { position: relative; list-style: none; margin: 0; padding: 0 0 0 44px; display: grid; gap: clamp(56px, 8vw, 96px); }
.steps__rail { position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--line-strong); }
.steps__rail span { position: absolute; inset: 0; background: var(--accent-ink); transform-origin: top; transform: scaleY(0); }
.reduced .steps__rail span { transform: scaleY(1); }
.step { position: relative; display: grid; gap: 12px; }
.step__dot {
  position: absolute; left: -44px; top: 6px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg-2);
  border: 2px solid var(--line-strong);
  transition: background-color .4s, border-color .4s;
}
.step.is-on .step__dot { background: var(--accent); border-color: var(--accent); }
.step p { max-width: 48ch; }

@media (max-width: 900px) {
  .method__grid { grid-template-columns: 1fr; }
  .method__aside { position: static; }
}

/* ---------- Contact ---------- */
.contact { padding: var(--section) 0; }
.contact__title {
  font-size: clamp(3rem, 10vw, 9rem);
  letter-spacing: -0.055em;
  line-height: .92;
  margin-bottom: clamp(48px, 7vw, 96px);
}
.contact__grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: clamp(32px, 6vw, 80px); align-items: start; }
.contact__routes { display: grid; gap: 12px; }
.route {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color .3s, transform .5s var(--ease);
}
.route > i:first-child { font-size: 1.6rem; color: var(--accent-ink); }
.route strong { display: block; font-weight: 600; }
.route .muted { font-size: .92rem; }
.route__arrow { font-size: 1.2rem; transition: transform .5s var(--ease); }
.route:hover { border-color: var(--line-strong); transform: translateX(4px); }
.route:hover .route__arrow { transform: translate(3px, -3px); }
.route:first-child { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.route:first-child > i:first-child { color: var(--on-accent); }
.route:first-child .muted { color: rgba(16, 18, 11, .7); }

.contact__form { display: grid; gap: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 16px 24px; }

@media (max-width: 900px) {
  .contact__grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .form-row { grid-template-columns: 1fr; }
  .form-foot .btn { width: 100%; }
}

/* ---------- Footer ---------- */
.footer { padding: 40px 0 32px; border-top: 1px solid var(--line); overflow: hidden; }
.footer__big .k { color: inherit; }
.footer__big {
  font-size: clamp(2.6rem, 13.4vw, 13rem);
  font-weight: 650;
  letter-spacing: -0.065em;
  line-height: .85;
  white-space: nowrap;
  color: var(--surface-2);
  margin: 0 0 32px -0.04em;
  user-select: none;
}
.footer__row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; font-size: .9rem; }
.footer__links { display: flex; align-items: center; gap: 20px; }
.footer__links a { color: var(--muted); transition: color .3s; }
.footer__links a:hover { color: var(--text); }
.footer__links i { font-size: 1.25rem; }

/* ---------- Page projets ---------- */
.page-hero { padding-block: 152px 48px; }
.page-hero .display { max-width: 14ch; margin-bottom: 24px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 40px; }
.filter {
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 18px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: transparent;
  font-size: .92rem;
  transition: background-color .3s, color .3s, border-color .3s;
}
.filter .count { font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.filter:hover { border-color: var(--text); }
.filter[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.filter[aria-pressed="true"] .count { color: var(--bg); opacity: .7; }

.gallery { padding-block: 24px var(--section); }
.gallery__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 48px 24px; }
.gallery__grid .project { width: auto; }
.gallery__empty {
  grid-column: 1 / -1;
  padding: 64px 32px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  display: grid; justify-items: start; gap: 16px;
}
.text-card {
  aspect-ratio: 4 / 3;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 32px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.text-card i { font-size: 2.2rem; color: var(--accent-ink); }
.project .stack-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; grid-column: 1 / -1; }
.project .stack-list li { font-family: var(--mono); font-size: .75rem; color: var(--muted); padding: 2px 10px; border: 1px solid var(--line); border-radius: var(--r-pill); }
.project__desc { grid-column: 1 / -1; color: var(--muted); font-size: .95rem; }
@media (max-width: 760px) { .gallery__grid { grid-template-columns: 1fr; } }

/* ---------- Pages simples (mentions, 404) ---------- */
.prose { padding: 152px 0 var(--section); max-width: 760px; }
.prose h1 { margin-bottom: 32px; }
.prose h2 { font-size: 1.4rem; margin: 40px 0 12px; }
.prose p, .prose li { color: var(--muted); }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
