/* Ajustements de la variante bleue : cadrage, apparitions et filtres cinématiques. */
@media (min-width: 768px) {
  .project-dialog { border: 0; border-radius: 34px; }
}

.nav-primary .nav-home { display: none; }

/* Le pointeur indique le sens du défilement lorsque la souris atteint un bord du carrousel. */
@media (min-width: 768px) and (hover: hover) {
  .carousel-stage[data-edge-direction="-1"],
  .carousel-stage[data-edge-direction="-1"] .project-card {
    cursor: url('./cursor-carousel-left.svg') 22 22, w-resize;
  }
  .carousel-stage[data-edge-direction="1"],
  .carousel-stage[data-edge-direction="1"] .project-card {
    cursor: url('./cursor-carousel-right.svg') 22 22, e-resize;
  }
}

/* Évite le contour bleu conservé après un toucher, sans masquer le focus clavier. */
.project-card, .dialog-close { -webkit-tap-highlight-color: transparent; }
html:not(.keyboard-navigation) .project-card:focus,
html:not(.keyboard-navigation) .dialog-close:focus { outline: none; }
html.keyboard-navigation .project-card:focus-visible,
html.keyboard-navigation .dialog-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px #172033b3;
}

@media (min-width: 768px) and (max-width: 1250px) {
  .hero-portrait {
    width: 88%;
    right: 0;
  }
  .hero-portrait img { object-position: 100% 28%; }
}
@media (max-width: 767px) {
  .nav-primary .nav-home { display: inline-flex; }
  .hero-portrait { left: -5%; right: auto; width: 110%; }
  .hero-portrait img { object-position: 50% 20%; }
}

/* Titres et textes qui remontent doucement à leur entrée dans l'écran. */
html.reveal-ready .scroll-reveal {
  opacity: 0;
  filter: blur(7px);
  transform: translate3d(0, 31px, 0);
  transition: opacity .75s cubic-bezier(.2,.7,.2,1),
              transform .85s cubic-bezier(.2,.7,.2,1),
              filter .85s cubic-bezier(.2,.7,.2,1);
  transition-delay: var(--reveal-delay, 0ms);
}
html.reveal-ready .scroll-reveal.is-visible {
  opacity: 1;
  filter: blur(0);
  transform: none;
}
.contact-panel > * {
  transition: opacity .75s ease, transform .85s cubic-bezier(.2,.7,.2,1), filter .85s ease;
}
.contact-scene:not(.is-reveal-visible) .contact-panel > * {
  opacity: 0;
  filter: blur(7px);
  transform: translateY(26px);
}
.contact-scene.is-reveal-visible .contact-panel > :nth-child(2) { transition-delay: .08s; }
.contact-scene.is-reveal-visible .contact-panel > :nth-child(3) { transition-delay: .16s; }
.contact-scene.is-reveal-visible .contact-panel > :nth-child(4) { transition-delay: .24s; }
.contact-scene.is-reveal-visible .contact-panel > :nth-child(5) { transition-delay: .32s; }

/* Domaines du hero sans séparateurs ni numéros, avec entrée successive. */
.service-row { align-items: end; }
.service-row div { border: 0; padding-top: 0; text-align: center; }
.service-row span { display: none; }
.service-row strong {
  display: block;
  color: #fff;
  font-size: clamp(14px, 1.42vw, 19px);
  font-weight: 800;
  opacity: .7;
  animation: domain-appear .7s cubic-bezier(.15,.8,.2,1) both;
}
.service-row div:nth-child(1) strong { animation-delay: .15s; }
.service-row div:nth-child(2) strong { animation-delay: .3s; }
.service-row div:nth-child(3) strong { animation-delay: .45s; }
.service-row div:nth-child(4) strong { animation-delay: .6s; }
@keyframes domain-appear {
  from { opacity: 0; filter: blur(9px); transform: scale(.85) translateY(9px); }
  to { opacity: .7; filter: blur(0); transform: scale(1) translateY(0); }
}
.hero-cta, .contact-actions > a {
  width: 233px;
  min-height: 48px;
  padding: 0;
  justify-content: center;
  text-align: center;
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 500;
}
.nav-primary a:hover, .nav-primary a:focus-visible { color: var(--blue); }
.top-nav:not(.on-light) .nav-primary a:hover,
.top-nav:not(.on-light) .nav-primary a:focus-visible { color: var(--blue-bright); }

