/* ==========================================================================
   Maddie & Radek Reunited Countdown - Stylesheet
   Mobile-First, Glassmorphism, Premium Aesthetics
   ========================================================================== */

/* CSS Custom Properties */
:root {
  --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  
  --color-accent: #ff5e8e;
  --color-accent-glow: rgba(255, 94, 142, 0.4);
  --color-gold: #ffd166;
  --color-text-main: #ffffff;
  --color-text-muted: rgba(255, 255, 255, 0.85);
  --color-text-dim: rgba(255, 255, 255, 0.65);
  
  --glass-bg: rgba(18, 20, 32, 0.45);
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-border-hover: rgba(255, 255, 255, 0.35);
  --glass-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  --card-blur: blur(20px) saturate(160%);
  
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  
  --transition-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  font-family: var(--font-primary);
  background-color: #0b0d17;
  color: var(--color-text-main);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Background Image & Overlay Setup */
.bg-wrapper {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: #080a12;
}

/* Fullscreen Blurred Background to fill side areas on wide screens */
.bg-blurred {
  position: absolute;
  inset: -30px;
  width: calc(100% + 60px);
  height: calc(100% + 60px);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center 25%;
  filter: blur(40px) brightness(0.4) saturate(130%);
  pointer-events: none;
}

/* Center Container for the constrained main photo */
.bg-image-container {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 680px; /* Photo stops expanding at 680px width */
  height: 100%;
  overflow: hidden;
  box-shadow: 0 0 100px rgba(0, 0, 0, 0.9), 0 0 2px rgba(255, 255, 255, 0.15);
  pointer-events: none;
}

.bg-image {
  width: 100%;
  height: 100%;
  background-repeat: no-repeat;
  background-size: cover;
  /* Frame Maddie and Radek's faces nicely */
  background-position: center 25%;
  filter: brightness(0.92) contrast(1.05);
  animation: subtleZoom 25s infinite alternate ease-in-out;
}

@keyframes subtleZoom {
  0% { transform: scale(1.02) translateY(0); }
  100% { transform: scale(1.06) translateY(-6px); }
}

.bg-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: 
    linear-gradient(to bottom, 
      rgba(11, 13, 23, 0.5) 0%, 
      rgba(11, 13, 23, 0.2) 35%, 
      rgba(11, 13, 23, 0.75) 75%, 
      rgba(11, 13, 23, 0.95) 100%),
    radial-gradient(circle at 50% 30%, transparent 20%, rgba(0, 0, 0, 0.45) 90%);
  pointer-events: none;
}

.particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

/* Confetti Canvas */
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 100;
}

/* Main Container Layout */
.container {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  min-height: 100dvh;
  padding: clamp(16px, 4vh, 40px) clamp(16px, 5vw, 32px);
  padding-top: max(clamp(16px, 4vh, 40px), env(safe-area-inset-top));
  padding-bottom: max(clamp(16px, 4vh, 40px), env(safe-area-inset-bottom));
}

.content-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  max-width: 680px;
  margin: auto;
  padding: 10px;
}

/* Location Badge */
.location-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: var(--card-blur);
  -webkit-backdrop-filter: var(--card-blur);
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  margin-bottom: clamp(16px, 3vh, 28px);
  animation: fadeInDown 0.8s var(--transition-smooth);
}

.heart-pulse {
  display: inline-block;
  font-size: 0.95rem;
  animation: heartPulse 1.8s infinite ease-in-out;
}

@keyframes heartPulse {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.28); }
  30% { transform: scale(1); }
  45% { transform: scale(1.18); }
}

/* Title & Subtitle */
.title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 4.8vw, 2.85rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text-main);
  text-shadow: 0 4px 25px rgba(0, 0, 0, 0.7), 0 2px 4px rgba(0, 0, 0, 0.5);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
  animation: fadeInUp 0.9s var(--transition-smooth);
}

