/* ==========================
   ====== Tokens ===========
   ========================== */
:root {
  --blue: #3f87a6;
  --blue-strong: #2b6a86;
  --yellow: #ffd24d;

  --bg: #f9fafb;
  --card: #ffffff;
  --border: #e5e7eb;

  --text: #1f2937;
  --muted: #64748b;

  --tile: #e2e8f0;
  --tile-border: #cbd5e1;
  --tile-badge: #fef3c7;

  --ring: #93c5fd;
  --shadow-sm: 0 2px 8px rgba(2,6,23,.06);
  --shadow-md: 0 6px 18px rgba(2,6,23,.10);
  --shadow-lg: 0 10px 30px rgba(2,6,23,.14);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --card: #0f172a;
    --border: #1e293b;
    --text: #e5e7eb;
    --muted: #94a3b8;

    --tile: #0f172a;
    --tile-border: #1e293b;
    --tile-badge: #1e293b;

    --shadow-sm: 0 2px 8px rgba(0,0,0,.4);
    --shadow-md: 0 6px 18px rgba(0,0,0,.5);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.55);
  }
}

/* ==========================
   ====== Base Styles =======
   ========================== */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(160deg, var(--bg) 0%, #e8f0f4 100%);
  color: var(--text);
}

.subcategory-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

/* ==========================
   ====== Subcategory Title ==
   ========================== */
.subcategory-title {
  text-align: center;
  font-size: clamp(1.8rem,2.6vw,2.4rem);
  color: #1e40af;
  margin: 2rem 0 0.75rem;
  font-weight: 800;
  letter-spacing: 0.2px;
  position: relative;
  display: inline-block;
  left: 50%;
  transform: translateX(-50%);
}

/* Animated underline */
.subcategory-title::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -12px;
  width: 64px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--yellow), #ffe680, var(--yellow));
  animation: underline-glow 2.6s ease-in-out infinite;
  box-shadow: 0 6px 16px rgba(255,210,77,.35);
}

/* Tiny sparkles */
.subcategory-title::before {
  content: "✦";
  position: absolute;
  right: -22px;
  top: -6px;
  font-size: 16px;
  color: var(--yellow);
  opacity: 0.9;
  animation: sparkle 2.4s ease-in-out infinite;
}

/* ==========================
   ====== Filter Form =======
   ========================== */
.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.2rem;
  align-items: center;
  justify-content: center;
  margin: 1.6rem auto 1.2rem;
  padding: 0.9rem 1.1rem;
  background: color-mix(in srgb, var(--card) 92%, var(--blue) 8%);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 900px;
  box-shadow: var(--shadow-sm);
  transform: translateY(6px);
  opacity: 0;
  animation: fadeUp 0.6s ease-out 0.1s forwards;
}
.filter-form label {
  font-weight: 700;
  color: #1e40af;
  font-size: 0.95rem;
}
.filter-form select, .filter-form button {
  padding: 0.55rem 1rem;
  font-size: 0.95rem;
  border-radius: 10px;
  border: 1px #1e40af;
  background: #fff;
  transition: box-shadow 0.25s, transform 0.2s, border-color 0.2s;
}
@media (prefers-color-scheme: dark) {
  .filter-form select, .filter-form button { background: #0f172a; color: var(--text); }
}
.filter-form select:focus, .filter-form button:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 30%, transparent);
}
.filter-form button {
  background: #1e40af;
  color: #fff;
  font-weight: 700;
  border: none;
}
.filter-form button:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.filter-form button:active { transform: translateY(0); }

/* ==========================
   ====== Quiz Grid =======
   ========================== */

.quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* bigger min width */
  gap: 1.5rem;
  padding: 1.5rem 1rem 2.5rem;
  max-width: 1100px;
  margin: 0 auto;
}
/* ==========================
   ====== Quiz Cards =======
   ========================== */

  
.quiz-card {
  background: #1e40af !important;
  border: 2px solid var(--yellow);
  border-radius: 16px;
  padding: 1.5rem 1.3rem;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  transform: translateY(14px) scale(0.98);
  opacity: 0;
  animation: fadeUp 0.6s ease-out forwards;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
  will-change: transform;
  color: #fff !important; /* ensure text is visible */
}
.quiz-card h2,
.quiz-card p {
  color: #fff !important; /* force text white/light yellow */
}

