/* ==========================================================================
   Atelier Moussouni · V2
   Polices auto-hébergées (pas d'appel à Google Fonts : plus rapide, conforme RGPD)
   ========================================================================== */

@font-face {
  font-family: "Cinzel";
  src: url("../assets/fonts/cinzel-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Cinzel";
  src: url("../assets/fonts/cinzel-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Alegreya SC";
  src: url("../assets/fonts/alegreya-sc-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Alegreya SC";
  src: url("../assets/fonts/alegreya-sc-latin-500-normal.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("../assets/fonts/montserrat-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Couleurs */
  --sable: #d7caaa;          /* fond principal (maquette) */
  --sable-clair: #e6ddc8;    /* bandeau des villes, surfaces claires */
  --encre: #241c14;          /* texte principal : 10.3:1 sur sable */
  --encre-douce: #54473a;    /* texte secondaire : 5.5:1 sur sable */
  --bronze: #6b4f1f;         /* texte d'accent : 5.6:1 sur sable clair */
  --or: #a8823a;             /* filets et détails, jamais pour du texte courant */
  --nuit: #17110b;           /* voiles sombres sur photos */
  --ivoire: #f6f0e2;         /* texte sur photo */

  /* Typo */
  --f-titre: "Cinzel", "Trajan Pro", Georgia, serif;
  --f-capitales: "Alegreya SC", Georgia, serif;
  --f-texte: "Montserrat", system-ui, sans-serif;

  --t-xs: 0.75rem;
  --t-sm: 0.875rem;
  --t-base: 1rem;
  --t-lg: 1.25rem;
  --t-xl: clamp(1.75rem, 1.1rem + 2.2vw, 2.75rem);

  /* Espacements */
  --gouttiere: clamp(1rem, 4vw, 3rem);
  --section-y: clamp(4.5rem, 3rem + 7vw, 9rem);
  --max: 76rem;

  /* Mouvement */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--encre-douce) var(--sable);
}

body {
  margin: 0;
  background: var(--sable);
  color: var(--encre);
  font-family: var(--f-texte);
  font-size: var(--t-base);
  line-height: 1.7;
  font-weight: 400;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }
a { color: inherit; }

::selection { background: var(--encre); color: var(--sable-clair); }

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem; top: -4rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--encre);
  color: var(--sable-clair);
  font-size: var(--t-sm);
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.section-title {
  margin: 0 0 2rem;
  font-family: var(--f-titre);
  font-weight: 400;
  font-size: var(--t-xl);
  line-height: 1.15;
  letter-spacing: 0.02em;
  text-wrap: balance;
}

/* --------------------------------------------------------------------------
   En-tête
   -------------------------------------------------------------------------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 2rem;
  min-height: 3.75rem;
  padding: 0 var(--gouttiere);
  color: var(--ivoire);
  transition: background-color 0.4s var(--ease-out), color 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
}

.site-header[data-state="scrolled"] {
  background: rgb(215 202 170 / 0.94);
  color: var(--encre);
  box-shadow: 0 1px 0 rgb(36 28 20 / 0.12);
}
@supports (backdrop-filter: blur(1px)) {
  .site-header[data-state="scrolled"] {
    background: rgb(215 202 170 / 0.82);
    backdrop-filter: blur(10px) saturate(1.1);
  }
}

/* Nom de l'atelier : caché sur le hero (le titre est déjà là), visible ensuite */
.site-header__brand {
  order: 2;
  margin-left: auto;
  font-family: var(--f-titre);
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease-out);
}
.site-header[data-state="scrolled"] .site-header__brand { opacity: 1; pointer-events: auto; }

.site-nav {
  order: 1;
  display: flex;
  gap: 0.25rem;
}

.site-nav a {
  position: relative;
  padding: 0.75rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0.7rem; right: calc(0.7rem + 0.18em);
  bottom: 0.45rem;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease-out);
}
.site-nav a:hover::after,
.site-nav a[aria-current="true"]::after { transform: scaleX(1); }

.site-header[data-state="over-hero"] .site-nav a { text-shadow: 0 1px 8px rgb(0 0 0 / 0.45); }

.nav-toggle { display: none; }

