:root {
  color-scheme: dark;
  --night: #080408;
  --night-soft: #1a0b12;
  --burgundy: #5f142c;
  --rose: #d5667d;
  --blush: #f1b9c2;
  --ivory: #fff7ee;
  --gold: #d7b26d;
  --ui-font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display-font: Georgia, "Times New Roman", Times, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--night);
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow: hidden;
  background: var(--night);
  color: var(--ivory);
}

.finale {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  place-items: center;
  overflow: hidden;
  padding: max(5rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) max(4rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% 48%, rgba(126, 30, 58, 0.2) 0, rgba(75, 18, 38, 0.1) 29%, transparent 57%),
    radial-gradient(circle at 14% 10%, rgba(103, 48, 61, 0.13), transparent 32%),
    linear-gradient(145deg, var(--night) 0%, var(--night-soft) 52%, #090408 100%);
}

.finale::before,
.finale::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
}

.finale::before {
  background: radial-gradient(ellipse at center, transparent 28%, rgba(3, 1, 3, 0.26) 68%, rgba(3, 1, 3, 0.74) 100%);
}

.finale::after {
  opacity: 0.17;
  background-image:
    radial-gradient(circle at 18% 24%, rgba(255, 247, 238, 0.42) 0 0.04rem, transparent 0.055rem),
    radial-gradient(circle at 76% 18%, rgba(215, 178, 109, 0.34) 0 0.035rem, transparent 0.05rem),
    radial-gradient(circle at 63% 76%, rgba(255, 247, 238, 0.28) 0 0.035rem, transparent 0.05rem),
    radial-gradient(circle at 27% 83%, rgba(213, 102, 125, 0.3) 0 0.045rem, transparent 0.06rem);
  background-size: 17rem 19rem, 23rem 21rem, 19rem 25rem, 29rem 23rem;
}

.heart-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.moment {
  position: relative;
  z-index: 1;
  width: min(90vw, 54rem);
  text-align: center;
  filter: drop-shadow(0 1.3rem 2.4rem rgba(3, 1, 3, 0.5));
  animation: moment-arrives 1.4s 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.moment__ornament {
  display: inline-flex;
  align-items: center;
  width: clamp(4.5rem, 11vw, 7.5rem);
  height: 1rem;
  margin-bottom: clamp(1rem, 3vw, 1.8rem);
  gap: 0.45rem;
}

.moment__ornament::before,
.moment__ornament::after {
  height: 1px;
  flex: 1;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(215, 178, 109, 0.78));
}

.moment__ornament::after {
  transform: scaleX(-1);
}

.mensagem {
  margin: 0;
  color: var(--ivory);
  font-family: var(--display-font);
  font-size: clamp(2.25rem, 7.4vw, 5.75rem);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.045em;
  text-wrap: balance;
  text-shadow: 0 0 2rem rgba(213, 102, 125, 0.19), 0 0.15rem 0.2rem rgba(0, 0, 0, 0.54);
}

.mensagem__pause,
.mensagem__reveal {
  display: block;
}

.mensagem__pause {
  margin-bottom: 0.12em;
  color: var(--blush);
  font-size: 0.58em;
  font-style: italic;
  letter-spacing: 0.015em;
}

.mensagem__reveal {
  animation: words-arrive 1.35s 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.back-link {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top));
  left: max(1rem, env(safe-area-inset-left));
  z-index: 2;
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid rgba(215, 178, 109, 0.2);
  border-radius: 999px;
  background: rgba(8, 4, 8, 0.36);
  color: rgba(255, 247, 238, 0.68);
  font-family: var(--ui-font);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.045em;
  line-height: 1;
  text-decoration: none;
  backdrop-filter: blur(0.65rem);
  transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.back-link svg {
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.back-link:hover {
  border-color: rgba(215, 178, 109, 0.48);
  background: rgba(26, 11, 18, 0.7);
  color: var(--ivory);
  transform: translateX(-0.15rem);
}

.back-link:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 0.2rem;
  color: var(--ivory);
}

::selection {
  background: rgba(213, 102, 125, 0.35);
  color: var(--ivory);
}

@keyframes moment-arrives {
  from {
    opacity: 0;
    transform: translateY(1rem) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes words-arrive {
  from {
    opacity: 0;
    transform: translateY(0.32em);
    filter: blur(0.18rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@media (max-width: 35rem) {
  .finale {
    padding-inline: max(1rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-right));
  }

  .moment {
    width: min(92vw, 28rem);
  }

  .mensagem {
    font-size: clamp(2.4rem, 13.5vw, 4.2rem);
  }

  .back-link span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .back-link {
    width: 2.75rem;
    justify-content: center;
    padding: 0;
  }
}

@media (max-height: 31rem) and (orientation: landscape) {
  .finale {
    padding-block: 3.5rem 1.25rem;
  }

  .moment__ornament {
    margin-bottom: 0.5rem;
  }

  .mensagem {
    font-size: clamp(2rem, 9vh, 3.3rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  .back-link {
    border-color: ButtonText;
  }
}
