/* ═══════════════════════════════════════════════════════
   TIKA'S 22ND BIRTHDAY — style.css
   Ocean Soft Theme — FIXED v2
   ═══════════════════════════════════════════════════════ */

/* ── TOKENS ──────────────────────────────────────────── */
:root {
  --bg:        #f0f7f4;
  --primary:   #7ec8c8;
  --accent:    #a8d5ba;
  --text:      #2d4a3e;
  --highlight: #b8dfe8;
  --white:     #ffffff;
  --shadow:    rgba(45, 74, 62, 0.12);
  --shadow-md: rgba(45, 74, 62, 0.18);

  --ff-head: 'Playfair Display', Georgia, serif;
  --ff-body: 'Lato', sans-serif;

  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 32px;
  --transition: 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  width: 100%;
  height: 100%;
  /* FIXED: removed overflow:hidden from html so screen4 can scroll */
}

body {
  width: 100%;
  height: 100%;
  overflow: hidden; /* hidden on body only, screen4 overrides this */
  background: var(--bg);
  color: var(--text);
  font-family: var(--ff-body);
  -webkit-font-smoothing: antialiased;
}

/* ── SCREENS ─────────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  z-index: 1;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
  z-index: 2;
}
.screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* ── MUTE BUTTON ─────────────────────────────────────── */
.mute-btn {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 999;
  background: var(--white);
  border: 2px solid var(--highlight);
  border-radius: 50%;
  width: 48px; height: 48px;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 2px 12px var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.mute-btn:hover { transform: scale(1.1); box-shadow: 0 4px 18px var(--shadow-md); }
.mute-btn.hidden { display: none; }

/* ════════════════════════════════════════════════════════
   SCREEN 1 — LOADING / COUNTER
   ════════════════════════════════════════════════════════ */
.screen1-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  padding: 40px 24px 60px;
  position: relative;
  overflow: hidden;
}

/* Floating background bubbles */
.bubble-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.bb {
  position: absolute;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.08;
  animation: bbFloat linear infinite;
}
.bb1 { width: 180px; height: 180px; left: -60px; top: 10%;  animation-duration: 14s; animation-delay: 0s; }
.bb2 { width: 120px; height: 120px; right: -30px; top: 30%; animation-duration: 18s; animation-delay: -3s; }
.bb3 { width: 80px;  height: 80px;  left: 15%;  bottom: 20%; animation-duration: 12s; animation-delay: -6s; }
.bb4 { width: 200px; height: 200px; right: -80px; bottom: -40px; animation-duration: 20s; animation-delay: -2s; }
.bb5 { width: 60px;  height: 60px;  left: 50%;  top: 5%;  animation-duration: 10s; animation-delay: -8s; }
.bb6 { width: 100px; height: 100px; left: 30%;  bottom: 5%; animation-duration: 16s; animation-delay: -4s; }

@keyframes bbFloat {
  0%   { transform: translateY(0px) scale(1); }
  50%  { transform: translateY(-30px) scale(1.05); }
  100% { transform: translateY(0px) scale(1); }
}

.s1-label {
  font-family: var(--ff-body);
  font-size: clamp(11px, 3vw, 13px);
  font-weight: 300;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 12px;
  opacity: 0.8;
}

.count-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.counter-num {
  font-family: var(--ff-head);
  font-size: clamp(100px, 28vw, 200px);
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--text) 40%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: transform 0.1s;
  user-select: none;
}

.narrative-text {
  font-family: var(--ff-head);
  font-style: italic;
  font-size: clamp(15px, 4vw, 20px);
  color: var(--text);
  opacity: 0.7;
  text-align: center;
  margin-top: 16px;
  min-height: 3em; /* FIXED: taller min-height agar teks tidak loncat layout */
  padding: 0 24px;
  transition: opacity 0.35s ease;
  max-width: 420px;
  line-height: 1.6;
}
.narrative-text.changing { opacity: 0; }

