/* =========================================================
   Portfolio AH — styles (fidèles à la maquette Figma 1366×768)
   ========================================================= */

:root {
  --ink: #eeeeee;
  --dim: rgba(238, 238, 238, 0.5);
  --faint: rgba(238, 238, 238, 0.34);
  --line: rgba(255, 255, 255, 0.5);
  --shadow: 0 4px 30px 5px rgba(0, 0, 0, 0.45);
  --base: #24180f;
  --font: "Jomhuria", "Impact", "Arial Narrow", sans-serif;
  /* 1 unité de maquette, mise à l'échelle de l'écran */
  --u: min(calc(100vw / 1366), calc(100vh / 768));
  /* unité des photos du carrousel : plus grandes que la maquette, limitées à ~84 % de la hauteur */
  --c: min(calc(var(--u) * 1.25), calc(78vh / 564), calc(100vw / 1000));
  --ease: cubic-bezier(.22, .8, .24, 1);
  color-scheme: dark;
}

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

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--base);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Fond flouté (photo de la catégorie) ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--base);
}
.backdrop__layer {
  position: absolute;
  inset: -60px;
  background-size: cover;
  background-position: center;
  filter: blur(15px);
  transform: scale(1.12);
  opacity: 0;
  transition: opacity .9s var(--ease);
}
.backdrop__layer.is-visible { opacity: 1; }
.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.12);
}

/* ---------- En-tête ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 31px 32px 0 34px;
  pointer-events: none;
}
.site-header > * { pointer-events: auto; }

.logo {
  display: block;
  width: 82px;
  height: 87px;
}
.logo img { width: 100%; height: 100%; object-fit: contain; }
.logo__text {
  display: block;
  font-size: 120px;
  line-height: 87px;
  letter-spacing: -0.02em;
}

.site-nav {
  display: flex;
  gap: 28px;
  margin-top: -6px;
}
.site-nav a {
  font-size: 40px;
  line-height: 1;
  color: var(--ink);
  transition: color .25s;
}
.site-nav a:hover,
.site-nav a:focus-visible { color: #fff; }
/* Sur les pages À propos / Contact, le lien inactif est atténué */
.site-nav.has-current a:not([aria-current]) { color: var(--dim); }
.site-nav.has-current a:not([aria-current]):hover { color: var(--ink); }

/* ---------- Pied de page ---------- */
.site-footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  padding: 0 16px 8px 16px;
  pointer-events: none;
}
.site-footer a {
  pointer-events: auto;
  font-size: 32px;
  line-height: 1;
  color: var(--ink);
  opacity: .34;
  transition: opacity .25s;
}
.site-footer a:hover,
.site-footer a:focus-visible { opacity: .9; }

/* =========================================================
   ACCUEIL — carrousel par catégorie
   ========================================================= */
.home {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
}

.home__glow {
  position: absolute;
  left: 50%; top: 50%;
  width: calc(1000 * var(--c));
  height: calc(630 * var(--c));
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(0,0,0,.38), rgba(0,0,0,0));
  pointer-events: none;
  z-index: 1;
}

/* Mot géant derrière les photos */
.home__word {
  position: absolute;
  left: 50%;
  /* comme la maquette : ligne de base des lettres à 634/768 de la hauteur,
     mot sur toute la largeur de l'écran */
  top: calc(85% - 100vw * 440 / 1366);
}
/* Grand écran / plein écran : mot un peu plus bas */
@media (min-width: 1200px) and (min-height: 700px) {
  .home__word { top: calc(87.5% - 100vw * 440 / 1366); }
}
.home__word {
  width: 100vw;
  height: calc(100vw * 520 / 1366);
  transform: translateX(-50%);
  overflow: visible;
  z-index: 2;
  pointer-events: none;
  transition: opacity .35s ease, transform .5s var(--ease);
}
.home__word text {
  font-family: var(--font);
  fill: var(--dim);
}
.home__word.is-leaving-next { opacity: 0; transform: translateX(calc(-50% - 60px)); }
.home__word.is-leaving-prev { opacity: 0; transform: translateX(calc(-50% + 60px)); }
.home__word.is-entering-next { opacity: 0; transform: translateX(calc(-50% + 60px)); transition: none; }
.home__word.is-entering-prev { opacity: 0; transform: translateX(calc(-50% - 60px)); transition: none; }

