/* ==========================================================================
   ENDEVELOPMENT · mougins.css — the flight through Villa 9, its two
   pictures, the rail of its steps and the 360° visit.
   --------------------------------------------------------------------------
   Loaded by mougins.html only, after styles.css, with the same rules:
   everything outside `.is-*` states describes the static page (no script,
   or prefers-reduced-motion); mougins.js adds `.is-scrub` and the other
   states. Only transform and opacity move; the one clip-path that changes
   is the 360° visit's window while it opens and closes.
   ========================================================================== */

/* ---------- 1. The flight, static ---------- */
.flight { position: relative; background: var(--graphite); color: var(--blanc); }
.flight__stage {
  position: relative;
  height: min(86svh, 820px);
  min-height: 480px;
  overflow: clip;
}
.flight__frame { position: absolute; inset: 0; }
/* With motion on (html.motion-ok, set in the head before the first paint) the stage is a full screen from the start,
   as it will be once mougins.js turns the flight on: the title at its foot no longer jumps ~110 px on a phone
   (measured 14.10.2026: 0.054 of layout shift, CLS). Without motion it keeps the static height above. */
html.motion-ok .flight__stage { height: 100svh; min-height: 0; }
.flight__poster, .flight__video, .flight__still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.flight__video, .flight__still, .flight__beats, .flight__loader, .frail { display: none; }
.flight__veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(44, 46, 53, .62) 0%, rgba(44, 46, 53, .08) 30%, rgba(44, 46, 53, .34) 56%, rgba(44, 46, 53, .74) 78%, rgba(44, 46, 53, .94) 100%);
  pointer-events: none;
}

/* The two pictures, as ordinary blocks. */
.pictures {
  display: grid;
  gap: clamp(40px, 7vh, 88px);
  max-width: var(--maxw);
  margin-inline: auto;
  padding: clamp(48px, 9vh, 110px) var(--gutter);
}
.picture { margin: 0; }
.picture__img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #1f2025; }
.picture__cap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 28px;
  margin-top: 18px;
}
.picture__label {
  font: 600 11px/1.6 var(--font-ui);
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--gris-clair);
}
.picture__go {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 22px;
  border: 1px solid var(--glass-on-dark-line);
  border-radius: 999px;
  background: var(--glass-on-dark);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  color: var(--blanc);
  cursor: pointer;
  transition: background 320ms var(--ease-out), scale 240ms var(--ease-out);
}
.picture__go-text { font: 600 12px/1 var(--font-ui); letter-spacing: .18em; text-transform: uppercase; }
.picture__go-sub { font: 300 13px/1 var(--font-body); color: var(--gris-clair); }
@media (hover: hover) and (pointer: fine) {
  .picture__go:hover { background: var(--glass-on-dark-hi); }
}
.picture__go:active { scale: .97; }
/* Without the script there is no visit to open. */
html:not(.js-flight) .picture__go { display: none; }

.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px clamp(14px, 2vw, 28px); width: 100%; }
.board__item {
  display: grid;
  gap: 6px;
  padding: 18px 0 4px;
  border-top: 1px solid rgba(255, 255, 255, .22);
  color: inherit;
  text-decoration: none;
}
.board__name { font: 400 clamp(1.25rem, 2vw, 1.75rem)/1.1 var(--font-display); }
.board__where { font: 300 .9375rem/1.4 var(--font-body); color: var(--gris-clair); }
.board__go {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font: 600 11px/1 var(--font-ui);
  letter-spacing: .18em;
  text-transform: uppercase;
}
.board__go::before { content: ""; width: 22px; height: 1px; background: currentColor; transition: width 360ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .board__item:hover .board__go::before { width: 38px; }
}

/* ---------- 2. The flight, scrubbed (.is-scrub, set by mougins.js) ---------- */
.flight.is-scrub .flight__track { height: calc(var(--flight-screens, 16) * 100svh); }
.flight.is-scrub .flight__stage {
  position: sticky;
  top: 0;
  height: 100svh;
  min-height: 0;
  background: #1c1d21;
}
/* One 1920 x 1080 sheet, scaled and moved by transform: the video, the two
   4K stills of the pictures and everything laid on them share its pixels. */
.flight.is-scrub .flight__frame {
  inset: auto;
  left: 0;
  top: 0;
  width: 1920px;
  height: 1080px;
  transform-origin: 0 0;
  will-change: transform;
}
/* The upright film (a screen held upright): a 1080 x 1920 sheet, the wide one's middle with 420 px more above
   and below. The pictures' stills are the whole square frame there: 420 px past the sheet on either side,
   seen when the view opens out on a resting picture. */
