/* Google Fonts loaded via <link> in each HTML for faster rendering */

@font-face {
  font-family: 'NanumPenScript';
  src: url('/fonts/NanumPenScript-Regular.ttf') format('truetype');
  font-weight: normal;
  font-display: swap;
}

/* ─── CSS Variables ─────────────────────────────────────────── */
:root {
  --bg:        #f5f0e4;
  --primary:   #c40202;
  --primary-dk:#b30a0a;
  --accent:    #c9a96e;
  --accent-lt: #e8d5a8;
  --text:      #3a0808;
  --text2:rgb(0, 0, 0);
  --text-muted:#8B4A4A;
  --white:     #fffdf8;
  --card-bg:   #fdfaf3;
  --shadow:    rgba(223,13,13,0.16);
  --radius:    18px;
  --radius-sm: 10px;
}

/* ─── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Caveat', cursive;
  overflow-x: hidden;
}

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
  font-family: 'Caveat', cursive;
  font-size: 1.35rem;
  font-weight: 700;
  border-radius: 50px;
  padding: 0.65rem 2.2rem;
  cursor: pointer;
  border: 3.5px solid var(--primary);
  transition: transform 0.15s, box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
}

.btn:active { transform: scale(0.96); }

.btn-filled {
  background: var(--primary);
  color: var(--white);
  box-shadow: 4px 5px 0 var(--primary-dk);
}

.btn-filled:hover {
  transform: translateY(-2px);
  box-shadow: 4px 7px 0 var(--primary-dk);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  box-shadow: 3px 4px 0 var(--primary);
}

.btn-outline:hover {
  background: var(--accent-lt);
  transform: translateY(-2px);
  box-shadow: 3px 6px 0 var(--primary);
}

.btn-stamp {
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  font-weight: 600;
  background: var(--accent-lt);
  color: var(--primary);
  border: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 0.4rem 1.1rem;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-stamp:hover { background: var(--accent); transform: translateY(-1px); }
.btn-stamp:active { transform: scale(0.96); }

/* ─── Back Button ─────────────────────────────────────────────── */
.back-btn {
  position: fixed;
  top: 1.4rem;
  left: 1.4rem;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--card-bg);
  color: var(--primary);
  font-family: 'NanumPenScript', cursive;
  font-size: 1.3rem;
  text-decoration: none;
  border: 3px solid var(--primary);
  border-radius: 50px;
  padding: 0.35rem 1.1rem 0.35rem 0.7rem;
  box-shadow: 3px 4px 0 var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
  opacity: 0;
  animation: fade-in-back 0.5s 0.5s ease forwards;
}

.back-btn:hover {
  transform: translateY(-2px);
  box-shadow: 3px 6px 0 var(--shadow);
}

.back-btn svg {
  width: 18px;
  height: 18px;
}

@keyframes fade-in-back {
  to { opacity: 1; }
}

/* ─── Doodle Canvas ──────────────────────────────────────────── */
.doodle-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.doodle-layer svg.doodle {
  position: absolute;
}

/* Hand-drawn stroke animation: dashoffset draw-in */
.doodle-layer svg.doodle path,
.doodle-layer svg.doodle rect,
.doodle-layer svg.doodle circle {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: draw-stroke 2.2s ease forwards, gentle-float 6s ease-in-out infinite;
  animation-delay: var(--d, 0s), calc(var(--d, 0s) + 2.2s);
}

@keyframes draw-stroke {
  to { stroke-dashoffset: 0; }
}

@keyframes gentle-float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25%      { transform: translate(1px, -2px) rotate(0.8deg); }
  50%      { transform: translate(-1px, 1.5px) rotate(-0.5deg); }
  75%      { transform: translate(1.5px, 1px) rotate(0.6deg); }
}

/* ─── Page Wrapper ───────────────────────────────────────────── */
.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ─── Gift Menu Card ─────────────────────────────────────────── */
.menu-card {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  background: var(--card-bg);
  border: 3.5px solid var(--primary);
  border-radius: var(--radius);
  padding: 1.1rem 1.4rem;
  box-shadow: 5px 6px 0 var(--shadow);
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.2s, box-shadow 0.2s;
}

.menu-card:hover {
  transform: translateY(-4px) rotate(-0.5deg);
  box-shadow: 7px 10px 0 var(--shadow);
}