/* Cartes photo */
.home__cards {
  position: absolute;
  inset: 0;
  z-index: 3;
}
.card {
  --x: 0;
  --s: 1;
  --r: 50;
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(369 * var(--c));
  height: calc(564 * var(--c));
  margin: calc(-282 * var(--c)) 0 0 calc(-184.5 * var(--c));
  padding: 0;
  border: 0;
  border-radius: calc(var(--r) * var(--c));
  overflow: hidden;
  background: #111;
  box-shadow: var(--shadow);
  cursor: pointer;
  transform: translateX(calc(var(--x) * var(--c))) scale(var(--s));
  transition:
    transform .75s var(--ease),
    border-radius .75s var(--ease),
    opacity .5s ease;
  will-change: transform;
}
.card__empty {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(160deg, #3a2a1e, #1b130d);
  font-size: calc(90 * var(--c));
  color: var(--dim);
}
.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
}
/* Voile sombre sur les photos latérales */
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.22), rgba(0,0,0,.08));
  opacity: 0;
  transition: opacity .6s ease;
  pointer-events: none;
}
.card[data-pos="-1"]::after { background: linear-gradient(90deg, rgba(0,0,0,.05), rgba(0,0,0,.28)); }

.card[data-pos="0"]  { --x: 0;    --s: 1;     --r: 50; z-index: 3; }
.card[data-pos="-1"] { --x: -216; --s: .8325; --r: 90; z-index: 2; }
.card[data-pos="1"]  { --x: 230;  --s: .8325; --r: 90; z-index: 2; }
.card[data-pos="-2"] { --x: -260; --s: .7;    --r: 90; z-index: 1; opacity: 0; pointer-events: none; }
.card[data-pos="2"]  { --x: 274;  --s: .7;    --r: 90; z-index: 1; opacity: 0; pointer-events: none; }
.card[data-pos="-1"]::after,
.card[data-pos="1"]::after { opacity: 1; }
.card.no-anim { transition: opacity .3s ease; }

.card[data-pos="0"]:hover { --s: 1.015; }
.card:focus-visible { outline: 3px solid var(--ink); outline-offset: 6px; }

.home__hint {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  gap: 10px;
}
.home__dot {
  width: 8px; height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  opacity: .3;
  cursor: pointer;
  transition: opacity .3s, transform .3s;
}
.home__dot[aria-current="true"] { opacity: .9; transform: scale(1.25); }

/* =========================================================
   GALERIE
   ========================================================= */
.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.tabs {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: clamp(20px, 5vw, 72px);
  padding-top: 150px;
  margin: 0 auto;
}
.tab {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-size: 75px;
  line-height: .8;
  color: var(--dim);
  transition: color .3s, font-size .4s var(--ease);
}
.tab:hover { color: rgba(238,238,238,.8); }
.tab[aria-selected="true"] {
  font-size: 100px;
  color: var(--ink);
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, 201px);
  column-gap: 44px;
  row-gap: 35px;
  justify-content: center;
  padding: 40px 0 120px;
  transition: opacity .35s ease;
}
.grid.is-fading { opacity: 0; }
.grid__item {
  position: relative;
  width: 201px;
  aspect-ratio: 201 / 277;
  padding: 0;
  border: 0;
  background: rgba(0,0,0,.2);
  cursor: zoom-in;
  overflow: hidden;
  transition: transform .35s var(--ease), box-shadow .35s;
}
.grid__item img { width: 100%; height: 100%; object-fit: cover; }
.grid__item:hover,
.grid__item:focus-visible {
  transform: scale(1.035);
  box-shadow: var(--shadow);
  z-index: 1;
  outline: none;
}
.devis {
  display: flex;
  justify-content: center;
  padding: 0 16px 120px;
  margin-top: -50px;
}
.devis__btn {
  display: inline-block;
  padding: 10px 28px 6px;
  border: 4px solid var(--line);
  border-radius: 20px;
  font-size: 30px;
  line-height: 1;
  color: var(--ink);
  background: rgba(0,0,0,.12);
  transition: border-color .25s, background-color .25s, transform .25s var(--ease);
}
.devis__btn:hover,
.devis__btn:focus-visible {
  border-color: rgba(255,255,255,.9);
  background: rgba(255,255,255,.08);
  transform: translateY(-2px);
  outline: none;
}
.grid__empty {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 48px;
  color: var(--dim);
  padding-top: 60px;
}

