:root {
  --bg: #0b0a10;
  --bg-elevated: #14131c;
  --ink: #f6f0e8;
  --muted: rgba(246, 240, 232, 0.58);
  --line: rgba(246, 240, 232, 0.12);
  --accent: #ff6b4a;
  --coral: #ff6b4a;
  --violet: #c084fc;
  --teal: #2ee6c7;
  --lime: #c6f355;
  --ice: #7dd3fc;
  --rose: #fb7185;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(192, 132, 252, 0.16), transparent 55%),
    radial-gradient(ellipse 70% 45% at 100% 0%, rgba(255, 107, 74, 0.14), transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(46, 230, 199, 0.1), transparent 55%);
  background-attachment: fixed;
  line-height: 1.5;
}

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

.wrap {
  position: relative;
  z-index: 1;
  width: min(1100px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 2.4rem 0 4rem;
}

.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 3.2rem;
}

.brand {
  text-decoration: none;
  color: inherit;
}

.brand-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.brand h1,
.page-title {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 500;
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  letter-spacing: 0.02em;
  line-height: 1.15;
}

.tagline {
  margin-top: 0.7rem;
  font-size: 1.15rem;
  font-style: italic;
  color: var(--muted);
  max-width: 28ch;
}

.random-btn {
  appearance: none;
  border: 1px solid rgba(246, 240, 232, 0.22);
  background: linear-gradient(180deg, rgba(246, 240, 232, 0.08), rgba(246, 240, 232, 0.03));
  color: var(--ink);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  padding: 0.85rem 1.35rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease, background 0.35s ease;
}

.random-btn:hover {
  transform: translateY(-2px);
  border-color: var(--coral);
  box-shadow: 0 10px 28px rgba(255, 107, 74, 0.22);
  background: rgba(255, 107, 74, 0.12);
}

.random-btn:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 3px;
}

.poem-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.poem-card {
  --accent: var(--coral);
  display: flex;
  flex-direction: column;
  min-height: 240px;
  padding: 1.5rem 1.45rem 1.3rem;
  text-decoration: none;
  color: inherit;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: 18px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease, border-color 0.4s ease;
}

.poem-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: var(--accent);
}

.poem-card::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.08;
  filter: blur(12px);
  z-index: -1;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.poem-card:hover,
.poem-card:focus-visible {
  transform: translateY(-8px) scale(1.015);
  border-color: var(--accent);
  box-shadow: 0 18px 40px color-mix(in srgb, var(--accent) 28%, transparent);
}

.poem-card:hover::after,
.poem-card:focus-visible::after {
  opacity: 0.2;
  transform: translate(-12px, -10px) scale(1.1);
}

.poem-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.card-title {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.55rem;
  font-weight: 500;
  margin: 0.85rem 0 0.75rem;
}

.card-preview {
  font-style: italic;
  font-size: 1.08rem;
  color: var(--muted);
  line-height: 1.55;
  flex: 1;
}

.card-cta {
  margin-top: 1.2rem;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
}

.site-footer,
.poem-footer {
  margin-top: 3.5rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.back-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  transition: letter-spacing 0.3s ease, opacity 0.3s ease;
}

.back-link:hover,
.back-link:focus-visible {
  letter-spacing: 0.28em;
  opacity: 0.85;
}

.poem-page .wrap {
  width: min(640px, calc(100% - 2.5rem));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.poem-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3.2rem;
}

.poem-header {
  text-align: center;
}

.poem-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.9rem;
}

.poem-header h1 {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 500;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
}

.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 1.2rem;
  color: var(--accent);
}

.ornament .line {
  width: 52px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.stanza {
  font-size: clamp(1.2rem, 2.4vw, 1.5rem);
  font-style: italic;
  line-height: 1.75;
  text-align: center;
  margin: 0 auto 2.2rem;
  max-width: 28em;
  opacity: 0;
  animation: fadeUp 0.9s ease-out forwards;
}

.stanza:nth-child(1) { animation-delay: 0.15s; }
.stanza:nth-child(2) { animation-delay: 0.4s; }
.stanza:nth-child(3) { animation-delay: 0.65s; }
.stanza:nth-child(4) { animation-delay: 0.9s; }
.stanza:nth-child(5) { animation-delay: 1.15s; }

.poem-body {
  flex: 1;
}

.poem-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: auto;
  padding-top: 1.5rem;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .poem-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .site-header {
    flex-direction: column;
  }

  .poem-grid {
    grid-template-columns: 1fr;
  }

  .poem-top,
  .poem-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .poem-card,
  .random-btn,
  .back-link {
    transition: none;
  }

  .poem-card:hover,
  .poem-card:focus-visible,
  .random-btn:hover {
    transform: none;
  }

  .stanza {
    animation: none;
    opacity: 1;
  }
}
