/* ==========================================================================
   AESTHETIC FOLDER LETTER EXPERIENCE
   Song: Jin DC - Totoong Tayo
   ========================================================================== */

:root {
  --bg-dark: #12100e;
  --bg-warm: #1e1916;
  --accent-gold: #d4a373;
  --accent-rose: #c97a7e;
  --folder-kraft-light: #e5c39c;
  --folder-kraft-mid: #cf9f6e;
  --folder-kraft-dark: #b18151;
  --paper-bg: #fffdfa;
  --paper-line: #f2ece1;
  --ink-color: #2b221d;
  --ink-muted: #6e6057;
  --tape-color: rgba(255, 255, 255, 0.45);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.25);
  --shadow-deep: 0 25px 60px rgba(0, 0, 0, 0.45);
  --transition-smooth: all 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

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

body {
  min-height: 100vh;
  width: 100%;
  background: radial-gradient(circle at 50% 25%, #2a221d 0%, #171311 60%, #0d0b0a 100%);
  color: var(--ink-color);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 40px 16px 80px;
  -webkit-font-smoothing: antialiased;
}

/* Ambient Warm Glow Orbs */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(120px);
  z-index: 1;
  opacity: 0.3;
}

.glow-top {
  top: -150px;
  left: 15%;
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, #e9b986, transparent 70%);
}

.glow-bottom {
  bottom: -150px;
  right: 15%;
  width: 650px;
  height: 650px;
  background: radial-gradient(circle, #855335, transparent 70%);
}

/* Floating Particles Canvas */
#particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 2;
}

/* ==========================================================================
   FLOATING MUSIC CONTROLLER PILL
   ========================================================================== */
.music-pill {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(35, 29, 25, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 40px;
  padding: 8px 16px 8px 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: var(--transition-smooth);
  opacity: 0.92;
  cursor: pointer;
  user-select: none;
}

.music-pill:hover {
  opacity: 1;
  transform: translateY(-2px);
  border-color: rgba(212, 163, 115, 0.45);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5);
}

