/* ============================================================
   THE GUEST BOOK — what clients say, under the Continue tile.
   A hotel register and its key rack. One entry is open at a
   time; each room key opens one entry. Without scripts, every
   entry is simply listed down the page.

   The entries themselves are built into each page by
   wvh-site-guest-book-build.py (WvH Hospitality LLC folder)
   from wvh-site-guest-book.json. The words are the guests' own.
   Any spelling fix or black bar is recorded in that file.
   ============================================================ */

/* The signing hand. Same file the Steward's journal uses. */
@font-face {
  font-family: 'Homemade Apple';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/Qw3EZQFXECDrI2q789EKQZJob0x6XHgOiJM6.woff2') format('woff2');
}

.guest-book {
  margin: 60px auto 8px;
  max-width: 720px;
  text-align: center;
}
.guest-book .gb-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--oxblood);
  margin: 0 0 10px;
}
.guest-book .gb-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 32px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1.08;
  margin: 0 0 10px;
}
.guest-book .gb-lede {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--ink-muted);
  max-width: 500px;
  margin: 0 auto 24px;
}

/* ---- The register page ---- */
.gb-book {
  position: relative;
  background: var(--paper-bright);
  border: 1px solid var(--gold);
  box-shadow: inset 0 0 0 5px var(--paper-bright), inset 0 0 0 6px rgba(143, 112, 48, 0.4);
  padding: 36px 38px 28px;
  text-align: left;
}
/* the ribbon marker, centre top */
.gb-book::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 50%;
  width: 16px;
  height: 44px;
  margin-left: -8px;
  background: linear-gradient(90deg, var(--oxblood-deep), var(--oxblood) 45%, var(--oxblood-deep));
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
}
.gb-pages { display: grid; }
.gb-entry { margin: 0; min-width: 0; }
.gb-entry + .gb-entry {
  margin-top: 30px;
  padding-top: 26px;
  border-top: 1px dashed rgba(143, 112, 48, 0.5);
}
.gb-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-ink);
  border-bottom: 1px solid var(--gold);
  padding-bottom: 10px;
  margin: 0 0 20px;
}
.gb-words { margin: 0; padding: 0; border: 0; }
.gb-words p {
  font-family: var(--font-serif);
  font-size: 19.5px;
  line-height: 1.6;
  color: var(--ink);
  margin: 0 0 12px;
}
.gb-words p:last-child { margin-bottom: 0; }
/* the proprietor's black pen: a phrase withheld. The phrase is not in the page at all. */
.gb-redacted {
  display: inline-block;
  background: var(--ink);
  color: var(--paper-bright);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.56em;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  line-height: 1;
  padding: 0.42em 1.1em 0.36em;
  border-radius: 1px;
  vertical-align: 0.16em;
  -webkit-user-select: none;
  user-select: none;
}
.gb-words p:first-child::before { content: "\201C"; }
.gb-words p:last-child::after { content: "\201D"; }

.gb-signed {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin-top: 22px;
}
.gb-who {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  min-width: 0;
}
.gb-signature {
  font-family: 'Homemade Apple', 'Caveat', cursive;
  font-size: 21px;
  line-height: 1.6;
  color: #1d2c57;               /* fountain-pen blue-black */
  transform: rotate(-2deg);
  transform-origin: right bottom;
}
.gb-print {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1.5;
  color: var(--ink-muted);
  border-top: 1px solid var(--gold-deep);
  padding-top: 6px;
  margin-top: 2px;
}
.gb-print .gb-link {
  color: var(--oxblood);
  text-decoration: none;
  border-bottom: 1px dotted var(--oxblood);
}
.gb-print .gb-link:hover { color: var(--oxblood-deep); border-bottom-style: solid; }
.gb-print .gb-link:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
/* the clerk's dater: WORD over DATE (a facsimile object, like the other stamps) */
.gb-stamp {
  flex: none;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 7px 14px 6px;
  margin: 0 0 6px 4px;
  border: 2.5px solid var(--oxblood);
  color: var(--oxblood);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
  transform: rotate(-7deg);
  opacity: 0.8;
  mix-blend-mode: multiply;
}
.gb-stamp span + span {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.14em;
  border-top: 1.5px solid currentColor;
  padding-top: 4px;
  width: 100%;
  text-align: center;
}
.gb-entry:nth-child(even) .gb-stamp { transform: rotate(5deg); }

