/* =============================================
   RESPONSIVE BREAKPOINTS
   ============================================= */

/* =============================================
   GLOBAL OVERRIDES
   ============================================= */

/* Wish card dùng body font thay vì Mythshire */
.wish-content {
  font-family: "Poor Story", system-ui, sans-serif;
}

/* =============================================
   STAMP FLOATING ANIMATION (desktop only)
   ============================================= */

@media (min-width: 769px) {
  /* Dùng CSS variable cho rotation để animation không bị mất */
  .stamp-item {
    transform: rotate(var(--base-rotation, 0deg)) scale(0.8);
  }

  .stamp-item.visible {
    transform: rotate(var(--base-rotation, 0deg)) scale(1);
    animation: stampFloat 3.5s ease-in-out infinite;
    animation-delay: var(--float-delay, 0s);
  }

  /* Hover: chỉ dừng float animation.
     Transform (straighten + scale) do main.css xử lý: scale(1.1) translateY(-20px).
     Transition trên .stamp-item smooth từ vị trí float hiện tại → hover state. */
  .stamp-item:hover {
    animation: none !important;
  }

  @keyframes stampFloat {
    0%, 100% { transform: rotate(var(--base-rotation, 0deg)) scale(1) translateY(0);     }
    50%       { transform: rotate(var(--base-rotation, 0deg)) scale(1) translateY(-14px); }
  }
}

/* =============================================
   HERO SECTION
   ============================================= */

