:root {
  color-scheme: light dark;
  --bg: #f6f2ea;
  --bg-2: #efe8db;
  --bg-3: #e9e1e6;
  --ink: #1c1b18;
  --muted: #6f6a60;
  --accent: #b4552d;
  --line: rgba(28, 27, 24, 0.12);
  --glow-1: rgba(214, 158, 106, 0.42);
  --glow-2: rgba(126, 156, 132, 0.32);
  --glow-3: rgba(172, 146, 205, 0.26);
  --grain-opacity: 0.035;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e100f;
    --bg-2: #151816;
    --bg-3: #141522;
    --ink: #f2efe8;
    --muted: #9a978e;
    --accent: #e08a5f;
    --line: rgba(242, 239, 232, 0.14);
    --glow-1: rgba(190, 110, 60, 0.26);
    --glow-2: rgba(80, 130, 100, 0.22);
    --glow-3: rgba(92, 110, 190, 0.2);
    --grain-opacity: 0.05;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(1.5rem, 5vw, 4.5rem);
  background: linear-gradient(
    160deg,
    var(--bg) 0%,
    var(--bg-2) 45%,
    var(--bg-3) 100%
  );
  background-size: 180% 180%;
  background-position: 0% 0%;
  background-attachment: fixed;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  animation: bg-shift 42s ease-in-out infinite alternate;
}

html::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: -18%;
  z-index: 0;
  pointer-events: none;
  will-change: transform;
}

body::before {
  background: radial-gradient(
    48rem 42rem at 18% 22%,
    var(--glow-1),
    transparent 62%
  );
  animation: drift-slow 46s ease-in-out infinite alternate;
}

body::after {
  background:
    radial-gradient(54rem 44rem at 82% 78%, var(--glow-2), transparent 64%),
    radial-gradient(42rem 36rem at 66% 10%, var(--glow-3), transparent 60%);
  animation: drift-slower 64s ease-in-out infinite alternate;
}

.stage {
  position: relative;
  z-index: 1;
  width: min(100%, 64rem);
  display: flex;
  flex-direction: column;
  gap: clamp(2rem, 5vw, 3.5rem);
}

.card {
  display: flex;
  flex-direction: column;
  gap: clamp(1.25rem, 3vw, 2rem);
  animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.quote {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Times New Roman", serif;
  font-size: clamp(1.9rem, 5.4vw, 4.4rem);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
  overflow-wrap: break-word;
}

.author {
  margin: 0;
  font-size: clamp(0.95rem, 1.5vw, 1.15rem);
  letter-spacing: 0.01em;
  color: var(--muted);
}

.author::before {
  content: "— ";
}

.author[hidden] {
  display: none;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding-top: clamp(1rem, 2vw, 1.5rem);
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.meta .sep {
  opacity: 0.5;
}

@keyframes bg-shift {
  0% {
    background-position: 0% 0%;
  }
  50% {
    background-position: 60% 35%;
  }
  100% {
    background-position: 100% 100%;
  }
}

@keyframes drift-slow {
  0% {
    transform: translate3d(-3%, -2%, 0) scale(1.02) rotate(-1.5deg);
  }
  50% {
    transform: translate3d(1%, 2%, 0) scale(1.1) rotate(1deg);
  }
  100% {
    transform: translate3d(3%, 1%, 0) scale(1.06) rotate(2deg);
  }
}

@keyframes drift-slower {
  0% {
    transform: translate3d(3%, 2%, 0) scale(1.1) rotate(1.5deg);
  }
  50% {
    transform: translate3d(-1%, -2%, 0) scale(1.02) rotate(-1deg);
  }
  100% {
    transform: translate3d(-3%, -1%, 0) scale(1.07) rotate(-2deg);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
