/* Ana Lucía's 15th Birthday Invitation - Styles */

/* CSS Variables */
:root {
  /*  Color Palette */
  --primary-teal: #20b589; /* Primary */
  --dark-bg: #000000; /* Black background */
  --white: #ffffff; /* White text and elements */
  --shadow-color: rgba(47, 47, 47, 0.2);
  --scrollbar-size: 8px;

  /* Typography Scale */
  --font-xxxl: clamp(5.5rem, 10vw, 6.5rem); /* Main title */
  --font-xxl: clamp(3.5rem, 6vw, 3.5rem); /* Script headings */
  --font-xl: clamp(1.8rem, 5vw, 2.8rem); /* Section titles */
  --font-lg: clamp(1.4rem, 4vw, 2rem); /* Important content */
  --font-md: clamp(1.1rem, 3vw, 1.5rem); /* Sub-headings */
  --font-base: clamp(1rem, 2.5vw, 1.2rem); /* Regular text */
  --font-sm: clamp(0.875rem, 2vw, 1rem); /* Secondary text */
  --font-xs: clamp(0.75rem, 1.5vw, 0.875rem); /* Small text, labels */

  /* Font Weights */
  --weight-light: 300;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;

  /* Line Heights */
  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-loose: 1.8;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-xxl: 3rem;
  --space-xxxl: 4rem;

  /* Animation Timing */
  --transition-slow: 1.5s;
  --transition-medium: 0.8s;
  --transition-fast: 0.4s;
}

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

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-teal) var(--dark-bg);
}

/* Custom Scrollbar for Webkit Browsers */
::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: var(--scrollbar-size);
}

::-webkit-scrollbar-track {
  background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
  background-color: var(--primary-teal);
  border-radius: 20px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--primary-teal);
}

body {
  font-family: "Montserrat", sans-serif;
  background-color: var(--dark-bg);
  color: var(--white);
  overflow-x: hidden;
  line-height: var(--line-height-normal);
  font-weight: var(--weight-light);
  font-size: var(--font-base);
  position: relative;
}

/* Preloader Styles */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: transparent; /* Changed to transparent */
  overflow: hidden;
}

.preloader-content {
  position: relative;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.heart-container {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 102;
}

.heart-circle {
  position: absolute;
  width: 80px;
  height: 80px;
  background-color: var(--primary-teal);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: pulse 2s infinite;
}

.heart-icon {
  color: var(--dark-bg);
  font-size: 40px;
  animation: heartbeat 1.5s infinite;
}

.pulse-dots {
  position: absolute;
  width: 120px;
  height: 120px;
  animation: dotRotate 12s linear infinite;
}

.dot {
  position: absolute;
  width: 8px;
  height: 8px;
  background-color: var(--primary-teal);
  border-radius: 50%;
  opacity: 0.5;
}

.dot:nth-child(1) {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}
.dot:nth-child(2) {
  top: 14%;
  right: 14%;
}
.dot:nth-child(3) {
  top: 50%;
  right: 0;
  transform: translateY(-50%);
}
.dot:nth-child(4) {
  bottom: 14%;
  right: 14%;
}
.dot:nth-child(5) {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}
.dot:nth-child(6) {
  bottom: 14%;
  left: 14%;
}
.dot:nth-child(7) {
  top: 50%;
  left: 0;
  transform: translateY(-50%);
}
.dot:nth-child(8) {
  top: 14%;
  left: 14%;
}

/* Curtain animation */
.curtain {
  position: absolute;
  top: 0;
  height: 100%;
  width: 50%;
  background-color: var(--dark-bg);
  transition: transform 1.5s cubic-bezier(0.86, 0, 0.07, 1);
  z-index: 99; /* Below the heart container */
}

.curtain.left {
  left: 0;
  transform: translateX(0);
}

.curtain.right {
  right: 0;
  transform: translateX(0);
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.5);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 15px rgba(255, 255, 255, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
}

@keyframes heartbeat {
  0% {
    transform: scale(1);
  }
  14% {
    transform: scale(1.1);
  }
  28% {
    transform: scale(1);
  }
  42% {
    transform: scale(1.1);
  }
  70% {
    transform: scale(1);
  }
}

@keyframes dotRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Typography */
h1,
h2,
h3,
h4 {
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-md);
  font-weight: var(--weight-regular);
}

h1 {
  font-size: var(--font-xxxl);
  letter-spacing: 1px;
}

h2 {
  font-size: var(--font-md);
  letter-spacing: 0.5px;
}

