@charset "UTF-8";

/* Ma Shan Zheng, SIL OFL 1.1; license: assets/fonts/MaShanZheng-OFL.txt. */
@font-face {
  font-family: "Ma Shan Zheng";
  src: url("./assets/fonts/MaShanZheng-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

.guestbook {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  --guestbook-hand: "Ma Shan Zheng", "STXingkai", "KaiTi", "STKaiti", cursive;
}

.guestbook svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.guestbook-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.guestbook-heading h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 8px;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.4;
}

.guestbook-heading h2 svg {
  width: 25px;
  height: 25px;
  color: var(--accent);
}

.guestbook-heading > div > p:last-child {
  margin: 0;
  color: var(--text-soft);
  font-size: 16px;
}

.guestbook-total {
  flex-shrink: 0;
  padding: 7px 12px;
  border: 1px solid var(--accent-border);
  border-radius: 7px;
  background: var(--accent-faint);
  color: var(--text-soft);
  font-size: 14px;
  white-space: nowrap;
}

.guestbook-total strong {
  padding-right: 3px;
  color: var(--accent-strong);
  font-size: 20px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.guestbook-wall-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 9px;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.8;
}

.guestbook-wall-heading p {
  margin: 0;
}

.guestbook-compose-link {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--accent-border);
  color: var(--accent-strong);
  font-size: 14px;
  white-space: nowrap;
}

.guestbook-compose-link:hover {
  color: var(--accent-dark);
}

.guestbook-wall {
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 190px;
  max-height: 420px;
  padding: 16px 10px 6px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background-color: #fff8fb;
  background-image: radial-gradient(#cfadbf75 0.65px, transparent 0.65px);
  background-size: 19px 19px;
  box-shadow: inset 0 2px 12px #b9799410;
  scrollbar-color: var(--accent-border) transparent;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
  overscroll-behavior-y: contain;
}

.guestbook-wall:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 4px;
}

.guestbook-notes {
  margin: 0;
  padding: 2px 0 5px;
  columns: 3;
  column-gap: 10px;
  list-style: none;
}

