:root {
  --ink: #2a241c;
  --ink-soft: #5c5348;
  --paper: #f3ead9;
  --paper-edge: #e4d6bc;
  --room: #1c1914;
  --room-lift: #2a251e;
  --gold: #b8956a;
  --gold-bright: #d4b48a;
}

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

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

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.25rem;
  color: var(--paper);
  background:
    radial-gradient(ellipse at 50% 0%, var(--room-lift), var(--room) 70%);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

.frame {
  width: min(40rem, 100%);
}

.masthead {
  text-align: center;
  margin-bottom: 1.75rem;
}

.kicker {
  margin: 0 0 0.4rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--gold);
}

.masthead h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.rule {
  width: 3.5rem;
  height: 1px;
  margin: 0.9rem auto 0;
  background: var(--gold);
}

.stage {
  position: relative;
  min-height: 24rem;
  padding: 2.4rem 2.1rem 2.1rem;
  background: var(--paper);
  color: var(--ink);
  border-radius: 2px;
  box-shadow:
    0 0 0 1px rgba(232, 214, 184, 0.12),
    0 24px 50px rgba(0, 0, 0, 0.35);
}

.poem {
  position: absolute;
  inset: 2.4rem 2.1rem 2.1rem;
  margin: 0;
  opacity: 0;
  animation: show-poem 100s infinite;
}

.poem:first-child {
  opacity: 1;
}

.poem:nth-child(1) { animation-delay: 0s; }
.poem:nth-child(2) { animation-delay: 10s; }
.poem:nth-child(3) { animation-delay: 20s; }
.poem:nth-child(4) { animation-delay: 30s; }
.poem:nth-child(5) { animation-delay: 40s; }
.poem:nth-child(6) { animation-delay: 50s; }
.poem:nth-child(7) { animation-delay: 60s; }
.poem:nth-child(8) { animation-delay: 70s; }
.poem:nth-child(9) { animation-delay: 80s; }
.poem:nth-child(10) { animation-delay: 90s; }

@keyframes show-poem {
  0%,
  10%,
  100% {
    opacity: 0;
  }
  1.2%,
  8.8% {
    opacity: 1;
  }
}

.poem h2 {
  margin: 0 0 1.15rem;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.poem p {
  margin: 0 0 0.85rem;
  line-height: 1.65;
  font-size: 1.08rem;
}

.poem p:last-child {
  margin-bottom: 0;
}

.footer {
  display: grid;
  gap: 0.85rem;
  margin-top: 1.35rem;
  text-align: center;
}

.progress {
  height: 2px;
  background: rgba(243, 234, 217, 0.12);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  transform-origin: left center;
  background: var(--gold);
  animation: fill-bar 10s linear infinite;
}

@keyframes fill-bar {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

.meta {
  position: relative;
  min-height: 1.4rem;
  color: var(--gold-bright);
  font-size: 0.92rem;
  letter-spacing: 0.04em;
}

.meta span {
  position: absolute;
  inset: 0;
  opacity: 0;
  animation: show-poem 100s infinite;
}

.meta span:first-child {
  opacity: 1;
}

.meta span:nth-child(1) { animation-delay: 0s; }
.meta span:nth-child(2) { animation-delay: 10s; }
.meta span:nth-child(3) { animation-delay: 20s; }
.meta span:nth-child(4) { animation-delay: 30s; }
.meta span:nth-child(5) { animation-delay: 40s; }
.meta span:nth-child(6) { animation-delay: 50s; }
.meta span:nth-child(7) { animation-delay: 60s; }
.meta span:nth-child(8) { animation-delay: 70s; }
.meta span:nth-child(9) { animation-delay: 80s; }
.meta span:nth-child(10) { animation-delay: 90s; }

.dots {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dots li {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0.28;
  animation: pulse-dot 100s infinite;
}

.dots li:nth-child(1) { animation-delay: 0s; }
.dots li:nth-child(2) { animation-delay: 10s; }
.dots li:nth-child(3) { animation-delay: 20s; }
.dots li:nth-child(4) { animation-delay: 30s; }
.dots li:nth-child(5) { animation-delay: 40s; }
.dots li:nth-child(6) { animation-delay: 50s; }
.dots li:nth-child(7) { animation-delay: 60s; }
.dots li:nth-child(8) { animation-delay: 70s; }
.dots li:nth-child(9) { animation-delay: 80s; }
.dots li:nth-child(10) { animation-delay: 90s; }

@keyframes pulse-dot {
  0%,
  10%,
  100% {
    opacity: 0.28;
    transform: scale(1);
  }
  1.2%,
  8.8% {
    opacity: 1;
    transform: scale(1.25);
  }
}

.hint {
  margin: 0;
  color: #9a8f7d;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
}

@media (max-width: 40rem) {
  .stage {
    min-height: 26rem;
    padding: 1.8rem 1.35rem 1.5rem;
  }

  .poem {
    inset: 1.8rem 1.35rem 1.5rem;
  }

  .poem p {
    font-size: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .poem,
  .meta span,
  .dots li {
    animation-name: show-poem-step;
    animation-timing-function: steps(1, end);
  }

  .progress span {
    animation: none;
    transform: scaleX(1);
  }
}

@keyframes show-poem-step {
  0%,
  9.99% {
    opacity: 1;
  }
  10%,
  100% {
    opacity: 0;
  }
}
