/* General Reset and Base Styles */
* {
  box-sizing: border-box;
}

body,
html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
  overflow: hidden;
  font-family: "Arial", sans-serif; /* Base font family */
}

/* Accessibility: Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
  #background-image,
  #footer-link a {
    transition: none;
  }
}

/* Performance: GPU acceleration hints */
#background-image,
#countdown-text-container {
  will-change: opacity, transform;
}

/* Gradient background for fallback/non-image periods */
body.gradient-background {
  background: linear-gradient(135deg, #87ceeb 0%, #e0f6ff 50%, #b0e0e6 100%);
}

/* Container for the image and text */
#container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  box-sizing: border-box;
}

/* Background Image */
#background-image {
  position: fixed; /* Changed to fixed for full viewport coverage */
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  object-position: center center; /* Ensure image is centered */
  z-index: 0;
  transition: opacity 0.3s ease; /* Smooth image transitions */
}

/* Countdown Text Container (with background) */
#countdown-text-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(
    0,
    0,
    0,
    0.8
  ); /* Less transparent dark background for better text readability */
  padding: 20px; /* Padding around the text */
  border-radius: 10px; /* Rounded corners for the background */
  box-sizing: border-box;
  z-index: 1;
  max-width: 90%; /* Prevent it from being too wide */
  text-align: center; /* Center the text inside */
  min-height: auto; /* Allow container to shrink when no quote */
}

/* Text container styling for gradient background */
body.gradient-background #countdown-text-container {
  background: rgba(
    255,
    255,
    255,
    0.9
  ); /* Light semi-transparent background for gradient */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); /* Subtle shadow */
}

/* Countdown text color adjustment for gradient background */
body.gradient-background #countdown-text {
  color: #2c3e50; /* Dark blue-gray text for better contrast on light background */
}

/* Countdown Text (now h1) */
#countdown-text {
  color: white;
  font-size: 5vw; /* Scale text size dynamically */
  margin: 0; /* Remove default margins */
  word-wrap: break-word;
  font-weight: bold;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

/* Accessibility: High contrast mode support */
@media (prefers-contrast: high) {
  #countdown-text-container {
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid white;
  }

  body.gradient-background #countdown-text-container {
    background: rgba(255, 255, 255, 0.98);
    border: 2px solid #000;
  }
}

/* Responsive Design for Smaller Screens */
@media (max-width: 768px) {
  #countdown-text {
    font-size: 10vw; /* Larger text for small screens */
  }
}

@media (max-width: 480px) {
  #countdown-text {
    font-size: 12vw; /* Even larger text for very small screens */
  }

  #background-image {
    object-position: center center; /* Keep the focus on the center of the image */
    width: 100vw;
    height: 100vh;
  }
}

/* Footer Link */
#footer-link {
  position: fixed !important; /* Changed from absolute to fixed for better positioning */
  bottom: 20px !important;
  right: 20px !important;
  left: auto !important; /* Explicitly prevent left positioning */
  z-index: 2;
}

#footer-link a {
  color: white;
  text-decoration: none;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 12px;
  border-radius: 5px;
  transition: background-color 0.3s ease;
}

#footer-link a:hover {
  background: rgba(0, 0, 0, 0.7);
  text-decoration: underline;
}

/* Footer link styling for gradient background */
body.gradient-background #footer-link a {
  color: #2c3e50;
  background: rgba(255, 255, 255, 0.8);
}

body.gradient-background #footer-link a:hover {
  background: rgba(255, 255, 255, 0.95);
}

@media (max-width: 480px) {
  #footer-link {
    bottom: 15px;
    right: 15px;
  }

  #footer-link a {
    font-size: 12px;
    padding: 6px 10px;
  }
}

/* Accessibility: Focus indicators */
#footer-link a:focus {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

body.gradient-background #footer-link a:focus {
  outline-color: #2c3e50;
}

/* Performance: Optimize background attachment for mobile */
@media (max-width: 768px) {
  #background-image {
    background-attachment: scroll;
  }
}

/* Handle very wide screens */
@media (min-aspect-ratio: 16/9) {
  #background-image {
    object-fit: cover;
    object-position: center center;
  }
}

/* Handle very tall screens */
@media (max-aspect-ratio: 9/16) {
  #background-image {
    object-fit: cover;
    object-position: center center;
  }
}

/* Print styles */
@media print {
  #background-image {
    display: none;
  }

  #countdown-text-container {
    background: white;
    color: black;
  }

  #countdown-text {
    color: black;
    font-size: 24pt;
  }

  #footer-link {
    position: static;
    margin-top: 20px;
    text-align: center;
  }

  #footer-link a {
    color: black;
    background: transparent;
  }
}
