/* ============ RESET & BASE ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  min-height: 100vh;
  font-family: Arial, sans-serif;
  background: #000; /* fallback */
  color: #eee;
  display: flex;
  flex-direction: column;
  align-items: center;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

.site-container {
  position: relative;
  z-index: 3; /* above nebula and stars */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
}

/* ============ HEADER / BANNER ============ */
header.banner {
  width: 100%;
  position: relative; /* default */
  z-index: 2;
  margin: 0; /* remove any pushed margins */
}
header.banner img {
  width: 100%;
  display: block;
  object-fit: cover;
  max-height: 360px; /* adjust as needed */
}


header:not(.banner) {
  text-align: center;
  margin: 20px auto;
  padding: 0;
}

/* Site header that overlaps the banner slightly */
.site-header {
  width: 100%;
  margin-top: -120px; /* overlap banner — will be reduced on small screens */
  text-align: center;
  z-index: 2;
  position: relative;
  padding: 1rem 1rem 0.75rem 1rem;
  background: linear-gradient(180deg, rgba(0,0,0,0.45), rgba(0,0,0,0.25));
  border-bottom: 2px solid #FFD700;
  backdrop-filter: blur(4px);
}
.site-header h1 {
  font-family: 'Orbitron', sans-serif;
  color: #FFD700;
  letter-spacing: 2px;
  margin-bottom: 0.25rem;
  font-size: 2rem;
}
.site-header p {
  color: #ccc;
  margin-bottom: 0.5rem;
}

/* ============ GRID & CARD SYSTEM ============ */

/* Grid for main page */
main.grid {
  position: relative;
  z-index: 4; /* highest for clickable cards */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  padding: 20px;
  margin: 40px auto;
  max-width: 1200px;
  justify-items: center;
}

/* Card styling */
.card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(20,20,40,0.6);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 20px;
  border-radius: 8px;
  text-decoration: none;
  color: #fff;
  min-height: 100px;
  width: 100%;
  max-width: 250px;
  text-align: center;
  font-size: 1.2rem;
  transition: background 0.3s, transform 0.3s;
}

.card:hover {
  background: rgba(40,40,80,0.8);
  transform: scale(1.05);
}

.card:active {
  transform: translateY(-2px) scale(0.995);
}

/* ============ NEBULA CANVAS + STARS ============ */
canvas.nebula {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1; /* above stars, below site-container */
  pointer-events: none;
  display: block;
}

.stars {
  position: fixed;
  inset: 0;
  z-index: 0; /* baseline layer */
  pointer-events: none;
  overflow: hidden;
}

/* small helper for generated star elements (nebula.js will create .star divs) */
.star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  opacity: 0.8;
  transform: translate(-50%, -50%);
  animation-name: twinkle;
  animation-iteration-count: infinite;
  animation-timing-function: linear;
}

/* twinkle animation */
@keyframes twinkle {
  0%,100% { opacity: 0.15; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
}

/* ============ SEARCH BOX ============ */
.search-container {
  position: relative; /* instead of fixed */
  margin: 0 auto 20px auto; /* centers horizontally */
  width: 260px; /* or responsive width */
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 3; /* above nebula */
}

.search-input-row { display:flex; gap:8px; }
#searchInput {
  flex: 1;
  min-width: 80px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.02);
  color: #fff;
}
#searchBtn {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  background-color: #171717;
  color: #fff;
  cursor: pointer;
}
#searchBtn:hover { background-color: #2a2a2a; }
#searchResults {
  width: 100%;
  max-height: 260px;
  overflow-y: auto;
  background: rgba(20,20,40,0.85);
  padding: 8px;
  border-radius: 6px;
  color: #ddd;
}

/* ============ FOOTER ============ */
footer {
  text-align: center;
  padding: 1rem;
  border-top: 1px solid #FFD700;
  font-size: 0.9rem;
  color: #aaa;
  width: 100%;
  z-index: 2;
  background: linear-gradient(0deg, rgba(0,0,0,0.35), rgba(0,0,0,0.15));
}

/* ============ RESPONSIVE RULES ============ */
@media (max-width: 900px) {
  main.grid { grid-template-columns: repeat(2, 1fr); max-width: 780px; }
  .site-header { margin-top: -90px; }
}

@media (max-width: 600px) {
  .site-header { margin-top: -60px; padding: 0.75rem 0.75rem 0.5rem 0.75rem; }
  .site-header h1 { font-size: 1.45rem; }
  main.grid { grid-template-columns: 1fr; padding: 1rem; margin: 8px auto 28px auto; max-width: 92%; }
  .card { padding: 14px; font-size: 1rem; }
  .search-container { top: 10px; right: 10px; width: 200px; }
}

/* small accessibility + focus styles */
.card:focus, .card:focus-visible, #searchBtn:focus { outline: 3px solid rgba(255,215,0,0.18); outline-offset: 2px; }