/* Visionneuse */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(14, 9, 5, .55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s ease, visibility .35s;
}
.lightbox.is-open { opacity: 1; visibility: visible; }
.lightbox__img {
  max-width: min(86vw, 900px);
  max-height: 76vh;
  width: auto;
  height: auto;
  box-shadow: var(--shadow);
  transform: scale(.96);
  transition: transform .4s var(--ease);
}
.lightbox.is-open .lightbox__img { transform: scale(1); }
.lightbox__btn {
  position: absolute;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--ink);
  opacity: .6;
  font-size: 64px;
  line-height: 1;
  padding: 10px 18px;
  transition: opacity .2s;
}
.lightbox__btn:hover { opacity: 1; }
.lightbox__close { top: 18px; right: 22px; font-size: 48px; }
.lightbox__prev { left: 2vw; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 2vw; top: 50%; transform: translateY(-50%); }

/* =========================================================
   À PROPOS
   ========================================================= */
.about {
  display: grid;
  grid-template-columns: minmax(0, 712px) 369px;
  justify-content: space-between;
  align-items: start;
  gap: 60px;
  max-width: 1216px;
  margin: 0 auto;
  padding: 218px 75px 120px;
}
.about__text {
  margin: 36px 0 0;
  font-size: 36px;
  line-height: 1;
  color: var(--dim);
  white-space: pre-line;
}
.about__photo {
  width: 369px;
  height: 368px;
  object-fit: cover;
  box-shadow: var(--shadow);
}

/* =========================================================
   CONTACT — tient sur un seul écran d'ordinateur, sans défiler
   ========================================================= */
.contact {
  display: flex;
  flex-direction: column;
  max-width: 848px;
  margin: 0 auto;
  padding: 104px 0 52px;
}
.contact__title {
  margin: 0 0 14px;
  text-align: center;
  font-size: 56px;
  line-height: .9;
  font-weight: 400;
  color: var(--ink);
}
.contact__intro {
  margin: 0 0 18px;
  padding: 13px 24px 9px;
  border: 2px solid rgba(255,255,255,.22);
  border-radius: 20px;
  background: rgba(0,0,0,.16);
  font-size: 26px;
  line-height: 1;
  color: rgba(238,238,238,.78);
  white-space: pre-line;
}
.contact__intro:empty { display: none; }