h3 {
  font-size: var(--font-lg);
  letter-spacing: 0.5px;
}

p {
  margin-bottom: var(--space-md);
  line-height: var(--line-height-normal);
}

strong,
b {
  font-weight: 1000;
}

em,
i {
  font-style: italic;
}

.text-center {
  text-align: center;
}

.great-vibes {
  font-family: "Great Vibes";
  font-weight: bold;
  font-style: normal;
  text-shadow: 6px 6px 0px rgba(0, 0, 0, 0.2);
}

.teal-text {
  color: white;
  text-align: center;
  font-weight: 700;
  font-size: 0.975rem;
}

/* Script Headings */
h1.great-vibes {
  font-size: var(--font-xxxl);
}

h2.great-vibes {
  font-size: var(--font-xxl);
}

/* Video Background */
.video-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

.video-background::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.bg-video {
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  object-fit: cover;
  transition: opacity 1.5s ease-in-out;
}

/* Music Button */
.music-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--primary-teal);
  color: var(--white);
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  font-size: var(--font-md);
}

.music-toggle:hover {
  transform: scale(1.1);
  opacity: 0.9;
}

/* Echo animation for the button when playing */
.music-toggle.playing {
  animation: echo 2s infinite;
}

@keyframes echo {
  0% {
    box-shadow: 0 0 0 0 rgba(86, 157, 143, 0.7);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(86, 157, 143, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(86, 157, 143, 0);
  }
}

/* Dancing icon animation */
.dancing-icon {
  animation: dance 0.5s infinite alternate !important;
  display: inline-block !important;
  transform-origin: center;
}

/* SVG icons */
.play-icon,
.pause-icon {
  fill: var(--primary-teal); /* Default state - teal color */
  width: 24px;
  height: 24px;
  transition: fill 0.3s ease;
}

/* Change icon color to white when button is in playing state */
.play-button.playing .play-icon,
.play-button.playing .pause-icon {
  fill: var(--white);
}

@keyframes dance {
  0% {
    transform: rotate(-15deg) translateY(0);
  }
  25% {
    transform: rotate(-5deg) translateY(-2px);
  }
  50% {
    transform: rotate(0deg) translateY(-4px);
  }
  75% {
    transform: rotate(5deg) translateY(-2px);
  }
  100% {
    transform: rotate(15deg) translateY(0);
  }
}

/* Scroll Indicator */
.scroll-indicator {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  background-color: rgba(255, 255, 255, 0.1);
  z-index: 1000;
}

.scroll-indicator-progress {
  height: 100%;
  width: 0;
  background-color: var(--primary-teal);
  transition: width 0.1s ease;
}

/* Container */
.container {
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Sections */
.section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  position: relative;
}

/* Hero Section */
.section-hero {
  display: flex;
  flex-direction: column;
  position: relative;
  justify-content: space-evenly;
  gap: clamp(12rem, 5vh, 4rem);
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  margin-top: 14rem;
}

/* Date Section */
.date-section {
  position: relative;
  bottom: 20px;
  left: 0;
  right: 0;
  text-align: center;
  align-items: center;
}

.month {
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 2px;
  margin-bottom: 12px;
  text-transform: uppercase;
  text-shadow: 2px 4px 3px rgba(0, 0, 0, 0.3);
}

.date-row {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 360px;
  margin: 0;
  padding: 0 0.25rem;
}

.date-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.text {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  text-align: center;
  font-family: "Montserrat", sans-serif;
  letter-spacing: 2px;
  white-space: nowrap;
  text-shadow: 2px 4px 3px rgba(0, 0, 0, 0.3);
}

.line {
  width: 75px;
  height: 1px;
  background-color: var(--white);
}

.circle {
  background-color: var(--white);
  color: var(--dark-bg);
  font-size: 14px;
  font-weight: 900;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Lora", serif;
  margin: 0 20px;
}

.scroll-wrapper {
  position: relative;
  margin-top: -16rem;
}

.scroll-arrow {
  display: block;
  margin: 0 auto;
}

/* Countdown Section */
.gif-wrapper {
  position: relative;
  width: 90vw;
  max-width: 310px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: var(--space-xl) auto;
}

.circle-gif {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

.countdown-content {
  position: relative;
  z-index: 2;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 4.5rem;
  gap: 0.5rem;
}

.faltan-text {
  color: var(--white);
  margin-top: -60px;
  margin-bottom: 5px;
}

.countdown-timer {
  display: grid;
  grid-template-columns: repeat(7, auto);
  justify-content: center;
  align-items: baseline;
  text-align: center;
  gap: 4px;
}

.countdown-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.countdown-item span {
  display: block;
  text-align: center;
}

.countdown-item .label {
  font-size: 1rem;
  text-transform: lowercase;
  margin-top: 2px;
  color: var(--white);
  font-weight: var(--weight-semibold);
}

.countdown-text {
  margin: var(--space-xl) 0;
  font-style: italic;
  max-width: 100%;
  line-height: var(--line-height-loose);
  font-size: 0.75rem;
}

.colon {
  font-size: 16px;
  color: var(--white);
  line-height: 1;
  padding-top: 4px; /* tweak for vertical alignment with number */
}

#countdown-days,
#countdown-hours,
#countdown-minutes,
#countdown-seconds {
  font-size: 1.5rem;
  font-weight: var(--weight-semibold);
  letter-spacing: 0px;
  line-height: 1;
  margin-bottom: 4px;
  text-shadow: 3px 3px 0px rgba(29, 230, 183, 0.398);
}

/* Play button below text */
.play-button-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 20px 0;
}