.music-disc-wrapper {
  position: relative;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vinyl-disc {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at center, #252525 24%, #111 25%, #1c1c1c 45%, #2a2a2a 48%, #121212 70%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.music-pill.is-playing .vinyl-disc {
  animation: spinRecord 4s linear infinite;
}

@keyframes spinRecord {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.vinyl-center {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-gold);
  border: 2px solid #111;
}

.eq-bars {
  position: absolute;
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: 14px;
  z-index: 2;
}

.eq-bars .bar {
  width: 2.5px;
  height: 4px;
  background: #ffffff;
  border-radius: 2px;
  transition: height 0.2s ease;
}

.music-pill.is-playing .bar:nth-child(1) { animation: eqPulse 0.9s infinite ease-in-out; }
.music-pill.is-playing .bar:nth-child(2) { animation: eqPulse 1.2s infinite ease-in-out 0.2s; }
.music-pill.is-playing .bar:nth-child(3) { animation: eqPulse 0.8s infinite ease-in-out 0.4s; }
.music-pill.is-playing .bar:nth-child(4) { animation: eqPulse 1.1s infinite ease-in-out 0.1s; }

@keyframes eqPulse {
  0%, 100% { height: 4px; }
  50% { height: 14px; }
}

.music-info {
  display: flex;
  flex-direction: column;
}

.song-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.song-artist {
  font-size: 0.65rem;
  color: var(--accent-gold);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.music-btn {
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 50%;
  transition: transform 0.2s ease, color 0.2s ease;
}

.music-btn:hover {
  color: var(--accent-gold);
  transform: scale(1.15);
}

.music-pill .icon-pause { display: none; }
.music-pill .icon-play { display: block; }

.music-pill.is-playing .icon-pause { display: block; }
.music-pill.is-playing .icon-play { display: none; }

/* ==========================================================================
   SCENE CONTAINER
   ========================================================================== */
.scene {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 760px;
  margin: 30px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.folder-wrapper {
  position: relative;
  width: 100%;
  cursor: pointer;
  outline: none;
  transition: transform 0.4s ease;
}

.folder {
  position: relative;
  width: 100%;
  min-height: 480px;
  border-radius: 18px 24px 20px 20px;
}

/* Subtle Idle Floating when Closed */
.folder-wrapper:not(.is-opened):hover {
  transform: translateY(-4px);
}

.folder-wrapper:not(.is-opened) .folder {
  animation: folderFloat 4.5s ease-in-out infinite;
}

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

/* ==========================================================================
   FOLDER BACK (Stationery Folder Background)
   ========================================================================== */
.folder-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  background: linear-gradient(140deg, #e4c29b 0%, #c89868 60%, #b27f4d 100%);
  border-radius: 18px 24px 20px 20px;
  box-shadow: inset 0 2px 8px rgba(255, 255, 255, 0.4), var(--shadow-deep);
  border: 1px solid rgba(138, 93, 49, 0.35);
  z-index: 1;
  pointer-events: none;
}

/* Aesthetic Manila Tab */
.folder-tab {
  position: absolute;
  top: -34px;
  left: 40px;
  background: #e4c29b;
  padding: 8px 26px;
  border-radius: 12px 16px 0 0;
  border: 1px solid rgba(138, 93, 49, 0.35);
  border-bottom: none;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: opacity 0.5s ease;
}

.tab-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: #4a3424;
}

.tab-sub {
  font-size: 0.65rem;
  font-weight: 600;
  color: #7d593c;
  letter-spacing: 0.8px;
  border-left: 1px solid rgba(0, 0, 0, 0.2);
  padding-left: 10px;
}

/* ==========================================================================
   FOLDER FRONT COVER (Visible when Closed)
   ========================================================================== */
.folder-front {
  position: relative;
  width: 100%;
  min-height: 500px;
  background: linear-gradient(145deg, #e9c9a5 0%, #ce9f70 50%, #b58354 100%);
  border-radius: 18px 22px 20px 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), inset 0 2px 5px rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(138, 93, 49, 0.4);
  z-index: 20;
  padding: 44px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.7s;
}

.folder-front-inner {
  position: relative;
  min-height: 410px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1.5px dashed rgba(105, 68, 36, 0.35);
  border-radius: 14px;
  padding: 40px 24px;
  background: rgba(255, 255, 255, 0.05);
}

/* Washi Tape Details */
.washi-tape {
  position: absolute;
  width: 96px;
  height: 28px;
  background: rgba(255, 253, 245, 0.65);
  backdrop-filter: blur(2px);
  border-left: 3px dashed rgba(180, 160, 140, 0.45);
  border-right: 3px dashed rgba(180, 160, 140, 0.45);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  pointer-events: none;
}

.washi-top-right {
  top: -14px;
  right: 28px;
  transform: rotate(8deg);
}

.washi-bottom-left {
  bottom: -14px;
  left: 28px;
  transform: rotate(-6deg);
}

/* Paper Clip Detail */
.paper-clip {
  position: absolute;
  top: -20px;
  left: 48px;
  width: 15px;
  height: 44px;
  border: 3.5px solid #9aa0aa;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  box-shadow: 2px 4px 6px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.paper-clip::after {
  content: '';
  position: absolute;
  top: 8px;
  left: 1px;
  width: 7px;
  height: 34px;
  border: 2.5px solid #757c87;
  border-top: none;
  border-radius: 0 0 6px 6px;
}

/* Cover Typography */
.folder-stamp-box {
  margin-bottom: 32px;
}

.stamp-sub {
  display: inline-block;
  font-family: 'Special Elite', monospace, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 3px;
  color: #794d28;
  border: 1px solid rgba(121, 77, 40, 0.4);
  padding: 4px 14px;
  border-radius: 4px;
  margin-bottom: 16px;
  text-transform: uppercase;
}

.folder-title {
  font-family: 'Playfair Display', 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(2.1rem, 5.5vw, 3rem);
  font-weight: 600;
  color: #3b271a;
  letter-spacing: -0.5px;
  margin-bottom: 10px;
}

.folder-subtitle {
  font-size: 0.98rem;
  color: #694b33;
  font-style: italic;
  max-width: 440px;
  line-height: 1.5;
  margin: 0 auto;
}

/* Wax Seal & Instruction */
.seal-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.folder-wrapper:hover .seal-container {
  transform: scale(1.05);
}

.wax-seal {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #b74f46 0%, #872e26 70%, #5d1c16 100%);
  box-shadow: 0 10px 24px rgba(93, 28, 22, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 2px solid #a33e36;
}

.wax-seal::after {
  content: '';
  position: absolute;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 255, 255, 0.35);
}

.seal-icon {
  font-size: 2rem;
  color: #ffdfd8;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transform: translateY(-1px);
}

.open-instruction {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.click-tag {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: #3b271a;
  background: rgba(255, 255, 255, 0.6);
  padding: 6px 20px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.audio-hint {
  font-size: 0.74rem;
  color: #5f3e26;
  font-weight: 600;
  letter-spacing: 0.4px;
}

/* ==========================================================================
   THE LETTER (Inside the Folder)
   ========================================================================== */
.letter-sheet {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  background: var(--paper-bg);
  border-radius: 12px;
  padding: 60px 52px;
  box-shadow: var(--shadow-deep), 0 2px 5px rgba(0,0,0,0.08);
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  border: 1px solid rgba(220, 205, 185, 0.7);
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  transform: translateY(40px) scale(0.96);
}

/* Paper crease */
.paper-crease.horizontal {
  position: absolute;
  top: 32%;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.06), transparent);
  pointer-events: none;
}

/* Letter Header & Stamp */
.letter-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.postage-stamp {
  border: 2px dashed #b24d45;
  padding: 6px 14px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'Special Elite', monospace;
  color: #b24d45;
  transform: rotate(-2deg);
  background: rgba(178, 77, 69, 0.04);
}

.postage-stamp span:first-child {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.stamp-heart {
  font-size: 1.1rem;
  margin: 2px 0;
}

.postage-stamp small {
  font-size: 0.55rem;
  letter-spacing: 1px;
}

.letter-date {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.tag-confidential {
  font-size: 0.65rem;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: var(--accent-gold);
  background: #2b221d;
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.date-text {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1rem;
  color: var(--ink-muted);
  font-style: italic;
}

.letter-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(110, 96, 87, 0.25), transparent);
  margin-bottom: 36px;
}

/* Letter Typography & Message */
.letter-body {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.3rem;
  line-height: 2.0;
  color: var(--ink-color);
  letter-spacing: 0.25px;
}

.letter-opening {
  font-size: 1.75rem;
  font-weight: 600;
  color: #1e1714;
  margin-bottom: 24px;
}

.letter-body p {
  margin-bottom: 26px;
  text-align: justify;
  text-justify: inter-word;
}

.letter-closing {
  margin-top: 36px !important;
  font-weight: 600;
  color: #1a1411;
}

/* Letter Footer & Sign-off */
.letter-footer {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid rgba(110, 96, 87, 0.18);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 20px;
}

.heart-signature {
  display: flex;
  flex-direction: column;
  font-family: 'Caveat', cursive, sans-serif;
  color: #2b221d;
}

.heart-signature span:first-child {
  font-size: 1.35rem;
  color: var(--ink-muted);
}

.heart-signature .sig-name {
  font-size: 2.3rem;
  font-weight: 700;
  color: #a83d35;
  line-height: 1.1;
}

.close-folder-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(220, 205, 185, 0.35);
  border: 1px solid rgba(138, 93, 49, 0.3);
  color: #4a3424;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.close-folder-btn:hover {
  background: rgba(168, 61, 53, 0.12);
  color: #a83d35;
  border-color: rgba(168, 61, 53, 0.35);
  transform: translateY(-2px);
}

/* ==========================================================================
   STATE: WHEN FOLDER IS OPENED
   ========================================================================== */
.folder-wrapper.is-opened {
  cursor: default;
}

/* When opened, hide front flap seamlessly */
.folder-wrapper.is-opened .folder-front {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  position: absolute;
  top: 0;
  left: 0;
  transform: translateY(-25px) scale(0.95);
}

/* Letter takes normal flow and becomes fully visible */
.folder-wrapper.is-opened .letter-sheet {
  position: relative;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* The folder back expands to match the letter's height */
.folder-wrapper.is-opened .folder-back {
  box-shadow: var(--shadow-deep);
}

.folder-wrapper.is-opened .folder-tab {
  opacity: 0.55;
}

/* ==========================================================================
   RESPONSIVE DESIGN (Mobile & Tablet)
   ========================================================================== */
@media (max-width: 768px) {
  body {
    padding: 20px 12px 60px;
  }

  .music-pill {
    top: 14px;
    right: 14px;
    padding: 6px 12px 6px 8px;
    gap: 8px;
  }

  .scene {
    margin: 55px auto 0;
  }

  .folder {
    min-height: 420px;
  }

  .folder-front {
    padding: 24px 16px;
    min-height: 420px;
  }

  .folder-front-inner {
    padding: 24px 12px;
    min-height: 350px;
  }

  .folder-tab {
    left: 20px;
    padding: 6px 16px;
  }

  .tab-sub {
    display: none;
  }

  .letter-sheet {
    padding: 36px 20px;
  }

  .letter-body {
    font-size: 1.15rem;
    line-height: 1.85;
  }

  .letter-opening {
    font-size: 1.45rem;
  }

  .letter-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .close-folder-btn {
    align-self: flex-end;
  }
}