@media (max-width: 760px) {
  .site-header { justify-content: space-between; }
  .site-header__brand { order: 1; margin-left: 0; }

  .nav-toggle {
    order: 2;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 44px;
    margin-left: auto;
    padding: 0 0.25rem;
    border: 0;
    background: none;
    color: inherit;
    font: 500 0.72rem/1 var(--f-texte);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    cursor: pointer;
  }
  .nav-toggle__bars,
  .nav-toggle__bars::before {
    display: block;
    width: 22px; height: 1px;
    background: currentColor;
    transition: transform 0.3s var(--ease-out);
  }
  .nav-toggle__bars { position: relative; transform: translateY(-3px); }
  .nav-toggle__bars::before { content: ""; position: absolute; top: 6px; }
  .nav-toggle[aria-expanded="true"] .nav-toggle__bars { transform: rotate(45deg); }
  .nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { transform: translateY(-6px) rotate(-90deg); }

  .site-nav {
    position: fixed;
    inset: 3.75rem 0 auto 0;
    flex-direction: column;
    gap: 0;
    padding: 1rem var(--gouttiere) 2rem;
    background: var(--sable);
    color: var(--encre);
    box-shadow: 0 18px 30px -18px rgb(23 17 11 / 0.35);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-0.5rem);
    transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out), visibility 0s linear 0.3s;
  }
  .site-nav.is-open {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out);
  }
  .site-nav a {
    padding: 0.9rem 0;
    border-bottom: 1px solid rgb(36 28 20 / 0.12);
    font-family: var(--f-titre);
    font-size: 1.15rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: none;
    text-shadow: none !important;
  }
  .site-nav a::after { display: none; }

  /* Menu ouvert sur le hero : l'en-tête passe en clair pour rester lisible */
  .site-header.menu-open { background: var(--sable); color: var(--encre); }
  .site-header.menu-open .site-header__brand { opacity: 1; }
}

/* --------------------------------------------------------------------------
   Hero : bandes verticales
   Le nombre de bandes s'adapte : 6 (large), 4 (tablette), 3 (mobile).
   Chaque bande prend une part égale (flex: 1) : aucune largeur fixe.
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  display: grid;
  place-items: center;
  height: 100vh;
  height: 100svh;
  min-height: 32rem;
  overflow: hidden;
  background: var(--nuit);
  color: var(--ivoire);
  isolation: isolate;
}

.hero__strips {
  position: absolute;
  inset: 0;
  z-index: -1;
  display: flex;
  gap: 1px;
}

.strip {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  transition: flex-grow 0.9s var(--ease-out);
}

.strip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--focus, 50% 50%);
  filter: saturate(0.92);
}

/* Voile sombre : haut (lisibilité du menu) + centre (lisibilité du titre) */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgb(23 17 11 / 0.55) 0%, rgb(23 17 11 / 0) 18%),
    radial-gradient(ellipse 70% 42% at 50% 50%, rgb(23 17 11 / 0.55) 0%, rgb(23 17 11 / 0.2) 70%, rgb(23 17 11 / 0) 100%),
    rgb(23 17 11 / 0.32);
}

.strip--desktop { display: none; }
.strip--tablet { display: none; }
@media (min-width: 700px)  { .strip--tablet { display: block; } }
@media (min-width: 1100px) { .strip--desktop { display: block; } }

/* Sur ordinateur, la bande survolée s'élargit doucement */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .hero__strips:hover .strip:hover { flex-grow: 1.45; }
}

.hero__copy {
  width: min(100% - 2 * var(--gouttiere), 90rem);
  text-align: center;
  text-shadow: 0 2px 24px rgb(0 0 0 / 0.35);
}

