/* 
  Gentle Booth - Stylesheet
  Premium Vintage Aesthetics, grid paper patterns, and elegant transitions.
*/

:root {
  --bg-color: #FFFFFF; /* Warm vintage paper background */
  --grid-line-color: #B7A8A1; /* Soft graph paper grid */
  --primary-text: #1a1a1a;
  --secondary-text: #666666;
  --border-color: #1a1a1a;
  --card-bg: #ffffff;
  
  /* Envelope Palette */
  --env-base: #ccd7e2;
  --env-flap: #bdcad9;
  --env-pocket: #d9e3ec;
  --env-shadow: rgba(43, 62, 80, 0.12);
  --wax-color: #eae3d2;
  --wax-shadow: rgba(64, 54, 44, 0.15);
  
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Prompt';
  background-color: var(--bg-color);
  background-image: 
    linear-gradient(var(--grid-line-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line-color) 1px, transparent 1px);
  background-size: 30px 30px;
  color: var(--primary-text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

/* 1. Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  background-image: 
    linear-gradient(var(--grid-line-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line-color) 1px, transparent 1px);
  background-size: 30px 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.8s cubic-bezier(0.77, 0, 0.175, 1), 
              visibility 0.8s cubic-bezier(0.77, 0, 0.175, 1);
}

.loading-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-content {
  animation: pulseLogo 2s infinite ease-in-out;
}

@keyframes pulseLogo {
  0% { transform: scale(0.98); opacity: 0.95; }
  50% { transform: scale(1.02); opacity: 1; }
  100% { transform: scale(0.98); opacity: 0.95; }
}

.scallop-svg {
  width: 160px;
  height: 160px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.05));
}

/* 2. Main Mobile Wrapper */
.main-container {
  width: 100%;
  max-width: 720px;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  min-height: 100vh;
}

.main-container.blurred {
  filter: blur(6px);
  transition: filter 0.5s ease;
}

/* 3. Header Section */
.header {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
  text-align: center;
}

.logo-area {
  width: 100%;
  max-width: 320px;
  margin-bottom: -15px;
}

.logo-svg {
  width: 100%;
  height: auto;
}

.logo-gentle {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 40px;
  fill: var(--primary-text);
  text-anchor: middle;
  font-weight: 400;
}

.logo-booth-b, .logo-booth-th {
  font-family: 'Playfair Display', serif;
  font-size: 48px;
  fill: var(--primary-text);
  font-weight: 700;
}

.subtitle-badge {
  position: relative; /* เพิ่มบรรทัดนี้ */
  border: 1px solid var(--border-color);
  border-radius: 50px;
  padding: 10px 18px;
  font-size: 12px;
  font-weight: 600;
  /* text-transform: uppercase; */
  letter-spacing: 0.8px;
  background-color: var(--card-bg);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
  /* max-width: 100%; */
  margin-top: -25px;
  width: fit-content;
  max-width: none;
  white-space: nowrap;
  background-color: #FFFBF9;
  border: 1px solid #000000;
  color: #000000;
  width: 360px;       /* กำหนดขนาดคงที่ */
  height: 35px;       /* กำหนดความสูงคงที่ */
}

/* ข้อความทั้งสองซ้อนกัน */
.default-text,
.hover-text {
  position: absolute;

  left: 50%;
  top: 50%;

  transform: translate(-50%, -50%);

  white-space: nowrap;

  transition: opacity .3s ease;
}

.default-text {
  opacity: 1;
}

.hover-text {
  opacity: 0;
}

/* Hover */
.subtitle-badge:hover {
  background: #B7A8A1;
  color: #fff;
}

.subtitle-badge:hover .default-text {
  opacity: 0;
}

.subtitle-badge:hover .hover-text {
  opacity: 1;
}

/* 4. Envelope Overlay (Foreground Modal) */
.envelope-overlay {
  position: absolute;
  top: 140px;
  left: 0;
  width: 100%;
  height: calc(100% - 140px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 50px;
  z-index: 999;
  pointer-events: auto;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  filter: none !important;
  backdrop-filter: none !important;
}


.envelope-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.envelope-container {
  position: relative;
  perspective: 1000px;
}

/* 5. Envelope Interactive Element */
.envelope {
  position: relative;
  width: 320px;
  height: 200px;
  background-color: var(--env-base);
  border-radius: 6px;
  box-shadow: 0 12px 36px var(--env-shadow);
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.envelope:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 44px var(--env-shadow);
}

/* Envelope Flap (Top) */
.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--env-flap);
  clip-path: polygon(0 0, 50% 52%, 100% 0);
  z-index: 3;
  transform-origin: top;
  border-radius: 6px 6px 0 0;
  transition: transform 0.5s ease, z-index 0.3s;
}

/* Envelope Pocket (Inside layers) */
.envelope-pocket {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--env-pocket);
  clip-path: polygon(0 40%, 50% 72%, 100% 40%, 100% 100%, 0 100%);
  z-index: 2;
  border-radius: 0 0 6px 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.envelope-pocket::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background-color: #c2cfdd;
  clip-path: polygon(0 0, 48% 66%, 0 100%);
}

