/* ==========================================================================
   guestbook.css  |  a coupon to cut out, and the messages guests left
   The form is one pearl card with a perforation between its heading and its
   fields: two punched notches at the edges, a row of round holes across.
   The fields are filled blocks, not outlined boxes.
   ========================================================================== */

.guestbook { padding-block: var(--section-pad) calc(var(--section-pad) + 24px); }
.guestbook__grid { display: grid; gap: clamp(2.5rem, 6vw, 5rem); }
@media (min-width: 60rem) {
  .guestbook__grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; }
}

/* the coupon */
.guestbook__side {
  --p: clamp(1.5rem, 3.4vw, 2.5rem);
  display: grid;
  gap: var(--space-6);
  padding: var(--p);
  background: var(--surface);
}
.guestbook__head {
  position: relative;
  display: grid;
  gap: var(--space-3);
  padding-bottom: var(--space-6);
  border-bottom: 5px dotted var(--bg);          /* the perforation: round holes */
}
.guestbook__head::before,
.guestbook__head::after {                       /* the two notches punched at its ends */
  content: "";
  position: absolute;
  bottom: -14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg);
}
.guestbook__head::before { left: calc(-1 * var(--p) - 14px); }
.guestbook__head::after { right: calc(-1 * var(--p) - 14px); }
.guestbook__head h2 { font-size: var(--step-4); line-height: 0.9; }
.guestbook__head p { font-size: var(--step-0); color: var(--text); }

.gb-form { display: grid; gap: var(--space-3); }
.gb-field {
  width: 100%;
  padding: 1rem 1.1rem;
  border: 0;
  border-radius: 0;
  background: var(--paper-2);
  color: var(--name-ink);
  font: inherit;
  font-size: var(--step-0);
  line-height: 1.5;
}
.gb-field::placeholder { color: var(--text-soft); opacity: 1; }
.gb-field:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; border-radius: 0; }
textarea.gb-field { min-height: 9rem; resize: vertical; }
.gb-field[aria-invalid="true"] { outline: 3px solid #8c1d2b; outline-offset: 0; }

.gb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }   /* taste-skill-ignore: the hidden spam trap, not a rule */

.gb-form__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4); }
.gb-count { margin-inline-start: auto; font-size: var(--step--1); color: var(--text-soft); font-variant-numeric: tabular-nums; }
.gb-send { flex: 1 1 100%; min-height: 3.5rem; }
.gb-status { min-height: 1.5em; font-size: var(--step--1); color: var(--text-soft); }
.gb-status[data-tone="error"] { color: #8c1d2b; }
.gb-status[data-tone="ok"] { color: var(--accent); }

/* what guests wrote */
.guestbook__main { display: grid; gap: var(--space-4); justify-items: stretch; }
.gb-note {
  padding: 0.8rem 1.1rem;
  background: color-mix(in srgb, var(--zari) 30%, transparent);
  color: var(--ink);
  font-size: var(--step--1);
}
.gb-note[hidden], .gb-more[hidden] { display: none; }

.gb-list {
  display: grid;
  align-content: start;
  gap: var(--space-3);
  max-height: 34rem;
  overflow-y: auto;
  padding-inline-end: 0.5rem;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--zari) transparent;
}
.gb-list:focus-visible { outline-offset: 4px; }
.gb-entry {
  padding: 1.1rem 1.25rem;
  background: var(--surface);
}
.gb-entry__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); }
.gb-entry__name { font-family: var(--font-display); font-size: var(--step-1); line-height: 1.1; color: var(--name-ink); overflow-wrap: anywhere; }
.gb-entry__time { flex: none; font-size: var(--step--1); color: var(--text-soft); }
.gb-entry__text { margin-top: 0.5rem; max-width: none; font-size: var(--step-0); white-space: pre-line; overflow-wrap: anywhere; line-height: 1.65; }
.gb-entry.is-new { animation: fade-in 700ms var(--ease-soft) both; }
.gb-empty { padding: var(--space-7) var(--space-4); text-align: center; color: var(--text); background: var(--surface); max-width: none; }
.gb-more { justify-self: center; }

@media (max-width: 40rem) {
  .gb-list { max-height: 30rem; }
  .gb-entry__head { flex-direction: column; gap: 0.15rem; }
}
