/* Villa Lagune : visite au scroll (démo M1 Agency)
   Couleurs tirées des images : l'eau de la lagune, la chaux des murs, la latérite de la terrasse. */

/* Police hébergée avec la page : aucun appel à Google Fonts, et le site M1 Agency
   n'autorise que ses propres polices (en-tête Content-Security-Policy) */
@font-face {
  font-family: "Inter";
  src: url("inter.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* Poppins : la phrase de « La villa en bref » (choix d'Izack du 29 octobre) */
@font-face {
  font-family: "Poppins";
  src: url("poppins-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  --lagune: #0F3D44;
  --lagune-nuit: #082A2F;
  --chaux: #E8EDE9;
  --encre: #0B1A1C;
  --laterite: #C0532B;
  --blanc: #FFFFFF;

  --gouttiere: 16px;
  --police: 'Inter', system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--lagune-nuit);
  color: var(--encre);
  font-family: var(--police);
  font-stretch: 100%;
  font-size: 1rem;
  line-height: 1.5;
}

h1,
h2,
p,
ul,
ol,
dl,
dd {
  margin: 0;
}

a:focus-visible {
  outline: 2px solid var(--laterite);
  outline-offset: 3px;
}

/* Petits textes techniques : numéros, étiquettes, chiffres */
.sur-titre,
.numero,
.parcours,
.logo-agence,
.badge,
.invite {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- La visite ---------- */

.visite {
  position: relative;
  height: 700vh;
  height: 700svh;
}

.scene {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  color: var(--blanc);
  background: var(--lagune-nuit);
}

/* Le cadre affiche la première image en fond tant que le JavaScript n'a rien dessiné */
.ecran {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  overflow: hidden;
  background: var(--lagune) url("images/001.webp") center / cover no-repeat;
}

.image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Le fondu entre deux images se fait en changeant seulement l'opacité de ce canvas :
   le navigateur le gère sans redessiner, ce qui garde le défilement fluide */
.image-suivante {
  opacity: 0;
  will-change: opacity;
}

/* Voile dégradé pour que le texte reste lisible sur l'image */
.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to top, rgb(8 42 47 / 0.9) 0%, rgb(8 42 47 / 0.4) 32%, transparent 58%),
    linear-gradient(to bottom, rgb(8 42 47 / 0.6) 0%, transparent 22%);
}

.calque {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 20px;
  padding:
    max(var(--gouttiere), env(safe-area-inset-top))
    max(var(--gouttiere), env(safe-area-inset-right))
    max(28px, env(safe-area-inset-bottom))
    max(var(--gouttiere), env(safe-area-inset-left));
}

.barre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo-agence {
  padding: 7px 10px;
  border: 1px dashed rgb(255 255 255 / 0.7);
  border-radius: 2px;
}

.badge {
  color: rgb(255 255 255 / 0.75);
}

/* Le parcours : une ligne, un repère par pièce, placé là où la pièce commence */
.parcours {
  position: relative;
  list-style: none;
  padding: 0;
  height: 34px;
  margin-right: 48px; /* place pour l'étiquette de la dernière pièce */
  font-size: 0.6rem;
  letter-spacing: 0.04em;
}

.parcours::before,
.parcours::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 0;
  height: 1px;
}

.parcours::before {
  right: 0;
  background: rgb(255 255 255 / 0.35);
}

.parcours::after {
  width: calc(var(--progression, 0) * 100%);
  background: var(--blanc);
}

.parcours li {
  position: absolute;
  top: 0;
  left: calc(var(--debut, 0) * 100%);
  padding-top: 16px;
  color: rgb(255 255 255 / 0.6);
  white-space: nowrap;
  transition: color 0.3s;
}

.parcours li::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--lagune-nuit);
  border: 1px solid rgb(255 255 255 / 0.7);
  z-index: 1;
}

.parcours li[aria-current] {
  color: var(--blanc);
}

.parcours li[aria-current]::before {
  background: var(--laterite);
  border-color: var(--laterite);
}

/* L'intro et les pièces partagent le bas de l'écran : une seule est visible à la fois */
.intro,
.pieces {
  grid-row: 3;
  grid-column: 1;
  align-self: end;
}

.intro {
  transition: opacity 0.5s, visibility 0s;
}

.visite.est-commencee .intro {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s, visibility 0s 0.4s;
}

