/* =========================================================
   Home hero — "Photo Wall"
   A tilted wall of church photos drifts behind "you belong here."
   As you scroll the wall straightens and zooms, the words part,
   and the church name, invitation and buttons reveal.

   --p (0→1) is the scroll progress through the pinned hero, set by
   hero-wall.js. Without JavaScript it stays 1: the finished, static state.
   ========================================================= */
.hero-wall {
  position: relative;
  height: 240vh;
  background: var(--ink);
}
/* --ov: the overlay's presence (0 → 1) during the load sequence. Registered so it can animate. */
@property --ov { syntax: "<number>"; inherits: true; initial-value: 1; }

.hero-wall__stage {
  --p: 1;
  /* --lit: moodier at the top → full brightness by 60% of the scroll. */
  --lit: clamp(0, var(--p) / .6, 1);
  /* --e: the slogan's own motion (words part, "belong" grows) — done at 90%. */
  --e: clamp(0, var(--p) / .9, 1);
  /* --r: church name + invitation + buttons reveal from 75% → 90%, finishing with --e. */
  --r: clamp(0, (var(--p) - .75) / .15, 1);
  position: sticky;
  top: 0;
  /* Fill the tallest phone viewport (address bar hidden) so the navy behind the pinned
     stage never shows as a bar beneath it; .wall__copy keeps the words in the small viewport. */
  height: 100vh;
  height: 100lvh;
  overflow: hidden;
  isolation: isolate;
  background: var(--ink);
  color: var(--cream-on-dark);
}
html.hw-js .hero-wall__stage { --p: 0; }

/* Site navy (same as the marquee banner below) with an even dot texture.
   As the top shade (.wall__dim) lifts, the dots would read bigger and brighter — so two
   fixed dot layers cross-fade with --lit (opacity only: no repaint while scrolling). */
.hero-wall__stage::before,
.hero-wall__stage::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
}
.hero-wall__stage::before {
  background: radial-gradient(circle, rgba(214, 234, 250, .576) 1.1px, transparent 1.5px) 0 0 / 14px 14px;  /* 20% softer on load */
  opacity: calc(1 - var(--lit));
}
.hero-wall__stage::after {
  background: radial-gradient(circle, rgba(214, 234, 250, .42) .85px, transparent 1.25px) 0 0 / 14px 14px;
  opacity: var(--lit);
}

/* ---------- The wall ---------- */
.wall { position: absolute; inset: 0; perspective: 1500px; overflow: hidden; }
.wall__plane {
  position: absolute;
  left: 50%; top: 50%;
  width: 132vw; height: 180vh;
  margin: -90vh 0 0 -66vw;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1.4vw;
  transform-origin: 50% 45%;
  transform:
    rotateX(calc(26deg - var(--p) * 26deg))
    rotateZ(calc(-9deg + var(--p) * 9deg))
    scale(calc(1 + var(--p) * .45));
}
.wall__col { transform: translateY(calc(var(--k, 0) * var(--p) * 24vh)); will-change: transform; }
/* Each column keeps its own pace (--dur); the wall as a whole runs 10% faster than those base values. */
.wall__track { animation: wall-drift calc(var(--dur, 60s) / 1.1) linear infinite; }
.wall__col:nth-child(even) .wall__track { animation-direction: reverse; }
@keyframes wall-drift { to { transform: translateY(-50%); } }
/* The photos carry no scroll-linked filter: all darkening lives in the two overlay
   layers below, so scrolling never re-colours 70 photos frame by frame. */
.wall__track img {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 1.4vw;
  border-radius: .9rem;
  box-shadow: 0 1rem 2.5rem rgba(8, 27, 43, .28);
  transition: filter .45s ease, transform .6s var(--ease-out), box-shadow .45s ease;
}
/* Photo focus: hover a photo and it lifts gently out of the wall at full brightness. */
@media (hover: hover) and (pointer: fine) {
  .wall__track img:hover {
    position: relative; z-index: 1;
    filter: brightness(1.08) saturate(1.05);
    transform: scale(1.025);
    box-shadow: 0 0 0 1px rgba(243, 236, 221, .45), 0 1.2rem 3rem rgba(8, 27, 43, .5);
  }
}