@media (min-width: 680px) {
  .title {
    white-space: nowrap; /* Single line when container is 680px wide or larger */
  }
}

.subtitle {
  font-size: clamp(0.95rem, 3.2vw, 1.15rem);
  font-weight: 400;
  color: var(--color-text-muted);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  margin-bottom: clamp(24px, 4.5vh, 40px);
  animation: fadeInUp 1s var(--transition-smooth);
}

/* Countdown Grid - Designed specifically for mobile & desktop */
.countdown-section {
  width: 100%;
  margin-bottom: clamp(24px, 4vh, 36px);
}

.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(8px, 2.5vw, 16px);
  width: 100%;
}

/* Countdown Cards */
.time-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--card-blur);
  -webkit-backdrop-filter: var(--card-blur);
  border-radius: clamp(14px, 3vw, var(--radius-lg));
  padding: clamp(12px, 3vh, 24px) clamp(6px, 2vw, 16px);
  box-shadow: var(--glass-shadow), inset 0 1px 1px rgba(255, 255, 255, 0.2);
  transition: transform 0.3s var(--transition-smooth), border-color 0.3s ease, box-shadow 0.3s ease;
  animation: fadeInUp 1.1s var(--transition-smooth);
  user-select: none;
}

.time-card:hover {
  transform: translateY(-4px);
  border-color: var(--glass-border-hover);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 255, 255, 0.1);
}

.time-value-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(38px, 7vw, 64px);
}

.time-value {
  font-family: var(--font-primary);
  font-size: clamp(1.65rem, 6.5vw, 3.2rem);
  font-weight: 700;
  line-height: 1;
  color: #ffffff;
  text-shadow: 0 2px 15px rgba(255, 255, 255, 0.3);
  letter-spacing: -0.02em;
  transition: transform 0.15s ease-out, color 0.15s ease-out;
}

.time-value.tick {
  animation: popTick 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popTick {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); color: var(--color-gold); }
  100% { transform: scale(1); color: #ffffff; }
}

.time-label {
  font-size: clamp(0.7rem, 2.2vw, 0.85rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-dim);
  margin-top: 6px;
}

/* Celebration Box */
.celebration-box {
  background: rgba(255, 94, 142, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.4);
  backdrop-filter: var(--card-blur);
  -webkit-backdrop-filter: var(--card-blur);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: 0 20px 50px rgba(255, 94, 142, 0.3);
  margin-bottom: 24px;
  animation: pulseCelebration 2s infinite ease-in-out;
}

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

.celebration-title {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  color: #ffffff;
  margin-bottom: 8px;
}

.celebration-text {
  font-size: 1.1rem;
  color: var(--color-gold);
  font-weight: 500;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Floating Heart Animation created dynamically via JS */
.floating-heart {
  position: fixed;
  pointer-events: none;
  z-index: 99;
  font-size: clamp(1.2rem, 4vw, 2rem);
  animation: floatUp 2.5s ease-out forwards;
}

@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translateY(0) scale(0.6) rotate(0deg);
  }
  50% {
    opacity: 0.9;
    transform: translateY(-100px) scale(1.2) rotate(15deg);
  }
  100% {
    opacity: 0;
    transform: translateY(-220px) scale(0.8) rotate(-20deg);
  }
}

/* Extra Small Screens (Phone Optimization) */
@media (max-width: 420px) {
  .countdown-grid {
    gap: 6px;
  }
  
  .time-card {
    padding: 10px 4px;
    border-radius: 12px;
  }
  
  .time-value {
    font-size: 1.55rem;
  }
  
  .time-label {
    font-size: 0.65rem;
    margin-top: 4px;
  }

  .action-btn {
    padding: 10px 18px;
    font-size: 0.88rem;
  }
}

/* Tablet / Desktop enhancements */
@media (min-width: 768px) {
  .bg-image {
    background-position: center 30%;
  }

  .content-card {
    max-width: 680px;
  }
}
