/* ==========================
   Global Reset / Base
   ========================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden; /* safety net against any stray overflow */
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  background: #fafafa;
  color: #222;
  display: flex;
  flex-direction: column;
}

/* Make all images behave safely inside containers */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ==========================
   Hero Section
   ========================== */

.hero {
  text-align: center;
  padding: 70px 20px;
  background: #ffffff;
  border-bottom: 1px solid #e6e6e6;
}

.hero h1 {
  font-size: 2.6rem;
  margin-bottom: 10px;
}

.hero p {
  font-size: 1.15rem;
  color: #555;
}

/* ==========================
   Grid of Cards
   ========================== */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 32px;
  max-width: 1000px;
  width: 100%;
  margin: 60px auto;
  padding: 0 20px;
}

/* Each card is a clickable tile (likely an <a>) */
.card {
  background: #ffffff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 28px 20px;

  /* Ensure image + title share the same centering context */
  display: flex;
  flex-direction: column;
  align-items: center;

  text-align: center;
  text-decoration: none;
  color: inherit;

  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Image inside card */
.card img {
  max-width: 160px;
  max-height: 220px;
  object-fit: contain;
  margin-bottom: 18px;
}

/* Title under image */
.card span {
  display: block;
  width: 100%;

  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;

  /* Remove any chance of weird offset */
  margin: 0;
  padding: 0;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

/* ==========================
   Footer
   ========================== */

footer {
  margin-top: auto;
  text-align: center;
  padding: 25px;
  font-size: 0.9rem;
  color: #666;
  background: #ffffff;
  border-top: 1px solid #e6e6e6;
}

footer a {
  color: #0066cc;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* ==========================
   Responsive: Tablets & Phones
   ========================== */

@media (max-width: 768px) {
  .hero {
    padding: 40px 16px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .grid {
    gap: 24px;
    margin: 40px auto;
    padding: 0 16px;
    /* Keep auto-fit but allow columns to shrink properly */
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .card {
    padding: 22px 16px;
  }

  .card img {
    max-width: 140px;
    max-height: 190px;
  }
}

/* ==========================
   Extra Small Screens (narrow phones)
   ========================== */

@media (max-width: 480px) {
  .grid {
    /* Force a single column to avoid any chance of width overflow */
    grid-template-columns: minmax(0, 1fr);
    max-width: 100%;
    width: 100%;
  }

  .card {
    width: 100%;
  }

  .card img {
    max-width: 100%;
    max-height: 200px;
  }
}