/* One even blue tint over the whole wall; the text carries its own soft shadow. */
.wall__veil, .wall__dim { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
/* Same look as before (photos at 82% brightness under a 46% navy veil, deepening to 62%
   with the top shade) — folded into the overlays. --ov lets the load sequence bring them in. */
.wall__veil { background: rgba(12, 36, 59, .557); opacity: var(--ov); }
.wall__dim { background: rgba(8, 28, 47, .62); opacity: calc((1 - var(--lit)) * var(--ov)); }

/* ---------- Copy ---------- */
.wall__copy {
  position: relative; z-index: 2;
  height: 100%;
  height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.6rem;
  padding: 6rem 1.25rem 5rem;
  text-align: center;
  text-shadow: 0 .1rem .6rem rgba(8, 27, 43, .45), 0 .2rem 2.4rem rgba(8, 27, 43, .7);
  /* The copy layer covers the whole stage, so it lets the pointer through to the photos;
     the buttons take it back once they have revealed. */
  pointer-events: none;
}
.hero-wall__stage.is-revealed .wall__more a,
html:not(.hw-js) .wall__more a { pointer-events: auto; }

/* On load only the slogan shows, centred. --lift (set by hero-wall.js) offsets the hidden
   church name above and invitation + buttons below; the slogan glides into its final
   spot as they reveal. */
.wall__head { transform: translateY(calc(var(--lift, 0px) * (1 - var(--r)))); }
.wall__eyebrow {
  margin: 0 0 1.6rem;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .24em;
  line-height: 1.7;
  text-transform: uppercase;
  color: var(--cream-on-dark);
  opacity: clamp(0, var(--r) * 1.8, 1);
  transform: translateY(calc((1 - var(--r)) * -1rem));
}
.wall__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3.6rem, 11vw, 10.5rem);
  line-height: .9;
  letter-spacing: -.035em;
  color: var(--cream-on-dark);
}
.wall__title > span { display: block; }
.wall__title em { font-weight: 500; color: var(--blue-bright); }
.wall__title .ch { display: inline-block; }
.wall__line--1 { transform: translateX(calc(var(--e) * -12vw)); }
.wall__line--3 { transform: translateX(calc(var(--e) * 12vw)); }
.wall__line--2 { position: relative; transform: scale(calc(1 + var(--e) * .08)); }
.wall__line--2 em { position: relative; display: inline-block; }
.wall__flourish {
  position: absolute; left: .04em; bottom: -.03em;
  width: 90%; height: .09em;
  color: var(--blue-bright);
  stroke-dasharray: 330;
  stroke-dashoffset: 0;
}
@keyframes wall-draw { from { stroke-dashoffset: 330; } to { stroke-dashoffset: 0; } }

/* ---------- Load sequence ----------
   hero-wall.js adds .is-playing once the first photos have loaded (and, on a first visit,
   as the brand intro lifts away). Until then the photos, overlay and slogan wait unseen.
   1. photos rise into place in a wave from the centre columns — clear, no overlay
   2. the overlay settles over them
   3. "you" rises letter by letter, "belong" writes itself in, "here." follows
   4. the blue underline draws to finish. */
@media (prefers-reduced-motion: no-preference) {
  .hero-wall__stage {
    --t-ov: 2.17s;     /* overlay begins */
    --t-you: 2.57s;    /* "you" */
    --t-belong: 2.87s;  /* "belong" writes */
    --t-here: 3.57s;   /* "here." */
    --t-line: 4.02s;   /* underline */
  }
  html.hw-js .hero-wall__stage:not(.is-playing) { --ov: 0; }
  html.hw-js .hero-wall__stage:not(.is-playing) :is(.wall__track img, .wall__title .ch, .wall__belong, .wall__cue) { opacity: 0; }
  html.hw-js .hero-wall__stage:not(.is-playing) .wall__flourish { stroke-dashoffset: 330; }

  .is-playing .wall__track img { animation: wall-in 1s var(--ease-out) var(--d, 0s) backwards; }
  .is-playing { animation: wall-ov .9s ease var(--t-ov) backwards; }
  .is-playing .wall__line--1 .ch { animation: wall-letter .75s var(--ease-out) calc(var(--t-you) + var(--c) * 70ms) backwards; }
  .is-playing .wall__line--3 .ch { animation: wall-letter .75s var(--ease-out) calc(var(--t-here) + var(--c) * 70ms) backwards; }
  .is-playing .wall__belong { animation: wall-write 1s cubic-bezier(.55, .1, .35, 1) var(--t-belong) backwards; }
  .is-playing .wall__flourish { animation: wall-draw 1.1s var(--ease-out) var(--t-line) backwards; }
  .is-playing .wall__cue { animation: wall-fade .8s ease calc(var(--t-line) + .6s) backwards; }
}
@keyframes wall-in { from { opacity: 0; transform: translateY(3.5rem) scale(.9) rotate(-1.5deg); } }
@keyframes wall-ov { from { --ov: 0; } }
@keyframes wall-letter { from { opacity: 0; transform: translateY(.5em) rotate(8deg); filter: blur(6px); } }
@keyframes wall-write { from { clip-path: inset(-30% 100% -40% -10%); } to { clip-path: inset(-30% -10% -40% -10%); } }
@keyframes wall-fade { from { opacity: 0; } }