.flight.is-scrub.is-tall .flight__frame { width: 1080px; height: 1920px; }
.flight.is-scrub.is-tall .flight__still { inset: auto; left: -420px; top: 0; width: 1920px; height: 1920px; max-width: none; }
.flight.is-scrub .flight__video { display: block; opacity: 0; transition: opacity 500ms var(--ease-out); }
.flight.is-scrub .flight__video.is-ready { opacity: 1; }
/* The light copy of the flight, under the sharp film (main.js, scrubFilm): it is there only where the sharp
   film has not arrived yet. The sharp film steps aside at once and comes back with the fade above, the light
   copy itself never fades: a moving picture fading over a still one shows both. */
.flight.is-scrub .flight__video--lo { transition: none; }
.flight.is-scrub .flight__video--lo.is-shown { opacity: 1; }
.flight.is-scrub .flight__video.is-under { opacity: 0; transition: none; }
.flight.is-scrub .flight__still { display: block; opacity: 0; transition: opacity 260ms var(--ease-out); pointer-events: none; }
.flight.is-scrub .flight__still.is-shown { opacity: 1; }
.flight.is-scrub .flight__intro { will-change: opacity, transform; }
.flight.is-scrub .flight__beats { display: block; }
/* where the resting picture is smaller than the screen, a blurred copy of it fills the space round it */
.flight__ambient {
  position: absolute;
  inset: -10%;
  width: 120%;
  height: 120%;
  max-width: none;
  object-fit: cover;
  filter: blur(28px) saturate(1.1) brightness(.46);
  opacity: 0;
  transition: opacity 700ms var(--ease-out);
  pointer-events: none;
}
.flight__ambient.is-shown { opacity: 1; }

.fbeat {
  position: absolute;
  left: var(--gutter);
  bottom: clamp(56px, 12vh, 120px);
  max-width: min(640px, calc(100% - 2 * var(--gutter)));
  visibility: hidden;
  opacity: 0;
  text-shadow: 0 1px 24px rgba(20, 21, 24, .45);
}
.fbeat--title { font: 400 clamp(2.25rem, 5vw, 4.25rem)/1 var(--font-display); }
.fbeat--title span {
  display: block;
  margin-top: 16px;
  font: 600 11px/1.6 var(--font-ui);
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--gris-clair);
}
.fbeat--lead { font: 300 clamp(1.25rem, 2.4vw, 2rem)/1.35 var(--font-body); text-wrap: balance; }
.fbeat--room {
  font: 600 12px/1 var(--font-ui);
  letter-spacing: .26em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 14px;
}
.fbeat--room::before { content: ""; width: 34px; height: 1px; background: currentColor; }

.flight__loader {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: 18px;
  height: 1px;
  background: rgba(255, 255, 255, .16);
  opacity: 0;
  transition: opacity 400ms var(--ease-out);
}
.flight.is-scrub .flight__loader { display: block; }
.flight.is-waiting .flight__loader { opacity: 1; }
.flight__loader-bar { display: block; height: 100%; background: var(--blanc); transform-origin: left; transform: scaleX(var(--loaded, 0)); }
/* "Visualisation 3D non contractuelle" (styles.css, .mhero__notice): above the loading line, not across it */
.flight .mhero__notice { bottom: max(26px, calc(100% - 100svh + 26px)); }   /* the same before and after is-scrub: no jump */
/* on a phone the list of the three projects stands at the foot of the screen: the line goes under it */
.flight.is-scrub.is-narrow .flight__stage:has(> .board__list:not([hidden])) .mhero__notice { translate: 0 18px; }   /* 26 -> 8 px, by transform: no layout shift */

/* The rail: seven steps of the flight on the right edge. The current one
   reads its name, the others are ticks; each is a way to jump there. */
.flight.is-scrub .frail {
  position: absolute;
  right: calc(var(--gutter) - 8px);
  top: 50%;
  translate: 0 -50%;
  display: block;
  opacity: var(--rail, 0);
  transition: opacity 500ms var(--ease-out);
}
.flight.is-scrub .frail[hidden] { display: none; }
.frail__list { display: grid; justify-items: end; }
.frail button {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  height: 30px;
  padding: 0 8px;
  border: 0;
  background: none;
  color: var(--blanc);
  font: 600 10px/1 var(--font-ui);
  letter-spacing: .24em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}