.envelope-pocket::after {
  content: '';
  position: absolute;
  top: 0; right: 0; width: 100%; height: 100%;
  background-color: #c2cfdd;
  clip-path: polygon(100% 0, 52% 66%, 100% 100%);
}

/* Celebration Card (Letter inside) */
.celebration-card {
  position: absolute;
  bottom: 6px;
  left: 10px;
  width: 300px;
  height: 188px;
  background-color: #fffefb; /* Paper cream */
  border-radius: 4px;
  z-index: 1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.15), z-index 0.3s;
  border: 1px dashed rgba(64, 54, 44, 0.15);
  overflow: hidden;
}

.card-paper-texture {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background-image: radial-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px);
  background-size: 8px 8px;
  opacity: 0.5;
  pointer-events: none;
}

.card-content {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
  align-items: center;
  text-align: center;
}

.card-title-sub {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 16px;
  color: #8c7f70;
  line-height: 1.2;
}

.card-title-main {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 18px;
  color: #3b3127;
  letter-spacing: 0.6px;
  margin-top: 2px;
  margin-bottom: 12px;
}

.tag-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 10px;
  width: 100%;
}

.tag {
  border: 1px solid #8c7f70;
  border-radius: 30px;
  padding: 3px 10px;
  font-size: 9px;
  font-weight: 500;
  color: #40362c;
  background-color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
}

.card-footer {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 11px;
  color: #8c7f70;
  margin-bottom: 8px;
}

/* Dismiss / View Links Button */
.dismiss-btn {
  width: 100%;
  background-color: var(--primary-text);
  color: #ffffff;
  border: none;
  border-radius: 20px;
  padding: 7px 12px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.2s ease, transform 0.1s ease;
  opacity: 0; /* Hidden initially, fades in when card slides up */
  pointer-events: none;
}

.dismiss-btn svg {
  transition: transform 0.2s ease;
}

.dismiss-btn:hover {
  background-color: #333333;
}

.dismiss-btn:hover svg {
  transform: translateX(3px);
}

/* Wax Seal */
.wax-seal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -40%);
  width: 52px;
  height: 52px;
  z-index: 5;
  transition: opacity 0.3s ease, transform 0.4s ease;
}

.seal-wax-body {
  width: 100%;
  height: 100%;
  background-color: var(--wax-color);
  border-radius: 48% 52% 50% 50% / 50% 48% 52% 50%;
  box-shadow: 0 4px 10px var(--wax-shadow),
              inset 0 -3px 6px rgba(0,0,0,0.08),
              inset 0 3px 6px rgba(255,255,255,0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  border: 1px solid rgba(0,0,0,0.04);
}

.seal-heart {
  width: 22px;
  height: 22px;
  fill: #8c7e6c;
  opacity: 0.75;
  filter: drop-shadow(0 -1px 1px rgba(255,255,255,0.4)) 
          drop-shadow(0 1px 1px rgba(0,0,0,0.15));
}

.seal-shine {
  position: absolute;
  top: 10%;
  left: 15%;
  width: 12px;
  height: 6px;
  background-color: rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  transform: rotate(-30deg);
  pointer-events: none;
}

/* Click Hint underneath wax seal */
.click-hint {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #3b4d5e;
  background-color: rgba(255,255,255,0.8);
  padding: 3px 8px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  white-space: nowrap;
  animation: bounceHint 1.5s infinite ease-in-out;
}

@keyframes bounceHint {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -4px); }
}

/* 6. Envelope Open Animation Classes */
.envelope.open .envelope-flap {
  transform: rotateX(180deg);
  z-index: 1; /* Moves behind the card */
}

.envelope.open .celebration-card {
  transform: translateY(-135px) scale(1.06) rotate(-2deg);
  z-index: 5;
  box-shadow: 0 16px 36px rgba(43, 62, 80, 0.16);
}

.envelope.open .wax-seal {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -20%) scale(0.8);
}

.envelope.open .dismiss-btn {
  opacity: 1;
  pointer-events: auto;
  margin-top: 8px;
}

/* 7. Links Section (Main List) */
.links-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: filter 0.6s cubic-bezier(0.16, 1, 0.3, 1), 
              opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);

  background: #FFFFFF; /* 🟡 พื้นขาวโปร่ง */
  backdrop-filter: blur(10px);          /* ✨ glass effect */
  -webkit-backdrop-filter: blur(10px);

  border-radius: 2px;                  /* 🟣 มุมโค้ง */
  padding: 24px;

  box-shadow: 0 4px 8px rgba(0,0,0,0.25);  
  max-width: 420px; /* จำกัดความกว้าง */
  margin: 20px auto; /* จัดกลาง */    
  margin-top: -15px;        
}

