:root {
  --bg: #fef8f1;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-border: rgba(22, 24, 35, 0.1);
  --text: #1f2130;
  --muted: #5b6073;
  --accent: #de5f3c;
  --accent-2: #0f7b7b;
  --shadow: 0 20px 50px rgba(31, 33, 48, 0.1);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 800px at 10% 10%, #ffe2cf 0%, transparent 60%),
    radial-gradient(900px 600px at 95% 20%, #d7f2ee 0%, transparent 70%),
    var(--bg);
  overflow-x: hidden;
}

h1,
h2,
.brand {
  font-family: "Baskerville", "Palatino Linotype", serif;
  letter-spacing: 0.01em;
}

.bg-shape {
  position: fixed;
  width: 280px;
  height: 280px;
  border-radius: 40% 60% 63% 37% / 45% 40% 60% 55%;
  filter: blur(0.5px);
  opacity: 0.55;
  z-index: -1;
  animation: drift 14s ease-in-out infinite alternate;
}

.bg-shape-1 {
  background: linear-gradient(145deg, #ffbe95, #ffd9b8);
  top: -70px;
  left: -60px;
}

.bg-shape-2 {
  background: linear-gradient(145deg, #92d8d1, #d2f3ef);
  bottom: -90px;
  right: -50px;
  animation-delay: 2s;
}

.bg-shape-3 {
  background: linear-gradient(145deg, #ffceb6, #ffe9d5);
  top: 8vh;
  right: -90px;
}

.bg-shape-4 {
  background: linear-gradient(145deg, #9adcd5, #d7f2ee);
  bottom: -90px;
  left: -60px;
  animation-delay: 1.6s;
}

.site-header {
  width: min(1100px, 92vw);
  margin: 24px auto 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--surface-border);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  text-decoration: none;
  font-weight: 700;
}

.nav-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  gap: 10px;
}

.nav-link {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid transparent;
  transition: all 180ms ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: var(--surface);
  border-color: var(--surface-border);
}

.about-main,
.poems-main {
  width: min(1100px, 92vw);
  margin: 44px auto 56px;
}

.hero {
  max-width: 720px;
}

.eyebrow {
  display: inline-block;
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #244f53;
  background: rgba(210, 243, 239, 0.8);
}

h1 {
  font-size: clamp(2.1rem, 5vw, 3.8rem);
  margin: 14px 0 12px;
  line-height: 1.05;
}

.lead {
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  color: var(--muted);
  line-height: 1.7;
  max-width: 62ch;
}

.cards {
  margin-top: 36px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  max-width: 760px;
}

.card,
.poem-list-wrap,
.poem-view,
.cta {
  border: 1px solid var(--surface-border);
  background: var(--surface);
  backdrop-filter: blur(6px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card {
  padding: 20px;
}

.card h2 {
  margin: 0 0 10px;
  font-size: 1.2rem;
}

.card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.cta {
  margin-top: 24px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cta p {
  margin: 0;
  font-size: 1rem;
}

.btn {
  padding: 10px 18px;
  border-radius: 999px;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #ec815f);
  box-shadow: 0 10px 25px rgba(222, 95, 60, 0.26);
}

.poem-layout {
  margin-top: 28px;
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 16px;
}

.library-toggle {
  display: none;
}

.poem-list-wrap,
.poem-view {
  padding: 20px;
}

.poem-list-wrap h2,
.poem-view h2 {
  margin-top: 0;
}

.poem-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.poem-btn {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--surface-border);
  background: rgba(255, 255, 255, 0.65);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: all 180ms ease;
}

.poem-btn:hover,
.poem-btn.active {
  background: rgba(210, 243, 239, 0.9);
  border-color: rgba(15, 123, 123, 0.35);
  transform: translateY(-1px);
}

.poem-meta {
  margin-top: -6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.poem-body {
  margin-top: 18px;
  font-family: "Iowan Old Style", "Georgia", serif;
  line-height: 1.9;
  white-space: pre-line;
  font-size: 1.05rem;
}

.reveal {
  animation: rise-in 700ms ease both;
}

.reveal-delay-1 {
  animation-delay: 120ms;
}

.reveal-delay-2 {
  animation-delay: 240ms;
}

@keyframes drift {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  100% {
    transform: translate(16px, 20px) rotate(8deg);
  }
}

@keyframes rise-in {
  0% {
    transform: translateY(14px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 960px) {
  .poem-layout {
    grid-template-columns: 1fr;
  }

  .library-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: 10px;
    border: 1px solid var(--surface-border);
    background: rgba(255, 255, 255, 0.85);
    color: var(--text);
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
    cursor: pointer;
  }

  .poems-page.library-collapsed .poem-list-wrap {
    display: none;
  }
}

@media (max-width: 640px) {
  .site-header {
    margin-top: 16px;
  }

  .about-main,
  .poems-main {
    margin-top: 30px;
  }

  .cta {
    flex-direction: column;
    align-items: flex-start;
  }
}

.search-wrap {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.search-wrap input {
  border: 1px solid var(--surface-border);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
}

.search-wrap input:focus {
  outline: 2px solid rgba(15, 123, 123, 0.3);
  border-color: rgba(15, 123, 123, 0.45);
}

.tag-filter-wrap {
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.65);
  padding: 12px;
  margin-bottom: 14px;
}

.tag-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.tag-filter-head h3 {
  margin: 0;
  font-size: 0.95rem;
}

.clear-tags-btn {
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--muted);
  font: inherit;
  font-size: 0.84rem;
  padding: 6px 10px;
  cursor: pointer;
}

.tag-filters,
.poem-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-chip,
.poem-tag {
  border: 1px solid rgba(15, 123, 123, 0.22);
  border-radius: 999px;
  background: rgba(210, 243, 239, 0.6);
  color: #244f53;
  font: inherit;
  font-size: 0.82rem;
  padding: 6px 10px;
}

.tag-chip {
  cursor: pointer;
}

.tag-chip.active {
  background: rgba(15, 123, 123, 0.18);
  border-color: rgba(15, 123, 123, 0.45);
  color: #12393c;
}

.tag-chip-hidden {
  display: none;
}

.tag-toggle-btn {
  margin-top: 10px;
  width: 100%;
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--muted);
  font: inherit;
  font-size: 0.86rem;
  padding: 8px 10px;
  cursor: pointer;
}

.poem-tags {
  margin-top: 10px;
}

.random-poem-btn {
  border: 1px solid rgba(222, 95, 60, 0.35);
  background: linear-gradient(135deg, #de5f3c, #ec815f);
  color: #fff;
  border-radius: 10px;
  padding: 9px 12px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(222, 95, 60, 0.22);
  margin-bottom: 12px;
}

.poem-groups {
  display: grid;
  gap: 10px;
}

.year-group {
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.65);
  padding: 10px;
}

.year-toggle {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  padding: 6px 4px 10px;
  cursor: pointer;
}

.pagination,
.reader-nav {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.page-btn,
.reader-btn {
  border: 1px solid var(--surface-border);
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 12px;
  font: inherit;
  cursor: pointer;
}

.page-btn:disabled,
.reader-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.empty-state {
  margin: 6px 2px;
  color: var(--muted);
}

@media (max-width: 960px) {
  .pagination,
  .reader-nav {
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .tag-toggle-btn {
    font-size: 0.82rem;
    padding: 7px 9px;
  }

  .random-poem-btn {
    width: 100%;
    text-align: center;
  }
}
