/* ==========================================================================
   The Journey — a scroll-driven walk north: forest, aurora, a name.
   No text along the way; the picture carries it.

   Performance note: every moving layer is animated by transform/opacity only,
   written straight onto the handful of layer elements by journey.js. Nothing
   here uses blend modes, animated SVG filters, or scaled filtered content —
   each of those forces a full re-raster on every scroll frame.
   ========================================================================== */

.journey {
  --night-0: #060915;
  --night-1: #0a1026;
  --night-2: #121b3d;
  --night-3: #1d2a53;
  --aurora-green: #6fe8c4;
  --snow: #eaf1f8;

  position: relative;
  z-index: 2;
  height: 340vh;
}

/* Without JS the journey never runs, so it steps aside and the site shows. */
body:not(.js-journey) .journey { display: none; }
body.js-journey:not(.entered) #site { display: none; }
body.entered .journey { display: none; }

.journey-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--night-0);
  font-family: 'Manrope', system-ui, sans-serif;
}

.layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.layer svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* The layers journey.js moves get their own compositor layer up front, so a
   scroll frame is a transform and nothing else. */
.stars,
.aurora,
.mountains,
.pines-far,
.pines-mid,
.pines-near {
  will-change: transform;
}

/* Filters and the reusable conifer live here; nothing renders from it. */
.journey-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ── Sky ────────────────────────────────────────────────────────────────── */

.sky {
  background:
    radial-gradient(120% 80% at 50% 108%, rgba(111, 232, 196, 0.13), transparent 62%),
    radial-gradient(90% 60% at 18% 12%, rgba(169, 139, 224, 0.15), transparent 66%),
    linear-gradient(180deg, var(--night-0) 0%, var(--night-1) 34%, var(--night-2) 68%, var(--night-3) 100%);
}

/* ── Stars ──────────────────────────────────────────────────────────────── */

.stars { opacity: 0; }

.stars i {
  position: absolute;
  display: block;
  border-radius: 50%;
  background: #f4f8ff;
  opacity: var(--o, 0.7);
}

/* Only a minority of the field twinkles — enough to feel alive, few enough
   that the compositor isn't juggling a hundred animations. */
.stars i.lit {
  animation-name: twinkle;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
}

@keyframes twinkle {
  0%, 100% { opacity: calc(var(--o) * 0.3); }
  50%      { opacity: var(--o); }
}

/* ── Aurora ─────────────────────────────────────────────────────────────── */

/* Curtains, not ribbons: each is a broad ellipse of light, carved into
   vertical rays by a repeating mask and softened by a static blur. Rotations
   and sizes differ so they read as overlapping sheets rather than stripes. */
