/* Base palette and typography */
:root {
  --font-serif: 'Libre Baskerville', serif;
  --font-sans: 'Inter', sans-serif;
  --color-ivory: #f8f9ff;
  --color-lavender: #e4e6ff;
  --color-blue: #d6e6f9;
  --color-rose: #f6e1f2;
  --color-text-soft: #7b8796;
  --color-text-strong: #2f3442;
  --color-accent: #bdb8e6;
  --mx: 50%;
  --my: 50%;
  --mx-sm: 50%;
  --my-sm: 50%;
  --shift-x: 0px;
  --shift-y: 0px;
}

@property --mx {
  syntax: '<percentage>';
  inherits: true;
  initial-value: 50%;
}

@property --my {
  syntax: '<percentage>';
  inherits: true;
  initial-value: 50%;
}

@property --mx-sm {
  syntax: '<percentage>';
  inherits: true;
  initial-value: 50%;
}

@property --my-sm {
  syntax: '<percentage>';
  inherits: true;
  initial-value: 50%;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

/* Full-screen backdrop with animated layers */
body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  font-family: var(--font-sans);
  color: var(--color-text-strong);
  background-image:
    linear-gradient(
      120deg,
      var(--color-ivory) 0%,
      var(--color-lavender) 35%,
      var(--color-blue) 65%,
      var(--color-rose) 100%
    ),
    radial-gradient(
      circle at var(--mx) var(--my),
      rgba(255, 255, 255, 0.98) 0%,
      rgba(230, 232, 255, 0.78) 26%,
      rgba(214, 230, 249, 0.45) 44%,
      transparent 60%
    ),
    radial-gradient(
      circle at var(--mx-sm) var(--my-sm),
      rgba(184, 196, 240, 0.65) 0%,
      transparent 52%
    );
  background-size: 420% 420%, 200% 200%, 240% 240%;
  background-blend-mode: screen, screen, normal;
  animation:
    gradient-flow 34s ease-in-out infinite,
    spotlight-drift 26s ease-in-out infinite;
}

/* Moving haze overlay for depth */
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  pointer-events: none;
  background-image:
    conic-gradient(
      from 140deg at 50% 50%,
      rgba(189, 184, 230, 0.45),
      rgba(215, 230, 248, 0.3) 30%,
      rgba(245, 225, 241, 0.35) 55%,
      rgba(230, 228, 255, 0.3) 75%,
      rgba(189, 184, 230, 0.45)
    ),
    radial-gradient(
      circle at 20% 30%,
      rgba(185, 188, 230, 0.6),
      transparent 55%
    ),
    radial-gradient(
      circle at 80% 70%,
      rgba(223, 232, 248, 0.5),
      transparent 60%
    );
  background-size: 260% 260%, 200% 200%, 220% 220%;
  mix-blend-mode: screen;
  opacity: 0.8;
  filter: blur(22px);
  transform: translate3d(var(--shift-x), var(--shift-y), 0) scale(1.12);
  animation: overlay-drift 36s ease-in-out infinite;
}

/* Subtle grain layer */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(47, 52, 64, 0.07) 1px, transparent 1px),
    radial-gradient(rgba(47, 52, 64, 0.04) 1px, transparent 1px);
  background-size: 3px 3px, 4px 4px;
  background-position: 0 0, 1px 2px;
  opacity: 0.16;
  mix-blend-mode: soft-light;
}

/* Centered layout */
.page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(2rem, 8vw, 6rem);
}

/* Entry motion */
.message {
  max-width: 26ch;
  animation: text-rise 820ms ease-out both;
}

h1 {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(0.75rem, 2.5vw, 1.4rem);
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 2.5vw + 1rem, 3.1rem);
  line-height: 1.5;
  letter-spacing: 0.01em;
  text-shadow: 0 12px 32px rgba(32, 38, 60, 0.12);
}

.line {
  position: relative;
  display: inline-block;
  transition: color 600ms ease;
}

.line::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.2em;
  height: 1px;
  background: var(--color-accent);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 700ms ease, opacity 700ms ease;
}

.line--soft {
  color: var(--color-text-soft);
  font-weight: 400;
}

.line--strong {
  color: var(--color-text-strong);
  font-weight: 700;
}

/* Gentle hover for desktop */
@media (hover: hover) {
  .message:hover .line {
    color: #5f6b7c;
  }

  .message:hover .line::after {
    opacity: 0.45;
    transform: scaleX(1);
  }
}

/* Subtle automatic motion on touch devices */
@media (hover: none) {
  .line--strong {
    animation: whisper 6s ease-in-out infinite;
  }

  .line--strong::after {
    opacity: 0.35;
    transform: scaleX(1);
  }
}

@keyframes text-rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes gradient-flow {
  0% {
    background-position:
      calc(0% + var(--shift-x)) calc(10% + var(--shift-y)),
      50% 50%,
      50% 50%;
  }
  50% {
    background-position:
      calc(100% + var(--shift-x)) calc(90% + var(--shift-y)),
      50% 50%,
      50% 50%;
  }
  100% {
    background-position:
      calc(0% + var(--shift-x)) calc(10% + var(--shift-y)),
      50% 50%,
      50% 50%;
  }
}

@keyframes spotlight-drift {
  0% {
    --mx: 42%;
    --my: 34%;
    --mx-sm: 68%;
    --my-sm: 72%;
  }
  50% {
    --mx: 72%;
    --my: 66%;
    --mx-sm: 28%;
    --my-sm: 42%;
  }
  100% {
    --mx: 42%;
    --my: 34%;
    --mx-sm: 68%;
    --my-sm: 72%;
  }
}

@keyframes overlay-drift {
  0% {
    background-position: 0% 0%, 90% 20%, 10% 90%;
  }
  50% {
    background-position: 100% 100%, 10% 40%, 90% 0%;
  }
  100% {
    background-position: 0% 0%, 90% 20%, 10% 90%;
  }
}

@keyframes whisper {
  0% {
    color: var(--color-text-strong);
  }
  50% {
    color: #5f6b7c;
  }
  100% {
    color: var(--color-text-strong);
  }
}
