/* Rituel — finale CTA section. Everything scoped under .finale. */

.finale {
  --cream: #f6eedf;
  --ink: #23161a;
  --bordeaux: #5a1a22;
  --gold: #b8913c;
  --gold-light: #dcb45f;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --spot-size: 760px;

  position: absolute;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
  display: grid;
  place-items: center;
  background: #0b0809;
  color: var(--cream);
  font-family: "Source Serif 4", Georgia, serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.finale *,
.finale *::before,
.finale *::after { box-sizing: border-box; }

/* ---------- Background: marble, shade, spotlight, vignette ---------- */

.finale__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.finale__marble,
.finale__spot-marble {
  background: #0b0809 url("/textures/marbre-noir.jpg") center / cover no-repeat;
}

.finale__marble {
  position: absolute;
  inset: 0;
}

/* Equivalent to brightness(.5) on the base layer, without a filter. */
.finale__shade {
  position: absolute;
  inset: 0;
  background: rgba(6, 4, 5, 0.5);
}

/* Spotlight: a fixed-size masked window moved with transform; its inner
   marble is counter-translated so it stays aligned with the base layer. */
.finale__spot {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--spot-size);
  height: var(--spot-size);
  overflow: hidden;
  opacity: 0;
  transition: opacity 900ms var(--ease-out);
  -webkit-mask-image: radial-gradient(circle closest-side, #000 0%, rgba(0, 0, 0, 0.72) 38%, rgba(0, 0, 0, 0.22) 72%, transparent 100%);
          mask-image: radial-gradient(circle closest-side, #000 0%, rgba(0, 0, 0, 0.72) 38%, rgba(0, 0, 0, 0.22) 72%, transparent 100%);
  will-change: transform;
}

.finale.is-active .finale__spot { opacity: 1; }

.finale__spot-marble {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw; /* overwritten in px by JS to match the root */
  height: 100vh;
  will-change: transform;
}

.finale__spot-tint {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle closest-side, rgba(220, 180, 95, 0.16), rgba(184, 145, 60, 0.07) 55%, transparent 100%);
}

.finale__vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 45%, rgba(4, 2, 3, 0.7) 100%),
    linear-gradient(180deg, rgba(4, 2, 3, 0.35) 0%, transparent 22%, transparent 78%, rgba(4, 2, 3, 0.45) 100%);
}

/* ---------- Sparkles canvas ---------- */

.finale__sparkles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* ---------- Content ---------- */

.finale__inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1600px;
  padding: 0 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.finale__title {
  margin: 0;
  font-family: "Young Serif", Georgia, serif;
  font-weight: 400;
  font-size: min(7vw, 12.5vh, 8rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--cream);
  text-wrap: balance;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.45);
}

.finale__line {
  display: block;
  white-space: nowrap;
}

.finale__sent { display: block; }

.finale__accent {
  font-style: normal;
  color: var(--gold-light);
}

.finale__sub {
  margin: clamp(20px, 3.2vh, 32px) 0 0;
  max-width: none;
  font-size: clamp(1.05rem, 1.35vw, 1.3rem);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6);
  line-height: 1.5;
  color: rgba(246, 238, 223, 0.86);
  text-wrap: balance;
}

.finale__cta-wrap {
  position: relative;
  margin-top: clamp(32px, 5.5vh, 56px);
  will-change: transform;
}

/* Hover glow lives behind the button, animated by opacity only. */
.finale__cta-wrap::before {
  content: "";
  position: absolute;
  inset: -18px -26px;
  border-radius: 40px;
  background: radial-gradient(closest-side, rgba(220, 180, 95, 0.42), rgba(220, 180, 95, 0) 100%);
  opacity: 0.35;
  transition: opacity 400ms ease;
  pointer-events: none;
}

.finale__cta-wrap.is-near::before { opacity: 0.75; }
.finale__cta-wrap.is-hover::before { opacity: 1; }