.guest-book .gb-note {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-muted);
  max-width: 480px;
  margin: 18px auto 0;
}

/* ---- With the script running: one entry open at a time ---- */
/* The book is as tall as the open page. Entries differ a great deal in length, so a closed
   entry is folded to nothing (half a second after it starts to fade), and the script walks
   the height from the old page to the new one so the keys below glide instead of jumping. */
.gb-live .gb-pages {
  align-items: start;
  align-content: start;
  transition: height 0.55s ease;
}
.gb-live .gb-pages.is-closing-up { transition-delay: 0.5s; }   /* a shorter page: let the old words fade first */
.gb-live .gb-entry {
  grid-area: 1 / 1;
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
  opacity: 0;
  visibility: hidden;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s, max-height 0s linear 0.5s;
}
.gb-live .gb-entry.is-open {
  opacity: 1;
  visibility: visible;
  max-height: 4000px;
  overflow: visible;
  transition: opacity 0.9s ease 0.5s, visibility 0s linear 0.5s;
}
/* while the script is laying the book out, nothing fades or swings */
.gb-setting .gb-pages,
.gb-setting .gb-entry, .gb-setting .gb-entry.is-open,
.gb-setting .gb-entry .gb-stamp, .gb-setting .gb-entry.is-open .gb-stamp,
.gb-setting .gb-hang, .gb-setting .gb-room { transition: none !important; }
/* the stamp lands after the words, quietly */
.gb-live .gb-entry .gb-stamp { opacity: 0; transition: opacity 0.4s ease; }
.gb-live .gb-entry.is-open .gb-stamp { opacity: 0.8; transition: opacity 1.1s ease 1.5s; }

/* ---- The key rack: one hotel key per entry ----
   The four keys are photographs (Nano Banana Pro, 11.11.26) cut out on one shared
   frame, so the fob sits in the same place in each: centre 50% across, 57.3% down.
   The room number is real text laid over the blank fob. */
