/* Independent layers keep the scenery moving without advancing the scroll story. */
.atmosphere {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.air-cloud,.air-jasmine {
  display: block;
  position: absolute;
  background: center / contain no-repeat url("assets/ciel-echraf.webp");
  width: var(--cloud-width, 66vw);
  aspect-ratio: 2.55;
  opacity: var(--cloud-opacity, .59);
  animation: cloud-crossing var(--cloud-speed, 14s) var(--cloud-phase, -4s) ease-in-out infinite alternate;
}
.air-cloud:nth-child(2) {
  --cloud-phase: -8s;
  --cloud-speed: 19s;
  animation-direction: alternate-reverse;
}
.air-cloud {
  mask-image: radial-gradient(ellipse 49% 36% at 46% 54%, #000 30%, #000a 66%, transparent);
}
.air-jasmine {
  background-image: url("assets/chraf-jasmin.webp");
  width: clamp(190px, 29vw, 500px);
  aspect-ratio: 1.27;
  opacity: .91;
  transform-origin: 10% 85%;
  animation: branch-in-wind 6.6s -2s ease-in-out infinite alternate;
}
.atmosphere:not(.is-in-view) :is(.air-cloud, .air-jasmine, .ribbon-route path:last-child) {
  animation-play-state: paused;
}
html[data-motion=quiet] .atmosphere, html:not([data-motion]) .atmosphere { display: none }
@keyframes cloud-crossing {
  from { transform: translate3d(-22%, 1%, 0) scale(.96) }
  to { transform: translate3d(23%, -8%, 0) scale(1.12) }
}
@keyframes branch-in-wind {
  from { transform: translate3d(-5%, 3%, 0) rotate(-7deg) }
  to { transform: translate3d(7%, -4%, 0) rotate(7deg) }
}

.arrival-air { z-index: -2; --cloud-opacity: .34 }
.arrival-air .air-cloud { top: -14%; right: -12% }
.roots-air { z-index: -1; --cloud-opacity: .75 }
.roots-air .air-cloud { top: -12%; right: -1% }

.ribbon-air {
  z-index: 2;
  --cloud-opacity: .63;
  --cloud-speed: 11s;
}
.ribbon-air .air-cloud:first-child { left: -11%; top: -13% }
.ribbon-air .air-cloud:nth-child(2) { right: -22%; bottom: -17%; --cloud-width: 76vw }
.ribbon-air .air-jasmine:nth-of-type(3) { top: -7%; left: -15%; rotate: 14deg }
.ribbon-air .air-jasmine:nth-of-type(4) {
  bottom: -24%;
  right: -10%;
  rotate: 26deg;
  scale: -1 1;
  animation-delay: -4.8s;
}
.ribbon-controls { z-index: 3 }
.ribbon-route {
  position: absolute;
  left: 0;
  top: 5%;
  width: 100%;
  height: 88%;
  opacity: .75;
  z-index: -1;
}
.ribbon-route path {
  fill: none;
  stroke: #f4f6dd;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: .81;
}
.ribbon-route path:last-child {
  stroke-width: 2;
  stroke-dasharray: .05 .95;
  stroke-dashoffset: 0;
  animation: route-light 8s -1.65s linear infinite;
}
@keyframes route-light { to { stroke-dashoffset: -1 } }

.coast-air { z-index: -1; --cloud-opacity: .82 }
.coast-air .air-cloud:first-child { top: -20%; left: -27%; --cloud-width: 81vw }
.coast-air .air-cloud:nth-child(2) { top: -15%; right: -36%; --cloud-opacity: .63 }

.sky-chapter { position: relative; isolation: isolate; background: #344e51 }
.sky-screen {
  position: relative;
  isolation: isolate;
  height: 100svh;
  min-height: 470px;
  display: grid;
  align-content: end;
  overflow: hidden;
  color: #fff9e9;
}
.sky-photo { position: absolute; inset: 0; z-index: -2; overflow: hidden }
.sky-photo > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 54% 33%;
}
.sky-photo::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(175deg, #425a6a91, #66788a29 32%, transparent 48%);
}
.sky-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(18deg, #142921eb, #17292222 58%, transparent 78%);
}
.sky-air { --cloud-opacity: .84; --cloud-width: min(76vw, 1000px); --cloud-speed: 13s }
.sky-air .air-cloud {
  background-size: cover;
  mask-image:
    radial-gradient(ellipse 38% 32% at 36% 51%, #000 40%, transparent 100%),
    radial-gradient(ellipse 33% 29% at 62% 41%, #000c 25%, transparent 100%);
}
.sky-air .air-cloud:first-child { top: 1%; left: -9%; aspect-ratio: 3.9 }
.sky-air .air-cloud:nth-child(2) {
  top: -5%;
  right: -20%;
  aspect-ratio: 4.2;
  --cloud-width: min(64vw, 850px);
  --cloud-opacity: .64;
}
.sky-copy { padding-bottom: clamp(74px, 13svh, 155px) }
.sky-copy h2 {
  margin: 15px 0 0;
  font-size: clamp(74px, 12.3vw, 170px);
  line-height: .84;
}
.sky-copy h2 em { color: #efddb3 }
.sky-credit { position: absolute; inset: auto 0 28px; font-size: .72rem }
.sky-credit a { text-decoration: underline; text-underline-offset: 3px }
.sky-fold { display: none }
.home-motion .sky-chapter { height: 158svh }
.home-motion .sky-screen { position: sticky; top: 0 }
:is(.home-motion,html[data-motion=full]) .sky-fold {
  pointer-events: none;
  position: absolute;
  inset: auto 0 0;
  height: 53svh;
  z-index: 1;
  background: #dde3da;
}
.home-motion .sky-fold { display: block }

.shore-air { --cloud-opacity: .55; --cloud-width: 79% }
.shore-air .air-cloud { top: -14%; left: -19% }
.md-approach,.chraf-materials,.chraf-lead,.visit { position: relative; isolation: isolate }
.approach-air,.materials-air,.lead-air,.visit-air,.contact-air { z-index: -1 }
.approach-air .air-cloud { top: -13%; right: -10% }
.approach-air .air-jasmine { top: -16%; right: -15%; rotate: 181deg }
.materials-air .air-jasmine { bottom: -40%; right: -12%; rotate: 18deg; scale: -1 1; opacity: .55 }
.chraf-home footer,.chraf-detail footer { isolation: isolate }
.contact-air .air-jasmine { bottom: -35%; right: -12%; opacity: .41; scale: -1 1; rotate: 19deg }
.contact-air .air-cloud { top: -57%; left: -29%; --cloud-opacity: .23 }
.lead-air .air-cloud { top: -19%; left: -30%; --cloud-opacity: .27 }
.visit-air .air-cloud { top: -10%; right: -25%; --cloud-opacity: .20 }
.visit-air .air-jasmine { top: -17%; right: -18%; rotate: 170deg; opacity: .35 }
.chapter-menu-links a::after {
  content: "";
  position: absolute;
  inset: auto 0 5px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s var(--ease);
}
.chapter-menu-links a:is(:hover,:focus-visible)::after { transform: scaleX(1) }

@supports (animation-timeline: view()) and (animation-range: contain 0% contain 100%) {
  /* Crop the artwork without creating an inner scroll container for the text. */
  :is(.jasmine-stage,.shore-views,.md-approach,.chraf-materials,.chraf-home footer,.chraf-detail footer) {
    overflow: clip;
  }
  html[data-motion=full] [data-chapter-title] { view-timeline: --glyph block }
  html[data-motion=full] .chapter-word > span {
    animation: glyph-arrival linear both;
    animation-timeline: --glyph;
    animation-range: entry calc(8% + var(--glyph-delay)) cover calc(39% + var(--glyph-delay));
  }
  html[data-motion=full] .jasmine-copy .chapter-word > span {
    animation-timeline: --jasmine;
    animation-range: entry calc(24% + var(--glyph-delay)) entry calc(73% + var(--glyph-delay));
  }
  html[data-motion=full] .ribbon-intro .chapter-word > span {
    animation-timeline: --ribbon;
    animation-range: entry calc(25% + var(--glyph-delay)) entry calc(81% + var(--glyph-delay));
  }
  html[data-motion=full] .ribbon-outro .chapter-word > span {
    animation-timeline: --ribbon;
    animation-range: contain calc(63% + var(--glyph-delay)) contain calc(82% + var(--glyph-delay));
  }
  html[data-motion=full] .coast-title .chapter-word > span {
    animation-timeline: --coast;
    animation-range: entry calc(61% + var(--glyph-delay)) contain calc(42% + var(--glyph-delay));
  }
  html[data-motion=full] .ribbon-route path:first-child {
    animation: route-draw linear both;
    animation-timeline: --ribbon;
    animation-range: entry 50% contain 100%;
  }
  html[data-motion=full] .sky-chapter { height: 158svh; view-timeline: --sky block }
  html[data-motion=full] .sky-screen { position: sticky; top: 0 }
  html[data-motion=full] .sky-photo {
    animation: sky-open linear both;
    animation-timeline: --sky;
    animation-range: entry 8% contain 86%;
  }
  html[data-motion=full] .sky-copy .chapter-word > span {
    animation-timeline: --sky;
    animation-range: entry calc(57% + var(--glyph-delay)) contain calc(42% + var(--glyph-delay));
  }
  html[data-motion=full] .sky-fold {
    display: block;
    animation: sky-to-shore linear both;
    animation-timeline: --sky;
    animation-range: contain 66% exit 43%;
  }
}
@keyframes glyph-arrival {
  from { opacity: .20; transform: translate3d(0, .53em, 0) rotate(7deg) }
  to { opacity: 1; transform: translate3d(0, 0, 0) rotate(0deg) }
}
@keyframes route-draw { from { stroke-dashoffset: .84 } to { stroke-dashoffset: 0 } }
@keyframes sky-open {
  from { transform: translate3d(0, 5%, 0) scale(1.26) }
  to { transform: scale(1.025) }
}
@keyframes sky-to-shore {
  from { clip-path: ellipse(49% 1% at 46% 110%); opacity: 0 }
  27% { opacity: 1 }
  to { clip-path: ellipse(119% 95% at 58% 105%); opacity: 1 }
}
@media (max-width: 740px) {
  .air-cloud { width: max(480px, var(--cloud-width, 66vw)) }
  .ribbon-air .air-jasmine:nth-of-type(3) { left: -28%; top: -7% }
  .ribbon-air .air-jasmine:nth-of-type(4) { right: -23%; bottom: -12% }
  .ribbon-air { --cloud-opacity: .57 }
  .sky-photo > img { object-position: 66% 25% }
  .sky-air .air-cloud:first-child { top: 7%; left: -25% }
  .sky-copy h2 { font-size: clamp(66px, 15vw, 105px) }
  .approach-air .air-jasmine { right: -29%; top: -2% }
  .contact-air .air-jasmine { bottom: -18%; right: -24% }
}