.intro h1 {
  margin: 10px 0 18px;
  font-stretch: 125%;
  font-weight: 800;
  font-size: clamp(3rem, 15vw, 7.5rem);
  line-height: 0.88;
  text-transform: uppercase;
  max-width: 6ch;
}

.invite {
  color: rgb(255 255 255 / 0.8);
}

.pieces {
  display: grid;
}

.piece {
  grid-area: 1 / 1;
  align-self: end;
  max-width: 34rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity 0.45s, transform 0.45s, visibility 0s 0.45s;
}

.visite.est-commencee .piece.active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.45s, transform 0.45s, visibility 0s;
}

.piece h2 {
  margin: 8px 0 12px;
  font-stretch: 125%;
  font-weight: 800;
  font-size: clamp(2rem, 9vw, 3.6rem);
  line-height: 0.95;
  text-transform: uppercase;
}

.piece > p:not(.numero) {
  max-width: 30ch;
  color: rgb(255 255 255 / 0.88);
}

.numero {
  color: rgb(255 255 255 / 0.7);
}

/* ---------- La villa en bref ---------- */

.resume {
  display: grid;
  gap: 40px;
  padding: 72px var(--gouttiere) 80px;
  background: var(--chaux);
}

.resume .sur-titre {
  color: var(--lagune);
}

.resume h2 {
  margin: 10px 0 8px;
  color: var(--lagune);
  font-stretch: 125%;
  font-weight: 800;
  font-size: clamp(2.4rem, 11vw, 5rem);
  line-height: 0.9;
  text-transform: uppercase;
}

.prix {
  font-size: 1.125rem;
}

/* Les chiffres du bien, en une phrase */
.resume-phrase {
  font-family: "Poppins", var(--police);
  font-weight: 500;
  font-size: 25px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--lagune);
  text-wrap: pretty;
}

.bouton {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 56px;
  margin-top: 28px;
  padding: 0 20px;
  background: var(--lagune-nuit);
  color: var(--blanc);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  border-radius: 2px;
  transition: background-color 0.16s ease, transform 0.16s ease;
}

.bouton svg {
  flex: none;
}

/* le fond est presque noir : au survol, il s'éclaircit au lieu de foncer */
.bouton:hover {
  background: #123E45;
}

.bouton:active {
  transform: translateY(1px);
}

.note {
  margin-top: 14px;
  color: rgb(11 26 28 / 0.65);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* ---------- Pied de page ---------- */

.pied {
  display: grid;
  gap: 8px;
  padding: 28px var(--gouttiere) max(28px, env(safe-area-inset-bottom));
  background: var(--lagune-nuit);
  color: rgb(255 255 255 / 0.7);
  font-size: 0.875rem;
}

.pied a {
  color: var(--blanc);
}

/* ---------- Ordinateur : le texte à gauche, l'image centrée dans la moitié droite ---------- */

@media (min-width: 900px) {
  :root {
    --gouttiere: 48px;
  }

  .scene {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .scene::after {
    display: none;
  }

  /* Format 3:4 plutôt que 9:16 : l'image est plus large, au prix d'un léger recadrage
     en haut et en bas (environ 12 % de chaque côté). Le canvas la dessine en « cover ». */
  .ecran {
    position: relative;
    grid-column: 2;
    justify-self: center;
    align-self: center;
    width: min(calc(100% - 48px), calc((100svh - 48px) * 3 / 4));
    height: auto;
    aspect-ratio: 3 / 4;
    border-radius: 2px;
  }

  .calque {
    position: relative;
    grid-column: 1;
    grid-row: 1;
    grid-template-rows: auto 1fr auto;
    padding: 32px var(--gouttiere) 40px;
  }

  .parcours {
    grid-row: 3;
    max-width: 560px;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
  }

  .intro,
  .pieces {
    grid-row: 2;
    align-self: center;
  }

  .intro h1 {
    font-size: clamp(3rem, 7vw, 7.5rem);
  }

  .resume {
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    padding: 120px var(--gouttiere);
  }

  .resume-corps {
    max-width: 520px;
  }

  .resume-phrase {
    font-size: 32px;
    line-height: 1.25;
  }
}

@media (prefers-reduced-motion: reduce) {
  .intro,
  .piece,
  .parcours li {
    transition: none !important;
  }

  .piece {
    transform: none;
  }
}
