/* =========================================================
   COURSE CATALOGUE — HOVER / TAP EXPAND (NOT A MODAL)
   Append to style.css, or keep as its own linked stylesheet.

   How it works:
   - Each .course-card contains two children:
       .course-card-front     -> the normal icon/title/desc/pill
       .course-catalogue      -> the lesson list, hidden by default
   - .course-catalogue is positioned absolutely over the same
     card, so on hover it grows in place, right where the card
     is sitting, instead of opening a centered popup.
   - Desktop: pure CSS :hover / :focus-within.
   - Touch devices: JS toggles a `.is-active` class on tap
     (see course-modal.js), since touch screens have no hover.
   ========================================================= */

.course-hint {
  text-align: center;
  color: #276cff;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* The grid needs room for cards to grow into on hover without
   jumping the whole page layout around. */
.course-grid {
  align-items: start;
}

.course-card {
  position: relative;
  cursor: pointer;
  isolation: isolate;
  z-index: 1;
}

.course-card:focus-visible {
  outline: 2px solid #276cff;
  outline-offset: 4px;
}

/* Bring the hovered/active card above its neighbours so its
   expanded catalogue can overlap the row(s) below it. */
.course-card:hover,
.course-card:focus-within,
.course-card.is-active {
  z-index: 40;
}

.course-card-front {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: opacity 0.25s ease;
}

.course-card .lesson-count {
  display: inline-block;
  margin-top: 16px;

  color: #276cff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;

  transition: color 0.35s ease;
}

.course-card:hover .lesson-count,
.course-card:focus-within .lesson-count,
.course-card.is-active .lesson-count {
  color: #5d4dff;
}

/* ---------------- THE CATALOGUE PANEL ---------------- */

.course-catalogue {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;

  background: #fff;
  border-radius: 30px;
  border: 1px solid rgba(39, 108, 255, 0.12);
  box-shadow: 0 25px 55px rgba(16, 25, 53, 0.2);

  padding: 34px 28px 28px;

  max-height: 420px;
  overflow-y: auto;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px) scale(0.98);
  transform-origin: top center;

  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

.course-card:hover .course-catalogue,
.course-card:focus-within .course-catalogue,
.course-card.is-active .course-catalogue {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.course-catalogue-head {
  margin-bottom: 18px;
  padding-bottom: 14px;
  padding-right: 6px;
  border-bottom: 1px solid #eef1f8;
}

.course-catalogue-head h4 {
  font-size: clamp(15px, 1.8vw, 17px);
  color: #111;
  margin-bottom: 4px;
  text-align: left;
}

.course-catalogue-head span {
  color: #276cff;
  font-weight: 600;
  font-size: 12.5px;
}

.course-catalogue ol {
  list-style: none;
  counter-reset: topic-counter;
  margin-bottom: 22px;
  text-align: left;
}

.course-catalogue ol li {
  counter-increment: topic-counter;
  position: relative;

  padding: 9px 0 9px 34px;
  border-bottom: 1px solid #eef1f8;

  font-size: 13.5px;
  color: #333;
  line-height: 1.5;
}

.course-catalogue ol li:last-child {
  border-bottom: none;
}

.course-catalogue ol li::before {
  content: counter(topic-counter);

  position: absolute;
  left: 0;
  top: 7px;

  width: 22px;
  height: 22px;

  border-radius: 50%;
  background: rgba(39, 108, 255, 0.1);
  color: #276cff;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 11px;
  font-weight: 700;
}

.course-catalogue-cta {
  display: block;
  text-align: center;
  width: 100%;
  padding: 12px 20px;
  font-size: 14px;
}

/* Scrollbar polish for the catalogue panel */
.course-catalogue::-webkit-scrollbar {
  width: 6px;
}

.course-catalogue::-webkit-scrollbar-thumb {
  background: rgba(39, 108, 255, 0.3);
  border-radius: 10px;
}

/* ---------------- TOUCH / SMALL SCREENS ----------------
   Hover doesn't exist on touch, so JS toggles `.is-active`.
   On narrow screens the grid is a single column, so let the
   catalogue expand the card in normal flow instead of
   floating absolutely (avoids covering content awkwardly on
   a small screen where there's nothing to "float over"). */
@media (max-width: 700px) {

  .course-catalogue {
    position: static;
    width: auto;
    max-height: 0;
    padding: 0 28px;
    margin-top: 0;
    border: none;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    pointer-events: none;
    transform: none;
    transition: max-height 0.4s ease, padding 0.4s ease;
    overflow: hidden;
  }

  .course-card.is-active .course-catalogue {
    max-height: 900px;
    padding: 24px 28px 28px;
    pointer-events: auto;
    border-top: 1px solid #eef1f8;
    margin-top: 20px;
  }

  .course-card:hover,
  .course-card:focus-within,
  .course-card.is-active {
    z-index: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .course-catalogue {
    transition: none !important;
  }
}