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

.subtopics-inner {
  max-width: 1280px;
  margin: 0 auto;
  background: #f5f5f6;
  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;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.subtopics-track::-webkit-scrollbar { display: none; }

/* Individual sub-card */
.sub-card {
  flex: 0 0 calc(20% - 16px);
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-decoration: none;
  color: inherit;
}

/* Slightly wider than tall — matches original proportions */
.sub-card-img {
  width: 100%;
  aspect-ratio: 6 / 5;
  border-radius: 16px;
  overflow: hidden;
  background: #e5e7eb;
}
.sub-card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}
.sub-card:hover .sub-card-img img { transform: scale(1.05); }

.sub-card-name {
  font-size: 17px;
  font-weight: 500;
  color: #111;
  line-height: 1.2;
}

.sub-card-count {
  font-size: 14px;
  color: #6b7280;
  margin-top: -10px;
}

/* Desktop: hide overlay elements */
.sub-card-bookmark { display: none; }
.sub-card-overlay { display: none; }

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

@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; }

  /* 2-row grid, scrolls horizontally */
  .subtopics-track-wrap { overflow: visible; }
  .subtopics-track {
    display: grid !important;
    grid-template-rows: repeat(2, auto) !important;
    grid-auto-flow: column !important;
    grid-auto-columns: calc(50% - 8px) !important;
    gap: 12px !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  /* Overlay card design */
  .sub-card {
    position: relative !important;
    min-width: unset !important;
    flex: unset !important;
    scroll-snap-align: start;
    gap: 0 !important;
    aspect-ratio: 3/4;
    border-radius: 16px;
    overflow: hidden;
    display: block !important;
    text-decoration: none;
  }
  /* Fill image */
  .sub-card-img {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: unset !important;
    border-radius: 0 !important;
  }
  .sub-card-img img { width: 100%; height: 100%; object-fit: cover; }
  /* Dark gradient overlay */
  .sub-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.35) 50%, rgba(0,0,0,0.1) 100%);
    border-radius: 16px;
    z-index: 1;
  }
  /* Bookmark icon top-right */
  .sub-card-bookmark {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 12px; right: 12px;
    width: 32px; height: 32px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(6px);
    border: none;
    border-radius: 8px;
    color: #fff;
    z-index: 3;
    cursor: pointer;
  }
  /* Text overlay at bottom */
  .sub-card-overlay {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 14px;
    z-index: 2;
  }
  .sub-card-count {
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #fb923c !important; /* orange like reference */
    text-transform: uppercase !important;
    letter-spacing: 0.6px !important;
    margin-top: 0 !important;
  }
  .sub-card-name {
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #fff !important;
    line-height: 1.3 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }
  /* Hide original desktop name/count (shown via overlay instead) */
  .sub-card > h3.sub-card-name,
  .sub-card > p.sub-card-count { display: none !important; }
}

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