/* CSS Variables for consistent theming and easier maintenance */
:root {
  --color-background: #020409;
  --color-gradient-start: rgba(33, 39, 80, 1);
  --color-text: rgba(226, 225, 142, 1);
  --color-link: rgba(200, 220, 255, 1);
  --color-star: rgba(226, 225, 142, 1);
  --color-giant-star: rgba(180, 184, 240, 1);
  --color-comet: rgba(226, 225, 224, 1);
  
  --space-sm: clamp(0.5rem, 1vw, 1rem);
  --space-md: clamp(1rem, 2vw, 2rem);
  --space-lg: clamp(2rem, 4vw, 4rem);
  
  --font-size-base: clamp(1rem, 2vw, 1.25rem);
  --font-size-lg: clamp(1.5rem, 3vw, 2rem);
  
  --canvas-text-size: clamp(2rem, 5vw, 4rem);
}

/* Reset and base styles */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  font-size: var(--font-size-base);
  line-height: 1.5;
}

body {
  background-color: var(--color-background);
  color: var(--color-text);
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Main container */
.app-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-image: radial-gradient(
    circle at 10% 130%,
    var(--color-gradient-start) 10%,
    var(--color-background) 100%
  );
  overflow: hidden;
}

/* Canvas elements */
#universe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.text-animation {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
  padding: 0;
  margin: 0;
  overflow: visible;
}

@media (max-width: 768px) {
  .text-animation {
    margin-bottom: 20vh; /* Less space on tablets */
  }
}

@media (max-width: 480px) {
  .text-animation {
    margin-bottom: 15vh; /* Even less space on mobile */
  }
}

#text-canvas {
  /* Canvas will be sized in JS */
  margin: 0 auto; /* Center horizontally */
  display: block; /* Remove inline spacing */
}

/* Audio controls */
.audio-container {
  position: fixed;
  bottom: var(--space-md);
  right: var(--space-md);
  z-index: 10;
}

.play-button {
  background-color: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  width: 3rem;
  height: 3rem;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  color: var(--color-text);
  font-size: 1.2rem;
  transition: all 0.3s ease;
}

.play-button:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.play-button:focus {
  outline: 2px solid var(--color-text);
  outline-offset: 2px;
}

/* Footer scene */
/* Couple image styling */
.couple-container {
  position: absolute;
  bottom: 0; /* Position at the very bottom */
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 300px;
  z-index: 4; /* Higher z-index than sand dune */
  pointer-events: none; /* Allow clicking through to canvas */
}

.couple-image {
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.5));
  border-radius: 8px;
}

/* Sand dune footer */
.scene-container {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 22.5vh; /* 50% taller: 15vh * 1.5 = 22.5vh */
  z-index: 3;
  pointer-events: none; /* Allow clicking through to canvas */
  overflow: hidden; /* Prevent image overflow */
}

.dune-image {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Cover the container width */
  object-position: center bottom; /* Align to bottom */
}

/* Media Queries */
@media (max-width: 768px) {
  .scene-container {
    height: 18vh; /* 50% taller: 12vh * 1.5 = 18vh */
  }
  
  .couple-container {
    max-width: 200px; /* Smaller on tablets */
    bottom: 0; /* Keep at bottom */
  }
}

@media (max-width: 480px) {
  .scene-container {
    height: 15vh; /* 50% taller: 10vh * 1.5 = 15vh */
  }
  
  .couple-container {
    max-width: 150px; /* Smaller on mobile */
    bottom: 0; /* Keep at bottom */
  }
  
  .play-button {
    width: 2.5rem;
    height: 2.5rem;
  }
}

/* Larger screens */
@media (min-width: 1200px) {
  .couple-container {
    max-width: 400px; /* Larger on big screens */
  }
}

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

/* Animation keyframes */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
  animation: fadeIn 1s ease-in-out;
}