.menu-card-icon {
  width: 110px;
  height: 110px;
  min-width: 110px;
  border: none;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  overflow: hidden;
}

.menu-card-icon img {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.menu-card-icon .icon-emoji {
  font-size: 3rem;
  line-height: 1;
}

.menu-card-title {
  font-family: 'NanumPenScript', cursive;
  font-size: 1.6rem;
  color: var(--primary);
  margin-bottom: 0.3rem;
  line-height: 1.2;
}

.menu-card-desc {
  font-family: 'Caveat', cursive;
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ─── Lock Cards ─────────────────────────────────────────────── */
.lock-card {
  background: var(--card-bg);
  border: 3.5px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: 5px 6px 0 var(--shadow);
  width: 200px;
  height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.18s;
  position: relative;
  overflow: hidden;
}

.lock-card:hover { transform: translateY(-3px) rotate(0.5deg); }
.lock-card:active { transform: scale(0.97); }

.lock-face, .unlock-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.35s, transform 0.35s;
  padding: 1rem;
}

.unlock-face {
  opacity: 0;
  transform: scale(0.92);
  background: var(--white);
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  color: var(--text);
  text-align: center;
  line-height: 1.5;
  padding: 1.2rem;
}

.lock-card.unlocked .lock-face {
  opacity: 0;
  transform: scale(0.92);
}

.lock-card.unlocked .unlock-face {
  opacity: 1;
  transform: scale(1);
}

.lock-label {
  font-family: 'Caveat', cursive;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-top: 0.5rem;
  line-height: 1.3;
}

.unlock-face::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    transparent,
    transparent 23px,
    #d4c4a0 24px
  );
  opacity: 0.35;
  pointer-events: none;
}

.unlock-message {
  position: relative;
  z-index: 1;
  font-family: 'Caveat', cursive;
  font-size: 1.05rem;
  color: var(--text);
  text-align: center;
  line-height: 1.6;
}

/* ─── Polaroid ───────────────────────────────────────────────── */
.polaroid {
  background: var(--white);
  border: 3px solid #d4c8b0;
  box-shadow: 3px 4px 14px rgba(0,0,0,0.14);
  padding: 8px 8px 40px;
  display: inline-block;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
  user-select: none;
}

.polaroid.dragging {
  box-shadow: 8px 12px 28px rgba(0,0,0,0.25);
  z-index: 100 !important;
  cursor: grabbing;
}

.polaroid:hover {
  box-shadow: 6px 8px 22px rgba(0,0,0,0.2);
  z-index: 10 !important;
}

.polaroid img, .polaroid .photo-placeholder {
  width: 180px;
  height: 150px;
  object-fit: cover;
  display: block;
  cursor: grab;
}

.photo-placeholder {
  background: var(--accent-lt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 2.5rem;
}

.polaroid-caption {
  font-family: 'Caveat', cursive;
  font-size: 0.9rem;
  color: var(--primary);
  text-align: center;
  margin-top: 4px;
  line-height: 1.3;
  position: absolute;
  bottom: 6px;
  left: 8px;
  right: 8px;
}

.polaroid-tape {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 38px;
  height: 16px;
  background: var(--primary);
  opacity: 0.7;
  border-radius: 2px;
}

/* ─── Footer ─────────────────────────────────────────────────── */
.footer {
  text-align: center;
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  color: var(--text-muted);
  padding: 1.5rem 1rem;
}

/* ─── Dashed Divider ─────────────────────────────────────────── */
.divider-dash {
  border: none;
  border-top: 3.5px dashed var(--primary);
  opacity: 0.4;
  margin: 0.5rem 0 1.5rem;
}

/* ─── Animations ─────────────────────────────────────────────── */
@keyframes jiggle {
  0%,100% { transform: rotate(0deg); }
  20%      { transform: rotate(-8deg) scale(1.05); }
  40%      { transform: rotate(8deg) scale(1.05); }
  60%      { transform: rotate(-5deg); }
  80%      { transform: rotate(5deg); }
}

.jiggle { animation: jiggle 0.55s ease; }

@keyframes float-in {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.float-in { animation: float-in 0.6s ease forwards; }

@keyframes pulse-heart {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}