.wall__more {
  display: grid; justify-items: center; gap: 1.6rem;
  opacity: var(--r);
  transform: translateY(calc((1 - var(--r)) * 2rem));
}
.wall__sub {
  margin: 0;
  max-width: 56ch;
  font-size: clamp(1.1rem, 1.35vw, 1.3rem);
  line-height: 1.6;
  color: rgba(243, 236, 221, .96);
  text-shadow: 0 .1rem .9rem rgba(8, 27, 43, .8), 0 0 2.4rem rgba(8, 27, 43, .6);
}
.wall__sub strong { color: var(--cream-on-dark); }
.wall__cta { display: flex; flex-wrap: wrap; justify-content: center; gap: .8rem; text-shadow: none; }
.wall__cta .btn--outline-light { background: #fff; border-color: #fff; color: var(--ink); }
.wall__cta .btn--outline-light:hover { background: var(--cream-on-dark); border-color: var(--cream-on-dark); color: var(--ink); }

.wall__cue {
  position: absolute; z-index: 3; left: 50%; bottom: 1.6rem;
  bottom: calc(100lvh - 100svh + 1.6rem);   /* stays above a phone's address bar */
  margin: 0;
  display: grid; justify-items: center; gap: .7rem;
  transform: translateX(-50%);
  font-size: .68rem; font-weight: 600; letter-spacing: .3em; text-transform: uppercase;
  color: rgba(243, 236, 221, .82);
  opacity: clamp(0, 1 - var(--p) * 8, 1);
  pointer-events: none;
}
/* A hairline with a light travelling down it — reads as "keep going" without shouting. */
.wall__cue::after {
  content: ""; width: 1px; height: 2.6rem;
  background: linear-gradient(rgba(243, 236, 221, .9), rgba(243, 236, 221, .9)) 0 0 / 100% 40% no-repeat,
              rgba(243, 236, 221, .22);
  animation: wall-cue 2.2s cubic-bezier(.65, 0, .35, 1) infinite;
}
@keyframes wall-cue { from { background-position: 0 -120%; } to { background-position: 0 220%; } }

/* A soft shade under the header so its links read even while the photos are bright. */
.wall::after {
  content: ""; position: absolute; inset: 0 0 auto; height: 8.5rem; z-index: 1; pointer-events: none;
  background: linear-gradient(rgba(8, 27, 43, .5), rgba(8, 27, 43, 0));
}

@media (max-width: 767px) {
  .wall__plane { width: 160vw; margin-left: -80vw; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3vw; }
  .wall__col:nth-child(n+4) { display: none; }
  .wall__track img { margin-bottom: 3vw; border-radius: .6rem; }
  .wall__title { font-size: clamp(3.6rem, min(22vw, 10.5svh), 6.5rem); }
  .wall__line--1 { transform: translateX(calc(var(--e) * -14vw)); }
  .wall__line--3 { transform: translateX(calc(var(--e) * 14vw)); }
  .wall__eyebrow { font-weight: 700; text-shadow: 0 .1rem .5rem rgba(8, 27, 43, .85), 0 0 1.6rem rgba(8, 27, 43, .7); }
  .wall__cta { width: 100%; max-width: 26rem; }
  .wall__cta .btn { flex: 1 1 9rem; padding-inline: .6rem; }
}

/* Phones: the banner under the hero waits at the foot of the screen and fades in WITH the
   scroll over the last fifth of the hero (--mq, set by hero-wall.js) — it never slides up
   as a separate bar when the hero lets go. */
@media (max-width: 767px) and (prefers-reduced-motion: no-preference) {
  html.hw-js .hero-wall + .marquee {
    position: sticky; bottom: 0; z-index: 2;
    opacity: var(--mq, 0);
  }
  html.hw-js .hero-wall + .marquee:not(.is-shown) { pointer-events: none; }
  html.hw-js .hero-wall + .marquee:not(.is-shown) .marquee__track { animation-play-state: paused; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-wall { height: auto; }
  .hero-wall__stage { position: relative; }
  .wall__track { animation: none; }
  .wall__title { animation: none; }
  .wall__flourish { stroke-dashoffset: 0; animation: none; }
  .wall__cue { display: none; }
}

/* =========================================================
   Intro — the footer's brand box draws itself, then lifts away.
   Shown once per visit (hero-intro.js sets html.intro-on).
   ========================================================= */
.intro { display: none; }
html.intro-on .intro,
html.intro-leaving .intro {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  background: radial-gradient(ellipse 70% 60% at 50% 45%, #1a4a74, var(--ink) 70%);
  color: var(--cream-on-dark);
}
html.intro-on { overflow: hidden; }
/* Safety net: if the hero script never runs, the intro still gets out of the way. */
html.intro-on .intro { animation: intro-failsafe 0s linear 6s forwards; }
@keyframes intro-failsafe { to { visibility: hidden; } }
.intro__box {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .7rem;
  width: min(18.5rem, 78vw);
  aspect-ratio: 1.85;
  padding: 1.2rem;
}
/* The frame draws clockwise: top → right → bottom → left, closing into a full box. */
.intro__edge { position: absolute; background: rgba(243, 236, 221, .9); animation: intro-edge .3s linear forwards; }
.intro__edge--t { top: 0; left: 0; width: 100%; height: 2px; transform: scaleX(0); transform-origin: left; animation-delay: .15s; animation-timing-function: cubic-bezier(.5, 0, 1, 1); }
.intro__edge--r { top: 0; right: 0; width: 2px; height: 100%; transform: scaleY(0); transform-origin: top; animation-delay: .45s; animation-duration: .18s; }
.intro__edge--b { bottom: 0; right: 0; width: 100%; height: 2px; transform: scaleX(0); transform-origin: right; animation-delay: .63s; }
.intro__edge--l { bottom: 0; left: 0; width: 2px; height: 100%; transform: scaleY(0); transform-origin: bottom; animation-delay: .93s; animation-duration: .2s; animation-timing-function: cubic-bezier(0, 0, .3, 1); }
@keyframes intro-edge { to { transform: none; } }
.intro__logo {
  width: 3rem; height: 3rem;
  background: currentColor;
  -webkit-mask: url("assets/logo.svg") no-repeat center / contain;
  mask: url("assets/logo.svg") no-repeat center / contain;
  opacity: 0; transform: scale(.85);
  animation: intro-in .8s var(--ease-out) .45s forwards;
}
.intro__name {
  margin: 0;
  display: flex; flex-direction: column; align-items: center; gap: .08em;
  font: 600 clamp(1.1rem, 4.6vw, 1.55rem)/1.1 var(--font-body);
  letter-spacing: -.035em;
  text-transform: uppercase;
  overflow: hidden;
}
.intro__name span { display: block; opacity: 0; transform: translateY(100%); animation: intro-in .8s var(--ease-out) .65s forwards; }
.intro__name span + span { font-size: .72em; letter-spacing: .02em; font-weight: 500; animation-delay: .8s; }
@keyframes intro-in { to { opacity: 1; transform: none; } }
/* Exit: the curtain slides up while the box drifts up and fades. */
html.intro-leaving .intro { transform: translateY(-100%); transition: transform 1s cubic-bezier(.75, 0, .2, 1) .15s; }
html.intro-leaving .intro__box { opacity: 0; transform: translateY(-2rem) scale(.96); transition: opacity .45s ease, transform .6s ease; }
@media (prefers-reduced-motion: reduce) {
  .intro__edge { transform: none; animation: none; }
  .intro__logo, .intro__name span { opacity: 1; transform: none; animation: none; }
  html.intro-leaving .intro { transform: none; opacity: 0; transition: opacity .4s; }
}
