/* Global reset & box sizing */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Base page styles */
body {
  /* Use NASA brand fonts when available */
  --nasa-red: #CE1126;
  --nasa-black: #0b0b0b;
  --nasa-gray: #666666;

  font-family: 'DM Mono', 'Public Sans', 'Inter', monospace;
  background-color: #f1f1f1;
  padding: 20px;
}

/* Centered container */
.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 20px;
  padding-bottom: 20px;
  margin-bottom: 20px;
}

h1 {
  font-family: 'DM Mono', 'Inter', sans-serif;
  font-weight: 700;
  color: var(--nasa-black);
  font-size: 2rem;
}

/* Logo */
.logo {
  width: 140px;
  height: auto;
  display: block;
}

/* A wrapper that enforces protected space around the logo per brand guidance */
.logo-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px; /* protected space around the logo */
  margin-right: 12px;
}

.logo-insignia {
  width: 86px;
  height: auto;
  display: block;
}

/* Use this class when placing the worm/logo on a dark background */
.logo--on-dark {
  background: var(--nasa-black);
  padding: 18px;
  border-radius: 4px;
}

/* Date‐picker & button row */
.filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
  padding: 0 20px;
}

/* Inputs and buttons */
input[type="date"] {
  font-family: 'Inter', 'Public Sans', sans-serif;
  font-weight: normal;
  color: #666;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  line-height: 1.4;
  width: 100%;
}

button {
  font-family: 'DM Mono', monospace;
  font-weight: normal;
  color: #666;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  line-height: 1.4;
  width: 100%;
}

/* Button specific */
button {
  background-color: #d3d3d3;
  color: black;
  cursor: pointer;
}
button:hover {
  background-color: #bfbfbf;
}

/* Stack horizontally on wider screens */
@media (min-width: 600px) {
  .filters {
    flex-direction: row;
    padding: 0;
  }
  
  input[type="date"],
  button {
    width: auto;
  }
}

/* Gallery flex container */
.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 20px;
  justify-content: center;
}

/* Gallery items */
.gallery-item {
  flex: 1 1 100%;  /* full width by default */
  min-width: 280px;
  max-width: 500px;
  background: white;
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.gallery-item:hover {
  transform: translateY(-3px);
}

/* Three columns on wider screens */
@media (min-width: 1000px) {
  .gallery-item {
    flex: 0 1 31%;
  }
}

.gallery-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 4px;
  transition: transform 0.35s ease;
}

.gallery-item:hover img {
  transform: scale(1.06);
}

.media-wrap { position: relative; display: block; }
.media-wrap img { display: block; width: 100%; height: 200px; object-fit: cover; border-radius: 4px; }
.play-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 36px;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

.gallery-item h3 {
  margin-top: 10px;
  padding: 5px;
  font-size: 18px;
}

.gallery-item p {
  padding: 5px;
  font-size: 14px;
  color: #666;
  font-family: 'Inter', 'Public Sans', sans-serif;
}

/* Placeholder content */
.placeholder {
  flex: 1 1 100%;
  text-align: center;
  padding: 40px;
  color: #666;
}

.placeholder-icon {
  font-size: 48px;
  margin-bottom: 20px;
}

/* Random fact styling: centered above the gallery */
.random-fact {
  text-align: center;
  margin: 0 auto 16px;
  font-family: 'Inter', 'Public Sans', sans-serif;
  font-size: 1rem;
  color: var(--nasa-black);
}

/* Modal styles */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 8px;
  padding: 20px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: transparent;
  font-size: 28px;
  cursor: pointer;
}

.modal-image {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 15px;
}

.modal-iframe {
  width: 100%;
  height: 420px;
  border: none;
  border-radius: 6px;
  margin-bottom: 15px;
}

.modal-title {
  margin-bottom: 8px;
  color: #212121;
}

.modal-date {
  margin-bottom: 12px;
  color: #666;
}

.modal-explanation {
  line-height: 1.6;
  color: #333;
}

.modal-date {
  font-family: 'Inter', 'Public Sans', sans-serif;
}

.modal-explanation {
  font-family: 'Inter', 'Public Sans', sans-serif;
}

.placeholder p {
  font-family: 'Inter', 'Public Sans', sans-serif;
}