.frail button span {
  opacity: 0;
  translate: 8px 0;
  text-shadow: 0 1px 14px rgba(20, 21, 24, .7);
  transition: opacity 220ms var(--ease-out), translate 280ms var(--ease-strong);
}
.frail button::after {
  content: "";
  width: 34px;
  height: 1px;
  background: currentColor;
  opacity: .5;
  transform: scaleX(.42);
  transform-origin: 100% 50%;
  transition: transform 280ms var(--ease-strong), opacity 220ms var(--ease-out);
}
.frail button[aria-current="step"]::after { transform: scaleX(1); opacity: 1; }
.frail button[aria-current="step"] span, .frail button:focus-visible span { opacity: 1; translate: 0 0; }
.frail button:focus-visible { outline: 1px solid var(--blanc); outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) {
  .frail button:hover span { opacity: 1; translate: 0 0; }
  .frail button:hover::after { transform: scaleX(1); opacity: 1; }
}
.frail button:active::after { transform: scaleX(.8); }
/* a picture has the stage, or the page is handed over: the rail steps aside */
.flight.is-picture .frail, .flight.is-busy .frail, .flight.is-narrow .frail { opacity: 0; pointer-events: none; }

/* The pictures over the film: laid out in frame pixels by mougins.js. */
.flight.is-scrub .pictures {
  position: absolute;
  inset: 0;
  display: block;
  max-width: none;
  padding: 0;
  pointer-events: none;
}
.flight.is-scrub .picture {
  position: absolute;
  left: 0;
  top: 0;
  visibility: hidden;
  opacity: 0;
  transition: opacity 420ms var(--ease-out), visibility 0s linear 420ms;
}
.flight.is-scrub .picture.is-live {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0s;
}
.flight.is-scrub .picture__img { display: none; }
.flight.is-scrub .picture__cap { position: absolute; inset: 0; margin: 0; display: block; }

/* Plans: the whole picture is the door; a glass pill says so. */
.flight.is-scrub .picture--plans { cursor: pointer; }
.flight.is-scrub .picture--plans::before {
  /* a slow breath of light around the frame, so it reads as something to press */
  content: "";
  position: absolute;
  inset: -2px;
  border: 1px solid rgba(255, 255, 255, .55);
  opacity: 0;
  animation: frameBreath 3.6s var(--ease-in-out) infinite;
  pointer-events: none;
}
@keyframes frameBreath { 0%, 100% { opacity: 0; scale: 1; } 50% { opacity: .75; scale: 1.012; } }
.flight.is-scrub .picture--plans .picture__label { display: none; }
.flight.is-scrub .picture--plans .picture__go {
  position: absolute;
  left: 50%;
  top: 100%;
  translate: -50% 0;
  scale: var(--inv, 1); /* the frame is scaled; the pill keeps its own size */
  /* 22 px under the frame on screen: set before the scale, so it is scaled with the pill (22 x inv in the frame),
     as "top: calc(100% + 22px * inv)" was, but without moving the layout in every frame (that counted as CLS) */
  transform: translateY(22px);
  transform-origin: 50% 0;
  white-space: nowrap;
}
@media (hover: hover) and (pointer: fine) {
  .flight.is-scrub .picture--plans:hover .picture__go { background: var(--glass-on-dark-hi); }
  .flight.is-scrub .picture--plans:hover::before { animation-duration: 1.6s; }
}

/* Projects: three hit areas over the three panels of the poster. */
.flight.is-scrub .picture--projets .board { display: block; width: auto; }
.flight.is-scrub .board__item {
  position: absolute;
  display: block;
  padding: 0;
  border: 0;
  outline-offset: 6px;
}
.flight.is-scrub .board__item::before {
  /* gallery light: a soft sweep over the panel under the pointer */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 244, 226, .22) 50%, transparent 70%) 0 0 / 250% 100%;
  opacity: 0;
  transition: opacity 360ms var(--ease-out), background-position 900ms var(--ease-out);
}
.flight.is-scrub .board__item::after {
  /* a rule under the printed name and place (the hit area ends just below them) */
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  bottom: 0;
  height: 1px;
  background: #26262a;
  transform: scaleX(0);
  transition: transform 520ms var(--ease-strong);
}
.flight.is-scrub .board__name, .flight.is-scrub .board__where {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.flight.is-scrub .board__go {
  position: absolute;
  left: 50%;
  top: 100%;
  translate: -50% 6px;
  scale: var(--inv, 1);
  transform: translateY(30px);                 /* as the plans pill: the gap without moving the layout */
  transform-origin: 50% 0;
  margin: 0;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--glass-panel-on-dark);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  color: var(--blanc);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 300ms var(--ease-out), translate 420ms var(--ease-strong);
}
.flight.is-scrub .board__go::before { display: none; }
.flight.is-scrub .board__item:focus-visible::before,
.flight.is-scrub .board__item.is-hot::before { opacity: 1; background-position: 100% 0; }
.flight.is-scrub .board__item:focus-visible::after,
.flight.is-scrub .board__item.is-hot::after { transform: scaleX(1); }
.flight.is-scrub .board__item:focus-visible .board__go,
.flight.is-scrub .board__item.is-hot .board__go { opacity: 1; translate: -50% 0; }
@media (hover: hover) and (pointer: fine) {
  .flight.is-scrub .board__item:hover::before { opacity: 1; background-position: 100% 0; }
  .flight.is-scrub .board__item:hover::after { transform: scaleX(1); }
  .flight.is-scrub .board__item:hover .board__go { opacity: 1; translate: -50% 0; }
}
/* Phones: the printed names are too small to read, so the list is repeated
   under the picture in the site's own type. */