.aurora {
  opacity: 0;
  -webkit-mask-image: radial-gradient(126% 88% at 50% 40%, #000 30%, rgba(0, 0, 0, 0.5) 62%, transparent 88%);
          mask-image: radial-gradient(126% 88% at 50% 40%, #000 30%, rgba(0, 0, 0, 0.5) 62%, transparent 88%);
}

.aurora-haze {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(58% 34% at 40% 32%, rgba(111, 232, 196, 0.26), transparent 72%),
    radial-gradient(50% 30% at 70% 44%, rgba(169, 139, 224, 0.2), transparent 74%);
  animation: haze 32s ease-in-out infinite;
}

/* The outer element only tilts and never animates — rotating or scaling
   blurred content forces the blur to be recomputed every frame. The inner
   element carries the blur and drifts with translate/opacity alone, so its
   texture is rasterised once and then simply moved by the compositor.

   Each curtain is built from overlapping radial gradients that fade to
   nothing in every direction — no border, no border-radius, so there is no
   silhouette to read as a shape. They run wider than the viewport, so what
   you see is the middle of a sweep rather than an object in the sky. */
.curtain {
  position: absolute;
  left: 50%;
}

.curtain > i {
  display: block;
  width: 100%;
  height: 100%;
  will-change: transform, opacity;
}

.curtain-1 {
  top: 10%;
  width: 230%;
  height: 46%;
  margin-left: -115%;
  transform: rotate(-7deg);
}

.curtain-1 > i {
  background:
    radial-gradient(38% 74% at 26% 68%, rgba(150, 244, 218, 0.5), transparent 74%),
    radial-gradient(46% 96% at 58% 80%, rgba(111, 232, 196, 0.82), rgba(63, 201, 168, 0.3) 48%, transparent 82%),
    radial-gradient(30% 68% at 82% 62%, rgba(90, 216, 190, 0.42), transparent 78%);
  filter: blur(20px);
  animation: drift-a 34s ease-in-out infinite;
}

.curtain-2 {
  top: 0%;
  width: 196%;
  height: 44%;
  margin-left: -98%;
  transform: rotate(6deg);
}

.curtain-2 > i {
  background:
    radial-gradient(40% 82% at 34% 74%, rgba(169, 139, 224, 0.55), transparent 78%),
    radial-gradient(34% 70% at 68% 66%, rgba(140, 110, 210, 0.4), transparent 80%);
  filter: blur(30px);
  animation: drift-b 46s ease-in-out infinite;
}

/* The crest — the bright edge of the display. Not striped: a mask is applied
   after the filter, so any repeating mask lands as hard bars on top of the
   blur. Its structure is a narrow, intense core inside a wide flat ellipse,
   which reads as the luminous underside of a curtain rather than as bars. */
.curtain-3 {
  top: 21%;
  width: 176%;
  height: 30%;
  margin-left: -88%;
  transform: rotate(-4deg);
}

.curtain-3 > i {
  background:
    radial-gradient(50% 34% at 44% 72%, rgba(178, 246, 238, 0.6), rgba(110, 224, 210, 0.2) 54%, transparent 84%),
    radial-gradient(30% 26% at 74% 68%, rgba(127, 216, 232, 0.28), transparent 82%);
  filter: blur(22px);
  animation: drift-c 38s ease-in-out infinite;
}

.curtain-4 {
  top: 6%;
  width: 158%;
  height: 34%;
  margin-left: -79%;
  transform: rotate(-13deg);
}

.curtain-4 > i {
  background:
    radial-gradient(36% 76% at 56% 70%, rgba(239, 168, 198, 0.3), transparent 80%);
  filter: blur(38px);
  animation: drift-d 52s ease-in-out infinite;
}

@keyframes drift-a {
  0%, 100% { transform: translate3d(-3%, 2%, 0);  opacity: 0.78; }
  36%      { transform: translate3d(4%, -3%, 0);  opacity: 1; }
  70%      { transform: translate3d(-1%, 3%, 0);  opacity: 0.66; }
}

@keyframes drift-b {
  0%, 100% { transform: translate3d(4%, 3%, 0);   opacity: 0.55; }
  44%      { transform: translate3d(-5%, -2%, 0); opacity: 0.88; }
  76%      { transform: translate3d(2%, 4%, 0);   opacity: 0.64; }
}

@keyframes drift-c {
  0%, 100% { transform: translate3d(3%, 1%, 0);   opacity: 0.5; }
  48%      { transform: translate3d(-6%, -2%, 0); opacity: 0.82; }
}

@keyframes drift-d {
  0%, 100% { transform: translate3d(-4%, 3%, 0);  opacity: 0.34; }
  54%      { transform: translate3d(5%, -2%, 0);  opacity: 0.62; }
}

@keyframes haze {
  0%, 100% { opacity: 0.7; }
  50%      { opacity: 1; }
}

/* ── Depth layers ───────────────────────────────────────────────────────── */

.mountains { opacity: 0.55; }

/* ── Snowfall ───────────────────────────────────────────────────────────── */

.snowfall { opacity: 0.35; }

.snowfall i {
  position: absolute;
  top: -6%;
  display: block;
  border-radius: 50%;
  background: #f2f7ff;
  animation-name: fall;
  animation-iteration-count: infinite;
  animation-timing-function: linear;
}

@keyframes fall {
  from { transform: translate3d(0, -10vh, 0); }
  to   { transform: translate3d(var(--drift, 0), 112vh, 0); }
}

/* ── Air ────────────────────────────────────────────────────────────────── */

.mist {
  background:
    radial-gradient(120% 46% at 50% 100%, rgba(190, 214, 236, 0.28), transparent 68%),
    radial-gradient(80% 30% at 22% 96%, rgba(160, 200, 220, 0.2), transparent 70%);
}

.vignette {
  background: radial-gradient(96% 76% at 50% 46%, transparent 52%, rgba(4, 7, 16, 0.6) 100%);
}

/* Paper grain. Plain overlay rather than a blend mode — blending a
   full-screen layer re-composites the whole scene on every frame. */
.grain {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.3'/%3E%3C/svg%3E");
  opacity: 0.14;
}

/* ── The reveal ─────────────────────────────────────────────────────────── */

.reveal {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  /* Bottom padding lifts the name clear of the ruin below it. */
  padding: 0 24px 16vh;
  text-align: center;
  opacity: 0;
  pointer-events: none;
}

.journey-stage.is-ready .reveal { pointer-events: auto; }

.reveal-arc {
  width: clamp(150px, 26vw, 240px);
  margin-bottom: 22px;
  opacity: 0.9;
}

.reveal-eyebrow {
  margin: 0 0 14px;
  color: #8ff0d2;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

/* Both lines share one tracking. The negative right margin cancels the
   trailing space that letter-spacing adds after the final letter, which would
   otherwise push each centred line a little to the left. */
.reveal-title {
  max-width: none;
  margin: 0 -0.14em 0 0;
  color: #f2f7ff;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(2.9rem, 9vw, 6.4rem);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: 0.14em;
  text-shadow: 0 2px 24px rgba(6, 12, 28, 0.7), 0 4px 60px rgba(63, 201, 168, 0.28);
}

.reveal-title em {
  display: block;
  color: inherit;
  font-style: normal;
  font-weight: 300;
}

.reveal-rule {
  width: 74px;
  height: 1px;
  margin: 30px 0 34px;
  background: linear-gradient(90deg, transparent, rgba(111, 232, 196, 0.85), transparent);
}


.enter-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 18px 40px;
  border: 1.5px solid rgba(147, 224, 205, 0.6);
  border-radius: 3px;
  background: rgba(9, 18, 32, 0.78);
  color: #f2f9ff;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, color 0.25s, transform 0.25s;
}

.enter-btn:hover {
  border-color: var(--aurora-green);
  background: rgba(63, 201, 168, 0.18);
  color: #fff;
  transform: translateY(-2px);
}

.enter-btn svg { width: 18px; height: 18px; }

.journey-stage.is-ready .enter-btn { animation: breathe 3.4s ease-in-out infinite; }

@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(111, 232, 196, 0); }
  50%      { box-shadow: 0 0 34px 0 rgba(111, 232, 196, 0.22); }
}