.guest-note {
  position: relative;
  display: block;
  width: calc(100% - 16px - var(--paper-inset, 0px));
  margin: calc(10px + var(--paper-drop, 0px)) 0 calc(12px + var(--paper-gap, 0px));
  margin-left: calc(8px + var(--paper-shift, 0px));
  padding: 25px 18px 14px;
  transform: rotate(var(--paper-tilt, -1deg));
  transform-origin: 50% 35%;
  border: 1px solid #bf9d8952;
  border-radius: 2px 3px 5px 2px;
  background-color: var(--note-paper, #fff8e9);
  background-image: linear-gradient(135deg, #ffffff80, transparent 62%), radial-gradient(#a2766a0e 0.6px, transparent 0.6px);
  background-size: auto, 5px 5px;
  box-shadow: 2px 5px 11px #956a7b20, 0 1px 2px #94677314, inset 0 0 19px #ffffff66;
  break-inside: avoid;
}

.guest-note::before {
  position: relative;
  z-index: 1;
  display: block;
  left: var(--tape-left, 50%);
  width: 82px;
  height: 24px;
  box-sizing: border-box;
  margin-top: -36px;
  margin-bottom: 12px;
  transform: translateX(-50%) rotate(var(--tape-tilt, 3deg));
  border: 1px solid #cfb99540;
  background-color: var(--note-tape, #e8d5b68c);
  background-image: repeating-linear-gradient(93deg, #ffffff20 0 1px, #a89a7710 1px 3px);
  box-shadow: 0 1px 2px #9b866321;
  clip-path: polygon(0 8%, 7% 2%, 12% 6%, 20% 0, 26% 5%, 35% 1%, 42% 6%, 50% 1%, 60% 5%, 70% 0, 79% 5%, 89% 1%, 100% 5%, 98% 25%, 100% 50%, 97% 73%, 100% 96%, 91% 100%, 82% 95%, 73% 100%, 64% 95%, 54% 100%, 44% 96%, 35% 100%, 25% 95%, 16% 100%, 7% 95%, 0 99%, 2% 70%, 0 48%, 2% 27%);
  pointer-events: none;
  content: "";
}

.guest-note:nth-child(3n)::after {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 17px;
  height: 17px;
  background: linear-gradient(135deg, transparent 49%, #d7c3af55 51%, #fff9ee 65%);
  pointer-events: none;
  content: "";
}

.guest-note-example {
  display: inline-block;
  margin-bottom: 6px;
  padding: 2px 7px;
  border: 1px dashed #c8a79080;
  border-radius: 4px;
  color: #957a70;
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.7;
}

.guest-note-body {
  margin: 0;
  color: #765466;
  font-family: var(--guestbook-hand);
  font-size: 23px;
  font-weight: 400;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.guest-note-signature {
  display: block;
  margin-top: 9px;
  color: #946b7d;
  font-family: var(--guestbook-hand);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.5;
  overflow-wrap: anywhere;
  text-align: right;
}

.guest-note.is-new {
  animation: guest-note-arrive 450ms ease-out both;
}

.guestbook-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  align-items: start;
  gap: 20px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.guestbook-writing,
.guestbook-posting {
  min-width: 0;
}

.guestbook-field-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.guestbook-field-heading label,
.guestbook-identity legend {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.7;
}

.guestbook-field-heading output {
  color: var(--text-faint);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  line-height: 1.7;
  white-space: nowrap;
}

.guestbook-field-heading output.is-over {
  color: #b35872;
}

.guestbook textarea,
.guestbook input[type="text"] {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 9px 10px;
  border: 1px solid var(--accent-border);
  border-radius: 7px;
  background: #fffafd;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.8;
}

.guestbook textarea {
  height: 92px;
  min-height: 92px;
  line-height: 1.65;
  resize: vertical;
}

.guestbook textarea::placeholder,
.guestbook input::placeholder {
  color: #aa8196;
}

.guestbook textarea:focus,
.guestbook input[type="text"]:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent-soft);
  outline-offset: 1px;
}

.guestbook textarea[aria-invalid="true"],
.guestbook input[aria-invalid="true"] {
  border-color: #c07e92;
}

.guestbook-input-help {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.8;
}

.guestbook-posting > .guestbook-input-help {
  line-height: 1.5;
}

.guestbook-identity {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.guestbook-identity legend {
  margin-bottom: 6px;
  padding: 0;
}

.guestbook-identity-options {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.guestbook-identity-options label {
  display: inline-flex;
  min-height: 44px;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1px solid var(--accent-border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 15px;
  cursor: pointer;
}

.guestbook-identity-options label:has(input:checked) {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.guestbook-identity-options input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent-strong);
}

.guestbook-name-field {
  margin-top: 12px;
}

.guestbook-submit {
  width: 100%;
  min-height: 44px;
  justify-content: space-between;
  margin-top: 12px;
  padding: 9px 13px;
  font-size: 16px;
}

.guestbook-submit:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.guestbook-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: 10px;
}

.guestbook-status,
.guestbook-storage-note {
  margin: 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.8;
}

.guestbook-storage-note {
  max-width: 520px;
  color: var(--text-faint);
  text-align: right;
}

.guestbook-status.is-error {
  color: #ad5973;
}

@keyframes guest-note-arrive {
  from {
    transform: translateY(9px) rotate(var(--paper-tilt, -1deg));
    opacity: 0;
  }
  to {
    transform: translateY(0) rotate(var(--paper-tilt, -1deg));
    opacity: 1;
  }
}

@media (max-width: 1050px) {
  .guestbook-form {
    grid-template-columns: minmax(0, 1fr) 255px;
    gap: 18px;
  }
}

@media (max-width: 900px) {
  .guestbook-notes {
    columns: 2;
  }
}

@media (max-width: 760px) {
  .guestbook {
    margin-top: 24px;
    padding-top: 22px;
  }

  .guestbook-heading {
    gap: 15px;
  }

  .guestbook-heading h2 {
    font-size: 26px;
  }

  .guestbook-wall-heading {
    display: block;
  }

  .guestbook-compose-link {
    margin-top: 8px;
  }

  .guestbook-form {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 14px;
  }

  .guestbook-footer {
    flex-direction: column;
    gap: 9px;
  }

  .guestbook-storage-note {
    text-align: left;
  }
}

@media (max-width: 600px) {
  .guestbook-heading {
    align-items: flex-start;
  }

  .guestbook-total {
    margin-top: 29px;
    padding: 5px 8px;
    font-size: 13px;
  }

  .guestbook-total strong {
    font-size: 18px;
  }

  .guestbook-wall {
    max-height: 360px;
    padding: 15px 7px 5px;
  }

  .guestbook-notes {
    columns: 1;
  }

  .guest-note {
    padding-inline: 16px;
  }

  .guest-note-body {
    font-size: 23px;
  }

  .guestbook textarea {
    height: 100px;
    min-height: 100px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .guest-note.is-new {
    animation: none;
  }
}