.hero__trades {
  margin: 0 0 1.1rem;
  font-size: clamp(0.66rem, 0.6rem + 0.25vw, 0.8rem);
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.hero__title {
  margin: 0;
  font-family: var(--f-titre);
  font-weight: 400;
  font-size: clamp(2.1rem, 1rem + 4.6vw, 6rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

.hero__motto {
  display: inline-block;
  margin: 1.4rem 0 0;
  padding-top: 1.1rem;
  border-top: 1px solid rgb(246 240 226 / 0.55);
  font-size: clamp(0.68rem, 0.6rem + 0.3vw, 0.85rem);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  max-width: 60ch;
}

@media (min-width: 1000px) {
  .hero__title { white-space: nowrap; font-size: clamp(3.4rem, 4.6vw, 6rem); }
}
@media (max-width: 480px) {
  .hero__trades { letter-spacing: 0.14em; font-size: 0.62rem; }
  .hero__motto { letter-spacing: 0.12em; }
}

/* Hauteur réduite (téléphone à l'horizontale) */
@media (max-height: 520px) and (orientation: landscape) {
  .hero { min-height: 100svh; }
  .hero__title { font-size: clamp(1.8rem, 9vh, 3rem); }
}

/* Entrée : les bandes se dévoilent de gauche à droite, puis le titre apparaît */
@media (prefers-reduced-motion: no-preference) {
  .js .strip { clip-path: inset(100% 0 0 0); }
  .js .hero.is-ready .strip {
    clip-path: inset(0 0 0 0);
    transition: clip-path 1.3s var(--ease-out), flex-grow 0.9s var(--ease-out);
  }
  .js .hero.is-ready .strip:nth-child(2) { transition-delay: 0.08s, 0s; }
  .js .hero.is-ready .strip:nth-child(3) { transition-delay: 0.16s, 0s; }
  .js .hero.is-ready .strip:nth-child(4) { transition-delay: 0.24s, 0s; }
  .js .hero.is-ready .strip:nth-child(5) { transition-delay: 0.32s, 0s; }
  .js .hero.is-ready .strip:nth-child(6) { transition-delay: 0.40s, 0s; }

  .js .hero__copy > * { opacity: 0; transform: translateY(0.6rem); filter: blur(4px); }
  .js .hero.is-ready .hero__copy > * {
    opacity: 1; transform: none; filter: none;
    transition: opacity 1.2s var(--ease-out), transform 1.2s var(--ease-out), filter 1.2s var(--ease-out);
  }
  .js .hero.is-ready .hero__trades { transition-delay: 0.7s; }
  .js .hero.is-ready .hero__title  { transition-delay: 0.8s; }
  .js .hero.is-ready .hero__motto  { transition-delay: 1s; }
}

/* --------------------------------------------------------------------------
   À propos
   -------------------------------------------------------------------------- */
.about {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(2.5rem, 6vw, 6rem);
  align-items: center;
  width: min(100% - 2 * var(--gouttiere), var(--max));
  margin: 0 auto;
  padding: var(--section-y) 0;
}

.about__photos {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(12, auto);
  max-width: 30rem;
}

.about__photo {
  width: 100%;
  aspect-ratio: 3 / 4.6;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 18px 40px -16px rgb(23 17 11 / 0.45);
}
.about__photo--first  { grid-column: 1 / span 7; grid-row: 1 / span 8; z-index: 1; object-position: 50% 30%; }
.about__photo--second { grid-column: 6 / span 7; grid-row: 5 / span 8; object-position: 50% 40%; }

.about__text { max-width: 40rem; }

/* Trois niveaux de lecture :
   1. le chapeau, plus grand, dit l'essentiel ;
   2. le corps, plus doux, avec les savoir-faire en gras ;
   3. la conclusion, détachée par un filet doré, comme une signature. */
.about__text p {
  margin: 0 0 1.25em;
  color: var(--encre-douce);
  font-size: clamp(0.95rem, 0.9rem + 0.15vw, 1.03rem);
  line-height: 1.75;
}
.about__text strong { font-weight: 600; color: var(--encre); }

.about__text .about__lede {
  position: relative;
  margin-bottom: 2.25em;
  padding-bottom: 1.9em;
  color: var(--encre);
  font-size: clamp(1.1rem, 1rem + 0.45vw, 1.3rem);
  line-height: 1.6;
  font-weight: 400;
}
.about__lede strong {
  font-weight: 500;
  color: var(--bronze);
  background: linear-gradient(transparent 62%, rgb(168 130 58 / 0.22) 62%);
}

/* Filet doré entre le chapeau et le corps du texte */
.about__lede::before {
  content: "";
  position: absolute;
  bottom: 0; left: 0;
  width: 3.5rem; height: 1px;
  background: var(--or);
}
.about__lede::after {
  content: "";
  position: absolute;
  bottom: -3px; left: 3.5rem;
  width: 7px; height: 7px;
  background: var(--or);
  transform: translateX(-50%) rotate(45deg);
}
.about__text p:last-child { margin-bottom: 0; }

/* Téléphone et tablette : photos centrées, puis texte centré en dessous */
@media (max-width: 899px) {
  .about {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 2.5rem;
    text-align: center;
  }
  .about__photos { width: min(100%, 24rem); margin: 0 auto; }
  .about__text { margin: 0 auto; }
  .about__lede::before { left: 50%; transform: translateX(-50%); }
  .about__lede::after { left: 50%; transform: translateX(-50%) rotate(45deg); }
}

/* --------------------------------------------------------------------------
   Bandeau des villes
   Lignes alternées : 1 vers la gauche, 2 vers la droite, 3 vers la gauche.
   -------------------------------------------------------------------------- */
.places {
  position: relative;
  padding: clamp(1.4rem, 2.5vw, 2rem) 0;
  background: var(--sable-clair);
  border-block: 1px solid rgb(168 130 58 / 0.45);
  color: var(--bronze);
  overflow: hidden;
}

/* Liste de référence : lue par les lecteurs d'écran ; affichée telle quelle si le JS
   ne tourne pas ou si l'utilisateur a demandé moins d'animations. */
.places__list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 0;
  width: min(100% - 2 * var(--gouttiere), var(--max));
  margin: 0 auto;
  padding: 0;
  list-style: none;
  font-family: var(--f-capitales);
  font-size: clamp(1rem, 0.9rem + 0.4vw, 1.25rem);
  letter-spacing: 0.08em;
}
.places__list li { display: inline-flex; align-items: center; }
.places__list li + li::before {
  content: "";
  width: 5px; height: 5px;
  margin: 0 0.9em;
  background: var(--or);
  transform: rotate(45deg);
}

.places__marquee { display: none; }

.places.is-animated .places__list { /* conservée pour l'accessibilité */
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
}
.places.is-animated .places__marquee {
  display: grid;
  gap: clamp(0.5rem, 1vw, 0.8rem);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.marquee-row {
  display: flex;
  width: max-content;
  font-family: var(--f-capitales);
  font-size: clamp(1.05rem, 0.85rem + 0.8vw, 1.6rem);
  line-height: 1.3;
  letter-spacing: 0.08em;
  white-space: nowrap;
  animation: marquee var(--duree, 80s) linear infinite;
  animation-direction: var(--sens, normal);
  will-change: transform;
}
.marquee-row:nth-child(2) {
  font-family: var(--f-titre);
  font-size: clamp(0.95rem, 0.8rem + 0.6vw, 1.35rem);
  letter-spacing: 0.14em;
  color: var(--encre-douce);
}
.marquee-row span { display: inline-flex; align-items: center; }
.marquee-row span::after {
  content: "";
  width: 5px; height: 5px;
  margin: 0 1.1em;
  background: var(--or);
  transform: rotate(45deg);
}


@keyframes marquee {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

/* --------------------------------------------------------------------------
   Projets : mosaïque sans gouttière
   Grand écran : 4 colonnes, placement défini dans js/projects.js (grid).
   Tablette : 2 colonnes. Mobile : 1 colonne.
   -------------------------------------------------------------------------- */
.projects {
  width: min(100% - 2 * var(--gouttiere), var(--max));
  margin: 0 auto;
  padding: var(--section-y) 0;
}

.mosaic {
  --row: clamp(11rem, 17vw, 16.5rem);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: var(--row);
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--nuit);
}

.tile { position: relative; min-width: 0; }
@media (min-width: 901px) {
  .tile { grid-column: var(--col); grid-row: var(--row-span); }
}

.tile__button {
  text-decoration: none;
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--nuit);
  color: var(--ivoire);
  cursor: pointer;
  overflow: hidden;
  text-align: center;
}

.tile__button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.2s var(--ease-out), filter 0.6s var(--ease-out);
}

/* Fondu sombre par le bas : garantit la lisibilité du titre quelle que soit la photo */
.tile__button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgb(23 17 11 / 0) 42%,
    rgb(23 17 11 / 0.45) 66%,
    rgb(23 17 11 / 0.88) 100%);
  transition: opacity 0.6s var(--ease-out);
}

