/* Global box-sizing and overflow control */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden;
  width: 100%;
}

input, button, section, div {
  max-width: 92vw;
}

/* Site title */
.site-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: clamp(2rem, 6vw, 3.5rem);
  letter-spacing: 0.02em;
  line-height: 1.2;
  padding: 0.5em 0;
}

.site-title em {
  font-style: italic;
}

/* Stack search row when screen is narrow (height/width > 1.9) */
@media (max-aspect-ratio: 10/19) {
  #search-row {
    flex-direction: column;
  }
  #search-row #search-btn {
    width: 100%;
    text-align: center;
  }
}

/* Dynamic sky background */
.animated-bg {
  position: relative;
  background: #0a0a1a;
  transition: background 2s ease;
  overflow: hidden;
}

/* Gradient overlay layer */
.animated-bg::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  transition: opacity 2s ease;
  animation: shimmer 12s ease-in-out infinite;
}

/* Accent glow layer */
.animated-bg::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.4;
  transition: opacity 2s ease;
  animation: drift 20s ease-in-out infinite;
}

.animated-bg > * {
  position: relative;
  z-index: 1;
}

/* Stars canvas sits behind content */
#stars-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  transition: opacity 1.5s ease;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes drift {
  0%, 100% { background-position: 20% 80%; }
  33% { background-position: 80% 20%; }
  66% { background-position: 50% 60%; }
}

/* Custom datetime-local input styling */
input[type="datetime-local"] {
  max-width: 100%;
  box-sizing: border-box;
}

input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Smooth transitions for dialog */
#confirm-dialog {
  animation: slideDown 0.2s ease-out;
}

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