/* =========================================================
   "The Last Ember" holding page
   Runs on the brand tokens/fonts from brand.css. The city photo is
   the world; a black-green spotlight overlay opens over it like a
   held breath, and a handful of embers drift over the top.
   ========================================================= */

.ember-page {
  background: var(--world-bg); /* shows while the photo loads */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  /* Horizontal only — the backdrop/glow/ember layers are all
     position: fixed (pinned to the viewport, not to this box), so
     letting vertical overflow through just lets the *page* scroll on
     short viewports without a second, custom scrollbar appearing
     over the image. Only the browser's own scrollbar should show. */
  overflow-x: hidden;
  font-family: var(--f-clinical);
  color: var(--ink);
}

/* ---------- City backdrop ----------
   Reveal is driven by mask-size (a plain length), not by interpolating
   gradient strings — that's what made the old version snap open
   instead of growing smoothly. The mask's own gradient has a soft
   feathered edge, so growing its size reads as the photo fading in
   while expanding outward from the centre, not a hard-edged disk. */

.city-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: url("../img/the-last-ember/full-city-4.jpg");
  background-size: cover;
  background-position: 50% 50%;
  background-repeat: no-repeat;
  /* pull the photo's dusty tans/golds toward the world's black-green */
  filter: saturate(0.8) contrast(1.1) brightness(0.88);

  opacity: 0;
  -webkit-mask-image: radial-gradient(circle at center, black 0%, black 30%, rgba(0, 0, 0, 0.5) 55%, transparent 82%);
  mask-image: radial-gradient(circle at center, black 0%, black 30%, rgba(0, 0, 0, 0.5) 55%, transparent 82%);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: 50% 50%;
  mask-position: 50% 50%;
  -webkit-mask-size: 4% 4%;
  mask-size: 4% 4%;

  /* The fully-opaque core of the mask (0–30% of its own box) is what
     actually reaches viewport edge-to-edge — that happens well before
     mask-size reaches 100%, so growth must keep going most of the way
     to the final size for the reveal to read as gradual throughout,
     not "open immediately, then nothing happens". */
  animation: city-reveal 6.5s ease-in-out 0.4s forwards;
  will-change: opacity, mask-size;
}

@keyframes city-reveal {
  to {
    opacity: 1;
    -webkit-mask-size: 170% 170%;
    mask-size: 170% 170%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .city-backdrop {
    animation: none;
    opacity: 1;
    -webkit-mask-size: 170% 170%;
    mask-size: 170% 170%;
  }
}

/* ---------- Spotlight glow + overlay ----------
   Split into two layers so the gold ring and the dark vignette can
   breathe in opposite directions: the ring is brightest exactly when
   the vignette is at its lightest (least obscuring), and dims back
   down as the vignette darkens again. Same 10s cycle, opposite phase. */

.spotlight-glow {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.35;
  background: radial-gradient(
    circle at 50% 50%,
    transparent 0%,
    rgba(201, 154, 68, 0.6) 18%,
    rgba(201, 154, 68, 0.28) 32%,
    transparent 48%
  );
  animation: glow-pulse 10s ease-in-out 7.8s infinite;
}

@keyframes glow-pulse {
  0%, 100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spotlight-glow {
    animation: none;
    opacity: 0.35;
  }
}

.spotlight-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 1;
  background: radial-gradient(
    circle at 50% 50%,
    transparent 0%,
    transparent 32%,
    rgba(10, 13, 11, 0.55) 54%,
    rgba(10, 13, 11, 0.9) 76%,
    var(--world-bg) 100%
  );
  /* Holds at its normal opacity through the whole opening sequence
     (delay below covers city-reveal + the last reveal-3 fade), then
     breathes gently forever: 5s up, 5s down, never fully off, never
     fully blown out. */
  animation: overlay-pulse 10s ease-in-out 7.8s infinite;
}

