:root {
  --bg: #f5f2ec;
  --paper: #fffdf8;
  --ink: #24211d;
  --muted: #6d665d;
  --line: #ded6c8;
  --accent: #8f2f25;
  --accent-dark: #642019;
  --sage: #53665a;
  --blue: #354e68;
  --shadow: 0 18px 50px rgba(45, 37, 25, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a { color: inherit; text-decoration: none; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 56px);
  background: rgba(245, 242, 236, .92);
  border-bottom: 1px solid rgba(110, 98, 80, .2);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 235px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-family: Georgia, serif;
  font-weight: 700;
}

.brand strong,
.brand em {
  display: block;
  font-style: normal;
}

.brand strong { font-size: 15px; }
.brand em { color: var(--muted); font-size: 13px; }

.top-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-nav a {
  padding: 9px 12px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 15px;
}

.top-nav a:hover,
.top-nav a.active {
  background: var(--paper);
  color: var(--ink);
}

main { min-height: calc(100vh - 150px); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: clamp(28px, 6vw, 72px);
  align-items: center;
  padding: clamp(42px, 7vw, 96px) clamp(18px, 5vw, 72px) 48px;
}

.hero-copy h1,
.page-hero h1,
.bio-page h1,
.poem-page h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  line-height: 1.03;
  letter-spacing: 0;
}

.hero-copy h1 {
  max-width: 850px;
  font-size: clamp(46px, 8vw, 92px);
}

