/* =========================
   RESET / BASE
========================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.subject-page {
  margin: 0;
  font-family: Arial, sans-serif;
  background-image: url("img/subject-ind-background.png");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  position: relative;
}

.subject-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.18);
  z-index: -1;
}

/* =========================
   SUBJECT TITLE
========================= */
.subject-hero {
  width: min(92%, 1100px);
  margin: 30px auto 20px;
  text-align: center;
}

#subjectTitle {
  text-align: center;
  font-family: "Dancing Script", cursive;
  color: #113562;
  font-size: 42px;
  line-height: 1.2;
}

#subjectTitle::after {
  content: "";
  display: block;
  width: 120px;
  height: 3px;
  background: #113562;
  margin: 10px auto 0;
  border-radius: 10px;
}

/* =========================
   MAIN CONTAINER
========================= */
.subject-container {
  width: min(92%, 1200px);
  margin: 0 auto 70px;
}

/* =========================
   SECTIONS
========================= */
.resource-section {
  margin-bottom: 35px;
}

.resource-section h2 {
  margin-bottom: 18px;
  color: #0b2545;
  font-family: "Dancing Script", cursive;
  font-size: 32px;
  text-align: center;
}

/* =========================
   2-COLUMN GRID
========================= */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

/* =========================
   CARDS
========================= */
.resource-card {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 22px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    background 0.25s ease;
}

.resource-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.16);
  background: rgba(255, 255, 255, 0.9);
}

.resource-card h3 {
  margin-bottom: 10px;
  color: #155a8a;
  font-size: 22px;
  font-family: "Dancing Script", cursive;
}

.resource-card p {
  color: #333;
  line-height: 1.65;
  margin-bottom: 14px;
  font-size: 16px;
}

.resource-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

/* =========================
   BUTTONS / LINKS
========================= */
.resource-card button,
.resource-card a,
.popup-link-btn,
.resource-link-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 10px 16px;
  background: #33a9db;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  font-size: 15px;
  transition: background 0.25s ease, transform 0.2s ease;
}

.resource-card button:hover,
.resource-card a:hover,
.popup-link-btn:hover,
.resource-link-btn:hover {
  background: #2c90bc;
  transform: translateY(-1px);
}

/* =========================
   POPUP OVERLAY
========================= */
.content-box {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);

  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-y: auto;
  z-index: 9999;
}

.popup-panel {
  position: relative;
  background: white;
  width: min(92%, 920px);
  max-height: 85vh;
  overflow-y: auto;
  padding: 26px 22px 22px;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
}

#contentArea {
  width: 100%;
}

#contentArea h2,
#videoPopupTitle {
  color: #155a8a;
  margin-bottom: 10px;
  font-family: "Dancing Script", cursive;
  font-size: 30px;
  text-align: center;
}

#contentArea p,
#videoPopupDescription {
  color: #333;
  line-height: 1.65;
  margin-bottom: 12px;
}

#videoContent {
  width: 100%;
}

.close-btn {
  position: sticky;
  top: 0;
  margin-left: auto;
  display: block;
  background: #e53935;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  z-index: 5;
}

.close-btn:hover {
  background: #c62828;
}

/* =========================
   VIDEO
========================= */
.video-wrapper {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 20px auto 0;
  padding-bottom: 56.25%;
  height: 0;
}

.video-wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 12px;
}

/* =========================
   QUIZ BUTTONS INSIDE POPUP
========================= */
#contentArea button {
  display: inline-block;
  margin: 8px 8px 0 0;
  padding: 10px 14px;
  background: #33a9db;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

#contentArea button:hover {
  background: #2c90bc;
}

/* =========================
   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.08);
}

/* =========================
   TABLET
========================= */
@media (max-width: 768px) {
  #subjectTitle {
    font-size: 34px;
  }

  .resource-section h2 {
    font-size: 28px;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .popup-panel {
    width: 94%;
    padding: 22px 16px 18px;
  }
}

/* =========================
   MOBILE
========================= */
@media (max-width: 480px) {
  .subject-hero {
    margin: 20px auto 14px;
  }

  #subjectTitle {
    font-size: 28px;
  }

  .resource-section h2 {
    font-size: 24px;
  }

  .subject-container {
    width: 96%;
    margin-bottom: 50px;
  }

  .resource-card {
    padding: 18px 14px;
  }

  .resource-card h3 {
    font-size: 20px;
  }

  .resource-card p {
    font-size: 15px;
    line-height: 1.55;
  }

  .resource-actions {
    flex-direction: column;
  }

  .resource-card button,
  .resource-card a,
  .popup-link-btn,
  .resource-link-btn {
    width: 100%;
    text-align: center;
  }

  .content-box {
    padding: 12px;
  }

  .popup-panel {
    width: 100%;
    max-height: 88vh;
    border-radius: 14px;
  }

  #contentArea h2,
  #videoPopupTitle {
    font-size: 24px;
  }

  #backToTop {
    width: 56px;
    height: 42px;
    font-size: 16px;
    right: 12px;
    bottom: 12px;
  }
}