@font-face {
  src: url('font/pokemon-b-w.otf');
  font-family: 'Pokemon BW';
}

/* ===== Page Base ===== */

* {
  box-sizing: border-box;
}

html {
  font-size: 62.5%;
}

body {
  margin: 0;
  background-color: #2b2116;
  padding: 0;
  color: #f2ead3;
  font-family: Georgia, 'Times New Roman', serif;
}

/* ===== Centered Container ===== */
#page {
  margin: 40px auto;
  border: 4px solid #7b5a2e;
  background: rgba(43, 33, 22, 0.92);
  padding: 20px;
  max-width: 85vw;
}

/* ===== Title ===== */
h1 {
  color: #e7d6a3;
  font-size: 3.6rem;
  letter-spacing: 1px;
  text-align: center;
}

h2 {
  font-size: 2.4rem;
}

.subtitle {
  margin-bottom: 30px;
  color: #c9b98a;
  font-style: italic;
  font-size: 1.8rem;
  text-align: center;
}

/* ===== Carousel ===== */
#carousel {
  margin: 4rem auto;
  border-radius: 10px;
  background: #3a2d1b;
  padding: 4rem 7rem;
  width: max-content;
  max-width: 80vw;
  text-align: center;
}

#carousel img {
  transition: transform 0.5s;
  border: 4px solid #f7b957;
  border-radius: 22px;
  width: 600px;
  max-width: 100%;
}

#carousel img:hover {
  transform: translateY(-0.5rem) scale(1.01);
}

#carousel h2 {
  margin-top: 0;
}

/* ===== Grid ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
}

.card {
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 10px;
  padding: 8px 12px;
  text-align: center;
}

.card img {
  transition: transform 0.5s;
  border: 2px solid #f7b957;
  border-radius: 15px;
  width: 100%;
}

.card:nth-child(odd) img:hover {
  transform: rotate(1deg);
}

.card:nth-child(even) img:hover {
  transform: rotate(-1deg);
}

.card:hover {
  background: #4a3620;
}

/* ===== Loading Spinner ===== */
#loadingSpinner {
  padding: 40px;
  color: #d8cba0;
  text-align: center;
}

.spinner {
  animation: spin 1.2s linear infinite;
  margin: 0 auto 12px;
  border: 5px solid #7b5a2e;
  border-top: 5px solid #e7d6a3;
  border-radius: 50%;
  width: 48px;
  height: 48px;
}

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

.grid,
#carousel {
  display: none; /* hidden until loaded */
}

/* ===== Laptops (≤ 1600px) ===== */
@media (max-width: 1600px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ===== Tablets (≤ 1024px) ===== */
@media (max-width: 1024px) {
  #page {
    max-width: 90vw;
  }
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== Small Tablets / Large Phones (≤ 768px) ===== */
@media (max-width: 768px) {
  #carousel {
    padding: 4rem 5rem;
  }
}

/* ===== Phones (≤ 550px) ===== */
@media (max-width: 550px) {
  #page {
    margin: 10px auto;
    max-width: 95vw;
  }

  #carousel {
    padding: 3rem;
  }

  .grid {
    grid-template-columns: repeat(1, 1fr);
  }
}