.lead {
  max-width: 650px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(18px, 2vw, 24px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-weight: 700;
  cursor: pointer;
}

.button.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.button.primary:hover { background: var(--accent-dark); }
.button.secondary { background: var(--paper); }

.portrait-panel {
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 8px;
  background: var(--line);
  box-shadow: var(--shadow);
}

.portrait-panel img,
.bio-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.stats-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0 clamp(18px, 5vw, 72px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stats-band a {
  padding: 26px 24px;
  border-right: 1px solid var(--line);
}

.stats-band a:last-child { border-right: 0; }
.stats-band strong { display: block; font-size: 34px; font-family: Georgia, serif; }
.stats-band span { color: var(--muted); }

.section,
.bio-preview,
.archive-layout,
.bio-page,
.poem-page,
.page-hero {
  margin: 0 auto;
  padding: 56px clamp(18px, 5vw, 72px);
  max-width: 1240px;
}

.bio-preview {
  display: grid;
  grid-template-columns: 280px 1fr auto;
  gap: 28px;
  align-items: start;
}

h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 500;
  letter-spacing: 0;
}

.text-link {
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}

.section-head {
  margin-bottom: 24px;
}

.verse-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.verse-card,
.verse-row,
.filters,
.bio-page article,
.poem-page {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.verse-card {
  display: flex;
  min-height: 230px;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.verse-card h3 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 25px;
  font-weight: 500;
}

.verse-card p,
.verse-row p {
  color: var(--muted);
}

.verse-card:hover,
.verse-row:hover,
.verse-card:focus-visible,
.verse-row:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 10px 28px rgba(45, 37, 25, .08);
  transform: translateY(-1px);
  outline: none;
}

.meta {
  margin: 0 0 8px;
  color: var(--sage);
  font-size: 13px;
  text-transform: uppercase;
}

.page-hero.compact {
  padding-bottom: 24px;
}

.page-hero h1,
.bio-page h1,
.poem-page h1 {
  font-size: clamp(40px, 6vw, 72px);
}

.archive-layout {
  display: block;
}

.filters {
  position: sticky;
  top: 96px;
  padding: 18px;
}

.filters form {
  display: grid;
  gap: 14px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
  font: inherit;
}

.results-head {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
  color: var(--muted);
}

.verse-list {
  display: grid;
  gap: 12px;
}

.verse-row {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 18px;
  padding: 20px;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.verse-row h2 {
  font-size: 26px;
}

.verse-row p {
  margin: 10px 0 0;
}

.verse-row-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.pagination a {
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
}

.pagination a:not(.pagination-step) {
  padding: 0;
}

.pagination a.current {
  background: var(--ink);
  color: var(--paper);
}

.bio-page {
  display: grid;
  grid-template-columns: minmax(260px, 380px) 1fr;
  gap: 34px;
  align-items: start;
}

.bio-photo {
  position: sticky;
  top: 96px;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.bio-page article {
  padding: clamp(24px, 4vw, 46px);
}

.prose {
  margin-top: 24px;
  font-size: 18px;
}

.prose p {
  margin: 0 0 18px;
}

.poem-page {
  max-width: 860px;
  margin-top: 40px;
  margin-bottom: 56px;
  padding: clamp(24px, 5vw, 58px);
}

.back-link {
  display: inline-block;
  margin-bottom: 26px;
  color: var(--muted);
}

.poem-text {
  margin-top: 32px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(20px, 2.2vw, 25px);
  line-height: 1.75;
  white-space: normal;
}

.like-form {
  margin-top: 20px;
}

.like-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background-color: white;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' class='bi bi-suit-heart' viewBox='0 0 16 16'%3E%3Cpath d='m8 6.236-.894-1.789c-.222-.443-.607-1.08-1.152-1.595C5.418 2.345 4.776 2 4 2 2.324 2 1 3.326 1 4.92c0 1.211.554 2.066 1.868 3.37.337.334.721.695 1.146 1.093C5.122 10.423 6.5 11.717 8 13.447c1.5-1.73 2.878-3.024 3.986-4.064.425-.398.81-.76 1.146-1.093C14.446 6.986 15 6.131 15 4.92 15 3.326 13.676 2 12 2c-.777 0-1.418.345-1.954.852-.545.515-.93 1.152-1.152 1.595zm.392 8.292a.513.513 0 0 1-.784 0c-1.601-1.902-3.05-3.262-4.243-4.381C1.3 8.208 0 6.989 0 4.92 0 2.755 1.79 1 4 1c1.6 0 2.719 1.05 3.404 2.008.26.365.458.716.596.992a7.6 7.6 0 0 1 .596-.992C9.281 2.049 10.4 1 12 1c2.21 0 4 1.755 4 3.92 0 2.069-1.3 3.288-3.365 5.227-1.193 1.12-2.642 2.48-4.243 4.38z'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 20px 20px;
  color: var(--accent);
  cursor: pointer;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.like-button:hover,
.like-button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 8px 22px rgba(143, 47, 37, .12);
  outline: none;
  transform: translateY(-1px);
}

.like-button.liked {
  background-color: rgba(143, 47, 37, .08);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' class='bi bi-suit-heart-fill' viewBox='0 0 16 16'%3E%3Cpath d='M4 1c2.21 0 4 1.755 4 3.92C8 2.755 9.79 1 12 1s4 1.755 4 3.92c0 3.263-3.234 4.414-7.608 9.608a.513.513 0 0 1-.784 0C3.234 9.334 0 8.183 0 4.92 0 2.755 1.79 1 4 1'/%3E%3C/svg%3E");
  border-color: rgba(143, 47, 37, .34);
  cursor: default;
}

.rate-panel {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf7f0;
}

.rate-metric {
  color: var(--muted);
  font-weight: 700;
}

.rate-metric:nth-of-type(2) {
  margin-right: auto;
}

.rate-button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.rate-button.plus {
  background: var(--sage);
  border-color: var(--sage);
}

.rate-button.minus {
  background: var(--accent);
  border-color: var(--accent);
}

.rate-logout {
  color: var(--muted);
  font-size: 14px;
}

.rate-login-page {
  display: grid;
  place-items: center;
  min-height: 62vh;
  padding: 42px clamp(18px, 5vw, 72px);
}

.rate-login-box {
  width: min(100%, 430px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.rate-login-box h1 {
  margin: 0 0 20px;
  font-family: Georgia, serif;
  font-size: 38px;
  font-weight: 500;
}

.rate-login-box form {
  display: grid;
  gap: 14px;
}

.form-error {
  padding: 10px 12px;
  border-radius: 7px;
  background: rgba(143, 47, 37, .1);
  color: var(--accent);
  font-weight: 700;
}

.poem-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 42px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.poem-nav-link {
  display: flex;
  min-height: 88px;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.poem-nav-link.next {
  text-align: right;
}

.poem-nav-link span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.poem-nav-link strong {
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.25;
}

.poem-nav-link:hover {
  border-color: var(--accent);
}

.poem-nav-link.disabled {
  opacity: .55;
}

.empty {
  padding: 24px;
  color: var(--muted);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 28px clamp(18px, 4vw, 56px);
  border-top: 1px solid var(--line);
  color: var(--muted);
}

@media (max-width: 900px) {
  .site-header,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-nav { justify-content: flex-start; }

  .hero,
  .archive-layout,
  .bio-page,
  .bio-preview {
    grid-template-columns: 1fr;
  }

  .portrait-panel,
  .bio-photo {
    position: static;
    max-width: 430px;
  }

  .stats-band,
  .verse-grid {
    grid-template-columns: 1fr;
  }

  .stats-band a {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .filters { position: static; }
}

@media (max-width: 640px) {
  .hero {
    padding-top: 32px;
  }

  .hero-copy h1 {
    font-size: 42px;
  }

  .verse-row {
    grid-template-columns: 1fr;
  }

  .verse-row-meta {
    align-items: flex-start;
  }

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

  .poem-nav-link.next {
    text-align: left;
  }
}