/* .links-container.blurred {
  filter: blur(6px) brightness(0.95);
  opacity: 0.4;
  pointer-events: none;
} */

/* Link Cards */
.link-card {
  display: flex;
  align-items: center;
  background-color: var(--card-bg);
  border: 1.5px solid #C7CED8;
  border-radius: 12px;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--primary-text);
  /* box-shadow: 0 4px 0px var(--primary-text); */
  transition: transform 0.2s cubic-bezier(0.25, 0.8, 0.25, 1), 
              box-shadow 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
}

.link-card:hover {
  transform: translate(-2px, -3px);
  box-shadow: 2px 7px 0px var(--primary-text);
}

.link-card:active {
  transform: translate(0, 0);
  box-shadow: 0 1px 0px var(--primary-text);
}

/* Brand Icons */
.link-icon-bg {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  border: 1.5px solid var(--border-color);
}

.link-svg {
  width: 24px;
  height: 24px;
}

/* Brand Colors */
.line-bg { background-color: #06C755; }
.instagram-bg { background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }
.tiktok-bg { background-color: #000000; }
.facebook-bg { background-color: #1877F2; }
.email-bg { background-color: #EA4335; }
.tel-bg { background-color: #34A853; }
.map-bg { background-color: #EA4335; } /* Red marker theme */

.link-info {
  flex-grow: 1;
  padding-left: 14px;
  display: flex;
  flex-direction: column;
}

.link-title {
  font-size: 14px;
  text-transform: uppercase;
  font-weight: 700;
  color: #988888;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.link-detail {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.link-chevron {
  width: 22px;
  height: 22px;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0.25;
}

.link-chevron svg {
  width: 20px;
  height: 20px;
  fill: var(--primary-text);
}

/* 8. Map Container */
.map-container {
  width: 100%;
  background-color: var(--card-bg);
  border: 1.5px solid #C7CED8;
  border-radius: 12px;
  padding: 14px;
  margin-top: 5px;
  /* box-shadow: 0 4px 0px var(--primary-text); */
}

.map-header {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
  padding-left: 2px;
}

.map-title-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-text);
  margin-bottom: 2px;
}

.map-address-label {
  font-size: 14px;
  font-weight: 500;
  color: #988888;
}

.map-iframe-wrapper {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid var(--border-color);
  height: 260px;
}

.map-iframe-wrapper iframe {
  display: block;
}

/* Responsive adjustments */
@media (max-width: 400px) {
  .main-container {
    padding: 24px 12px;
  }
  
  .envelope {
    width: 290px;
  }
  
  .envelope-flap {
    clip-path: polygon(0 0, 50% 50%, 100% 0);
  }
  
  .envelope-pocket {
    clip-path: polygon(0 40%, 50% 70%, 100% 40%, 100% 100%, 0 100%);
  }
  
  .envelope-pocket::before {
    clip-path: polygon(0 0, 48% 64%, 0 100%);
  }
  
  .envelope-pocket::after {
    clip-path: polygon(100% 0, 52% 64%, 100% 100%);
  }
  
  .celebration-card {
    width: 270px;
    height: 188px;
  }
  
  .envelope.open .celebration-card {
    transform: translateY(-130px) scale(1.03) rotate(-2deg);
  }
}

.logo_gentlebooth {
  display: flex;
  justify-content: center;
}

.logo_gentlebooth img {
  width: 260px;      /* ปรับขนาด */
  height: auto;
  transform: translateY(-30px);
  width: 500px;
  /* height: 243px; */
}

.envelope-wrapper {
  display: inline-block;
  animation: glow 2.5s ease-in-out infinite;
}

/* ปิด animation ตอนเปิด */
.envelope-wrapper.open {
  animation: none;
  filter: none !important;
  backdrop-filter: none !important;
}

/* ตัวรูป */
.envelope-image {
  width: 402px;
  height: auto;
  cursor: pointer;

  transition: transform 0.5s ease, filter 0.3s ease;
}

/* 🟡 glow (ไม่ใช้ transform แล้ว = ไม่ชน) */
@keyframes glow {
  0%, 100% {
    filter: drop-shadow(0 0 0 rgba(255,255,255,0));
  }
  50% {
    filter:
      drop-shadow(0 0 10px rgba(255,255,255,0.7))
      drop-shadow(0 0 20px rgb(248, 255, 219));
  }
}

/* 🟢 hover เด้งขึ้น */
.envelope-wrapper:hover .envelope-image {
  transform: translateY(-18px) scale(1.05);
}

/* 🔵 ตอนเปิด */
.envelope-wrapper.open .envelope-image {
  width: 420px;
  transform: translateX(2px) translateY(-50px);
}

/* ตอนซ่อน */
.envelope-wrapper.open.fade-out {
  opacity: 0;
  transform: scale(0.95);
}
.envelope-overlay {
  opacity: 1;
  transition: opacity 0.6s ease;
}

.envelope-overlay.hide {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