/* Cadre doré intérieur, comme une baguette d'encadrement : apparaît au survol */
.tile__button::before {
  content: "";
  position: absolute;
  inset: 12px;
  z-index: 2;
  border: 1px solid rgb(201 168 97 / 0.85);
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
  transition: opacity 0.5s var(--ease-out), transform 0.7s var(--ease-out);
}

.tile__caption {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 0.3rem;
  padding: 1.25rem 1.5rem 1.4rem;
  transition: transform 0.6s var(--ease-out);
}

.tile__place {
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgb(246 240 226 / 0.85);
}

.tile__title {
  font-family: var(--f-capitales);
  font-weight: 500;
  font-size: clamp(1.05rem, 0.85rem + 0.55vw, 1.4rem);
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-wrap: balance;
}

/* Invitation à ouvrir : cachée au repos sur ordinateur, toujours visible sur écran tactile */
.tile__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.35rem;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #e3c98e;
}
.tile__cta::before,
.tile__cta::after {
  content: "";
  width: 1.25rem;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}

@media (hover: hover) and (pointer: fine) {
  .tile__cta {
    opacity: 0;
    transform: translateY(0.5rem);
    transition: opacity 0.45s var(--ease-out), transform 0.6s var(--ease-out);
  }
  .tile__caption { transform: translateY(1.35rem); }

  /* Les autres tuiles s'effacent : l'œil va droit sur celle qu'on survole */
  .mosaic:has(.tile__button:hover) .tile__button:not(:hover) img,
  .mosaic:has(.tile__button:focus-visible) .tile__button:not(:focus-visible) img {
    filter: brightness(0.78) saturate(0.8);
  }

  .tile__button:hover img,
  .tile__button:focus-visible img { transform: scale(1.06); }
  .tile__button:hover::before,
  .tile__button:focus-visible::before { opacity: 1; transform: none; }
  .tile__button:hover .tile__caption,
  .tile__button:focus-visible .tile__caption { transform: none; }
  .tile__button:hover .tile__cta,
  .tile__button:focus-visible .tile__cta { opacity: 1; transform: none; transition-delay: 0.08s; }
  /* La souris a la priorité : une seule tuile mise en avant à la fois */
  .mosaic:has(.tile__button:hover) .tile__button:not(:hover) img { transform: none; filter: brightness(0.78) saturate(0.8); }
  .mosaic:has(.tile__button:hover) .tile__button:not(:hover)::before { opacity: 0; }
  .mosaic:has(.tile__button:hover) .tile__button:not(:hover) .tile__caption { transform: translateY(1.35rem); }
  .mosaic:has(.tile__button:hover) .tile__button:not(:hover) .tile__cta { opacity: 0; }
}