@keyframes overlay-pulse {
  0%, 100% {
    opacity: 0.9;
  }
  50% {
    opacity: 0.4;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spotlight-overlay {
    animation: none;
    opacity: 1;
  }
}

/* ---------- Ember field: only a few, drifting over the reveal ---------- */

.ember-field {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.ember {
  position: absolute;
  bottom: -40px;
  left: var(--x, 50%);
  width: var(--size, 6px);
  height: var(--size, 6px);
  border-radius: 50%;
  background: radial-gradient(circle, var(--facade-gold-bright) 0%, var(--facade-gold) 45%, transparent 80%);
  /* soft halo that scales with size — bigger embers read as "closer" */
  box-shadow: 0 0 var(--aura-blur, 10px) var(--aura-spread, 3px) var(--facade-gold);
  opacity: 0;
  filter: blur(0px) hue-rotate(0deg);
  animation:
    ember-rise var(--rise-duration, 14s) linear var(--delay, 0s) infinite,
    ember-focus var(--focus-duration, 5s) ease-in-out var(--delay, 0s) infinite;
  will-change: transform, opacity, filter;
}

@keyframes ember-rise {
  0% {
    transform: translate(0, 0) translateX(0);
  }
  100% {
    transform: translate(0, calc(-100vh - 80px)) translateX(var(--drift, 40px));
  }
}

/* Opacity/blur handle the "drifts in and out of focus" pulse; the
   hue-rotate riding along the same cycle sweeps the halo softly
   through gold/rose/amber — kept warm so it still reads as fire. */
@keyframes ember-focus {
  0%, 100% {
    opacity: 0;
    filter: blur(var(--focus-blur, 3px)) hue-rotate(0deg);
  }
  15% {
    opacity: var(--peak-opacity, 0.85);
    filter: blur(0px) hue-rotate(30deg);
  }
  55% {
    opacity: calc(var(--peak-opacity, 0.85) * 0.45);
    filter: blur(calc(var(--focus-blur, 3px) * 0.7)) hue-rotate(-40deg);
  }
  80% {
    opacity: var(--peak-opacity, 0.85);
    filter: blur(0px) hue-rotate(50deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ember {
    animation: ember-focus 7s ease-in-out infinite;
  }
}

/* ---------- Staged reveal ----------
   The spotlight opens first. Content fades up in three waves after
   it: title block, then the release date, then the form/nav/footer. */

.reveal {
  opacity: 0;
  transform: translateY(10px);
  animation: reveal-in 1.2s ease-out forwards;
}

.reveal-1 { animation-delay: 3.4s; }
.reveal-2 { animation-delay: 5.2s; }
.reveal-3 { animation-delay: 6.6s; }

@keyframes reveal-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    animation-duration: 0.6s;
  }
}

/* ---------- Content over the field ---------- */

.ember-header,
.ember-main,
.ember-footer {
  position: relative;
  z-index: 3;
}

.ember-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 24px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  font-family: var(--f-clinical);
}

.ember-header a {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--facade-steel);
}

.ember-header a:hover {
  color: var(--facade-gold-bright);
}

.ember-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px 60px;
}

.ember-content {
  max-width: 560px;
}

.book-eyebrow {
  display: block;
  font-family: var(--f-clinical);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  /* bone, not gold — gold-on-gold was disappearing against the photo */
  color: var(--facade-bone);
  margin-bottom: 22px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.95), 0 0 1px rgba(0, 0, 0, 0.9), 0 0 20px rgba(201, 154, 68, 0.5);
}

.book-title {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(2.6rem, 8vw, 4.6rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
  margin: 0 0 18px;
  color: var(--facade-bone);
  text-shadow: 0 4px 26px rgba(0, 0, 0, 0.92), 0 0 40px rgba(201, 154, 68, 0.28);
}

.book-tagline {
  font-family: var(--f-literary);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--ink);
  margin-bottom: 28px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.9);
}

.book-blurb {
  max-width: 500px;
  margin: 0 auto 34px;
  padding: 24px 28px;
  background: rgba(10, 13, 11, 0.62);
  border: 1px solid rgba(139, 146, 144, 0.25);
  border-radius: 8px;
}

.book-blurb p {
  font-family: var(--f-clinical);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.92);
  margin: 0 0 16px;
}

.book-blurb p:last-child {
  margin-bottom: 0;
}

.book-status {
  font-family: var(--f-display);
  font-size: clamp(1.7rem, 5.5vw, 2.6rem);
  letter-spacing: 0.03em;
  color: var(--ink);
  margin: 8px 0 42px;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.92);
}

.book-status strong {
  color: var(--facade-gold-bright);
  font-weight: 600;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.92), 0 0 30px rgba(201, 154, 68, 0.5);
}

/* ---------- Deco divider ---------- */

.deco-divider {
  width: 220px;
  height: 26px;
  margin: 0 auto 30px;
  color: var(--facade-gold);
  opacity: 0.8;
}

/* ---------- Signup panel: a "registry notice" over the photo ---------- */

.signup-panel {
  position: relative;
  max-width: 460px;
  margin: 0 auto;
  padding: 30px 28px 24px;
  background: rgba(9, 12, 10, 0.86);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  border: 1px solid var(--facade-steel);
}

.signup-panel::before,
.signup-panel::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 1px solid var(--facade-gold);
}

.signup-panel::before { top: 7px; left: 7px; border-right: none; border-bottom: none; }
.signup-panel::after { bottom: 7px; right: 7px; border-left: none; border-top: none; }

.signup-form {
  display: flex;
  gap: 10px;
  margin: 0 0 14px;
  flex-wrap: wrap;
  justify-content: center;
}

.signup-form input[type="email"] {
  flex: 1;
  min-width: 220px;
  padding: 13px 18px;
  border-radius: 2px;
  border: 1px solid var(--world-line, rgba(180, 190, 170, 0.16));
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 0.92rem;
  font-family: var(--f-clinical);
}

.signup-form input[type="email"]::placeholder {
  color: var(--ink-faint);
}

.signup-form input[type="email"]:focus-visible {
  outline: none;
  border-color: var(--facade-gold);
  box-shadow: 0 0 0 3px rgba(201, 154, 68, 0.18);
}

.btn {
  display: inline-block;
  padding: 11px 26px;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--facade-gold-bright), var(--facade-gold));
  color: var(--world-bg);
  font-family: var(--f-clinical);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: none;
}

.btn:hover {
  filter: brightness(1.08);
}

.signup-note {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  margin: 0;
}

.ember-footer {
  text-align: center;
  padding: 20px 24px 40px;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
}
