/* Entrance journey: a tall page whose scroll drives a fixed stage. Colors come from tokens only. */

.journey-bar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem clamp(1rem, 4vw, 2.5rem);
  color: var(--scene-ink);
  mix-blend-mode: normal;
}

.journey-brand {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}


/* The stage is fixed behind everything; this spacer only provides the scroll distance. */
.journey {
  height: 600vh;
  height: 600svh; /* one "screen" stays constant while phone toolbars come and go */
}

.journey-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background-color: var(--scene-veil);
  color: var(--scene-ink);
}

.journey-photo,
.journey-video,
.journey-veil {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.journey-photo {
  /* How far the photo zooms: it must end on the video's first frame. */
  --zoom-end: 2.2;
}

.journey-video {
  object-fit: cover;
  opacity: 0;
  will-change: opacity;
}

.journey-veil {
  background: linear-gradient(to bottom, var(--scene-veil), transparent 45%, var(--scene-veil));
  opacity: 0.55;
  pointer-events: none;
}


.journey-step {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 0 1.5rem;
  text-align: center;
}

.journey-step h1,
.journey-step h2 {
  max-width: 18ch;
  font-size: clamp(2.25rem, 7vw, 5rem);
  line-height: 1.02;
  text-shadow: 0 2px 30px var(--scene-veil);
}

.journey-step p {
  color: var(--scene-ink-muted);
  font-size: 1.125rem;
}

.journey-bar.is-over-light {
  color: var(--scene-veil);
}

.journey-cue {
  width: 2px;
  height: 3.5rem;
  background: linear-gradient(to bottom, var(--scene-ink), transparent);
  animation: journey-cue 1.8s ease-in-out infinite;
  transform-origin: top;
}

@keyframes journey-cue {
  0% { transform: scaleY(0); opacity: 1; }
  70% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}


/* Landing end: the courses (or the way in) sit over the clouds where the video finishes. */
.landing-end {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  min-height: 100vh;
  min-height: 100svh;
  padding: 7rem 1.5rem 6rem;
  color: var(--scene-veil);
  text-align: center;
  justify-content: center;
}

.landing-title {
  max-width: 18ch;
  font-size: clamp(2.25rem, 7vw, 5rem);
  line-height: 1.02;
}

.landing-hello,
.landing-note {
  font-size: 1rem;
}

.landing-end .course-grid {
  width: 100%;
  margin-top: 2.5rem;
  text-align: left;
}

.landing-end .course-card,
.landing-end .course-summary {
  color: var(--scene-veil);
}

.landing-end .course-body {
  border-bottom-color: color-mix(in oklch, var(--scene-veil) 55%, transparent);
}

.landing-end .course-media {
  background-color: color-mix(in oklch, var(--scene-veil) 10%, transparent);
}

.landing-end .course-card:focus-visible {
  outline-color: var(--scene-veil);
}

/* "Reduce motion": the journey still follows the visitor's scroll, but nothing moves on its own. */
@media (prefers-reduced-motion: reduce) {
  .journey-cue { animation: none; }
}

/* If the journey script fails on some device, show the opening photo and then the courses. */
.no-journey .journey { height: 0; }
.no-journey .journey-video { display: none; }
.no-journey .journey-intro { display: none; }

/* Top bar: the Mentor's name on the left, the actions on the right with the rest of the width. */
.journey-bar {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 1rem;
}

.journey-bar-side {
  justify-self: start;
}

.journey-bar-end {
  justify-self: end;
}

.journey-brand {
  color: inherit;
  text-decoration: none;
}

/* Sound switch: a round button that morphs between a line of dots (off) and an equalizer (on). */
.journey-sound {
  position: fixed;
  left: clamp(1rem, 4vw, 2.5rem);
  bottom: 1.5rem;
  z-index: 30;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background-color: var(--scene-veil);
  color: var(--scene-ink);
  cursor: pointer;
  box-shadow: 0 6px 24px color-mix(in oklch, var(--scene-veil) 35%, transparent);
  transition: background-color 300ms, color 300ms, transform 300ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* A ring that opens around the button on hover and focus. */
.journey-sound::after {
  content: "";
  position: absolute;
  inset: -0.35rem;
  border: 1.5px solid var(--scene-veil);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 250ms, transform 350ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.journey-sound:hover::after,
.journey-sound:focus-visible::after {
  opacity: 1;
  transform: scale(1);
}

.journey-sound:focus-visible {
  outline: none;
}

.journey-sound[aria-pressed="true"] {
  background-color: var(--scene-ink);
  color: var(--scene-veil);
}

.journey-sound-bars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 1.25rem;
}

.journey-sound-bars i {
  display: block;
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background-color: currentColor;
  transition: height 400ms cubic-bezier(0.2, 0.7, 0.2, 1), width 400ms;
}

.journey-sound[aria-pressed="true"] .journey-sound-bars i {
  width: 2px;
  height: 4px;
  animation: journey-wave 1s ease-in-out infinite;
}

.journey-sound[aria-pressed="true"] .journey-sound-bars i:nth-child(2) { animation-delay: -0.8s; }
.journey-sound[aria-pressed="true"] .journey-sound-bars i:nth-child(3) { animation-delay: -0.35s; }
.journey-sound[aria-pressed="true"] .journey-sound-bars i:nth-child(4) { animation-delay: -0.6s; }
.journey-sound[aria-pressed="true"] .journey-sound-bars i:nth-child(5) { animation-delay: -0.15s; }

@keyframes journey-wave {
  0%, 100% { height: 4px; }
  50% { height: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .journey-sound[aria-pressed="true"] .journey-sound-bars i {
    animation: none;
    height: 10px;
  }
}

/* While the browser holds the music back, the button gently pulses to invite a click. */
.journey-sound[data-waiting]::after {
  opacity: 1;
  transform: scale(1);
  animation: journey-nudge 2s ease-in-out infinite;
}

@keyframes journey-nudge {
  0%, 100% { opacity: 0.25; transform: scale(0.95); }
  50% { opacity: 0.9; transform: scale(1.12); }
}

@media (prefers-reduced-motion: reduce) {
  .journey-sound[data-waiting]::after { animation: none; }
}

/* Phones: never scroll sideways, respect the notch and the home bar, keep the bar compact. */
html,
body {
  overflow-x: clip;
}

.journey-bar {
  padding-top: max(1.25rem, env(safe-area-inset-top));
  padding-left: max(clamp(1rem, 4vw, 2.5rem), env(safe-area-inset-left));
  padding-right: max(clamp(1rem, 4vw, 2.5rem), env(safe-area-inset-right));
}

.journey-sound {
  bottom: max(1.5rem, calc(env(safe-area-inset-bottom) + 0.75rem));
  left: max(clamp(1rem, 4vw, 2.5rem), env(safe-area-inset-left));
}

@media (max-width: 480px) {
  .journey-step h1 {
    font-size: clamp(2rem, 10.5vw, 3rem);
  }

  .landing-end {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
}

/* The lit sound button is white: give it an edge so it still reads over the white clouds. */
.journey-sound[aria-pressed="true"] {
  box-shadow:
    0 0 0 1px color-mix(in oklch, var(--scene-veil) 30%, transparent),
    0 6px 24px color-mix(in oklch, var(--scene-veil) 35%, transparent);
}

/* Buttons on the right sit side by side and wrap under each other on narrow phones. */
.journey-bar-end {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.journey-brand {
  white-space: nowrap;
}

.journey-brand:focus-visible {
  outline: 2px solid currentcolor;
  outline-offset: 4px;
}

@media (max-width: 480px) {
  .journey-bar {
    gap: 0.5rem;
  }

  .journey-brand {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
  }
}

/* The landing runs over a light, airy video: dark ink on top of it, no darkening veil. */
.hero-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The journey is the base video; the two loops fade over it when it is their turn. */
video[data-intro-video],
video[data-ocean-video] {
  opacity: 0;
  transition: opacity 250ms linear;
}

video[data-intro-video].is-on,
video[data-ocean-video].is-on {
  opacity: 1;
}

/* Lets the courses be read over the water while it keeps moving. */
.hero-wash {
  position: absolute;
  inset: 0;
  background-color: color-mix(in oklab, var(--scene-ink) 42%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 600ms;
}

.journey-light .journey-bar {
  color: var(--scene-veil);
}

.journey-light .journey-sound {
  box-shadow: 0 6px 24px color-mix(in oklch, var(--scene-veil) 25%, transparent);
}

/* The arch stands in the middle of the picture, so the headline sits to its left. */
.journey-light .journey-step {
  right: auto;
  align-items: flex-start;
  width: 40%;
  padding-inline: max(1.5rem, 5vw) 0;
  color: var(--scene-veil);
  text-align: left;
}

.journey-light .journey-step h1 {
  max-width: 13ch;
  font-size: clamp(2rem, 4.2vw, 4rem);
  text-shadow: none; /* the sky is light enough; also cancels the dark glow of other scenes */
}

.journey-light .journey-step p {
  color: var(--scene-veil);
  font-weight: 600;
  text-shadow: none;
}

.journey-light .journey-cue {
  background: linear-gradient(to bottom, var(--scene-veil), transparent);
}

.journey-light .journey-step :focus-visible,
.journey-light .journey-bar :focus-visible {
  outline-color: var(--scene-veil);
}

/* Narrow screens only see the middle of the picture: the headline goes over the water. */
@media (max-width: 820px), (orientation: portrait) {
  .journey-light .journey-step {
    right: 0;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    padding: 0 1.5rem 16vh;
    text-align: center;
  }
}

.no-journey video.hero-layer,
.no-journey .hero-wash {
  display: none;
}

/* A short gold rule under the landing headline. */
.journey-light .journey-step h1::after {
  content: "";
  display: block;
  width: 3.5rem;
  height: 3px;
  margin-top: 1rem;
  background-color: var(--mark);
}

@media (max-width: 820px), (orientation: portrait) {
  .journey-light .journey-step h1::after {
    margin-inline: auto;
  }
}

/* The landing has two views on one page (ADR-0015): the entrance and the experiences. */
.journey-light .journey-intro {
  transition: opacity 400ms, transform 400ms, visibility 400ms;
}

.journey-light .landing-end {
  transition: opacity 250ms, visibility 250ms;
}

/* Out of sight but still laid out, so its pictures and cards are ready when the visitor arrives. */
[data-view="home"] .landing-end {
  position: fixed;
  inset: 0;
  overflow: hidden;
  justify-content: flex-start;
  visibility: hidden;
  opacity: 0;
}

[data-view="experiences"] .journey-intro,
[data-moving] .journey-intro {
  visibility: hidden;
  opacity: 0;
  transform: translateY(-2.5rem);
}

[data-moving="back"] .landing-end {
  opacity: 0;
  transition-duration: 125ms;
}

[data-view="experiences"] .hero-wash {
  opacity: 1;
}

/* There the ocean loop (or its picture) is the scene. */
[data-view="experiences"] video[data-journey-video] {
  opacity: 0;
}

/* The way in: the shared button, with an arrow that invites the click. */
.hero-enter {
  position: relative;
  margin-top: 0.5rem;
}

.hero-enter svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentcolor;
  stroke-width: 2;
  transition: transform 200ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.hero-enter:hover svg,
.hero-enter:focus-visible svg {
  transform: translateX(0.35rem);
}


@media (prefers-reduced-motion: reduce) {
  .journey-light .journey-intro,
  .journey-light .landing-end,
  .journey-light .hero-wash { transition: none; }
}
