* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  padding: 20px;
  background-color: #f5f5f5;
  font-family: Arial, sans-serif;
}

figure {
  margin: 0;
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px;
  text-align: center;
  overflow: hidden;
}

figure img {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 4px;
}

figcaption {
  font-size: 9px;
  font-weight: bold;
  color: #333;
  margin-top: 9px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin: 0 auto;
}

.search-container {
  max-width: 420px;
  margin: 0 auto;
}

#searchBox {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 16px;
}

/* ── Search results ─────────────────────────────── */
#global-results {
  flex-direction: column;
  gap: 10px;
  max-width: 420px;
  margin: 0 auto;
}

.result-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px;
  text-decoration: none;
  color: inherit;
}

.result-card img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.result-title {
  font-size: 14px;
  font-weight: bold;
  color: #222;
}

.result-box {
  font-size: 12px;
  color: crimson;
  margin-top: 4px;
}

#no-results {
  text-align: center;
  color: #888;
  margin: 20px 0;
}

/* ── Desktop responsive ─────────────────────────────── */
@media (min-width: 1024px) {
  .gallery {
    max-width: 900px;  /* limit gallery width on desktop */
  }
}

@media (min-width: 1440px) {
  .gallery {
    max-width: 1000px;  /* slightly larger on big screens */
  }
}