.form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
}
.field { position: relative; }
.field input,
.field select,
.field textarea {
  display: block;
  width: 100%;
  height: 66px;
  padding: 27px 22px 4px;
  border: 4px solid var(--line);
  border-radius: 20px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font);
  font-size: 30px;
  line-height: 1;
  outline: none;
  transition: border-color .25s, background-color .25s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(255,255,255,.9);
  background-color: rgba(0,0,0,.08);
}
.field label {
  position: absolute;
  left: 25px;
  top: 21px;
  font-size: 26px;
  line-height: 1;
  color: var(--dim);
  pointer-events: none;
  transform-origin: left top;
  transition: transform .25s var(--ease), color .25s;
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label,
.field textarea:focus + label,
.field textarea:not(:placeholder-shown) + label,
.field--select label {
  transform: translateY(-12px) scale(.7);
  color: rgba(238,238,238,.75);
}

/* Liste « Objet de la demande » */
.field select {
  padding-right: 52px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.field select:invalid { color: var(--dim); }
.field select option { background: #2a1f17; color: var(--ink); font-family: system-ui, sans-serif; font-size: 16px; }
.field--select::after {
  content: "";
  position: absolute;
  right: 24px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 3px solid var(--dim);
  border-bottom: 3px solid var(--dim);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* La zone « Demande » prend la place qui reste */
.field--grow { flex: 1; min-height: 96px; }
.field--grow textarea { height: 100%; min-height: 96px; padding-top: 32px; resize: none; }

.form__foot {
  display: flex;
  align-items: center;
  gap: 16px;
}
.form__captcha { margin-right: auto; min-height: 0; }
.form__status {
  margin: 0;
  font-size: 26px;
  line-height: 1;
  color: var(--dim);
  text-align: right;
}
.form__submit {
  flex: none;
  padding: 10px 32px 6px;
  border: 4px solid var(--line);
  border-radius: 20px;
  background: transparent;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
  transition: border-color .25s, background-color .25s;
}
.form__submit:hover,
.form__submit:focus-visible {
  border-color: rgba(255,255,255,.9);
  background: rgba(255,255,255,.08);
  outline: none;
}
.form__submit[disabled] { opacity: .5; cursor: wait; }

/* Ordinateur : la page occupe exactement la hauteur de l'écran */
@media (min-width: 701px) and (min-height: 560px) {
  .contact { height: 100vh; height: 100dvh; }
}

/* =========================================================
   PAGES LÉGALES
   ========================================================= */
.legal {
  max-width: 860px;
  margin: 0 auto;
  padding: 150px 32px 120px;
  font-size: 30px;
  line-height: 1.05;
  color: rgba(238,238,238,.72);
}
.legal h1 {
  margin: 0 0 24px;
  font-size: 64px;
  line-height: 1;
  font-weight: 400;
  color: var(--ink);
}
.legal h2 {
  margin: 34px 0 6px;
  font-size: 42px;
  line-height: 1;
  font-weight: 400;
  color: var(--ink);
}
.legal p { margin: 0 0 10px; }
.legal a { text-decoration: underline; text-underline-offset: 3px; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1240px) {
  .grid {
    grid-template-columns: repeat(4, 201px);
  }
}
@media (max-width: 1000px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 201px));
    column-gap: 28px;
    row-gap: 28px;
    padding-inline: 24px;
  }
  .grid__item { width: 100%; }
  .about {
    grid-template-columns: 1fr;
    padding: 150px 32px 120px;
  }
  .about__photo { order: -1; width: min(369px, 100%); height: auto; aspect-ratio: 1; }
  .about__text { margin-top: 0; }
  .contact { padding-inline: 24px; }
}

@media (max-width: 700px) {
  .site-header { padding: 18px 16px 0 18px; }
  .logo { width: 54px; height: 58px; }
  .logo__text { font-size: 82px; line-height: 58px; }
  .site-nav { gap: 16px; margin-top: -2px; }
  .site-nav a { font-size: 32px; }
  .site-footer a { font-size: 26px; }

  .tabs {
    justify-content: flex-start;
    gap: 22px;
    padding: 108px 20px 0;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { font-size: 52px; scroll-snap-align: center; flex: none; }
  .tab[aria-selected="true"] { font-size: 72px; }
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 24px 16px 90px;
  }
  .about { padding: 108px 20px 90px; gap: 28px; }
  .about__text { font-size: 30px; }
  .contact { padding: 96px 16px 90px; }
  .contact__title { font-size: 48px; }
  .contact__intro { padding: 12px 18px 8px; font-size: 25px; }
  .form__row { grid-template-columns: 1fr; }
  .field--grow { flex: none; }
  .field--grow textarea { height: 150px; }
  .form__foot { flex-direction: column; align-items: stretch; }
  .form__captcha { margin: 0 auto; }
  .form__status { text-align: center; }
  .devis { margin-top: -60px; padding-bottom: 100px; }
  .devis__btn { font-size: 28px; }
  .legal { padding: 108px 20px 90px; font-size: 26px; }
  .legal h1 { font-size: 52px; }
}

/* Accueil en portrait (mobile) : photos plus grandes, mot sous les photos */
@media (orientation: portrait) and (max-width: 900px) {
  :root {
    --u: min(calc(100vw / 640), calc(100vh / 1000));
    --c: min(calc(100vw / 560), calc(66vh / 564));
  }
  /* Mot centré entre le bas des photos et le bas de l'écran :
     bas des photos = 44vh + 282c ; milieu = 72vh + 141c ;
     on y place le centre des lettres (≈ 59 % de la hauteur du SVG) */
  .home__word {
    top: calc(66vh + 141 * var(--c) - (100vw - 48px) * 520 / 1366 * .594);
    bottom: auto;
    /* 24px de marge de chaque côté */
    width: calc(100vw - 48px);
    height: calc((100vw - 48px) * 520 / 1366);
  }
  .home__cards { top: -6vh; bottom: 6vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