.finale__cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 72px;
  padding: 0 58px;
  border-radius: 14px;
  overflow: hidden;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
  background: linear-gradient(180deg, #e8c776 0%, #dcb45f 42%, #c79f4b 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 246, 220, 0.65),
    inset 0 -1px 0 rgba(90, 26, 34, 0.28),
    0 14px 34px -14px rgba(220, 180, 95, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.45);
  transition: transform 160ms var(--ease-out);
  -webkit-user-select: none;
          user-select: none;
}

/* Brighter fill on hover, as an opacity layer. */
.finale__cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #f1d58e 0%, #e3bd66 50%, #cfa651 100%);
  opacity: 0;
  transition: opacity 220ms ease;
}

/* Hot-foil shimmer sweep. */
.finale__cta::after {
  content: "";
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 46%;
  background: linear-gradient(100deg,
    rgba(255, 250, 235, 0) 0%,
    rgba(255, 250, 235, 0.08) 30%,
    rgba(255, 252, 242, 0.62) 50%,
    rgba(255, 250, 235, 0.08) 70%,
    rgba(255, 250, 235, 0) 100%);
  transform: translateX(-120%) skewX(-18deg);
  mix-blend-mode: soft-light;
  animation: finale-foil 4.8s cubic-bezier(0.77, 0, 0.175, 1) 1.2s infinite;
  animation-play-state: paused;
  pointer-events: none;
}

.finale.is-active .finale__cta::after { animation-play-state: running; }

@keyframes finale-foil {
  0% { transform: translateX(-120%) skewX(-18deg); }
  26% { transform: translateX(330%) skewX(-18deg); }
  100% { transform: translateX(330%) skewX(-18deg); }
}

.finale__cta-label {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  will-change: transform;
}

.finale__cta-arrow {
  width: 22px;
  height: 22px;
  flex: none;
  transition: transform 220ms var(--ease-out);
}

.finale__cta:active { transform: scale(0.97); }

.finale__cta:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 5px;
}

@media (hover: hover) and (pointer: fine) {
  .finale__cta:hover::before { opacity: 1; }
  .finale__cta:hover .finale__cta-arrow { transform: translateX(4px); }
}

.finale__note {
  margin: 24px 0 0;
  font-size: 0.98rem;
  line-height: 1.4;
  color: rgba(246, 238, 223, 0.78);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.7);
}

/* ---------- Entrance (first activation only) ---------- */

.finale__line,
.finale__sub,
.finale__cta-wrap,
.finale__note {
  opacity: 0;
  translate: 0 14px;
  transition: opacity 900ms var(--ease-out), translate 900ms var(--ease-out);
}

.finale.is-in .finale__line,
.finale.is-in .finale__sub,
.finale.is-in .finale__cta-wrap,
.finale.is-in .finale__note {
  opacity: 1;
  translate: 0 0;
}

.finale.is-in .finale__line:nth-child(2) { transition-delay: 80ms; }
.finale.is-in .finale__sub { transition-delay: 180ms; }
.finale.is-in .finale__cta-wrap { transition-delay: 260ms; }
.finale.is-in .finale__note { transition-delay: 340ms; }

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .finale__inner { padding: 0 16px; }
  .finale__title { font-size: min(calc((100vw - 32px) / 10.8), 11vh); }
  .finale__sub { font-size: 1.05rem; max-width: 32ch; }
  .finale__sent { display: inline; }
  .finale__cta-wrap { width: 100%; }
  .finale__cta {
    display: flex;
    width: 100%;
    padding: 0 24px;
    font-size: 1.25rem;
  }
  .finale__note { font-size: 0.92rem; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .finale__cta::after { animation: none; display: none; }
  .finale__line,
  .finale__sub,
  .finale__cta-wrap,
  .finale__note { translate: none; transition: opacity 400ms ease; }
  .finale__spot { transition: opacity 400ms ease; }
  .finale__cta-arrow { transition: none; }
}
