/* ════════════════════════════════════════
   SUBTOPICS SECTION
════════════════════════════════════════ */
.subtopics-section {
  background: #fff;
  padding: 72px 24px 72px;
}

.subtopics-inner {
  max-width: 1280px;
  margin: 0 auto;
  background: #f5f0eb;
  border-radius: 24px;
  padding: 48px 52px 56px;
}

/* Header row */
.subtopics-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 40px;
}

.subtopics-title {
  font-size: 28px;
  font-weight: 600;
  color: #111;
  letter-spacing: -0.8px;
  margin-bottom: 6px;
  line-height: 1.1;
}

.subtopics-sub {
  font-size: 14px;
  color: #6b7280;
  font-weight: 400;
}

/* Arrow buttons */
.subtopics-arrows {
  display: flex;
  gap: 10px;
  padding-top: 6px;
  flex-shrink: 0;
}

.arrow-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1.5px solid #d1d5db;
  background: transparent;
  display: grid; place-items: center;
  color: #374151;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.arrow-btn:hover {
  border-color: #111;
  background: #111;
  color: #fff;
}

/* Track */
.subtopics-track-wrap { overflow: hidden; }

.subtopics-track {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.subtopics-track::-webkit-scrollbar { display: none; }

/* ── CARD — overlay design on all sizes ── */
.sub-card {
  position: relative;
  flex: 0 0 calc(20% - 16px);
  min-width: 200px;
  aspect-ratio: 3 / 4;
  border-radius: 20px;
  overflow: hidden;
  display: block;
  text-decoration: none;
  cursor: pointer;
}

/* Image fills the whole card */
.sub-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #1a1a2e;
}
.sub-card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.sub-card:hover .sub-card-img img { transform: scale(1.07); }

/* Dark gradient overlay — stronger at bottom */
.sub-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0,0,0,0.85) 0%,
    rgba(0,0,0,0.4)  45%,
    rgba(0,0,0,0.08) 100%
  );
  border-radius: 20px;
  z-index: 1;
  transition: opacity 0.3s;
}
.sub-card:hover::after {
  background: linear-gradient(
    to top,
    rgba(0,0,0,0.92) 0%,
    rgba(0,0,0,0.5)  50%,
    rgba(0,0,0,0.15) 100%
  );
}

/* Bookmark icon — top right */
.sub-card-bookmark {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 14px; right: 14px;
  width: 34px; height: 34px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  color: #fff;
  z-index: 3;
  cursor: pointer;
  transition: background 0.2s;
}
.sub-card-bookmark:hover { background: rgba(255,255,255,0.28); }

/* Text overlay — sits at bottom of image */
.sub-card-overlay {
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 20px 18px;
  z-index: 2;
}

.sub-card-overlay .sub-card-count {
  font-size: 11px;
  font-weight: 700;
  color: #fb923c;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0;
}

.sub-card-overlay .sub-card-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Stats row inside overlay */
.sub-card-overlay .sub-card-stats {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}
.sub-card-overlay .sub-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  font-weight: 500;
}

/* Hide the duplicate text that sits outside the image */
.sub-card > p.sub-card-count,
.sub-card > h3.sub-card-name,
.sub-card > .sub-card-stats {
  display: none !important;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .sub-card { min-width: 180px; }
}

@media (max-width: 768px) {
  .subtopics-inner {
    padding: 32px 24px 36px;
    border-radius: 20px;
  }
  .subtopics-title { font-size: 26px; }
  .sub-card { min-width: 160px; }
  .sub-card-overlay .sub-card-name { font-size: 14px; }
}

@media (max-width: 600px) {
  .subtopics-section { padding: 32px 16px 40px; }
  .subtopics-inner { padding: 24px 16px; border-radius: 16px; }
  .subtopics-header { margin-bottom: 16px; }
  .subtopics-title { font-size: 20px; letter-spacing: -0.4px; }
  .subtopics-sub { font-size: 12px; }
  .subtopics-arrows { gap: 8px; }

  /* Single-row horizontal scroll — no vertical overflow */
  .subtopics-track-wrap { overflow: hidden; }
  .subtopics-track {
    display: flex !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 12px !important;
    padding-bottom: 4px;
  }
  .sub-card {
    flex: 0 0 58vw !important;
    min-width: unset !important;
    scroll-snap-align: start;
    aspect-ratio: 3 / 4;
  }
}

/* ── Bento subtopics mobile ── */
@media (max-width: 640px) {
  .subtopics-section { padding: 0 12px 36px; }
}
