/* ==========================================================================
   Mission — an altar call. Dark and candlelit at the top, fully lit at the end.
   mission.js sets --bg, --ink, --enter and the glow values as you scroll.
   ========================================================================== */

.altar {
  --bg: #0E0E0E;
  --ink: #F4F1EC;
  --enter: 0;          /* 0 → 1 as the first candle settles to the bottom */
  --ga: 0.14;          /* glow strength */
  --gr: 22%;           /* glow reach */
  --amber: #F5B971;
  --lit-red: #E8344F;  /* brighter red for small text on dark (readable contrast) */
  background: var(--bg);
  color: var(--ink);
}

/* ---------- Sanctuary: sticky candle stage + scrolling words ---------- */

.sanctuary { position: relative; }

.sanctuary__stage {
  position: sticky;
  top: var(--header-h);
  z-index: 0;
  height: calc(100vh - var(--header-h));
  height: calc(100svh - var(--header-h));
  overflow: hidden;
  pointer-events: none;
}

.sanctuary__glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% calc(52% + var(--enter) * 26%),
    rgba(245, 185, 113, var(--ga)) 0%,
    rgba(245, 185, 113, calc(var(--ga) * 0.35)) calc(var(--gr) * 0.5),
    rgba(245, 185, 113, 0) var(--gr));
}

.sanctuary__content {
  position: relative;
  z-index: 1;
  margin-top: calc(-1 * (100vh - var(--header-h)));
  margin-top: calc(-1 * (100svh - var(--header-h)));
}

.sanctuary__opening {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: calc(100vh - var(--header-h));
  height: calc(100svh - var(--header-h));
  padding-top: 14vh;
  text-align: center;
}
.altar-label {
  color: var(--lit-red);
  font-size: 1.25rem;
  letter-spacing: 0.5em;
  margin-right: -0.5em; /* keeps letter-spaced text optically centered */
  line-height: 1;
}
.altar-scroll {
  margin-top: auto;
  margin-bottom: 2rem;
  font-size: 0.8125rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: calc(0.8 - var(--enter));
}

/* ---------- Candles ---------- */

.candle {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}
.candle__flame {
  position: relative;
  z-index: 1;
  width: 14px;
  height: 30px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(ellipse at 50% 78%, #FFFFFF 0 14%, #FFF1C9 26%, #FFD58A 42%, var(--amber) 58%, rgba(240, 120, 50, 0.55) 72%, rgba(240, 120, 50, 0) 80%);
  transform-origin: 50% 90%;
  opacity: 0;
  scale: 0.3;
  transition: opacity 0.9s ease, scale 0.9s ease;
}
.candle__flame::after {
  content: "";
  position: absolute;
  top: 60%;
  left: 50%;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 185, 113, 0.5), rgba(245, 185, 113, 0.15) 40%, rgba(245, 185, 113, 0) 70%);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.candle__wick { width: 2px; height: 8px; background: #2A2018; }
.candle__body {
  width: 24px;
  height: var(--h, 6rem);
  border-radius: 4px 4px 2px 2px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(245, 185, 113, 0.0), transparent 70%),
    linear-gradient(90deg, #CFC2AA, #F6EFE2 38%, #E9DFCB 70%, #C4B59A);
  box-shadow: inset 0 6px 8px -6px rgba(0, 0, 0, 0.25);
  transition: background 0.9s ease;
}

.candle.is-lit .candle__flame {
  opacity: 1;
  scale: 1;
  animation: flicker 2.6s ease-in-out infinite;
}
.candle.is-lit .candle__flame::after { animation: halo 3.4s ease-in-out infinite; }
.candle.is-lit .candle__body {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 214, 150, 0.75), transparent 60%),
    linear-gradient(90deg, #CFC2AA, #F6EFE2 38%, #E9DFCB 70%, #C4B59A);
}

@keyframes flicker {
  0%, 100% { transform: scale(1, 1) skewX(0deg); }
  18%      { transform: scale(0.95, 1.05) skewX(1.6deg); }
  37%      { transform: scale(1.03, 0.97) skewX(-1.1deg); }
  55%      { transform: scale(0.98, 1.03) skewX(0.8deg); }
  76%      { transform: scale(1.02, 0.98) skewX(-1.5deg); }
}
@keyframes halo {
  0%, 100% { opacity: 0.9; }
  30%      { opacity: 0.72; }
  60%      { opacity: 1; }
}

/* The first candle: centered, then settles toward the bottom as you scroll */
.altar-candle {
  position: absolute;
  top: calc(54% + var(--enter) * 24%);
  left: 50%;
  transform: translate(-50%, -50%) scale(calc(1 - var(--enter) * 0.22));
}
.candle--main .candle__flame { width: 22px; height: 48px; }
.candle--main .candle__flame::after { width: 340px; height: 340px; }
.candle--main .candle__wick { width: 3px; height: 10px; }
.candle--main .candle__body { width: 42px; height: 9.5rem; }

