* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Professional base font */
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial;
  background: #f5f7fa;
  color: #2c3e50;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Kid-friendly display font for prominent headings and buttons */
.kids-font {
  font-family: "Baloo 2", "Segoe UI", cursive;
}
.big-tab .icon,
.big-tab lottie-player {
  pointer-events: none; /* Allow button/anchor to receive clicks */
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

/* Header */
header {
  background: #1e3a8a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 3rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Header actions (used by chapters page for a top-right back button) */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-actions .small-link.back {
  background: transparent;
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.12);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
}
.header-actions .small-link.back:hover {
  background: rgba(255, 255, 255, 0.06);
}

.logo {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.logo img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  background: #ffffff;
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.logo h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.site-tag {
  font-size: 0.875rem;
  color: #e0e7ff;
  font-weight: 500;
  margin-top: 2px;
}

/* Main */
main {
  flex: 1;
  padding: 4rem 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.subjects-container {
  width: 100%;
  max-width: 1200px;
}

/* Single-subject card */
.single-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 4rem 3rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  text-align: center;
  min-height: 500px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Chapters page tweaks (global so chapters.html can be simpler) */
.chapters-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1.25rem;
  width: 100%;
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}
.chapter-link {
  display: block;
  /* soft colored background with accent left border */
  background: linear-gradient(180deg, #f0f7ff 0%, #ffffff 100%);
  border-left: 8px solid #2563eb;
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  box-shadow: 0 8px 22px rgba(16, 24, 40, 0.06);
  color: #0b2545;
  font-weight: 800;
  text-decoration: none;
  font-size: 1.125rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.chapter-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 40px rgba(16, 24, 40, 0.12);
  background: linear-gradient(180deg, #e6f0ff 0%, #ffffff 100%);
}

@media (max-width: 768px) {
  .header-actions {
    position: absolute;
    right: 1rem;
  }
  .chapters-list {
    padding: 0 1rem;
  }
}

.single-title {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  line-height: 1.2;
  color: #1e3a8a;
  margin-bottom: 1rem;
  font-weight: 800;
  /* kid-friendly display font */
  font-family: "Baloo 2", cursive;
}

.single-desc {
  color: #64748b;
  margin-bottom: 3rem;
  font-size: 1.15rem;
  font-weight: 500;
}

.single-tabs {
  display: flex;
  gap: 1rem; /* tighter gap so tabs sit closer together */
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap; /* keep tabs on a single line on larger screens */
  overflow-x: auto; /* allow horizontal scrolling if viewport is narrow */
  padding: 0.25rem 0; /* small vertical breathing room */
}

.big-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  text-decoration: none;
  padding: 0.9rem 1.6rem; /* compact touch area */
  border-radius: 12px;
  border: none;
  color: white;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  min-width: 0; /* allow flex sizing */
  flex: 0 0 auto; /* size to content so tabs stay compact */
  transition: all 0.18s ease;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
}

.big-tab:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.big-tab:active {
  transform: translateY(0);
}

.youtube-tab {
  background: #ff5338;
}

.ai-tab {
  background: #2563eb;
}

/* Flip Book specific styling: visually distinct box, slightly larger and responsive */
.flipbook-tab {
  /* beautiful green gradient background (replaces previous pale-blue) */
  background: linear-gradient(180deg, #34d399 0%, #10b981 100%);
  color: #ffffff; /* white text for contrast on green */
  padding: 1.15rem 2.2rem; /* slightly larger than other compact tabs */
  border-radius: 12px;
  box-shadow: 0 10px 26px rgba(16, 185, 129, 0.08); /* soft green shadow */
  border: 1px solid rgba(16, 185, 129, 0.12); /* subtle green-tinted border */
}

/* Make the flipbook icon a little larger so the box looks more substantial */
.flipbook-tab .icon,
.flipbook-tab lottie-player {
  width: 56px;
  height: 56px;
}

/* Keep flipbook label slightly smaller and darker to balance the light background */
.flipbook-tab .tab-label {
  color: #ffffff; /* keep label readable on green */
  font-weight: 800;
  font-size: 0.95rem;
}

/* Hover state for flipbook to keep consistency with other tabs */
.flipbook-tab:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(16, 185, 129, 0.1);
  /* deepen the green on hover to give affordance */
  background: linear-gradient(180deg, #2bbf7a 0%, #0ea06a 100%);
}

/* Answer Key tab: yellow variant with good contrast for the label */
.answer-key-tab {
  background: linear-gradient(180deg, #ffea7f 0%, #ffd54f 100%);
  color: #1b1b1b; /* dark text for contrast on yellow */
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 10px 26px rgba(255, 213, 79, 0.08);
}
.answer-key-tab:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.12);
  background: linear-gradient(180deg, #ffe36b 0%, #ffc83d 100%);
}

.big-tab .icon {
  font-size: 1.25rem;
}
.big-tab .icon,
.big-tab lottie-player {
  width: 40px;
  height: 40px;
}

/* Ensure flipbook lottie is larger than other tabs — placed after the general rule so it wins */
.big-tab.flipbook-tab .icon,
.big-tab.flipbook-tab lottie-player {
  width: 84px;
  height: 84px;
}

/* Enlarge YouTube and AI lottie icons to match flipbook emphasis */
.big-tab.youtube-tab .icon,
.big-tab.youtube-tab lottie-player,
.big-tab.ai-tab .icon,
.big-tab.ai-tab lottie-player {
  width: 84px;
  height: 84px;
}

/* Footer */
footer {
  background: #1e293b;
  color: #e2e8f0;
  /* slightly tighter vertical padding */
  padding: 3rem 2rem 1.5rem;
  margin-top: auto;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  /* Make left logo column larger and place contact on the right for balance */
  /* Increased to allow a much bigger footer logo without overlap */
  grid-template-columns: 320px 1fr;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.footer-col h4 {
  color: #ffffff;
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #334155;
}

.logo-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
}

.logo-section img {
  /* Increased footprint for a more prominent footer logo */
  width: 260px;
  height: auto;
  margin-bottom: 0.5rem;
  background: #ffffff;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(2,6,23,0.14);
}

/* Align the contact column to the right to balance the large logo on the left */
.footer-content > .footer-col:nth-of-type(2) {
  justify-self: end;
  text-align: right;
  max-width: 640px;
}

.ceo-info {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: #334155;
  border-radius: 8px;
}

.ceo-info h5 {
  color: #ffffff;
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.footer-title {
  color: #94a3b8;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer-col p,
.footer-col address {
  color: #cbd5e1;
  line-height: 1.75;
  margin-bottom: 1rem;
  font-style: normal;
  font-size: 0.95rem;
}

.footer-col a {
  color: #cbd5e1;
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-col a:hover {
  color: #ffffff;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: #60a5fa;
}

.footer-bottom {
  border-top: 1px solid #334155;
  padding-top: 2rem;
  text-align: center;
}

.footer-bottom p {
  color: #94a3b8;
  font-size: 0.875rem;
}

@media (max-width: 768px) {
  header {
    padding: 1rem 1.5rem;
  }

  .logo h1 {
    font-size: 1.4rem;
  }

  .site-tag {
    font-size: 0.75rem;
  }

  /* make the header logo slightly smaller on mobile to preserve space */
  .logo img {
    width: 48px;
    height: 48px;
    padding: 4px;
  }

  main {
    padding: 2rem 1rem;
  }

  .single-card {
    padding: 2.5rem 1.5rem;
    min-height: 400px;
  }

  .single-title {
    font-size: 2rem;
  }

  .single-desc {
    font-size: 1rem;
  }

  .single-tabs {
    gap: 1rem;
    /* Stack tabs vertically on small screens to avoid horizontal scrolling */
    flex-direction: column;
    align-items: stretch;
    overflow-x: visible;
  }

  .big-tab {
    min-width: 100%;
    width: 100%;
    padding: 1.25rem 1.5rem;
    font-size: 1.15rem;
    flex: 0 0 auto;
  }

  /* Scale down the flipbook lottie icon on small screens for balance */
  .big-tab.flipbook-tab .icon,
  .big-tab.flipbook-tab lottie-player {
    width: 48px;
    height: 48px;
  }

  /* Mobile sizes for YouTube and AI lotties to keep buttons balanced */
  .big-tab.youtube-tab .icon,
  .big-tab.youtube-tab lottie-player,
  .big-tab.ai-tab .icon,
  .big-tab.ai-tab lottie-player {
    width: 56px;
    height: 56px;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  /* reduce footer logo on small screens so it doesn't dominate header */
  .logo-section img {
    width: 120px;
    padding: 10px;
  }

  footer {
    padding: 3rem 1.5rem 1.5rem;
  }
}