/* Progress bar */
.progress-bar-wrap {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 5px;
  background: rgba(126, 200, 200, 0.2);
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.15s linear;
  border-radius: 0 3px 3px 0;
}

/* ════════════════════════════════════════════════════════
   SCREEN 2 — GIFT BOX
   ════════════════════════════════════════════════════════ */
.screen2-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 36px;
  width: 100%;
  padding: 40px 24px;
  position: relative;
  overflow: hidden;
}

.s2-hint {
  font-family: var(--ff-head);
  font-style: italic;
  font-size: clamp(16px, 4.5vw, 22px);
  color: var(--text);
  text-align: center;
  opacity: 0.85;
  max-width: 340px;
  animation: fadeInUp 0.8s ease both;
}

/* CSS Gift Box */
.gift-box {
  position: relative;
  cursor: pointer;
  animation: giftFloat 2.4s ease-in-out infinite;
  transform-origin: center bottom;
  outline: none;
}
.gift-box:focus-visible { outline: 3px solid var(--primary); border-radius: 4px; }

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

.gift-lid {
  position: relative;
  width: 160px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary) 0%, #5ab5b5 100%);
  border-radius: 8px 8px 0 0;
  margin: 0 auto;
  left: 0; right: 0;
  box-shadow: 0 -4px 12px var(--shadow);
  transform-origin: top center;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 3;
}
.gift-lid::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0.25) 0%, transparent 100%);
}
.gift-lid-ribbon {
  position: absolute;
  left: 50%; transform: translateX(-50%);
  top: 0; bottom: 0;
  width: 22px;
  background: linear-gradient(to right, #e8a87c, #f0c090, #e8a87c);
  border-radius: 3px;
}

.gift-body {
  position: relative;
  width: 180px;
  height: 140px;
  background: linear-gradient(145deg, var(--accent) 0%, #8dc8a0 100%);
  border-radius: 0 0 16px 16px;
  box-shadow: 0 8px 32px var(--shadow-md);
  overflow: hidden;
}
.gift-body::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom right, rgba(255,255,255,0.15) 0%, transparent 50%);
  border-radius: 0 0 16px 16px;
}

.gift-ribbon-v {
  position: absolute;
  left: 50%; transform: translateX(-50%);
  top: 0; bottom: 0;
  width: 22px;
  background: linear-gradient(to right, #e8a87c, #f0c090, #e8a87c);
}
.gift-ribbon-h {
  position: absolute;
  top: 44px; left: 0; right: 0;
  height: 22px;
  background: linear-gradient(to bottom, #e8a87c, #f0c090, #e8a87c);
}

/* Bow */
.gift-bow {
  position: absolute;
  top: -22px;
  left: 50%; transform: translateX(-50%);
  width: 80px; height: 44px;
  z-index: 4;
}
.bow-left, .bow-right {
  position: absolute;
  top: 0;
  width: 34px; height: 28px;
  background: linear-gradient(135deg, #f0c090, #e8a87c);
  border-radius: 50%;
}
.bow-left  { left: 0;    transform: rotate(-20deg); }
.bow-right { right: 0;   transform: rotate(20deg); }
.bow-center {
  position: absolute;
  top: 8px; left: 50%; transform: translateX(-50%);
  width: 16px; height: 16px;
  background: #e0985a;
  border-radius: 50%;
  z-index: 5;
}

/* Lid open state */
.gift-box.opened .gift-lid {
  transform: rotateX(-110deg) translateY(-20px);
}
.gift-box.opened {
  animation: none;
}

/* Sparkle field */
.sparkle-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.sparkle {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0;
  animation: sparklePop var(--sd, 1.6s) ease-in-out var(--delay, 0s) infinite;
}
@keyframes sparklePop {
  0%   { opacity: 0; transform: scale(0) translateY(0); }
  40%  { opacity: 1; transform: scale(1.4) translateY(-8px); }
  100% { opacity: 0; transform: scale(0.3) translateY(-24px); }
}

/* Confetti */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 100;
}
.confetti-piece {
  position: absolute;
  width: 10px; height: 14px;
  top: -20px;
  border-radius: 2px;
  animation: confettiFall var(--cf-dur, 1.8s) ease-in var(--cf-delay, 0s) forwards;
}
.bubble-rise {
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--primary);
  opacity: 0;
  bottom: -30px;
  animation: bubbleRise var(--br-dur, 2s) ease-in var(--br-delay, 0s) forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg) translateX(0); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg) translateX(var(--cf-drift, 40px)); opacity: 0.2; }
}
@keyframes bubbleRise {
  0%   { transform: translateY(0); opacity: 0.7; }
  100% { transform: translateY(-110vh); opacity: 0; }
}

