:root {
  --bg: #f7efe7;
  --bg-alt: #f1e4d5;
  --ink: #2a1f1a;
  --muted: #60493c;
  --accent: #b35032;
  --accent-soft: #e7bfa6;
  --card: #fffdf9;
  --ring: rgba(179, 80, 50, 0.25);
  --success: #2f7a50;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 10% 0%, #f9e8d8, var(--bg) 50%);
  min-height: 100%;
}

body {
  line-height: 1.5;
}

h1,
h2,
h3,
h4 {
  font-family: "Cormorant Garamond", Georgia, serif;
  margin: 0 0 0.5rem;
  letter-spacing: 0.3px;
}

a {
  color: inherit;
}

.hero {
  padding: 1rem 1.1rem 2.5rem;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.6), transparent 45%),
    linear-gradient(200deg, #efdac8, #f7efe7 70%);
}

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.8rem;
}

.brand {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.3rem, 4vw, 1.7rem);
  font-weight: 700;
}

.nav-links {
  display: flex;
  gap: 0.9rem;
}

.nav-links a {
  text-decoration: none;
  font-size: 0.93rem;
  font-weight: 600;
  border-bottom: 2px solid transparent;
}

.nav-links a:hover {
  border-bottom-color: var(--accent);
}

.identity-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.identity-status {
  font-size: 0.8rem;
  color: var(--muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-btn {
  background: #f8eee5;
  color: #51372b;
  border: 1px solid #ecdacb;
  padding: 0.4rem 0.65rem;
  border-radius: 0.55rem;
  font-size: 0.8rem;
}

.hero-content {
  display: grid;
  gap: 1.4rem;
  align-items: center;
}

.avatar-wrap {
  justify-self: center;
  width: min(84vw, 360px);
  aspect-ratio: 4 / 5;
  border-radius: 1.8rem;
  padding: 0.7rem;
  background: linear-gradient(165deg, #ead2c2, #d7a788);
  box-shadow: 0 20px 50px rgba(90, 38, 19, 0.2);
}

.avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 1.3rem;
}

.hero-copy {
  max-width: 50ch;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.hero-copy h1 {
  font-size: clamp(2.2rem, 8vw, 4rem);
  margin-bottom: 0.3rem;
}

.hero-copy p {
  margin-top: 0;
  color: var(--muted);
}

.cta {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  margin-top: 0.6rem;
}

.section {
  padding: 2.5rem 1.1rem;
}

.section-head p {
  color: var(--muted);
  margin-top: 0;
}

.book-grid {
  display: grid;
  gap: 1rem;
}

.book-card {
  background: var(--card);
  border: 1px solid #ecdacb;
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: 0 10px 28px rgba(112, 65, 40, 0.08);
}

.book-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0.8rem;
  margin-bottom: 0.8rem;
  border: 1px solid #ecdacb;
}

.book-card h3 {
  margin-bottom: 0.35rem;
  font-size: 1.45rem;
}

.book-card p {
  margin-top: 0;
  color: var(--muted);
}

.book-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.8rem;
}

button,
.action-link {
  border: none;
  border-radius: 0.7rem;
  padding: 0.55rem 0.8rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.book-open {
  background: #2b1d17;
  color: #fff;
}

.love-btn,
.share-btn {
  background: var(--bg-alt);
  color: #472f24;
}

.back-btn {
  background: transparent;
  color: var(--accent);
  padding-left: 0;
}

.details-card {
  background: var(--card);
  border-radius: 1rem;
  border: 1px solid #ecdacb;
  padding: 1rem;
}

.post-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  gap: 1rem;
}

.add-post-btn {
  background: var(--accent);
  color: #fff;
}

.add-post-form {
  display: grid;
  gap: 0.45rem;
  margin-top: 1rem;
  border-top: 1px solid #efd9cb;
  padding-top: 1rem;
}

input,
textarea {
  width: 100%;
  border: 1px solid #e2c8b7;
  background: #fff;
  border-radius: 0.6rem;
  padding: 0.6rem;
  font-family: inherit;
}

input:focus,
textarea:focus {
  outline: 3px solid var(--ring);
  border-color: var(--accent);
}

.posts-list {
  margin-top: 1rem;
  display: grid;
  gap: 0.8rem;
}

.post-card {
  border: 1px solid #ecdacb;
  border-radius: 0.85rem;
  padding: 0.8rem;
  background: #fff;
}

.post-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.reaction-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}

.reaction-btn {
  background: #f8eee5;
  color: #51372b;
  font-size: 0.88rem;
}

.comments {
  margin-top: 0.7rem;
  border-top: 1px dashed #ecdacb;
  padding-top: 0.7rem;
}

.comment-item {
  margin: 0 0 0.45rem;
  color: #3d2b22;
  font-size: 0.92rem;
}

.comment-form {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.comment-form input {
  width: 100%;
}

.comment-form button {
  background: #2b1d17;
  color: #fff;
}

.media-preview {
  width: min(100%, 420px);
  margin-top: 0.6rem;
  border-radius: 0.8rem;
  border: 1px solid #ecdacb;
  display: block;
}

.comment-media {
  width: min(100%, 240px);
  margin: 0.3rem 0 0.6rem;
  border-radius: 0.7rem;
  border: 1px solid #ecdacb;
  display: block;
}

.social-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(100px, 1fr));
  gap: 0.8rem;
}

.social-grid a {
  background: linear-gradient(120deg, #fcefe5, #f4dcc9);
  text-decoration: none;
  border: 1px solid #eccfbc;
  border-radius: 0.9rem;
  text-align: center;
  padding: 0.9rem 0.5rem;
  font-weight: 700;
}

footer {
  padding: 1.5rem 1.1rem 2.5rem;
  text-align: center;
  color: var(--muted);
}

.hidden {
  display: none;
}

.toast {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: #2c201a;
  color: #fff;
  padding: 0.65rem 0.95rem;
  border-radius: 999px;
  font-size: 0.88rem;
  z-index: 20;
}

.toast.success {
  background: var(--success);
}

.identity-modal {
  position: fixed;
  inset: 0;
  background: rgba(25, 17, 13, 0.45);
  display: grid;
  place-items: center;
  z-index: 35;
  padding: 1rem;
}

.identity-modal.hidden {
  display: none;
}

.identity-card {
  width: min(100%, 420px);
  background: var(--card);
  border: 1px solid #ecdacb;
  border-radius: 1rem;
  padding: 1rem;
}

.identity-note {
  margin-top: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.identity-form {
  display: grid;
  gap: 0.5rem;
}

.identity-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.identity-cancel {
  background: #efe1d5;
  color: #4e3428;
}

@media (min-width: 720px) {
  .hero {
    padding: 1.2rem 2.2rem 3.2rem;
  }

  .section {
    padding: 3rem 2.2rem;
  }

  .hero-content {
    grid-template-columns: 0.95fr 1.05fr;
    gap: 2rem;
  }

  .book-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .social-grid {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hero-content,
  .book-card,
  .social-grid a,
  .details-card {
    animation: fadeUp 0.6s ease both;
  }

  .book-card:nth-child(2) {
    animation-delay: 0.08s;
  }

  .book-card:nth-child(3) {
    animation-delay: 0.16s;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
