/* ========================================
   Birthday Web — Style Sheet
   Surprise Edition: Start → Reveal
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400;1,600&display=swap');

/* ---------- Custom Properties ---------- */
:root {
  --color-bg: #0d0b08;
  --color-bg-warm: #1a1610;
  --color-surface: rgba(255, 248, 235, 0.06);
  --color-surface-hover: rgba(255, 248, 235, 0.1);
  --color-gold: #d4a853;
  --color-gold-light: #f0d890;
  --color-gold-dark: #a07830;
  --color-cream: #fef8eb;
  --color-cream-muted: #e8dcc8;
  --color-text: #fef8eb;
  --color-text-muted: rgba(254, 248, 235, 0.6);
  --color-border: rgba(212, 168, 83, 0.25);
  --color-error: #e06050;

  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  --shadow-soft: 0 4px 30px rgba(212, 168, 83, 0.08);
  --shadow-glow: 0 0 40px rgba(212, 168, 83, 0.15);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(212, 168, 83, 0.1);

  --transition-fast: 0.2s ease;
  --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ---------- Background Patterns ---------- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 20% 30%, rgba(212, 168, 83, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 500px 500px at 80% 70%, rgba(212, 168, 83, 0.04) 0%, transparent 70%),
    radial-gradient(ellipse 800px 300px at 50% 100%, rgba(160, 120, 48, 0.05) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ---------- Particles Background ---------- */
#particles-container {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--color-gold);
  border-radius: 50%;
  opacity: 0;
  animation: particle-float 8s infinite ease-in-out;
}

@keyframes particle-float {
  0% { opacity: 0; transform: translateY(100vh) scale(0); }
  10% { opacity: 0.6; }
  90% { opacity: 0.6; }
  100% { opacity: 0; transform: translateY(-10vh) scale(1); }
}

/* ---------- App Container ---------- */
.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

/* ---------- Page Transitions ---------- */
.page {
  display: none;
  width: 100%;
  max-width: 560px;
  animation: page-enter 0.8s var(--transition-smooth) forwards;
}

.page.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ---------- Start Page (Surprise Entry) ---------- */
.start-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  max-width: 420px;
  background: var(--color-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 56px 40px 48px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.start-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-gold-light), transparent);
  opacity: 0.4;
}

.start-emoji {
  font-size: 56px;
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

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

.start-title {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--color-gold-light);
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.start-subtitle {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-top: 8px;
  font-weight: 300;
  line-height: 1.6;
}

/* ---------- Form ---------- */
.form-group {
  margin-bottom: 24px;
  width: 100%;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-cream-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  text-align: left;
}

.form-group input {
  width: 100%;
  padding: 14px 18px;
  background: rgba(255, 248, 235, 0.04);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1rem;
  transition: all var(--transition-fast);
  outline: none;
  text-align: center;
}

.form-group input::placeholder {
  color: var(--color-text-muted);
  font-weight: 300;
}

.form-group input:focus {
  border-color: var(--color-gold);
  background: rgba(255, 248, 235, 0.07);
  box-shadow: 0 0 0 3px rgba(212, 168, 83, 0.12);
}

.form-group input.error {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(224, 96, 80, 0.12);
}

.form-error {
  font-size: 0.78rem;
  color: var(--color-error);
  margin-top: 6px;
  display: none;
  text-align: center;
}

.form-error.visible {
  display: block;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-smooth);
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-gold), var(--color-gold-dark));
  color: var(--color-bg);
  width: 100%;
  padding: 16px 32px;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: var(--radius-md);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--color-gold-light), var(--color-gold));
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(212, 168, 83, 0.35);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-icon {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-gold-light);
  border: 1px solid var(--color-border);
  font-size: 1.2rem;
  backdrop-filter: blur(10px);
}

.btn-icon:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-gold);
  transform: scale(1.05);
}

/* ---------- Reveal Page ---------- */
#reveal-page {
  text-align: center;
}

.reveal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.reveal-wreath {
  width: 220px;
  height: 220px;
  object-fit: contain;
  opacity: 0;
  animation: reveal-zoom 1.2s 0.3s ease-out forwards;
}

@keyframes reveal-zoom {
  from {
    opacity: 0;
    transform: scale(0.5) rotate(-10deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.reveal-greeting {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  opacity: 0;
  animation: fade-up 0.8s 0.8s ease-out forwards;
}

.reveal-name {
  font-family: var(--font-serif);
  font-size: 3rem;
  font-weight: 700;
  color: var(--color-gold-light);
  line-height: 1.1;
  opacity: 0;
  animation: fade-up 0.8s 1.1s ease-out forwards;
}

.reveal-message {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--color-cream-muted);
  max-width: 420px;
  line-height: 1.7;
  opacity: 0;
  animation: fade-up 0.8s 1.5s ease-out forwards;
  margin-top: 12px;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reveal-controls {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  opacity: 0;
  animation: fade-up 0.6s 2s ease-out forwards;
}

/* Audio control button */
.audio-btn {
  position: relative;
}

.audio-btn .audio-wave {
  display: flex;
  gap: 2px;
  align-items: center;
  height: 20px;
}

.audio-btn .audio-wave span {
  display: block;
  width: 3px;
  background: var(--color-gold-light);
  border-radius: 2px;
  animation: wave 1s ease-in-out infinite;
}

.audio-btn .audio-wave span:nth-child(1) { height: 8px; animation-delay: 0s; }
.audio-btn .audio-wave span:nth-child(2) { height: 14px; animation-delay: 0.15s; }
.audio-btn .audio-wave span:nth-child(3) { height: 10px; animation-delay: 0.3s; }
.audio-btn .audio-wave span:nth-child(4) { height: 16px; animation-delay: 0.45s; }

@keyframes wave {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.4); }
}

.audio-btn.muted .audio-wave span {
  animation: none;
  height: 3px !important;
  opacity: 0.4;
}

/* ---------- Confetti Canvas ---------- */
#confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
}

/* ---------- Divider ---------- */
.divider {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
  margin: 20px auto;
  opacity: 0.5;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .app {
    padding: 16px;
  }

  .start-container {
    padding: 40px 24px 36px;
    border-radius: var(--radius-lg);
  }

  .start-title {
    font-size: 2rem;
  }

  .start-subtitle {
    font-size: 0.88rem;
  }

  .reveal-name {
    font-size: 2.2rem;
  }

  .reveal-message {
    font-size: 0.95rem;
  }

  .reveal-wreath {
    width: 160px;
    height: 160px;
  }
}

@media (min-width: 768px) {
  .start-title {
    font-size: 2.8rem;
  }

  .reveal-name {
    font-size: 3.6rem;
  }
}

/* ---------- Utility ---------- */
.hidden {
  display: none !important;
}