.tile__button:focus-visible { outline: 2px solid var(--or); outline-offset: -2px; }

@media (max-width: 900px) {
  .mosaic {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: clamp(12rem, 42vw, 20rem);
    grid-auto-flow: dense;
  }
  .tile--wide { grid-column: span 2; }
}
@media (max-width: 560px) {
  .mosaic { grid-template-columns: 1fr; grid-auto-rows: 72vw; }
  .tile--wide { grid-column: auto; }
  .projects { width: 100%; }
  .projects .section-title { padding: 0 var(--gouttiere); }
}

/* --------------------------------------------------------------------------
   Fenêtre projet (<dialog> natif : focus piégé et touche Échap gérés par le navigateur)
   -------------------------------------------------------------------------- */
body.has-dialog { overflow: hidden; }

.project {
  width: min(100% - 2rem, 84rem);
  max-width: none;
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 0;
  background: var(--sable-clair);
  color: var(--encre);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.6);
  overflow: hidden;
}
.project::backdrop { background: rgb(23 17 11 / 0.78); }

@media (prefers-reduced-motion: no-preference) {
  .project[open] { animation: dialog-in 0.5s var(--ease-out); }
  .project[open]::backdrop { animation: fade-in 0.4s ease-out; }
}
@keyframes dialog-in { from { opacity: 0; transform: translateY(1rem) scale(0.985); } }
@keyframes fade-in { from { opacity: 0; } }

.project__inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(17rem, 24rem);
  /* Taille fixe : la fenêtre ne change pas de format d'une photo à l'autre */
  height: min(calc(100dvh - 2rem), 56rem);
}

.project__viewer {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  background: var(--nuit);
}

/* La photo est contenue dans la zone au-dessus du bandeau, quel que soit son format */
.project__stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