/* Side candles: the congregation */
.pew { position: absolute; top: 0; bottom: 0; width: 7rem; }
.pew--left { left: clamp(0.5rem, 4vw, 4rem); }
.pew--right { right: clamp(0.5rem, 4vw, 4rem); }
.candle--side {
  position: absolute;
  top: var(--y);
  left: 50%;
  transform: translateX(-50%);
}
.pew .candle--side:nth-child(2) { left: 20%; }
.pew .candle--side:nth-child(3) { left: 70%; }
.candle--side:nth-child(2) .candle__flame { animation-duration: 3.1s; }
.candle--side:nth-child(3) .candle__flame { animation-duration: 2.2s; }
.pew--right .candle--side:nth-child(1) .candle__flame { animation-duration: 2.9s; }

/* ---------- The statement ---------- */

.vow {
  max-width: 22em;
  margin: 0 auto;
  padding: 18vh var(--gutter) 0;
  font-family: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  font-size: clamp(1.65rem, 5.2vw, 3.75rem);
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-wrap: balance;
}
.vow__line {
  display: block;
  margin-bottom: 30vh;
  text-shadow: 0 1px 18px rgba(14, 14, 14, 0.55); /* keeps words crisp over the glow */
  transition: opacity 1.3s ease, transform 1.3s ease, filter 1.3s ease;
}
.kw {
  color: var(--lit-red);
  text-shadow: 0 0 14px rgba(232, 52, 79, 0.65), 0 0 34px rgba(232, 52, 79, 0.35);
  transition: color 0.6s ease, text-shadow 0.6s ease;
}

/* Before a line is reached, it waits in the dark (only when the script is running) */
.altar.is-live .vow__line:not(.is-lit) {
  opacity: 0;
  transform: translateY(1.75rem);
  filter: blur(5px);
}
.altar.is-live .vow__line:not(.is-lit) .kw { text-shadow: none; }

/* ---------- The response ---------- */

.response {
  padding: 4vh var(--gutter) 34vh;
  text-align: center;
}
.response__ask {
  font-size: clamp(3.5rem, 12vw, 9.5rem);
  line-height: 0.9;
}
.response__btn {
  margin-top: 2.25rem;
  padding: 1rem 2.5rem 0.85rem;
  font-size: 1.375rem;
}

/* Once the room is bright, switch to the site's light colors */
.altar.is-bright { --lit-red: var(--accent); }
.altar.is-bright .vow__line { text-shadow: none; }
.altar.is-bright .kw { text-shadow: none; }

/* ---------- Fully lit: why I started ---------- */

.benediction {
  max-width: 42rem;
  padding-block: clamp(5rem, 12vw, 9rem);
  background: #FFFFFF;
  color: var(--text);
  text-align: center;
}
.benediction .rule { margin: 0 auto 2rem; }
.benediction h2 { margin-bottom: 1.25rem; }
.benediction p { color: var(--muted); }
.amen-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 3rem;
  color: var(--accent) !important;
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.45em;
  text-transform: uppercase;
}
.amen-mark::before,
.amen-mark::after {
  content: "";
  width: 2.5rem;
  height: 2px;
  background: currentColor;
}
.amen-mark::after { margin-left: -0.45em; }

/* ---------- Phones: one centered candle, fewer side candles ---------- */

@media (max-width: 40em) {
  .pew { width: 3rem; }
  .pew--left { left: 0.25rem; }
  .pew--right { right: 0.25rem; }
  .pew .candle--side:nth-child(n + 2) { display: none; }
  .candle--side { left: 50% !important; }
  .candle--side .candle__body { width: 16px; height: calc(var(--h) * 0.7); }
  .candle--side .candle__flame { width: 10px; height: 22px; }
  .candle--side .candle__flame::after { width: 90px; height: 90px; }
  .vow__line { margin-bottom: 24vh; }
}

/* ---------- Motion off: fully lit, all text visible, no flicker or fades ---------- */

.altar.is-still {
  --bg: #FFFFFF;
  --ink: var(--text);
  --lit-red: var(--accent);
  --ga: 0.22;
  --gr: 45%;
}
.altar.is-still .vow__line,
.altar.is-still .kw { text-shadow: none; }
/* candles stay on the opening screen instead of following the words */
.altar.is-still .sanctuary__stage { position: absolute; top: 0; left: 0; right: 0; }
.altar.is-still .sanctuary__content { margin-top: 0; }
.altar.is-still .candle__flame { opacity: 1; scale: 1; }
.altar.is-still .vow__line { margin-bottom: 1.25rem; }
.altar.is-still .vow { padding-bottom: 6rem; }
.altar.is-still .response { padding-bottom: 8rem; }

@media (prefers-reduced-motion: reduce) {
  .candle__flame,
  .candle__flame::after { animation: none !important; }
}
