/* ============================================================
   guestbook.css — an openable book that turns pages left/right
   ============================================================ */

.gb {
  max-width: 1000px;
  margin: 3rem auto 0;
  padding: 0 var(--container-pad);
}

/* The open book (two-page spread) */
.book {
  position: relative;
  margin: 0 auto;
  width: min(920px, 100%);
  aspect-ratio: 16 / 10;
  display: flex;
  perspective: 2400px;
  background: #b4694f;                 /* leather cover peeking at edges */
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 40px 80px -40px rgba(44, 51, 42, 0.6), inset 0 0 0 2px rgba(255,255,255,0.06);
}

.book__page {
  position: relative;
  flex: 1 1 50%;
  background:
    repeating-linear-gradient(to bottom, transparent 0, transparent 33px, rgba(130,147,126,0.18) 34px),
    linear-gradient(#fffef8, #fdfaf0);
  overflow: hidden;
}
.book__page--left  { border-radius: 6px 0 0 6px; box-shadow: inset -18px 0 30px -18px rgba(44,51,42,0.4); }
.book__page--right { border-radius: 0 6px 6px 0; box-shadow: inset 18px 0 30px -18px rgba(44,51,42,0.4); }

.book__spine {
  position: absolute;
  top: 14px; bottom: 14px; left: 50%;
  transform: translateX(-50%);
  width: 3px;
  background: rgba(44, 51, 42, 0.28);
  z-index: 3;
}

/* The turning leaf (blank paper flip) */
.book__leaf {
  position: absolute;
  top: 14px; bottom: 14px;
  width: calc(50% - 14px);
  background: linear-gradient(#fffef8, #fdfaf0);
  z-index: 4;
  display: none;
  backface-visibility: hidden;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.4);
}
.book__leaf.turning { display: block; }
.book__leaf.right { left: 50%; transform-origin: left center; border-radius: 0 6px 6px 0; }
.book__leaf.left  { right: 50%; transform-origin: right center; border-radius: 6px 0 0 6px; }

/* Page content */
.page__inner {
  position: absolute;
  inset: 8% 10%;
  display: flex;
  flex-direction: column;
}
.page__folio {
  margin-top: auto;
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(110, 122, 107, 0.5);
}

/* Title page */
.gb-title { justify-content: center; text-align: center; }
.gb-title h2 {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--text-main);
}
.gb-title p { color: var(--text-muted); margin-top: 0.6rem; font-size: 0.95rem; }
.gb-title .gb-heart { color: var(--accent); margin: 0 auto 0.5rem; }

/* A guestbook entry */
.entry { display: flex; flex-direction: column; height: 100%; }
.entry__msg {
  font-family: "Caveat", cursive;
  font-size: clamp(1.3rem, 2.6vw, 1.8rem);
  line-height: 1.3;
  color: #3a3730;
}
.entry__sig {
  margin-top: auto;
  font-family: "Caveat", cursive;
  font-weight: 600;
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: var(--primary);
}
.entry__date {
  font-family: var(--font-body);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(110, 122, 107, 0.55);
  margin-top: 0.3rem;
}
.entry--empty {
  align-items: center;
  justify-content: center;
  color: rgba(110, 122, 107, 0.4);
  font-family: "Caveat", cursive;
  font-size: 1.6rem;
}

/* Controls */
.book__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.6rem;
  flex-wrap: wrap;
}
.gb-btn {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(44, 51, 42, 0.14);
  background: var(--surface);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.gb-btn:hover:not(:disabled) { background: rgba(130,147,126,0.12); transform: translateY(-1px); }
.gb-btn:disabled { opacity: 0.35; cursor: default; }
.book__count { font-size: 0.8rem; color: var(--text-muted); min-width: 90px; text-align: center; }
.gb-sign { margin-left: 0.4rem; }

.field textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(44, 51, 42, 0.14);
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.95rem;
  resize: vertical;
}
.field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(130,147,126,0.18); }

@media (max-width: 600px) {
  /* On phones show a single page for readability */
  .book { aspect-ratio: 3 / 4; }
  .book__page--left { display: none; }
  .book__page--right { border-radius: 6px; box-shadow: none; }
  .book__spine { display: none; }
  .book__leaf { display: none !important; }
}