.flight.is-scrub.is-narrow .board__go { display: none; }
.flight.is-scrub .board__list {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: clamp(22px, 5vh, 48px);
  display: none;
  gap: 8px;
  pointer-events: auto;
}
.flight.is-scrub.is-narrow .board__list:not([hidden]) { display: grid; }
.board__list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border: 1px solid var(--glass-on-dark-line);
  border-radius: 999px;
  background: var(--glass-on-dark);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  color: var(--blanc);
  text-decoration: none;
}
.board__list b { font: 400 1.125rem/1 var(--font-display); }
.board__list span { font: 600 9.5px/1 var(--font-ui); letter-spacing: .16em; text-transform: uppercase; color: var(--gris-clair); }

/* While the page is handed over (entering the visit, flying out),
   the pictures' own controls step aside. */
.flight.is-busy .picture { pointer-events: none; }
.flight.is-busy .picture__go, .flight.is-busy .board__go { opacity: 0; }

/* ---------- 3. The 360° visit ---------- */
.tour {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-header) - 2);
  background: #1c1d21;
  color: var(--blanc);
}
.tour[hidden] { display: none; }
/* loaded ahead of the visit: laid out at full size (the viewer needs one), not shown */
.tour.is-preload { visibility: hidden; pointer-events: none; }
.tour__frame { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; border: 0; }
.tour__loading {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .18);
  border-top-color: rgba(255, 255, 255, .85);
  opacity: 0;
  transition: opacity 300ms var(--ease-out);
  animation: tourSpin 1s linear infinite;
  pointer-events: none;
}
.tour.is-loading .tour__loading { opacity: 1; }
@keyframes tourSpin { to { rotate: 360deg; } }
/* The page stays behind the visit, but nothing of it scrolls. */
html.is-touring { overflow: clip; }

/* ---------- 4. Villas Lauvas, the way to their page ---------- */
.lteaser {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(24px, 5vw, 88px);
  align-items: center;
  margin-top: clamp(32px, 6vh, 64px);
  color: inherit;
  text-decoration: none;
}
.lteaser__media { display: block; overflow: clip; aspect-ratio: 4 / 3; background: var(--gris-clair-40); }
.lteaser__media img { width: 100%; height: 100%; object-fit: cover; transition: scale 900ms var(--ease-out); }
.lteaser__text { display: grid; justify-items: start; }
.lteaser__text .plannote__title, .lteaser__text .page__lead { display: block; }
.lteaser__go {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: clamp(20px, 3vh, 32px);
  font: 600 11px/1 var(--font-ui);
  letter-spacing: .18em;
  text-transform: uppercase;
}
.lteaser__go::before { content: ""; width: 26px; height: 1px; background: currentColor; transition: width 360ms var(--ease-out); }
.lteaser:focus-visible { outline: 1px solid var(--bleu); outline-offset: 8px; }
@media (hover: hover) and (pointer: fine) {
  .lteaser:hover .lteaser__media img { scale: 1.04; }
  .lteaser:hover .lteaser__go::before { width: 42px; }
}

/* ---------- 5. Le chantier: the construction diary ---------- *
   Its styles are in chantier.css (shared with villas-lauvas.html).                             */

/* ---------- 6. Responsive and reduced motion ---------- */
@media (max-width: 900px) {
  .board { grid-template-columns: 1fr; }
  .lteaser { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .flight.is-scrub .picture--plans .picture__go { align-items: center; min-height: 44px; padding: 0 20px; }
  .picture__go-sub { display: none; }
  .fbeat { bottom: clamp(40px, 10vh, 90px); }
}
@media (prefers-reduced-motion: reduce) {
  .flight.is-scrub .picture--plans::before { animation: none; }
  .tour__loading { animation-duration: 2.4s; }
}

/* ---------- "Au crépuscule", cut on its left (tools/v9-crepuscule.py) ----------
   The side wall of the villa is out of the frame, so the picture is nearly square. On a wide screen it takes
   7 columns and the upright "L’arrivée" 5: the two then have one height to within a pixel, and the second
   stretches over that pixel. On a phone each keeps its own row. */
.mshot--dusk { aspect-ratio: 2840 / 2560; }
@media (min-width: 900px) {
  .mshot--dusk { grid-column: span 7; }
  .mshot--bydusk { grid-column: span 5; aspect-ratio: auto; align-self: stretch; }
}