.quiz-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 10px 28px rgba(0,0,0,0.15);
  border-color: var(--blue-strong);
  /* Slightly shift gradient for hover effect */
  background: linear-gradient(135deg, var(--blue-strong), #5ba6c8 50%, var(--yellow) 90%) !important;
}

.quiz-card h2 {
  margin: 0 0 0.6rem;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #fff; /* White text on gradient */
}

.quiz-card p {
  margin: 0.2rem 0 0.7rem;
  color: #fffde7; /* Light yellow text for contrast */
  font-weight: 600;
}

/* Start Button inside quiz card */
.start-button {
  display: inline-block;
  text-decoration: none;
  font-weight: 800;
  font-size: 1rem;
  padding: 0.65rem 1.4rem;
  border-radius: 12px;
  color: var(--blue-strong);
  background: var(--yellow);
  box-shadow: 0 6px 16px rgba(255,210,77,0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.25s ease;
}

.start-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(255,210,77,0.45);
}

/* Mobile stacking */
@media (max-width: 768px) {
  .quiz-grid {
    grid-template-columns: 1fr; /* stack vertically */
    gap: 1rem;
    padding: 1rem;
  }
  
  .quiz-card {
    padding: 1.3rem 1rem;
  }

  .quiz-card h2 {
    font-size: 1.15rem;
  }

  .start-button {
    font-size: 0.95rem;
    padding: 0.6rem 1.2rem;
  }
}

/* ==========================
   ====== Concept & Example Blocks =======
   ========================== */
.concept-block, .example-block {
  background: color-mix(in srgb, var(--card) 95%, var(--blue) 5%);
  border: 1px solid color-mix(in srgb, var(--border) 80%, var(--blue) 20%);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin: 1rem 0;
  box-shadow: var(--shadow-sm);
}

/* Concept block headings (same style as example block) */
.concept-block h3 {
  font-family: 'Arial Black', 'Impact', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--blue-strong);
  margin-bottom: 0.6rem;
}

/* Example block headings */
.example-block h4 {
  font-family: 'Arial Black', 'Impact', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--blue-strong);
  margin-bottom: 0.6rem;
}

/* Tip box styling */
.tip-box {
  background: #fffbe6;
  border-left: 5px solid var(--yellow);
  padding: 0.8rem 1rem;
  font-style: italic;
  margin: 1rem 0;
  box-shadow: 0 2px 10px rgba(255,210,77,0.2);
}

/* ==========================
   ====== Subcategory Explanation =======
   ========================== */
.subcategory-explanation {
  font-size: 1.5rem;
  line-height: 1.7rem;
}

.subcategory-explanation p {
  font-size: 1.5rem;
  line-height: 1.7rem;
  margin: 0.8rem 0;
}

.subcategory-explanation ul {
  list-style: none;
  padding-left: 1.2rem;
}

.subcategory-explanation ul li {
  position: relative;
  margin-bottom: 0.6rem;
  padding-left: 1.5rem;
  line-height: 1.7rem;
  font-weight: 600;
}

/* Custom bullet: small colored circle */
.subcategory-explanation ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 0.6rem;
  height: 0.6rem;
  background: var(--blue-strong);
  border-radius: 50%;
}

.subcategory-explanation img {
  max-width: 100%;
  height: auto;
  margin: 1rem 0;
}

/* Section headings (H2 style for main sections) */
.subcategory-explanation h2 {
  font-family: 'Arial Black', 'Impact', sans-serif;
  font-weight: 900;
  font-size: 1.4rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--blue-strong);
  margin: 2rem 0 1rem;
  padding-bottom: 0.2rem;
  border-bottom: 3px solid var(--yellow);
  display: inline-block;
}

.subcategory-explanation h2::before {
  content: "✦";
  margin-right: 0.4rem;
  color: var(--yellow);
  font-size: 1.1rem;
  vertical-align: middle;
}

/* Section headings H3 (subsections) */
.subcategory-explanation h3 {
  font-family: 'Arial Black', 'Impact', sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 1px;
  color: var(--blue-strong);
  margin: 1.5rem 0 0.8rem;
}