/* ════════════════════════════════════════════════════════
   SCREEN 3 — ENVELOPE
   ════════════════════════════════════════════════════════ */
.screen3-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  width: 100%;
  padding: 40px 24px;
}

.s3-hint {
  font-family: var(--ff-head);
  font-style: italic;
  font-size: clamp(16px, 4.5vw, 22px);
  color: var(--text);
  text-align: center;
  opacity: 0.85;
  max-width: 340px;
  animation: fadeInUp 0.8s ease both;
}

/* CSS Envelope */
.envelope {
  position: relative;
  width: clamp(260px, 70vw, 340px);
  height: clamp(180px, 48vw, 240px);
  cursor: pointer;
  animation: envFloat 3s ease-in-out infinite;
  outline: none;
}
.envelope:focus-visible { outline: 3px solid var(--primary); border-radius: 4px; }

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

.env-body {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #e8f5f0 0%, var(--white) 100%);
  border-radius: 8px;
  box-shadow: 0 12px 40px var(--shadow-md), 0 2px 8px var(--shadow);
  overflow: hidden;
}

.env-left-fold, .env-right-fold, .env-bottom-fold {
  position: absolute;
  border-style: solid;
}
.env-left-fold {
  left: 0; bottom: 0;
  border-width: 0 0 120px 130px;
  border-color: transparent transparent rgba(168,213,186,0.35) transparent;
}
.env-right-fold {
  right: 0; bottom: 0;
  border-width: 120px 0 0 130px;
  border-color: transparent transparent transparent rgba(126,200,200,0.25);
}
.env-bottom-fold {
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: rgba(126,200,200,0.4);
}

/* Flap */
.env-flap {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  z-index: 5;
  transform-origin: top center;
  transition: transform 0.7s cubic-bezier(0.34, 1.2, 0.64, 1);
  overflow: hidden;
}
.env-flap::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  border-left: 50% solid transparent;
  border-right: 50% solid transparent;
  border-top: 110px solid #d0eceb;
  filter: drop-shadow(0 3px 6px var(--shadow));
}