/* Un double-clic rapide sur les flèches sélectionnait la photo : la couleur de
   sélection (sombre) recouvrait alors l'image. On désactive la sélection ici. */
.project__viewer,
.project__viewer * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.project__image { -webkit-user-drag: none; }

.project__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.3s var(--ease-out);
}
.project__image.is-loading { opacity: 0.35; }

.project__nav {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgb(246 240 226 / 0.35);
  border-radius: 50%;
  background: rgb(23 17 11 / 0.45);
  color: var(--ivoire);
  cursor: pointer;
  transition: background-color 0.25s, border-color 0.25s;
}
.project__nav:hover { background: rgb(23 17 11 / 0.75); border-color: var(--or); }
.project__nav--prev { left: 1rem; }
.project__nav--next { right: 1rem; }
.project__nav svg,
.project__close svg {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}
.project__nav[hidden] { display: none; }

.project__thumbs {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 10px;
  background: var(--nuit);
  border-top: 1px solid rgb(246 240 226 / 0.1);
  list-style: none;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--encre-douce) transparent;
}
.project__thumbs button {
  display: block;
  width: 64px;
  height: 48px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.25s;
}
.project__thumbs button:hover { opacity: 0.85; }
.project__thumbs button[aria-current="true"] { opacity: 1; outline: 1px solid var(--or); outline-offset: 2px; }
.project__thumbs img { width: 100%; height: 100%; object-fit: cover; }

.project__text {
  min-height: 0;
  padding: clamp(1.5rem, 3vw, 2.75rem);
  padding-top: clamp(3.5rem, 5vw, 4rem);
  overflow-y: auto;
}

.project__place {
  margin: 0 0 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bronze);
}
.project__title {
  margin: 0;
  font-family: var(--f-titre);
  font-weight: 400;
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2.1rem);
  line-height: 1.2;
  text-wrap: balance;
}
/* Légende qui change avec chaque photo */
.project__caption {
  margin: 1.5rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid rgb(36 28 20 / 0.12);
}
.project__caption[hidden] { display: none; }
.project__caption-text {
  margin: 0;
  font-family: var(--f-capitales);
  font-weight: 500;
  font-size: clamp(1.1rem, 1rem + 0.35vw, 1.3rem);
  line-height: 1.35;
  letter-spacing: 0.02em;
  color: var(--encre);
  text-wrap: balance;
}
.project__caption-place {
  margin: 0.5rem 0 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bronze);
}
.project__caption-place[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .project__caption.is-changing > * { animation: caption-in 0.5s var(--ease-out); }
}
@keyframes caption-in { from { opacity: 0; transform: translateY(0.3rem); } }

.project__desc { margin: 1.5rem 0 1.75rem; font-size: 0.95rem; }
.project__desc p { margin: 0 0 1em; }
.project__desc p:last-child { margin-bottom: 0; }
.project__desc:empty { display: none; }
.project__techniques h4 {
  margin: 0 0 0.6rem;
  font-family: var(--f-capitales);
  font-weight: 500;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
}
.project__techniques ul { margin: 0; padding: 0; list-style: none; font-size: 0.92rem; }
.project__techniques li {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.5rem 0;
  border-top: 1px solid rgb(36 28 20 / 0.12);
}
.project__techniques li::before {
  content: "";
  flex: none;
  width: 5px; height: 5px;
  background: var(--or);
  transform: translateY(-2px) rotate(45deg);
}

.project__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--encre);
  cursor: pointer;
}
.project__close:hover { background: rgb(36 28 20 / 0.08); }

@media (max-width: 900px) {
  .project { width: 100%; max-height: 100dvh; height: 100dvh; margin: 0; }
  .project__inner { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: 100dvh; overflow-y: auto; }
  .project__viewer { grid-template-rows: auto auto; }
  .project__stage { height: min(62dvh, 75vw); }
  .project__text { overflow: visible; padding-top: 1.5rem; }
  .project__close { background: rgb(23 17 11 / 0.55); color: var(--ivoire); }
  .project__close:hover { background: rgb(23 17 11 / 0.8); }
  .project__nav { width: 44px; height: 44px; }
  .project__nav--prev { left: 0.5rem; }
  .project__nav--next { right: 0.5rem; }
}

/* --------------------------------------------------------------------------
   Contact
   -------------------------------------------------------------------------- */