/* Section headings H4 (optional sub-subsections) */
.subcategory-explanation h4 {
  font-family: 'Arial Black', 'Impact', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 1px;
  color: var(--blue-strong);
  margin: 1rem 0 0.6rem;
}

/* ==========================
   ====== Animations =======
   ========================== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes underline-glow {
  0%,100% { box-shadow: 0 6px 16px rgba(255,210,77,.35); transform: translateX(-50%) scaleX(1); }
  50%     { box-shadow: 0 10px 24px rgba(255,210,77,.55); transform: translateX(-50%) scaleX(1.08); }
}
@keyframes sparkle {
  0%,100% { transform: translateY(0) rotate(0deg); opacity: 0.9; }
  50%     { transform: translateY(-3px) rotate(12deg); opacity: 1; }
}

/* ==========================
   ====== Responsive tweaks =======
   ========================== */
@media (max-width: 768px){
  .subcategory-title { font-size: 1.6rem; }
  .quiz-grid { gap: 1rem; padding: 1rem; }
  .quiz-card { padding: 1rem; }
  .quiz-card h2 { font-size: 1.02rem; }
  .concept-block, .example-block, .tip-box { padding: 0.9rem 1rem; }
  .subcategory-explanation { font-size: 1.35rem; line-height: 1.6rem; }
  .subcategory-explanation p { font-size: 1.35rem; line-height: 1.6rem; }
  .subcategory-explanation ul li { font-size: 1.35rem; line-height: 1.6rem; }
}
/* Make all images in concept and example blocks uniform */
.concept-block img,
.example-block img {
    display: block;          /* Remove inline spacing */
    width: 100%;             /* Make image fill container width */
    max-width: 400px;        /* Optional: cap max width */
    height: auto;            /* Maintain aspect ratio */
    margin: 10px 0;          /* Optional spacing above/below */
    object-fit: contain;     /* Prevent stretching */
}

.solutions-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
}

.solution-box {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
  padding: 1rem 1.2rem;
  transition: all 0.2s ease;
}

.solution-box:hover {
  box-shadow: 0 6px 14px rgba(0,0,0,0.1);
}

.solutions-section h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid #1f6feb;
  padding-bottom: 0.3rem;
  color: #1f3f6f;
}

/* Responsive */
@media (max-width: 768px) {
  .solution-box {
    padding: 0.8rem 1rem;
  }

  .solutions-section h2 {
    font-size: 1.3rem;
  }
}

.subcategory-featured-image {
  text-align: center;
  margin-bottom: 2rem;
}

.subcategory-featured-image img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.subcategory-featured-image .image-caption {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  color: #555;
}

.quiz-divider {
  border: none;
  border-top: 2px dashed #1f6feb;
  margin: 3rem 0;
  opacity: 0.7;
}

html.dark-mode .quiz-card {
  background: linear-gradient(135deg, #2b3e6b, #3f5a9a 50%, #ffd24d 90%);
  border: 2px solid #ffd24d;
  color: #fff;
}

html.dark-mode .quiz-card h2,
html.dark-mode .quiz-card p {
  color: #fffde7;
}

html.dark-mode .start-button {
  color: #2b3e6b;
  background: #ffd24d;
  box-shadow: 0 6px 16px rgba(255,210,77,0.3);
}

html.dark-mode .start-button:hover {
  box-shadow: 0 10px 24px rgba(255,210,77,0.45);
}

html.dark-mode .filter-form {
  background: color-mix(in srgb, #0f172a 92%, var(--blue) 8%);
  border-color: #1e293b;
}

html.dark-mode .filter-form label {
  color: var(--blue);
}

html.dark-mode .filter-form select,
html.dark-mode .filter-form button {
  background: #0f172a;
  color: #fff;
  border-color: #1e293b;
}


/* Dark mode overrides */
html.dark-mode .solutions-section h2 {
  color: #3f87a6;
  border-color: #4fa6c8;
}

html.dark-mode .solution-box {
  background: #0f172a;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

html.dark-mode .solution-box h3 {
  color: #93c5fd;
}

html.dark-mode .solution-box p {
  color: #cbd5e1;
}

.subcategory-video iframe {
  max-width: 100%;
  height: 600px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