.play-button {
  background-color: transparent;
  border: 2px solid var(--primary-teal);
  color: var(--primary-teal);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 24px;
  transition: all 0.3s ease;
}

.play-button:hover {
  background-color: var(--primary-teal);
  color: var(--white);
  transform: scale(1.1);
}

.play-button.playing {
  background-color: var(--primary-teal);
  color: var(--white);
  animation: echo 2s infinite;
}

/* Info Grid Section - Mobile First (Default) */
.info-grid-container {
  display: flex; /* Keep flex for mobile */
  flex-direction: column; /* Stack vertically */
  align-items: center; /* Center items horizontally */
  width: 100%;
  max-width: 500px; /* Optional: constrain max width on mobile */
  margin: 0 auto;
  gap: var(--space-xxxl); /* Add gap between items */
}

.info-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  width: 100%;
  text-align: center;
  min-height: 325px;
  box-sizing: border-box;
  overflow: hidden; /* hides overflow from bg animation */
}

.info-bg {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 325px;
  height: 325px;
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
  user-select: none;
}

.info-icon,
.info-content,
.btn {
  position: relative;
  z-index: 1; /* ensures they appear above the background */
}

.info-title {
  font-family: "Montserrat", sans-serif;
  letter-spacing: 2px;
  font-size: var(--font-md);
  font-weight: var(--weight-medium);
  color: var(--primary-teal);
}

.info-icon {
  margin-bottom: var(--space-md);
  color: var(--primary-teal);
  width: 64px;
  height: 64px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.info-icon img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.info-content {
  margin-bottom: var(--space-lg);
  flex-grow: 1; /* Allows content to take available space */
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 220px;
  margin: 0 auto;
  text-align: center;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.info-content p {
  font-size: var(--font-md);
  line-height: var(--line-height-normal);
}

/* Buttons - Standardized Size */
.info-item .btn {
  display: inline-block;
  background-color: var(--primary-teal);
  color: var(--white);
  border-radius: 1rem;
  text-decoration: none;
  font-weight: var(--weight-semibold);
  box-shadow: 0 4px 0 #c6f2d3;
  letter-spacing: 1px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: var(--font-xs);
  text-transform: none;
  text-align: center;
  width: 50%;
  box-sizing: border-box;
  margin-bottom: 2rem;
  height: 25px;
  line-height: 25px;
}

.info-item .btn:hover {
  background-color: var(--primary-teal);
  opacity: 0.9;
  transform: translateY(-2px);
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Media Query for Desktop (768px and up) */
@media (min-width: 768px) {
  .info-grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columns */
    grid-template-rows: repeat(3, auto); /* 3 rows */
    gap: var(--space-xl);
    max-width: 900px;
    padding: 0 var(--space-md);
  }

  .info-item {
    width: auto; /* Reset width for grid */
    min-height: 350px;
    font-size: 8px;
  }

  .info-title {
    font-size: var(--font-xs);
  }

  /* Explicitly set grid order using data-order attribute */
  .info-item[data-order="1"] {
    grid-area: 1 / 1 / 2 / 2;
  } /* CUANDO */
  .info-item[data-order="2"] {
    grid-area: 1 / 2 / 2 / 3;
  } /* DÓNDE */
  .info-item[data-order="3"] {
    grid-area: 2 / 1 / 3 / 2;
  } /* MÚSICA */
  .info-item[data-order="4"] {
    grid-area: 2 / 2 / 3 / 3;
  } /* REGALOS */
  .info-item[data-order="5"] {
    grid-area: 3 / 1 / 4 / 2;
  } /* FOTOS */
  .info-item[data-order="6"] {
    grid-area: 3 / 2 / 4 / 3;
  } /* TE ESPERO */

  .info-content p {
    font-size: var(--font-xs) !important;
  }

  .info-content p strong {
    font-size: var(--font-sm) !important;
  }

  .info-item .btn {
    width: 100%;
    max-width: 200px;
    font-size: var(--font-sm);
    height: 35px;
    line-height: 35px;
    padding: 0;
  }

  .info-icon {
    width: 64px;
    height: 64px;
  }
}

/* Larger screens adjustments */
@media (min-width: 1200px) {
  .info-grid-container {
    max-width: 1100px;
    grid-template-columns: repeat(3, 1fr); /* Change to 3 columns */
    grid-template-rows: repeat(2, auto); /* Change to 2 rows */
  }

  /* Re-assign grid areas for 3 columns */
  .info-item[data-order="1"] {
    grid-area: 1 / 1 / 2 / 2;
  }
  .info-item[data-order="2"] {
    grid-area: 1 / 2 / 2 / 3;
  }
  .info-item[data-order="3"] {
    grid-area: 1 / 3 / 2 / 4;
  }
  .info-item[data-order="4"] {
    grid-area: 2 / 1 / 3 / 2;
  }
  .info-item[data-order="5"] {
    grid-area: 2 / 2 / 3 / 3;
  }
  .info-item[data-order="6"] {
    grid-area: 2 / 3 / 3 / 4;
  }

  .info-item .btn {
    width: 60%;
    max-width: 200px;
  }
}

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  40% {
    transform: translateX(-50%) translateY(-10px);
  }
  60% {
    transform: translateX(-50%) translateY(-5px);
  }
}

/* Final Section */

#final {
  margin-top: 18rem;
  justify-content: space-evenly;
}