/* Scroll indicator — ẩn trên desktop, bật trên mobile qua media query bên dưới */
.scroll-indicator {
  position: absolute;
  bottom: calc(2rem + 80px);
  left: 50%;
  transform: translateX(-50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.8s ease;
  pointer-events: none;
  z-index: 5;
}

.scroll-indicator.visible {
  opacity: 1;
}

.scroll-indicator-arrow {
  animation: scrollBounce 1.4s ease-in-out infinite;
  color: var(--colors-primary-500, #0038bc);
}

.scroll-indicator-text {
  font-family: "Poor Story", sans-serif;
  font-size: 14px;
  color: var(--colors-primary-500, #0038bc);
  letter-spacing: 0.08em;
}

@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

/* Mobile - 768px and below */
@media (max-width: 768px) {
  .hero-viewport {
    min-height: 100vh;
    margin-bottom: 6rem;
  }

  /* Fixed width — envelope không scale theo màn hình,
     tràn ra 2 bên nhờ overflow-x: hidden trên body.
     Text giữ kích thước đọc được (~55px heading-2).
     Dùng left thay vì translateX(-50%) để tránh GSAP
     convert % sang px sai kích thước khi animate y. */
  .envelope-wrapper {
    width: 650px;
    height: calc(650px * 983 / 1260);
    top: 50%;
    left: calc(50% - 295px);
    transform: translateY(200%);
  }

  .scroll-indicator {
    display: flex;
  }

  /* Nav: gọn hơn trên mobile */
  nav {
    padding: 16px 20px;
    top: 10px;
  }

  nav img {
    width: 96px;
    height: auto;
  }

  nav .right {
    gap: 8px;
  }

  nav .right p {
    font-size: 16px;
    line-height: 1.3;
  }
}

/* =============================================
   STAMPS SECTION
   ============================================= */

@media (max-width: 768px) {
  .stamps-section {
    margin-top: 40px;
    padding: 0 0 3rem 0;
    min-height: auto;
    align-items: flex-start;
  }

  /* Desktop dùng translate(-50%, -50%) để căn tuyệt đối vào giữa.
     Mobile dùng position: sticky nên chỉ cần translateY cho entrance animation. */
  #stamps-section-title {
    text-align: left;
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    font-size: 72px;
    line-height: 0.9;
    min-height: auto;
    width: 100%;
    max-width: 100%;
    left: 0;
    transform: translateY(40px);
  }

  #stamps-section-title.visible {
    transform: translateY(0);
  }

  /* Center-snap carousel:
     padding = (100vw - 75vw) / 2 = 12.5vw
     để stamp đầu và stamp cuối cũng có thể snap vào giữa */
  .stamps-grid {
    padding: 1rem 12.5vw;
    gap: 4vw;
    scrollbar-width: none;
  }

  .stamps-grid::-webkit-scrollbar {
    display: none;
  }

  .stamp-item {
    width: auto;
    height: 60vw;
    object-fit: contain;
  }

  .stamp-item:hover {
    transform: scale(1) !important;
  }
}

/* Swipe indicator cho mobile stamps section (góc phải trên) */
.stamps-swipe-indicator {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  display: flex;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
  color: var(--colors-primary-500, #0038bc);
}

.stamps-swipe-indicator.visible {
  animation: swipeArrowBlink 1.1s ease-in-out infinite;
}

.stamps-swipe-indicator.hidden {
  animation: none;
  opacity: 0 !important;
  transition: opacity 0.3s ease;
}

@keyframes swipeArrowBlink {
  0%, 100% { opacity: 1;   transform: translateX(0); }
  50%       { opacity: 0.2; transform: translateX(5px); }
}

/* ScrollTrigger pin mode — kích hoạt khi JS thêm class .st-mode */
@media (max-width: 768px) {
  /* Section clip horizontal overflow, height tự nhiên (không phải 100vh)
     sticky + top được set bởi JS để căn giữa trong wrapper */
  .stamps-section.st-mode {
    overflow: hidden;
    justify-content: center;
    align-items: flex-start;
    padding: 0;
    margin-top: 0;
    gap: 2rem;
  }

  /* Title vẫn ở trên, bỏ sticky vì section đã được pin bởi GSAP */
  .stamps-section.st-mode #stamps-section-title {
    position: relative;
    flex-shrink: 0;
    left: 0;
    padding: 0;
    margin: 0;
  }

  /* Grid translate ngang bởi scroll listener, khgoông cần flex: 1 */
  .stamps-section.st-mode .stamps-grid {
    overflow: visible;
    align-items: center;
    margin: 0;
  }
}

/* =============================================
   STAMP DETAIL
   ============================================= */

/* Desktop: giảm scale từ 1.5 xuống 1.1 */
.stamp-detail-image img {
  transform: scale(1.1);
}

/* Tablet - 1024px and below */
@media (max-width: 1024px) {
  .stamp-detail-image img {
    transform: scale(1.05);
  }
}

/* Mobile - 768px and below */
@media (max-width: 768px) {
  /* Reset scale — ở mobile detail section đã column nên ảnh full width,
     scale(1.5) sẽ tràn ra ngoài */
  .stamp-detail-image img {
    transform: scale(1);
  }

  /* Giới hạn chiều cao ảnh để không chiếm hết màn hình */
  .stamp-detail-image {
    max-height: 55vw;
    overflow: visible;
  }

  /* Title nhỏ hơn để fit mobile */
  .stamp-detail-title {
    font-size: 44px;
    line-height: 1;
  }

  /* Back button rõ hơn trên nền nhỏ */
  .back-to-stamps {
    font-size: 16px;
    gap: 8px;
  }

  /* Favorite button full width, center */
  .favorite-button {
    align-self: stretch;
  }
}

/* =============================================
   INVITATION SECTION
   ============================================= */

/* Tablet - 1024px and below */
@media (max-width: 1024px) {
  .invitation-card {
    padding: 48px 60px;
  }

  .invitation-header {
    gap: 24px;
  }

  .invitation-stamp {
    width: 140px;
    height: 140px;
  }

  .greeting-text {
    font-size: 36px;
  }

  .detail-value {
    font-size: 22px;
  }
}

/* Mobile - 768px and below */
@media (max-width: 768px) {
  .invitation-section {
    padding: 2rem 1rem;
    margin-top: 60px;
  }

  .invitation-card {
    padding: 40px 32px;
    transform: rotate(0deg);
  }

  .invitation-card.visible {
    transform: rotate(0deg) translateY(0);
    animation: cardFloatMobile 3s ease-in-out infinite;
  }

  @keyframes cardFloatMobile {
    0%, 100% {
      transform: rotate(0deg) translateY(0);
    }
    50% {
      transform: rotate(0deg) translateY(-8px);
    }
  }

  /* Stack header vertically on mobile */
  .invitation-header {
    flex-direction: column;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
  }

  .invitation-stamp {
    width: 160px;
    height: 160px;
    order: -1; /* Put stamp before greeting */
  }

  .invitation-greeting {
    text-align: center;
    width: 100%;
  }

  .greeting-text {
    font-size: 28px;
  }

  .invitation-details {
    grid-template-columns: 1fr;
    gap: 32px;
    margin-bottom: 32px;
  }

  .detail-value {
    font-size: 20px;
  }

  /* Footer vertical on mobile */
  .invitation-footer {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
  }

  .thank-message,
  .thank-message-note {
    font-size: 16px;
  }

  .thank-message-note {
    font-size: 14px;
    margin-bottom: 8px;
  }

  .message-btn {
    width: 100%;
    justify-content: center;
  }
}

/* =============================================
   GUEST NAME MODAL
   ============================================= */

@media (max-width: 768px) {
  .guest-modal {
    width: min(100vw - 32px, 520px);
    padding: 32px 24px;
    border-radius: 14px;
  }

  .guest-modal-title {
    font-size: 72px;
    line-height: 0.9;
    margin-bottom: 24px;
  }

  .guest-modal-question {
    font-size: 20px;
  }

  .guest-modal-note {
    font-size: 16px;
    margin-bottom: 20px;
  }

  .guest-input-group {
    margin-bottom: 32px;
  }

  .guest-input {
    font-size: 18px;
    padding: 10px 14px;
  }

  .guest-submit-btn {
    width: 100%;
    font-size: 18px;
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .guest-modal {
    width: calc(100vw - 24px);
    padding: 24px 18px;
  }

  .guest-modal-title {
    font-size: 56px;
  }

  .guest-modal-question {
    font-size: 18px;
  }

  .guest-modal-note {
    font-size: 14px;
  }

  .guest-input {
    font-size: 16px;
  }

  /* Nav nhỏ hơn trên màn rất hẹp */
  nav {
    padding: 12px 16px;
  }

  nav .right p {
    font-size: 14px;
  }
}

/* =============================================
   FOOTER SECTION
   ============================================= */

@media (max-width: 768px) {
  .footer-title {
    font-size: 13px;
  }

  .footer-month {
    font-size: 16px;
  }

  .dayblock-note {
    font-size: 14px;
    line-height: 18px;
    left: 19px;
    top: 29px;
  }
}

/* =============================================
   WISHES SECTION
   ============================================= */

@media (max-width: 768px) {
  .wish-paper {
    width: 180px;
    min-height: 100px;
  }

  .wish-content {
    padding: 16px 14px;
    font-size: 15px;
  }

  .wish-bookmark {
    width: 14px;
  }
}
