@font-face {
  font-family: "Marck Script";
  src: url("/assets/fonts/MarckScript-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper-base: #e6d2a8;
  --paper-shadow: #b38852;
  --paper-edge: rgba(91, 52, 18, 0.26);
  --ink: #41210f;
  --ink-soft: rgba(65, 33, 15, 0.78);
  --torch-core: rgba(255, 221, 160, 0.42);
  --torch-halo: rgba(186, 112, 24, 0.13);
  --sheet-width: min(90vw, 54rem);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 247, 226, 0.42), transparent 34%),
    radial-gradient(circle at bottom right, rgba(124, 71, 23, 0.16), transparent 38%),
    radial-gradient(circle at center, rgba(255, 232, 184, 0.25), transparent 56%),
    linear-gradient(180deg, #e9d9b4 0%, #d6bb87 52%, #caa46a 100%);
  font-family: "Marck Script", "Times New Roman", serif;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  opacity: 0.22;
  background-image:
    linear-gradient(115deg, transparent 0%, rgba(255, 255, 255, 0.16) 24%, transparent 46%),
    linear-gradient(90deg, rgba(87, 52, 17, 0.05) 0, rgba(87, 52, 17, 0.05) 1px, transparent 1px, transparent 23px),
    linear-gradient(0deg, rgba(87, 52, 17, 0.04) 0, rgba(87, 52, 17, 0.04) 1px, transparent 1px, transparent 19px);
  mix-blend-mode: multiply;
}

body::after {
  background:
    radial-gradient(circle at 18% 18%, var(--torch-core) 0%, var(--torch-halo) 22%, transparent 54%),
    radial-gradient(circle at 82% 24%, rgba(255, 211, 134, 0.18) 0%, rgba(186, 112, 24, 0.06) 18%, transparent 42%);
  animation: torchFlicker 6.4s ease-in-out infinite alternate;
  opacity: 0.92;
}

.page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.scroll {
  position: relative;
  width: var(--sheet-width);
  padding: clamp(2.5rem, 6vw, 4.75rem) clamp(1.6rem, 4vw, 3.6rem);
  border-radius: 1.75rem;
  background:
    radial-gradient(circle at 50% 14%, rgba(255, 247, 222, 0.78), transparent 26%),
    linear-gradient(180deg, rgba(251, 239, 205, 0.92) 0%, rgba(230, 208, 164, 0.95) 47%, rgba(210, 176, 117, 0.96) 100%);
  border: 1px solid rgba(115, 75, 30, 0.18);
  box-shadow:
    0 0.55rem 1.2rem rgba(71, 41, 14, 0.16),
    0 1.7rem 4rem rgba(71, 41, 14, 0.28),
    inset 0 0 0.9rem rgba(255, 248, 227, 0.42),
    inset 0 -1.5rem 2.4rem rgba(106, 64, 25, 0.12);
  isolation: isolate;
}

.scroll::before,
.scroll::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.scroll::before {
  border: 1px solid rgba(95, 57, 23, 0.18);
  transform: rotate(-0.4deg);
}

.scroll::after {
  inset: 0.85rem;
  border-radius: 1.15rem;
  border: 1px dashed rgba(116, 71, 26, 0.14);
  opacity: 0.7;
}

.glow,
.paper-noise {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.glow {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 240, 204, 0.48) 0%, rgba(255, 240, 204, 0.18) 20%, transparent 54%);
  mix-blend-mode: screen;
  animation: pulseGlow 5.8s ease-in-out infinite;
}

.paper-noise {
  opacity: 0.24;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(120, 71, 23, 0.14) 0 0.08rem, transparent 0.08rem),
    radial-gradient(circle at 70% 34%, rgba(120, 71, 23, 0.1) 0 0.06rem, transparent 0.06rem),
    radial-gradient(circle at 42% 78%, rgba(120, 71, 23, 0.1) 0 0.07rem, transparent 0.07rem),
    radial-gradient(circle at 84% 82%, rgba(120, 71, 23, 0.12) 0 0.08rem, transparent 0.08rem);
  mix-blend-mode: multiply;
}

.message {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  text-align: center;
}

.line {
  margin: 0;
  max-width: 20ch;
  color: var(--ink);
  text-wrap: balance;
  line-height: 1.22;
  letter-spacing: 0.01em;
  text-shadow:
    0 0.04em 0 rgba(255, 247, 226, 0.42),
    0 0.12em 0.24em rgba(88, 51, 19, 0.16);
  font-size: clamp(2rem, 3.9vw + 0.35rem, 4.7rem);
  opacity: 0;
  transform: translateY(0.85rem) scale(0.985);
  filter: blur(0.18rem);
  animation: revealLine 1.2s cubic-bezier(0.2, 0.75, 0.15, 1) forwards;
}

.line-1 { animation-delay: 0.35s; }
.line-2 { animation-delay: 1.2s; }
.line-3 { animation-delay: 2.45s; }
.line-4 { animation-delay: 3.15s; }
.line-5 { animation-delay: 4s; }

.gap {
  height: clamp(1rem, 2vw, 1.55rem);
}

@keyframes revealLine {
  0% {
    opacity: 0;
    transform: translateY(0.85rem) scale(0.985);
    filter: blur(0.18rem);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes torchFlicker {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.86;
  }

  30% {
    transform: translate3d(0.35rem, -0.12rem, 0) scale(1.03);
    opacity: 0.95;
  }

  64% {
    transform: translate3d(-0.25rem, 0.16rem, 0) scale(0.985);
    opacity: 0.82;
  }

  100% {
    transform: translate3d(0.14rem, -0.08rem, 0) scale(1.02);
    opacity: 0.92;
  }
}

@keyframes pulseGlow {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(1);
  }

  50% {
    opacity: 0.78;
    transform: scale(1.025);
  }
}

@media (max-width: 720px) {
  .page {
    padding: 1rem;
  }

  .scroll {
    width: min(94vw, 40rem);
    padding: 2.35rem 1.2rem 2.6rem;
    border-radius: 1.2rem;
  }

  .scroll::after {
    inset: 0.55rem;
  }

  .line {
    max-width: 16ch;
    font-size: clamp(1.8rem, 6vw + 0.35rem, 3.2rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  body::after,
  .glow {
    animation: none;
  }

  .line {
    opacity: 1;
    transform: none;
    filter: none;
    animation: none;
  }
}
