/* RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

/* BODY */
.subject-body {
  font-family: "Poppins", sans-serif;
  background-image: url("img/subject-background.png");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  position: relative;
}

.subject-body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.25);
  z-index: -1;
}

/* SEARCH SECTION */
.search-section {
  text-align: center;
  padding: 40px 20px;
  margin-bottom: 40px;
}

.search-section h2 {
  font-size: 42px;
  font-family: "Dancing Script", cursive;
  color: #0b2545;
  text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.15);
}

/* SUBJECT GRID */
.subjects-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  width: min(92%, 1200px);
  margin: 0 auto 80px;
}

.card-link {
  text-decoration: none;
  color: inherit;
}

/* CARD */
.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px;
  border-radius: 24px;
  cursor: pointer;
  min-height: 100%;
  
  /* Glass effect visible even in normal state */
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);

  transition:
    transform 0.35s ease,
    box-shadow 0.35s ease,
    background 0.35s ease,
    border-color 0.35s ease;
}

.card:hover {
  transform: translateY(-8px);
  background: rgba(28, 87, 113, 0.28);
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.card:hover .subject-title,
.card:hover .description,
.card:hover .explore-link {
  color: white;
}

/* IMAGE */
.image-box {
  width: 100%;
  height: 240px;
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 15px;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 10px rgba(240, 248, 249, 0.65);
}

.image-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 18px;
  transition: transform 0.35s ease;
}

.card:hover .image-box img {
  transform: scale(1.05);
}

/* SUBJECT TITLE */
.subject-title {
  width: 100%;
  text-align: center;
  padding: 14px;
  margin-bottom: 12px;
  font-family: "Dancing Script", cursive;
  font-size: 22px;
  font-weight: bold;
  color: #103b70;
  border-radius: 18px;

  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1.5px solid rgba(255, 255, 255, 0.45);
}

/* DESCRIPTION */
.description {
  width: 100%;
  text-align: center;
  padding: 14px;
  font-size: 17px;
  line-height: 1.6;
  font-family: "Dancing Script", cursive;
  font-weight: bold;
  color: #103b70;
  border-radius: 18px;

  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
}

/* EXPLORE LINK STYLE */
.explore-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 19px;
  font-weight: bold;
  color: #0b4f8a;
  transition: transform 0.3s ease, color 0.3s ease;
}

.card:hover .explore-link {
  transform: translateX(6px);
  color: white;
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .subjects-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    width: 94%;
  }

  .search-section h2 {
    font-size: 34px;
  }
}

@media (max-width: 600px) {
  .subjects-container {
    grid-template-columns: 1fr;
    width: 96%;
  }

  .search-section {
    padding: 30px 12px;
    margin-bottom: 25px;
  }

  .search-section h2 {
    font-size: 28px;
  }

  .card {
    padding: 16px;
  }

  .image-box {
    height: 220px;
  }

  .subject-title {
    font-size: 20px;
    padding: 12px;
  }

  .description {
    font-size: 16px;
    padding: 12px;
  }

  .explore-link {
    font-size: 18px;
  }

  #backToTop {
    width: 56px;
    height: 42px;
    font-size: 16px;
    right: 12px;
    bottom: 12px;
  }
}

/* BACK TO TOP */
#backToTop {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 1000;
  width: 75px;
  height: 50px;
  border: none;
  border-radius: 12px;
  background-color: #16a2e8;
  color: white;
  font-size: 24px;
  cursor: pointer;
  display: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#backToTop:hover {
  background-color: #03caf7;
  transform: scale(1.1);
}