/* Rail unique : la sélection bleue reste centrée, les catégories défilent. */
.project-filter-shell {
  position: relative;
  width: min(100%, 830px);
  height: 58px;
  margin: 70px auto 18px;
  border-radius: 999px;
  background: rgba(80, 90, 110, .1);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  transform-origin: center;
}
.project-filter-shell:not(.is-visible) {
  opacity: 0;
  filter: blur(12px);
  transform: scaleX(.07) scaleY(.7);
}
.project-filter-shell.is-visible {
  opacity: 1;
  filter: blur(0);
  transform: none;
}
.project-filter-shell {
  transition: opacity .35s ease, filter .85s cubic-bezier(.18,.85,.2,1), transform .85s cubic-bezier(.18,.85,.2,1);
}
.project-filter-active {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 50%;
  z-index: 0;
  width: var(--active-width, 62px);
  border-radius: 999px;
  background: var(--blue);
  box-shadow: none;
  transform: translateX(-50%);
  transition: width .35s cubic-bezier(.2,.8,.2,1), opacity .25s ease .35s;
}
.project-filter-shell:not(.is-visible) .project-filter-active { opacity: 0; }
.project-filter-viewport {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
  touch-action: pan-x;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}
.project-filter-viewport::-webkit-scrollbar { display: none; }
.project-filter-shell .project-filters {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 5px;
  width: max-content;
  height: 100%;
  margin: 0;
  padding: 5px 0;
  overflow: visible;
}
.project-filter-shell .project-filters button {
  flex: none;
  height: 48px;
  padding: 0 17px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #273044;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  scroll-snap-align: center;
  transition: color .22s ease, opacity .35s ease, transform .35s ease;
}
.project-filter-shell .project-filters button:hover { border: 0; background: transparent; color: var(--blue); }
.project-filter-shell .project-filters button[aria-pressed="true"],
.project-filter-shell .project-filters button[aria-pressed="true"]:hover {
  border: 0;
  background: transparent;
  color: #fff;
}
.project-filter-shell:not(.is-visible) .project-filters button { opacity: 0; transform: translateY(8px); }
.project-filter-shell.is-visible .project-filters button { opacity: 1; transform: none; transition-delay: .3s; }

/* Commandes du carrousel : simples flèches sans cercle. */
.carousel-controls button {
  border: 0;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: none;
  color: #202a3d;
  font-size: 28px;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), color .2s ease;
}
.carousel-controls button:hover {
  border: 0;
  background: transparent;
  color: var(--blue);
  transform: scale(1.13);
}