.gb-rack {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px 34px;
  width: fit-content;
  max-width: 100%;
  margin: 30px auto 0;
  padding: 7px 44px 0;
}
.gb-rack::before {              /* the rail */
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--gold-pale), var(--gold) 45%, var(--gold-deep));
  box-shadow: 0 1px 2px rgba(10, 6, 4, 0.3);
}
.gb-key {
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  position: relative;
  display: block;
  width: 50px;
  height: 148px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.gb-key::before {               /* the peg it hangs from */
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  z-index: 2;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold-pale), var(--gold-deep) 72%);
  box-shadow: 0 1px 1px rgba(10, 6, 4, 0.45);
}
.gb-hang {                      /* the part that swings: the picture and its number */
  position: absolute;
  top: 1px;
  left: 50%;
  width: 92px;
  height: 143px;
  margin-left: -46px;
  pointer-events: none;
  transform-origin: 50% 3%;
  transform: rotate(var(--hang, 0deg));
  filter: drop-shadow(0 2px 2px rgba(10, 6, 4, 0.28)) brightness(0.9) saturate(0.9);
  transition: transform 1.2s cubic-bezier(0.22, 0.8, 0.3, 1), filter 0.7s ease;
}
.gb-hang img { display: block; width: 100%; height: 100%; }
.gb-hang.is-flipped img { transform: scaleX(-1); }
.gb-room {                      /* gold-stamped room number on the fob */
  position: absolute;
  left: 50%;
  top: 57.3%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.08em;
  line-height: 1;
  color: #dcc27c;
  text-shadow: 0 1px 0 rgba(24, 4, 8, 0.6);
  transition: color 0.7s ease;
}
.gb-key:hover .gb-hang {
  transform: rotate(calc(var(--hang, 0deg) + 3deg));
  filter: drop-shadow(0 3px 3px rgba(10, 6, 4, 0.3)) brightness(1) saturate(1);
}
/* the open entry's key: lifted off its peg, a touch larger, in full colour */
.gb-key[aria-pressed="true"] .gb-hang {
  transform: translateY(10px) rotate(calc(var(--hang, 0deg) - 7deg)) scale(1.08);
  filter: drop-shadow(0 8px 7px rgba(10, 6, 4, 0.36)) brightness(1.05) saturate(1.06);
}
.gb-key[aria-pressed="true"] .gb-room { color: #fff0c2; }
.gb-key:focus-visible { outline: 2px solid var(--ink); outline-offset: 8px; border-radius: 6px; }

/* ---- The front desk: turn back, hold, turn ---- */
.gb-desk {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 26px;
  margin: 20px auto 0;
}
.gb-desk button {
  -webkit-appearance: none;
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 1px dotted var(--oxblood);
  min-height: 32px;
  padding: 8px 1px 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--oxblood);
  cursor: pointer;
}
.gb-desk button:hover { color: var(--oxblood-deep); border-bottom-style: solid; }
.gb-desk button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.gb-desk .gb-hold.is-held { color: var(--ink); border-bottom-color: var(--ink); }

@media (max-width: 560px) {
  .guest-book { margin-top: 44px; }
  .guest-book .gb-title { font-size: 25px; letter-spacing: 0.06em; }
  .guest-book .gb-lede { font-size: 15.5px; }
  .gb-book { padding: 44px 20px 22px; }
  .gb-book::before { height: 30px; }
  .gb-head { letter-spacing: 0.14em; flex-wrap: wrap; gap: 4px 12px; }
  .gb-words p { font-size: 17.5px; }
  .gb-signed { flex-direction: column-reverse; align-items: stretch; gap: 12px; }
  .gb-stamp { align-self: flex-start; margin-left: 2px; }
  .gb-signature { font-size: 18px; }
  .gb-rack { gap: 10px 26px; padding: 7px 24px 0; }
  .gb-key { width: 42px; height: 126px; }
  .gb-hang { width: 78px; height: 121px; margin-left: -39px; }
  .gb-room { font-size: 13px; }
  .gb-desk { display: grid; grid-template-columns: auto auto; justify-content: center; gap: 4px 24px; }
  .gb-desk .gb-hold { grid-column: 1 / -1; justify-self: center; order: 3; }
  .gb-desk button { letter-spacing: 0.18em; }
}

@media (max-width: 359px) {
  .gb-rack { gap: 10px 16px; padding: 7px 16px 0; }
  .gb-key { width: 38px; height: 114px; }
  .gb-hang { width: 70px; height: 109px; margin-left: -35px; }
  .gb-room { font-size: 12px; }
}

/* Five or six keys on a phone: hung closer together, so they still share the one rail.
   (A seventh key will wrap to a second row; the rack will want a second rail then.) */
@media (max-width: 560px) {
  .gb-rack-full { gap: 10px 8px; padding: 7px 14px 0; }
  .gb-rack-full .gb-key { width: 38px; height: 114px; }
  .gb-rack-full .gb-hang { width: 70px; height: 109px; margin-left: -35px; }
  .gb-rack-full .gb-room { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .gb-live .gb-pages,
  .gb-live .gb-entry, .gb-live .gb-entry.is-open,
  .gb-live .gb-entry .gb-stamp, .gb-live .gb-entry.is-open .gb-stamp,
  .gb-hang, .gb-room { transition: none; }
}
