/* ============================================================
   Guest Book — themed to the Sweet Apple Porch.
   A hand-kept farm ledger / porch corkboard: pinned parchment
   notes, replies hanging off twine like slips on a string,
   typewriter timestamps. No like/dislike — pure threaded
   conversation. Backed by Liveblocks (see guestbook.js).
   Namespaced .aj-gbook / .gb-* to avoid the legacy .guestbook
   rules still living in style.css.
   ============================================================ */

:root {
  --gb-ink: #2c1808;
  --gb-ink-soft: #6c4623;
  --gb-rust: #a73620;
  --gb-bark: #6a3a16;
  --gb-twine: rgba(120, 80, 30, .7);
  --gb-parch-a: #fff6d7;
  --gb-parch-b: #ecd49a;
  --gb-paper-noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .25  0 0 0 0 .16  0 0 0 0 .05  0 0 0 .04 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* =====================================================================
   HOME: the light "porch rail" — a slim plank pinned across the porch,
   tickering the latest note. One line tall; stays out of the way.
   ===================================================================== */
.gb-rail {
  position: relative;
  display: flex; align-items: center; gap: 16px;
  margin-top: 22px;
  padding: 11px 18px 11px 16px;
  color: #fff4d4;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.16) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, #8d5226, #4d2a10);
  border: 3px solid #2c1808;
  border-top-color: #d3a558;
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px rgba(255,220,150,.14), 0 8px 16px rgba(0,0,0,.5);
}
.gb-rail::before, .gb-rail::after {
  content: ""; position: absolute; top: 50%; transform: translateY(-50%);
  width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #ffe7b8 0 18%, #b07a3c 55%, #5a3010 100%);
  box-shadow: 0 1px 2px rgba(0,0,0,.55);
}
.gb-rail::before { left: 6px; }
.gb-rail::after  { right: 6px; }
.gb-rail__brand {
  display: flex; align-items: center; gap: 9px;
  padding-right: 16px;
  border-right: 1px dashed rgba(255,220,150,.3);
  white-space: nowrap;
}
.gb-rail__icon {
  font-family: Georgia, serif; font-size: 20px; line-height: 1;
  color: #ffb958; text-shadow: 0 0 10px rgba(255,175,80,.6), 0 1px 0 rgba(0,0,0,.7);
}
.gb-rail__label {
  font-family: "Rye", Georgia, serif; font-size: 15px; letter-spacing: .03em;
  color: #fff5cc; text-shadow: 0 1px 0 rgba(60,22,4,.9);
}
.gb-rail__count {
  font-family: "Special Elite", monospace; font-size: 10px; color: #ffd58a; margin-left: 2px;
}
.gb-rail__ticker { position: relative; flex: 1; height: 22px; overflow: hidden; }
.gb-rail__line {
  position: absolute; inset: 0;
  display: flex; align-items: center; gap: 6px;
  font-family: "Kalam", cursive; font-size: 14.5px; color: #ffe9c4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transform: translateY(8px);
  transition: opacity .5s ease, transform .5s ease;
}
.gb-rail__line.is-active { opacity: 1; transform: translateY(0); }
.gb-rail__line b { font-family: "IM Fell English SC", Georgia, serif; color: #fff; font-weight: 400; }
.gb-rail__line .quote { color: #ffe9c4; font-style: italic; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.gb-rail__cta {
  flex: 0 0 auto;
  font-family: "Rye", Georgia, serif; font-size: 12.5px; letter-spacing: .02em;
  color: #fff9df; text-decoration: none;
  padding: 7px 15px;
  background: linear-gradient(#81994c, #546b2d);
  border: 2px solid #37491c; border-radius: 3px;
  box-shadow: 0 3px 0 rgba(52,28,9,.42);
  white-space: nowrap;
}
.gb-rail__cta:hover { background: linear-gradient(#8fa856, #5d7733); }

/* =====================================================================
   TAB: dedicated page masthead
   ===================================================================== */
.gb-page { padding: 24px 30px 44px; }
.gb-page__masthead {
  position: relative; text-align: center;
  padding: 18px 22px 20px; margin-bottom: 24px;
  color: #fff4d4;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.14) 0 2px, transparent 2px 26px),
    linear-gradient(180deg, #8d5226, #4d2a10);
  border: 4px solid #2c1808; border-top-color: #d3a558; border-radius: 4px;
  box-shadow: inset 0 0 0 2px rgba(255,220,150,.14), 0 10px 22px rgba(0,0,0,.5);
}
.gb-page__masthead .kicker {
  display: block; font-family: "Rye", Georgia, serif; font-size: 11px;
  letter-spacing: .28em; color: #ffb958;
}
.gb-page__masthead h1 {
  font-family: "Rye", Georgia, serif; font-size: 33px; color: #fff5cc; margin-top: 4px;
  text-shadow: 0 0 10px rgba(255,200,120,.45), 1px 2px 0 rgba(60,22,4,.85);
}
.gb-page__masthead p { font-family: "Kalam", cursive; font-size: 15px; color: #ffd58a; margin-top: 6px; }

/* =====================================================================
   The ledger surface
   ===================================================================== */
.aj-gbook {
  position: relative;
  max-width: 940px; margin: 0 auto;
  padding: 24px 26px 28px;
  background:
    radial-gradient(circle at 12% 8%, rgba(167,54,32,.07) 0 7px, transparent 14px),
    radial-gradient(circle at 92% 96%, rgba(113,137,61,.08) 0 9px, transparent 18px),
    var(--gb-paper-noise),
    linear-gradient(180deg, var(--gb-parch-a), var(--gb-parch-b));
  border: 3px solid var(--gb-bark); border-radius: 4px;
  box-shadow: inset 0 0 0 2px rgba(255,250,222,.7), 0 12px 22px rgba(0,0,0,.5);
}

/* ---- write box ---- */
.aj-gbook__form {
  display: grid; gap: 11px;
  padding: 16px 18px 18px; margin-bottom: 22px;
  background: rgba(255,252,238,.6);
  border: 1px dashed rgba(120,80,30,.45); border-radius: 5px;
}
.aj-gbook__row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.aj-gbook__name {
  flex: 0 0 240px;
  font-family: "Special Elite", monospace; font-size: 14px; color: var(--gb-ink);
  padding: 9px 11px; background: #fffaf0; border: 1px solid #b6925d; border-radius: 3px;
}
.aj-gbook__body {
  width: 100%; min-height: 70px; resize: vertical;
  font-family: "Kalam", cursive; font-size: 15.5px; line-height: 1.45; color: var(--gb-ink);
  padding: 11px 13px; background: #fffaf0; border: 1px solid #b6925d; border-radius: 3px;
}
.aj-gbook__name:focus, .aj-gbook__body:focus, .gb-replyform textarea:focus, .gb-replyform input:focus {
  outline: none; border-color: #a86a2e;
  box-shadow: 0 0 0 3px rgba(201,138,66,.32), inset 0 1px 3px rgba(120,80,30,.12);
}
.aj-gbook__hint { font-family: "Kalam", cursive; color: var(--gb-ink-soft); font-size: 13px; }
/* honeypot — hidden from humans, catches naive bots */
.aj-gbook__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.gb-btn {
  font-family: "Rye", Georgia, serif; font-size: 14px; color: #fff9df; cursor: pointer;
  background: linear-gradient(#81994c, #546b2d);
  border: 2px solid #37491c; border-radius: 3px;
  padding: 9px 20px; box-shadow: 0 3px 0 rgba(52,28,9,.42);
}
.gb-btn:hover { background: linear-gradient(#8fa856, #5d7733); }
.gb-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(52,28,9,.42); }
.gb-btn:disabled { opacity: .55; cursor: default; transform: none; }
.gb-btn--ghost { background: linear-gradient(#f7e5bf, #d9b878); color: #5a2a0e; border-color: #8a6432; }
.gb-btn--ghost:hover { background: linear-gradient(#fff0c8, #e3c489); }
.gb-btn--danger {
  background: linear-gradient(#b04a23, #6b2014);
  border-color: #2a0c04;
}
.gb-btn--danger:hover { background: linear-gradient(#c75a2b, #812818); }

.gb-manager {
  display: none;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: -8px 0 18px;
  padding: 12px 14px;
  background: rgba(255, 250, 240, .62);
  border: 1px dashed rgba(138,73,47,.55);
  border-radius: 5px;
}
body.aj-gb-owner .gb-manager { display: flex; }
.gb-manager__label {
  font-family: "Special Elite", monospace;
  font-size: 12px;
  color: #5a2a0e;
}
.gb-manager__input {
  min-width: 220px;
  padding: 8px 10px;
  font-family: "Special Elite", monospace;
  font-size: 12px;
  color: var(--gb-ink);
  background: #fffaf0;
  border: 1px solid #b6925d;
  border-radius: 3px;
}

/* ---- thread head + status ---- */
.aj-gbook__head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px; padding-bottom: 8px;
  border-bottom: 1px dashed rgba(120,80,30,.4);
}
.aj-gbook__head h2 { font-family: "Rye", Georgia, serif; font-size: 17px; color: var(--gb-bark); }
.aj-gbook__status { font-family: "Special Elite", monospace; font-size: 11px; color: var(--gb-ink-soft); }
.aj-gbook__status.is-live { color: #4f7a3a; }
.aj-gbook__status.is-offline { color: #a8492f; }
.aj-gbook__thread { display: grid; gap: 16px; }
.aj-gbook__empty {
  text-align: center; padding: 26px 10px;
  font-family: "Kalam", cursive; font-size: 16px; color: var(--gb-ink-soft);
}

/* ---- a pinned note (top-level comment) ---- */
.gb-comment { position: relative; }
.gb-note {
  position: relative; padding: 13px 16px 12px;
  background: #f4e6b6; background-image: var(--gb-paper-noise);
  border: 1px solid #8a6432;
  box-shadow: inset 0 0 0 1px rgba(255,242,205,.6), 0 3px 7px rgba(0,0,0,.3);
}
.gb-comment > .gb-note:nth-child(odd)  { transform: rotate(-.35deg); }
.gb-comment > .gb-note:nth-child(even) { transform: rotate(.4deg); }
.gb-note::before {
  content: ""; position: absolute; top: -8px; left: 22px;
  width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #ffe7e7 0 16%, #c1351b 42%, #5a1303 95%);
  box-shadow: 0 2px 3px rgba(0,0,0,.5), inset 0 0 0 1px rgba(255,210,200,.4);
}
.gb-note__head { display: flex; align-items: baseline; gap: 10px; justify-content: space-between; margin-bottom: 4px; }
.gb-note__namewrap { display: inline-flex; align-items: baseline; gap: 7px; min-width: 0; }
.gb-note__name { font-family: "IM Fell English SC", Georgia, serif; font-size: 15.5px; color: var(--gb-bark); }
.gb-note__name.is-anon { color: var(--gb-ink-soft); font-style: italic; }
.gb-note__time { font-family: "Special Elite", monospace; font-size: 10px; color: #8a6432; letter-spacing: .04em; white-space: nowrap; }
.gb-note__body { font-family: "Kalam", cursive; font-size: 15.5px; line-height: 1.46; color: var(--gb-ink); white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.gb-note__foot { display: flex; gap: 14px; align-items: center; margin-top: 7px; }
.gb-reply-btn {
  font-family: "Kalam", cursive; font-size: 13px; color: var(--gb-rust);
  background: none; border: none; cursor: pointer; padding: 0;
  border-bottom: 1px dashed rgba(167,54,32,.45);
}
.gb-reply-btn:hover { color: #8a2a16; }

/* owner-only remove control (revealed by body.aj-gb-owner) */
.gb-remove {
  font-family: "Special Elite", monospace; font-size: 11px; color: #8a492f;
  background: none; border: none; cursor: pointer; padding: 0; display: none;
  border-bottom: 1px dashed rgba(138,73,47,.5);
}
body.aj-gb-owner .gb-remove { display: inline; }
.gb-remove:hover { color: #c1351b; }

/* owner (Applejack) reply highlight */
.gb-note--owner { background: #e8eccf; border-color: #6f863f; }
.gb-note--owner::before { background: radial-gradient(circle at 32% 28%, #eafad0 0 16%, #6f9a3c 45%, #3d5a1e 95%); }
.gb-owner-badge {
  font-family: "Special Elite", monospace; font-size: 9px; letter-spacing: .06em;
  color: #fff7e3; background: linear-gradient(#a73620, #7a230f);
  border-radius: 10px; padding: 2px 8px 3px; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,.4);
}

/* ---- replies hanging off twine ---- */
.gb-replies { position: relative; margin: 9px 0 0 36px; }
.gb-replies::before {
  content: ""; position: absolute; left: -20px; top: -6px; bottom: 16px; width: 3px;
  background: repeating-linear-gradient(180deg, var(--gb-twine) 0 5px, rgba(185,135,72,.55) 5px 9px);
  border-radius: 2px;
}
.gb-replies__toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: "Kalam", cursive; font-size: 13px; color: #2c4a6e;
  background: none; border: none; cursor: pointer; padding: 2px 0 8px;
}
.gb-replies__toggle .chev { transition: transform .2s ease; }
.gb-replies__toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.gb-replies__list { display: grid; gap: 11px; }
.gb-replies[data-collapsed="true"] .gb-replies__list { display: none; }
.gb-note--reply {
  background: #f8efd4; font-size: 14px;
  box-shadow: inset 0 0 0 1px rgba(255,245,215,.6), 0 2px 5px rgba(0,0,0,.22);
  transform: rotate(.25deg);
}
.gb-note--reply .gb-note__name { font-size: 14px; }
.gb-note--reply .gb-note__body { font-size: 14.5px; }
.gb-note--reply::before {
  content: ""; position: absolute; top: 14px; left: -20px;
  width: 20px; height: 3px; border-radius: 0;
  background: var(--gb-twine); box-shadow: none;
}
.gb-note--reply::after {
  content: ""; position: absolute; top: 8px; left: -6px;
  width: 7px; height: 16px; border-radius: 2px;
  background: linear-gradient(180deg, #c79a5c, #8a6432);
  border: 1px solid #5a3c1c; box-shadow: 0 1px 2px rgba(0,0,0,.4);
}

/* ---- pager : flip through the book's pages ---- */
.gb-pager {
  display: flex; align-items: center; justify-content: center; gap: 7px; flex-wrap: wrap;
  margin-top: 22px; padding-top: 15px;
  border-top: 1px dashed rgba(120,80,30,.4);
}
.gb-pager__btn, .gb-pager__num {
  font-family: "Special Elite", monospace; font-size: 12px; color: #5a2a0e;
  background: #f4e6b6; background-image: var(--gb-paper-noise);
  border: 1px solid #8a6432; border-radius: 3px;
  padding: 6px 11px; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255,242,205,.6), 0 2px 4px rgba(0,0,0,.22);
}
.gb-pager__btn:hover:not(:disabled), .gb-pager__num:hover:not(.is-current) {
  background-color: #fbf0ca; color: var(--gb-rust);
}
.gb-pager__btn:disabled { opacity: .45; cursor: default; }
.gb-pager__num.is-current {
  color: #fff7e3; cursor: default;
  background: linear-gradient(#a73620, #7a230f); background-image: none;
  border-color: #4a1206;
  box-shadow: inset 0 1px 0 rgba(255,210,190,.3), 0 2px 4px rgba(0,0,0,.3);
}
.gb-pager__gap { font-family: "Special Elite", monospace; font-size: 12px; color: var(--gb-ink-soft); padding: 0 2px; }

/* ---- inline reply form ---- */
.gb-replyform {
  margin: 9px 0 0 36px; padding: 12px 13px;
  background: rgba(255,252,238,.7);
  border: 1px dashed rgba(120,80,30,.45); border-radius: 5px;
}
.gb-replyform textarea {
  width: 100%; min-height: 52px; resize: vertical;
  font-family: "Kalam", cursive; font-size: 14.5px; color: var(--gb-ink);
  padding: 9px 11px; background: #fffaf0; border: 1px solid #b6925d; border-radius: 3px;
}
.gb-replyform__row { display: flex; gap: 10px; align-items: center; margin-top: 9px; }
.gb-replyform input[type="text"] {
  flex: 0 0 180px; font-family: "Special Elite", monospace; font-size: 13px; color: var(--gb-ink);
  padding: 7px 9px; background: #fffaf0; border: 1px solid #b6925d; border-radius: 3px;
}
.gb-replyform__spacer { flex: 1; }
.gb-replyform .gb-btn { padding: 7px 15px; font-size: 13px; }