/* ── Wordmark ───────────────────────────────────────────────────────────── */

.journey-mark {
  position: absolute;
  top: 24px;
  left: 26px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 11px;
  color: #e9f2fb;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 18px rgba(6, 12, 28, 0.9);
}

.journey-mark svg {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

/* ── Scroll cue & skip ──────────────────────────────────────────────────── */

/* A wordless hairline with a light running down it. */
.scroll-cue {
  position: absolute;
  bottom: 40px;
  left: 50%;
  width: 1px;
  height: 58px;
  overflow: hidden;
  background: rgba(226, 238, 252, 0.16);
  transform: translateX(-50%);
}

.scroll-cue span {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 42%;
  background: linear-gradient(180deg, transparent, rgba(226, 238, 252, 0.95));
  animation: drip 2.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes drip {
  0%   { transform: translateY(-100%); }
  100% { transform: translateY(240%); }
}

.skip-btn {
  position: absolute;
  top: 26px;
  right: 26px;
  z-index: 5;
  padding: 12px 22px;
  border: 1.5px solid rgba(200, 220, 240, 0.34);
  border-radius: 3px;
  background: rgba(8, 14, 30, 0.62);
  color: #e2eefc;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.skip-btn:hover { color: #fff; border-color: rgba(111, 232, 196, 0.6); }

.enter-btn:focus-visible,
.skip-btn:focus-visible {
  outline: 2px solid var(--aurora-green);
  outline-offset: 3px;
}

/* ── Doorway transition ─────────────────────────────────────────────────── */

.journey-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  background:
    radial-gradient(circle at 50% 52%, rgba(238, 248, 255, 0.96) 0%, rgba(150, 226, 208, 0.7) 34%, rgba(10, 16, 38, 0) 72%);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.4);
}

body.entering .journey-stage::after {
  animation: doorway 400ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes doorway {
  0%   { opacity: 0;    transform: scale(0.4); }
  55%  { opacity: 1;    transform: scale(1.6); }
  100% { opacity: 0.96; transform: scale(3.4); }
}

body.entering .journey-stage > .layer,
body.entering .reveal,
body.entering .scroll-cue,
body.entering .journey-mark,
body.entering .skip-btn {
  transition: opacity 240ms ease;
  opacity: 0;
}

/* The site fades up out of the flash rather than snapping in. */
body.entered #site { animation: arrive 420ms cubic-bezier(0.22, 1, 0.36, 1) both; }

@keyframes arrive {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ── Small screens ──────────────────────────────────────────────────────── */

@media (max-width: 680px) {
  .journey { height: 300vh; }
  .reveal-rule { margin: 24px 0 28px; }
  .skip-btn { top: 18px; right: 18px; }
  .journey-mark { top: 17px; left: 18px; font-size: 0.9rem; gap: 9px; }
  .journey-mark svg { width: 28px; height: 28px; }
  .scroll-cue { bottom: 28px; height: 48px; }
}

/* ── Reduced motion: the same picture, held still ───────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .journey { height: 100vh; }

  .stars i,
  .curtain,
  .aurora-haze,
  .snowfall i,
  .scroll-cue,
  .enter-btn {
    animation: none !important;
  }

  .scroll-cue { display: none; }

  body.entering .journey-stage::after { animation-duration: 1ms; }
  body.entered #site { animation: none; }
}