.contact {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(2.5rem, 6vw, 6rem);
  width: min(100% - 2 * var(--gouttiere), var(--max));
  margin: 0 auto;
  padding: calc(var(--section-y) / 2) 0 var(--section-y);
}

.contact__intro p { margin: 0 0 2rem; max-width: 34rem; }

.contact__details { margin: 0; display: grid; gap: 1.25rem; }
.contact__details dt {
  margin-bottom: 0.2rem;
  font-family: var(--f-capitales);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: var(--bronze);
}
.contact__details dd { margin: 0; }
.contact__mail {
  text-decoration: underline;
  text-decoration-color: var(--or);
  text-underline-offset: 0.3em;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 0.25s;
}
.contact__mail:hover { text-decoration-color: var(--encre); }

.contact__form { display: grid; gap: 1.5rem; }

.field { display: grid; gap: 0.35rem; }
.field label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--encre-douce);
}
.field input,
.field textarea {
  width: 100%;
  padding: 0.6rem 0;
  border: 0;
  border-bottom: 1px solid rgb(36 28 20 / 0.35);
  border-radius: 0;
  background: transparent;
  color: var(--encre);
  font: inherit;
  caret-color: var(--bronze);
  transition: border-color 0.25s;
}
.field textarea { resize: vertical; min-height: 8rem; }
.field input:hover,
.field textarea:hover { border-bottom-color: var(--encre-douce); }
.field input:focus-visible,
.field textarea:focus-visible {
  outline: none;
  border-bottom: 1px solid var(--encre);
  box-shadow: 0 1px 0 0 var(--encre);
}
.field [aria-invalid="true"] { border-bottom-color: #8e2a1c; }
.field__error { margin: 0; font-size: 0.85rem; color: #8e2a1c; }
.field--trap { position: absolute; left: -9999px; }

.contact__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; }

.button {
  min-height: 48px;
  padding: 0 1.75rem;
  border: 1px solid var(--encre);
  border-radius: 0;
  background: var(--encre);
  color: var(--sable-clair);
  font: 600 0.75rem/1 var(--f-texte);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.3s var(--ease-out), color 0.3s var(--ease-out);
}
.button:hover { background: transparent; color: var(--encre); }
.button:disabled { opacity: 0.55; cursor: progress; }

.contact__status { margin: 0; font-size: 0.92rem; }
.contact__status[data-type="error"] { color: #8e2a1c; }

@media (max-width: 899px) {
  .contact { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   Pied de page
   -------------------------------------------------------------------------- */
.site-footer {
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  padding: clamp(3rem, 6vw, 4.5rem) var(--gouttiere) 2rem;
  background: var(--nuit);
  color: rgb(246 240 226 / 0.75);
  text-align: center;
}
.site-footer p { margin: 0; }
.site-footer__name {
  font-family: var(--f-titre);
  font-size: clamp(1.3rem, 1rem + 1vw, 1.75rem);
  letter-spacing: 0.04em;
  color: var(--ivoire);
}
.site-footer__trades { font-family: var(--f-capitales); font-size: 1.05rem; letter-spacing: 0.06em; color: #c9a861; }
.site-footer__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 2rem;
  margin-top: 2.25rem !important;
  padding-top: 1.25rem;
  border-top: 1px solid rgb(246 240 226 / 0.15);
  width: min(100%, 40rem);
  font-size: 0.8rem;
}
.site-footer a { text-underline-offset: 0.3em; }
.site-footer a:hover { color: var(--ivoire); }

/* --------------------------------------------------------------------------
   Préférences de mouvement
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* --------------------------------------------------------------------------
   Divers
   -------------------------------------------------------------------------- */
.noscript-note { margin: 1rem 0 0; color: var(--encre-douce); }

/* --------------------------------------------------------------------------
   Page Mentions légales
   -------------------------------------------------------------------------- */
.legal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.75rem;
  padding: 0 var(--gouttiere);
  border-bottom: 1px solid rgb(36 28 20 / 0.12);
}
.legal-header a { text-decoration: none; }
.legal-header__brand { font-family: var(--f-titre); font-size: 0.95rem; letter-spacing: 0.06em; }
.legal-header__back {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.legal-header__back:hover { text-decoration: underline; text-underline-offset: 0.3em; }

.legal {
  width: min(100% - 2 * var(--gouttiere), 46rem);
  margin: 0 auto;
  padding: clamp(3rem, 6vw, 5rem) 0 var(--section-y);
}
.legal h1 {
  margin: 0 0 2.5rem;
  font-family: var(--f-titre);
  font-weight: 400;
  font-size: var(--t-xl);
  line-height: 1.15;
}
.legal h2 {
  margin: 2.75rem 0 0.75rem;
  font-family: var(--f-capitales);
  font-weight: 500;
  font-size: 1.3rem;
  letter-spacing: 0.03em;
}
.legal p, .legal li { color: var(--encre-douce); }
.legal strong { color: var(--encre); font-weight: 600; }
.legal dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.5rem; margin: 0; }
.legal dt { font-weight: 600; color: var(--encre); }
.legal dd { margin: 0; color: var(--encre-douce); }
.legal a { text-decoration-color: var(--or); text-underline-offset: 0.25em; }
.legal .maj { margin-top: 3rem; font-size: var(--t-sm); }
@media (max-width: 560px) { .legal dl { grid-template-columns: 1fr; } .legal dd { margin-bottom: 0.6rem; } }

/* Champs à compléter : bien visibles tant qu'ils ne sont pas remplis.
   Une fois tout rempli, retirer les <mark class="todo">. */
mark.todo {
  padding: 0 0.25em;
  background: #f3d98b;
  color: var(--encre);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Pages projets (projets/*.html, générées par tools/prepare_deploy.py)
   -------------------------------------------------------------------------- */
.pp {
  width: min(100% - 2 * var(--gouttiere), var(--max));
  margin: 0 auto;
  padding: clamp(3rem, 6vw, 5rem) 0 var(--section-y);
}
.pp-intro { max-width: 44rem; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.pp-place {
  margin: 0 0 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bronze);
}
.pp-title {
  margin: 0 0 1.75rem;
  font-family: var(--f-titre);
  font-weight: 400;
  font-size: var(--t-xl);
  line-height: 1.15;
  text-wrap: balance;
}
.pp-intro p:not(.pp-place) { margin: 0 0 1em; color: var(--encre-douce); max-width: 40rem; }
.pp-techniques { margin-top: 2rem; }
.pp-techniques h2 {
  margin: 0 0 0.6rem;
  font-family: var(--f-capitales);
  font-weight: 500;
  font-size: 1.2rem;
  letter-spacing: 0.04em;
}
.pp-techniques ul { margin: 0; padding: 0; list-style: none; max-width: 32rem; }
.pp-techniques li {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.5rem 0;
  border-top: 1px solid rgb(36 28 20 / 0.12);
  color: var(--encre-douce);
}
.pp-techniques li::before {
  content: "";
  flex: none;
  width: 5px; height: 5px;
  background: var(--or);
  transform: translateY(-2px) rotate(45deg);
}

/* Galerie : deux colonnes sur grand écran (lues ligne par ligne, dans l'ordre des photos),
   une colonne sur mobile */
.pp-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 2.5vw, 1.75rem) clamp(0.75rem, 2vw, 1.25rem);
  align-items: start;
}
.pp-photo { margin: 0; background: var(--nuit); }
.pp-photo img { width: 100%; height: auto; }
.pp-photo figcaption {
  padding: 0.75rem 0.25rem 0.5rem;
  background: var(--sable);
  font-family: var(--f-capitales);
  font-size: 1.02rem;
  letter-spacing: 0.02em;
  color: var(--encre);
}
.pp-photo__place {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--f-texte);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bronze);
}
@media (max-width: 700px) { .pp-gallery { grid-template-columns: 1fr; } }

/* Projet précédent / suivant */
.pp-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: clamp(3rem, 6vw, 4.5rem);
  padding-top: 1.5rem;
  border-top: 1px solid rgb(36 28 20 / 0.15);
}
.pp-nav__link { display: grid; gap: 0.3rem; text-decoration: none; padding: 0.5rem 0; }
.pp-nav__link--next { text-align: right; }
.pp-nav__label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bronze);
}
.pp-nav__title { font-family: var(--f-titre); font-size: clamp(1.05rem, 0.9rem + 0.5vw, 1.35rem); line-height: 1.25; }
.pp-nav__link:hover .pp-nav__title { text-decoration: underline; text-decoration-color: var(--or); text-underline-offset: 0.25em; }