.final-message {
  max-width: 80%;
  margin: var(--space-xl) 0;
  font-style: italic;
  line-height: var(--line-height-loose);
  font-size: var(--font-sm);
}

.final-title {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  font-size: var(--font-xl);
  color: var(--primary-teal);
}

.stars-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -1;
}

/* Star animation for the final section */
@keyframes twinkle {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}

.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background-color: var(--primary-teal);
  border-radius: 50%;
}

/* Animation Control */
:root {
  --animate-duration: 1s; /* Default animation duration */
  --animate-delay: 0.5s; /* Default animation delay */
  --animate-repeat: 1; /* Default animation repeat */
}

/* Initially pause all animations */
body .animate__animated {
  animation-play-state: paused;
  opacity: 0;
}

/* Enable animations when the class is removed */
body .animate__animated:not(.paused-animation) {
  animation-play-state: running;
  opacity: 1;
}

/* Animation Durations Control */
.animate__animated.animate__slower {
  --animate-duration: 2s;
}

.animate__animated.animate__slow {
  --animate-duration: 1.5s;
}

.animate__animated.animate__fast {
  --animate-duration: 0.8s;
}

.animate__animated.animate__faster {
  --animate-duration: 0.5s;
}

/* Media Queries */
@media (max-width: 767px) {
  .line {
    width: 60px;
  }

  .date-section {
    bottom: 100px;
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 90%;
  }

  .info-grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, auto);
    gap: var(--space-xl);
    padding: 0 var(--space-md);
  }

  .info-item {
    margin-bottom: 0;
  }

  /* Order of info items for desktop */
  .info-item:nth-child(1) {
    grid-area: 1 / 1 / 2 / 2;
  }
  .info-item:nth-child(2) {
    grid-area: 1 / 2 / 2 / 3;
  }
  .info-item:nth-child(3) {
    grid-area: 1 / 3 / 2 / 4;
  }
  .info-item:nth-child(4) {
    grid-area: 2 / 1 / 3 / 2;
  }
  .info-item:nth-child(5) {
    grid-area: 2 / 2 / 3 / 3;
  }
  .info-item:nth-child(6) {
    grid-area: 2 / 3 / 3 / 4;
  }

  /* Typography adjustments for larger screens */
  .final-message {
    max-width: 70%;
  }

  .info-content p {
    font-size: var(--font-base);
  }

  .btn {
    padding: 0.8rem 2.5rem;
  }
}

@media (min-width: 1200px) {
  .container {
    max-width: 80%;
  }

  .info-grid-container {
    max-width: 1200px;
  }

  .final-message {
    max-width: 60%;
  }
}