/* Letter inside envelope */
.env-letter {
  position: absolute;
  bottom: 10%;
  left: 10%; right: 10%;
  height: 75%;
  background: linear-gradient(to bottom, #fffef8, #f9f5e8);
  border-radius: 6px 6px 0 0;
  z-index: 2;
  transform: translateY(10%);
  transition: transform 0.8s cubic-bezier(0.34, 1.4, 0.64, 1) 0.3s;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
}
.env-letter-lines {
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.env-letter-lines span {
  display: block;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  border-radius: 2px;
  opacity: 0.5;
}
.env-letter-lines span:nth-child(2) { width: 80%; }
.env-letter-lines span:nth-child(3) { width: 60%; }

/* Opened envelope states */
.envelope.opened .env-flap {
  transform: rotateX(180deg);
}
.envelope.opened .env-letter {
  transform: translateY(-80%);
}

/* ════════════════════════════════════════════════════════
   SCREEN 4 — LETTER (FIXED)
   ════════════════════════════════════════════════════════ */
#screen4 {
  /* FIXED: override fixed positioning to allow natural scroll */
  position: fixed;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  align-items: flex-start;
  display: block; /* FIXED: block so scroll works naturally */
}

/* FIXED: wrapper fills screen and scrolls */
.letter-scroll-wrap {
  min-height: 100%;
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 40px 20px 100px;
}

.letter-card {
  background: linear-gradient(160deg, #fffef8 0%, #f6f2e8 100%);
  border-radius: var(--radius-lg);
  padding: clamp(28px, 8vw, 56px) clamp(24px, 7vw, 48px);
  max-width: 640px;
  width: 100%;
  box-shadow:
    0 2px 4px var(--shadow),
    0 8px 24px var(--shadow-md),
    0 32px 64px rgba(45,74,62,0.08),
    inset 0 1px 0 rgba(255,255,255,0.8);
  position: relative;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 27px,
      rgba(126,200,200,0.08) 27px,
      rgba(126,200,200,0.08) 28px
    ),
    linear-gradient(160deg, #fffef8 0%, #f6f2e8 100%);
  animation: fadeInUp 0.9s ease 0.2s both;
}

/* Corner fold effect */
.letter-card::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 48px; height: 48px;
  background: linear-gradient(225deg, var(--bg) 50%, rgba(168,213,186,0.3) 50%);
  border-radius: 0 0 var(--radius-lg) 0;
}

.letter-top-deco, .letter-bottom-deco {
  text-align: center;
  color: var(--primary);
  opacity: 0.5;
  font-size: 13px;
  letter-spacing: 0.1em;
  margin-bottom: 20px;
}
.letter-bottom-deco { margin-top: 28px; margin-bottom: 0; }

.letter-date {
  font-family: var(--ff-body);
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.12em;
  color: var(--primary);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.letter-title {
  font-family: var(--ff-head);
  font-size: clamp(28px, 8vw, 44px);
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  margin-bottom: 32px;
}
.letter-title em {
  font-style: italic;
  color: var(--primary);
}

.letter-body p {
  font-family: var(--ff-body);
  font-size: clamp(15px, 3.8vw, 17px);
  line-height: 1.9;
  color: var(--text);
  opacity: 0.88;
  margin-bottom: 22px;
}

.letter-closing {
  font-family: var(--ff-head);
  font-style: italic;
  font-size: clamp(17px, 4.5vw, 21px);
  font-weight: 600;
  color: var(--text);
  margin-top: 8px;
  margin-bottom: 0 !important;
}

/* Ambient hearts / bubbles */
.ambient-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.heart-particle {
  position: absolute;
  bottom: -30px;
  font-size: var(--hp-size, 16px);
  opacity: 0;
  animation: heartRise var(--hp-dur, 6s) ease-in var(--hp-delay, 0s) infinite;
  user-select: none;
}
.amb-bubble {
  position: absolute;
  bottom: -20px;
  border-radius: 50%;
  border: 1.5px solid var(--primary);
  opacity: 0;
  animation: ambBubbleRise var(--ab-dur, 7s) ease-in var(--ab-delay, 0s) infinite;
}
@keyframes heartRise {
  0%   { transform: translateY(0) scale(0.6); opacity: 0; }
  15%  { opacity: 0.7; }
  85%  { opacity: 0.4; }
  100% { transform: translateY(-105vh) scale(1.1); opacity: 0; }
}
@keyframes ambBubbleRise {
  0%   { transform: translateY(0) scale(0.5); opacity: 0; }
  15%  { opacity: 0.5; }
  100% { transform: translateY(-110vh) scale(1.2); opacity: 0; }
}

/* ════════════════════════════════════════════════════════
   SHARED ANIMATIONS
   ════════════════════════════════════════════════════════ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

/* ════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .gift-body { width: 150px; height: 120px; }
  .gift-lid  { width: 132px; }
  .gift-bow  { top: -18px; }

  .envelope {
    width: clamp(240px, 86vw, 300px);
    height: clamp(160px, 52vw, 210px);
  }

  /* FIXED: more padding bottom for mobile to avoid content cut */
  .letter-scroll-wrap { padding: 24px 16px 120px; }

  .letter-body p {
    font-size: 15px;
    line-height: 1.85;
  }
}

@media (min-width: 1024px) {
  .letter-card { padding: 64px 72px; }
   }
   
