@import url('https://fonts.googleapis.com/css2?family=Nanum+Pen+Script&display=swap');

/* ==========================================================================
   GUESTBOOK — guestbook.css
   ========================================================================== */

.guestbook{
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(64px, 8vw, 100px) var(--pad-edge, 20px) 120px;
  background: var(--clr-bg-soft, #f8f9fa);
  border-top: 1px solid var(--clr-line, #eee);
  transition: min-height .4s var(--ease, ease);
}

@supports (height: 100dvh){
  .guestbook{
    min-height: 100dvh;
  }
}

/* 포스트잇 전체 레이어 */
#guestbook-stage{
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* 중앙 입력 카드 */
.guestbook__center{
  position: relative;
  z-index: 5;
  max-width: 460px;
  width: min(460px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 28px;
  text-align: center;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 28px;
  box-shadow: 0 30px 60px rgba(36,38,59,0.08);
}

.guestbook__center h2{
  font-family: var(--ff-display, sans-serif);
  font-size: var(--fs-h2, 1.75rem);
  line-height: 1.25;
  margin: 0 0 14px;
}
.guestbook__desc{
  color: var(--clr-ink-soft, #666);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 14px;
}
.guestbook__total{
  font-size: 0.82rem;
  color: var(--clr-ink-soft, #666);
  margin-bottom: 24px;
}
.guestbook__total strong{
  font-family: var(--ff-display, sans-serif);
  color: var(--clr-cyan, #00bcd4);
  font-size: 1.1rem;
  margin-right: 2px;
}

.guestbook__form{
  display:flex;
  flex-direction:column;
  gap: 16px;
  text-align: left;
}
.guestbook__field{ display:flex; flex-direction:column; gap:6px; position:relative; }
.guestbook__field label{
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--clr-ink-soft, #666);
}
.guestbook__field input,
.guestbook__field textarea{
  border: none;
  border-bottom: 1.5px solid var(--clr-line, #ccc);
  background: transparent;
  padding: 10px 2px;
  font-family: var(--ff-body, sans-serif);
  font-size: 1rem;
  color: var(--clr-ink, #222);
  resize: none;
  transition: border-color .2s var(--ease, ease);
}
.guestbook__field input:focus,
.guestbook__field textarea:focus{
  border-color: var(--clr-cyan, #00bcd4);
  outline: none;
}
.guestbook__counter{
  align-self:flex-end;
  font-size: 0.7rem;
  color: var(--clr-ink-soft, #666);
}

.guestbook__submit{
  margin-top: 4px;
  padding: 13px 28px;
  background: var(--clr-cyan, #00bcd4);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: var(--ff-display, sans-serif);
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform .25s var(--ease, ease), background .25s var(--ease, ease);
}
.guestbook__submit:hover{ background: var(--clr-ink, #222); transform: translateY(-2px); }
.guestbook__submit:active{ transform: translateY(0) scale(0.98); }

.guestbook__status{
  min-height: 1.2em;
  font-size: 0.8rem;
  color: var(--clr-cyan, #00bcd4);
  margin: 8px 0 0;
  text-align:center;
}

/* ---- 포스트잇 메모지 본체 ---- */
.gb-sticker{
  position: absolute;
  pointer-events: auto;
  width: var(--size, 130px);
  min-height: var(--size, 130px);
  background: var(--note-bg, #fff6a6);
  border-radius: 2px 2px 8px 2px;
  padding: 24px 12px 14px;
  box-shadow: 2px 10px 18px rgba(36,38,59,0.12), 0 2px 4px rgba(36,38,59,0.06);
  cursor: pointer;
  opacity: 0;
  transform-origin: top center;
  transform: scale(0.3) rotate(var(--rot, 0deg));
  animation: gbPopIn .6s cubic-bezier(.34, 1.56, .64, 1) forwards, gbBob 6s ease-in-out infinite;
  animation-delay: 0s, .6s;
  transition: filter .25s var(--ease, ease), transform .25s var(--ease, ease);
}

.gb-sticker:hover{
  filter: brightness(1.03);
  z-index: 20 !important;
  transform: scale(1.06) rotate(var(--rot, 0deg));
}

.gb-sticker__pin{
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%) rotate(var(--pin-rot, 0deg));
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.22));
  z-index: 2;
  pointer-events: none;
}

.gb-sticker__content{
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: 100%;
  pointer-events: none;
}

.gb-sticker__name{
  display: block;
  font-family: 'Nanum Pen Script', cursive;
  font-size: 1.15rem;
  line-height: 1.1;
  color: var(--clr-ink, #222);
  margin-bottom: 6px;
  border-bottom: 1px dashed rgba(0,0,0,0.15);
  padding-bottom: 4px;
}

.gb-sticker__msg{
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: 'Nanum Pen Script', cursive;
  font-size: 1.05rem;
  line-height: 1.25;
  color: var(--clr-ink, #222);
  word-break: break-word;
}

@keyframes gbPopIn{
  0%{ opacity:0; transform: scale(0.3) rotate(var(--rot, 0deg)); }
  100%{ opacity:1; transform: scale(1) rotate(var(--rot, 0deg)); }
}
@keyframes gbBob{
  0%, 100%{ margin-top: 0px; }
  50%{ margin-top: -8px; }
}

/* ---- 메시지 팝업 ---- */
.guestbook__popup{
  position: fixed;
  inset: 0;
  z-index: 200;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 24px;
  background: rgba(36,38,59,0.35);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s var(--ease, ease);
}
.guestbook__popup.is-open{ opacity: 1; pointer-events: auto; }

.guestbook__popup-card{
  position: relative;
  max-width: 360px;
  width: 100%;
  background: #fff;
  border-radius: 24px;
  padding: 32px 28px;
  text-align:center;
  box-shadow: 0 30px 60px rgba(36,38,59,0.25);
  transform: scale(0.9);
  transition: transform .25s var(--ease, ease);
}
.guestbook__popup.is-open .guestbook__popup-card{ transform: scale(1); }

.guestbook__popup-close{
  position:absolute;
  top: 14px; right: 14px;
  width: 28px; height: 28px;
  border-radius: 50%;
  border:none;
  background: var(--clr-bg-soft, #f0f0f0);
  color: var(--clr-ink-soft, #666);
  font-size: 0.8rem;
  cursor: pointer;
}
.guestbook__popup-name{
  font-family: var(--ff-display, sans-serif);
  color: var(--clr-cyan, #00bcd4);
  margin-bottom: 10px;
}
.guestbook__popup-msg{
  color: var(--clr-ink, #222);
  line-height: 1.6;
  word-break: break-word;
}

/* ==========================================================================
   RESPONSIVE (아이패드 1080x810 및 태블릿/모바일 분기 점검)
   ========================================================================== */

@media (max-width: 1080px){
  .guestbook__center{ 
    max-width: 400px;
    width: min(400px, calc(100% - 24px));
    padding: 28px 22px; 
  }
  .gb-sticker{ 
    width: calc(var(--size, 125px) * 0.75) !important; 
    min-height: calc(var(--size, 125px) * 0.75) !important; 
    padding: 16px 8px 8px !important; 
  }
  .gb-sticker__name{ font-size: 0.95rem; margin-bottom: 4px; padding-bottom: 2px; }
  .gb-sticker__msg{ font-size: 0.88rem; line-height: 1.2; }
  .gb-sticker__pin{ width: 26px; height: 26px; top: -10px; }
}

@media (max-width: 480px){
  .guestbook{
    padding-left: max(16px, env(safe-area-inset-left, 16px));
    padding-right: max(16px, env(safe-area-inset-right, 16px));
    padding-bottom: max(88px, calc(64px + env(safe-area-inset-bottom, 0px)));
  }
  .guestbook__center{
    max-width: calc(100% - 16px);
    padding: 22px 16px;
    border-radius: 22px;
  }
  .gb-sticker{ 
    width: calc(var(--size, 125px) * 0.62) !important; 
    min-height: calc(var(--size, 125px) * 0.62) !important; 
    padding: 14px 6px 6px !important;
  }
  .guestbook__desc{ font-size: 0.84rem; }
}

@media (prefers-reduced-motion: reduce){
  .gb-sticker{ animation: gbPopIn .01ms forwards; }
}