/* Contact : portrait plus présent et liens épurés. */
.contact-photo { width: 117px; height: 117px; border: 0; transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.contact-photo:hover { transform: scale(1.11); }
.contact-actions .pill-light { justify-content: center; }
.contact-linkedin {
  display: inline-flex;
  align-items: center;
  border: 2px solid #ffffffaa;
  background: #ffffff1c;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: inset 0 1px #ffffff35;
}

/* Le cadre arrondi appartient à la fiche animée, pas à la fenêtre modale. */
.project-dialog {
  --project-card-radius: 34px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}
.dialog-shell { position: relative; display: block; height: 100%; overflow: visible; isolation: isolate; }
.dialog-shell.is-project-transitioning > .dialog-scroll {
  position: relative;
  pointer-events: none;
}
.dialog-shell.is-project-transitioning > .dialog-project-ghost {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  scrollbar-width: none;
}
.dialog-scroll {
  height: 100%;
  min-height: 0;
  padding-bottom: 96px;
  border-radius: var(--project-card-radius);
  background: #fff;
  box-shadow: 0 26px 80px #0008;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.dialog-media {
  position: relative;
  isolation: isolate;
  display: block;
  min-height: 0;
  overflow: hidden;
  overflow: clip;
  background: var(--media-backdrop-gradient, linear-gradient(135deg, #192b4b, #080d1b));
}
.dialog-media-backdrop {
  position: absolute;
  z-index: 0;
  top: -34px;
  left: -34px;
  width: calc(100% + 68px);
  height: calc(100% + 68px);
  object-fit: cover;
  object-position: center;
  transform: scale(var(--media-backdrop-zoom, 1.25));
  filter: blur(32px) brightness(.48) saturate(1.15);
  pointer-events: none;
  user-select: none;
}
.dialog-media-backdrop:not([data-mode="image"]) { visibility: hidden; }
.dialog-media::after {
  content: '';
  position: absolute;
  z-index: 0;
  inset: 0;
  background: linear-gradient(180deg, #06112424, #0307145c);
  pointer-events: none;
}
.dialog-media-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: auto;
  min-height: 0;
  overflow: visible;
}
.dialog-media-ghost {
  position: absolute;
  inset: 0 0 auto;
  pointer-events: none;
  overflow: hidden;
}
.dialog-media-content img, .dialog-media-content video {
  display: block;
  width: min(100%, var(--media-fit-width));
  height: auto;
  max-width: 100%;
  max-height: calc(100dvh - 86px);
  object-fit: contain;
  background: #d9dce2;
}
.media-dots {
  z-index: 2;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.media-dots button {
  width: 8px;
  height: 8px;
  background: #ffffffd9;
  box-shadow: 0 1px 5px 1px #0009;
}
.media-dots button[aria-current="true"] { width: 24px; background: #fff; }
.dialog-body { overflow: visible; }
.dialog-bottom {
  position: absolute;
  right: clamp(14px, 2.4vw, 28px);
  bottom: 16px;
  left: clamp(14px, 2.4vw, 28px);
  z-index: 4;
  min-height: 62px;
  padding: 10px clamp(18px, 2.4vw, 30px);
  border: 1px solid #ffffffbf;
  border-radius: 28px;
  background: #f2f4f7c9;
  -webkit-backdrop-filter: blur(22px) saturate(145%);
  backdrop-filter: blur(22px) saturate(145%);
  box-shadow: inset 0 1px #fff, 0 10px 30px #101b3526;
}
.dialog-bottom button, .dialog-bottom span {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}
.dialog-bottom button {
  padding: 8px 12px;
  border-radius: 999px;
  transition: background .2s ease, color .2s ease;
}
.dialog-bottom button .dialog-nav-project-word { color: inherit; }
.dialog-bottom button:hover { background: #00000012; }
.dialog-close, .media-arrow {
  border: 0;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  color: #fff;
  text-shadow: 0 0 10px #0008, 0 1px 3px #0007;
  filter: drop-shadow(0 1px 6px #0004);
}
.media-arrow {
  width: 48px;
  height: 54px;
}
.media-arrow svg {
  display: block;
  width: 36px;
  height: 42px;
  overflow: visible;
}
.media-prev svg { transform: rotate(180deg); }
.dialog-close {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  -webkit-text-stroke: .7px currentColor;
  text-shadow: none;
}
.dialog-close:hover, .media-arrow:hover {
  border: 0;
  background: transparent;
  color: #d9e5ff;
  transform: scale(1.1);
}
.media-arrow:hover { color: #fff; transform: translateY(-50%) scale(1.1); }

@media (max-width: 767px) {
  .project-dialog {
    --project-card-radius: 30px;
    width: calc(100% - 16px);
    height: calc(100dvh - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 0;
    overflow: visible;
  }
  .hero-cta, .contact-actions > a { width: 205px; min-height: 55px; font-size: 16px; }
  .service-row strong { font-size: 13px; line-height: 1.25; }
  .project-filter-shell { width: 100%; height: 56px; margin: 46px auto 18px; }
  .project-filter-shell .project-filters { margin: 0; padding-top: 4px; padding-bottom: 4px; }
  .project-filter-shell .project-filters button { height: 48px; }
  .project-filter-active { top: 4px; bottom: 4px; }
  .dialog-scroll { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .dialog-media-backdrop { filter: blur(26px) brightness(.48) saturate(1.15); }
  .dialog-media-content img, .dialog-media-content video {
    width: min(100%, var(--media-fit-width-mobile));
    max-height: calc(100dvh - 64px);
  }
  .media-arrow { width: 44px; height: 52px; }
  .media-arrow svg { width: 34px; height: 40px; }
  .dialog-bottom {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    left: 12px;
    min-height: 58px;
    padding: 8px 12px;
    border-radius: 999px;
  }
  .dialog-bottom button, .dialog-bottom span { font-size: 11px; }
  .dialog-bottom button { padding: 8px 4px; }
}
@media (max-width: 360px) {
  .dialog-bottom .dialog-nav-project-word { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html.reveal-ready .scroll-reveal, .contact-scene .contact-panel > * {
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
    transition: none !important;
  }
  .service-row strong { animation: none; opacity: .7; }
  .project-filter-shell, .project-filter-shell .project-filters button, .project-filter-active {
    opacity: 1 !important;
    filter: none !important;
    transform: none;
    transition: none !important;
  }
  .project-filter-active { transform: translateX(-50%); }
}

/* Plusieurs catégories peuvent être affichées sur une même vignette. */
.project-card-categories {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  max-width: 100%;
}
.project-card-category {
  flex: none;
  padding: 5px 9px;
  font-size: 10px;
  line-height: 1.15;
}

/* Fiches provisoires : aucun média n'est chargé avant son ajout. */
.dialog-media-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: min(56dvh, 580px);
  background: #d9dce1;
  color: #687180;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.project-dialog.is-placeholder-project .dialog-body { grid-template-columns: 1fr; }
.project-dialog.is-placeholder-project .dialog-thumbnails { display: none; }
.project-dialog [hidden] { display: none !important; }
.dialog-text p { margin: 0 0 1em; }
.dialog-text p:last-child { margin-bottom: 0; }

/* Entrée et sortie légères : seuls transform et opacity changent. */
@keyframes project-dialog-open {
  from { opacity: 0; transform: translate3d(0, 14px, 0) scale(.94); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}
@keyframes project-dialog-close {
  from { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
  to { opacity: 0; transform: translate3d(0, 10px, 0) scale(.96); }
}
@keyframes project-backdrop-open {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes project-backdrop-close {
  from { opacity: 1; }
  to { opacity: 0; }
}
.project-dialog.is-opening {
  animation: project-dialog-open 320ms cubic-bezier(.18, .7, .2, 1) both;
}
.project-dialog.is-closing {
  animation: project-dialog-close 210ms cubic-bezier(.4, 0, 1, 1) both;
  pointer-events: none;
}
.project-dialog.is-opening::backdrop {
  animation: project-backdrop-open 320ms ease-out both;
}
.project-dialog.is-closing::backdrop {
  animation: project-backdrop-close 210ms ease-in both;
}

@media (max-width: 767px) {
  .project-card-category { font-size: 9px; }
  .dialog-media-placeholder { min-height: 42dvh; }
  .project-dialog.is-opening { animation-name: project-dialog-open-mobile; }
  .project-dialog.is-closing {
    animation-name: project-dialog-close-mobile;
    animation-duration: 420ms;
    animation-timing-function: cubic-bezier(.25, .65, .25, 1);
    transform-origin: 50% 60%;
  }
  .project-dialog.is-closing::backdrop { animation-duration: 420ms; }
}

@keyframes project-dialog-open-mobile {
  from { opacity: 0; transform: translate3d(0, 34px, 0) scale(.985); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}
@keyframes project-dialog-close-mobile {
  from { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
  to { opacity: 0; transform: translate3d(var(--mobile-close-x, 0px), 82dvh, 0) scale(.7); }
}

@media (prefers-reduced-motion: reduce) {
  .project-dialog.is-opening,
  .project-dialog.is-closing,
  .project-dialog.is-opening::backdrop,
  .project-dialog.is-closing::backdrop { animation: none !important; }
}

/* « Tous » reste accessible hors de la barre de catégories défilante. */
.project-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(100%, 1010px);
  margin: 70px auto 18px;
}
.project-filter-row .project-filter-shell {
  flex: 1;
  min-width: 0;
  width: auto;
  margin: 0;
}
.project-filter-all {
  flex: none;
  height: 58px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: rgba(80, 90, 110, .1);
  color: #273044;
  font-size: 13px;
  font-weight: 700;
  transition: background .25s ease, color .25s ease, transform .25s ease;
}
.project-filter-all:hover { color: var(--blue); transform: scale(1.04); }
.project-filter-all[aria-pressed="true"],
.project-filter-all[aria-pressed="true"]:hover { background: var(--blue); color: #fff; }
.project-filter-shell.is-all-selected .project-filter-active { opacity: 0; }
@media (max-width: 767px) {
  .project-filter-row { gap: 8px; margin: 46px auto 18px; }
  .project-filter-all { height: 56px; padding: 0 16px; }
}

/* Retour en haut, visible uniquement à la fin du site. */
.contact-reveal { height: 100dvh; }
#contact { scroll-margin-top: -24px; }
.footer-back-to-top {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 24px;
}
.back-to-top {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: #ffffff24;
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: inset 0 1px #ffffff2e, 0 8px 25px #00000026;
  color: #fff;
  transition: background .2s ease, transform .2s ease;
}
.back-to-top svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.back-to-top:hover { background: rgba(255, 255, 255, .22); transform: translateY(-3px); }
.back-to-top:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
@media (prefers-reduced-motion: reduce) {
  .back-to-top { transition: none; }
}
