/* Single course enrol sidebar + mobile sticky bar (templates/course/topc2.php). No JS needed for layout. */

.single-course {
  --jn-brand: #7ba631;          /* Janets green */
  --jn-brand-strong: #658a26;   /* button fill: white text stays readable */
  --jn-brand-hover: #557520;
  --jn-brand-tint: #f2f8e8;
  --jn-brand-ink: #4a6a14;
  --jn-navy: #2b354e;           /* Janets navy */
  --jn-muted: #64748b;
  --jn-line: #e5e9f0;
  --jn-radius: 14px;
  --jn-sticky-top: 24px;
}

/* WPLMS sets `.pusher { overflow: hidden }`, which disables position: sticky.
   `clip` clips the same way without creating a scroll container. */
body.single-course .pusher {
  overflow: clip;
}

.jn-ico {
  width: 1em;
  height: 1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- sidebar card ---------- */
.jn-sidebar {
  position: relative;
  z-index: 2;
}

.jn-card {
  background: #fff;
  border: 1px solid var(--jn-line);
  border-radius: var(--jn-radius);
  box-shadow: 0 10px 30px -12px rgba(43, 53, 78, 0.25);
  overflow: hidden;
  color: var(--jn-navy);
}

.jn-card__media {
  aspect-ratio: 16 / 9;
  background: var(--jn-brand-tint);
  overflow: hidden;
}

.jn-card__media a {
  display: block;
  height: 100%;
}

.jn-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  margin: 0;
  border-radius: 0;
  max-width: none;
}

.jn-card__body {
  padding: 20px;
}

/* price row */
.jn-price {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.jn-price__now {
  font-size: 44px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--jn-navy);
}

.jn-price__now--legacy {
  font-size: 32px;
}

.jn-price__meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.jn-price__was {
  opacity: 1; /* WPLMS fades every <del> to .3 */
  font-size: 17px;
  font-weight: 600;
  color: var(--jn-muted);
}

.jn-price__vat {
  font-size: 13px;
  color: var(--jn-muted);
}

.jn-price__badge {
  margin-left: auto;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--jn-brand-tint);
  color: var(--jn-brand-ink);
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}

/* timer + button block */
.jn-cta {
  border-radius: 12px;
  box-shadow: 0 8px 20px -10px rgba(101, 138, 38, 0.55);
}

.jn-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid var(--jn-brand);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: #fff;
  font-size: 14px;
  line-height: 1.3;
  color: var(--jn-brand-ink);
  font-weight: 600;
}

.jn-timer .jn-ico {
  color: var(--jn-brand);
}

.jn-timer__time {
  color: var(--jn-navy);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.jn-btn,
.jn-btn:visited {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--jn-brand-strong);
  color: #fff !important;
  font-size: 19px;
  font-weight: 800;
  text-decoration: none !important;
  transition: background-color 0.2s ease;
}

.jn-timer + .jn-btn {
  border-radius: 0 0 12px 12px;
}

.jn-btn:hover,
.jn-btn:focus-visible {
  background: var(--jn-brand-hover);
  color: #fff;
}

.jn-btn:focus-visible {
  outline: 3px solid var(--jn-navy);
  outline-offset: 2px;
}

/* existing WPLMS / membership button for enrolled learners and members */
.jn-cta--legacy {
  box-shadow: none;
}

.jn-cta--legacy .course_button,
.jn-cta--legacy a.button,
.jn-cta--legacy button {
  display: block;
  width: 100%;
  margin: 0;
  padding: 16px 18px !important;
  border: 0;
  border-radius: 12px;
  background: var(--jn-brand-strong) !important;
  color: #fff !important;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}

/* trust row */
.jn-trust {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--jn-muted);
}

.jn-trust li {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
}

.jn-trust .jn-ico {
  color: var(--jn-brand);
}

/* course facts */
.jn-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--jn-line);
  list-style: none;
  text-align: center;
}

.jn-facts li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  min-width: 0;
}

.jn-facts span {
  font-size: 12px;
  color: var(--jn-muted);
}

.jn-facts strong {
  font-size: 14px;
  color: var(--jn-navy);
  overflow-wrap: anywhere;
}

/* accreditation logos */
.jn-accred {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.jn-accred li {
  flex: 1 1 0;
  margin: 0;
  text-align: center;
}

.jn-accred img {
  max-width: 100%;
  max-height: 44px;
  width: auto;
  object-fit: contain;
}

/* all-courses upsell */
.jn-all,
.jn-all:visited {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--jn-line);
  font-size: 14px;
  font-weight: 600;
  color: var(--jn-navy);
  text-decoration: none;
}

.jn-all:hover {
  color: var(--jn-brand-ink);
}

/* ---------- desktop: sticky sidebar ---------- */
@media (min-width: 768px) {
  .a2n_c-tab_section .row {
    align-items: stretch;
  }

  .jn-sidebar-col {
    align-self: stretch;
  }
}

/* only stick when the whole card fits on screen */
@media (min-width: 768px) and (min-height: 700px) {
  .jn-sidebar {
    position: sticky;
    top: var(--jn-sticky-top);
  }
}

@media (min-width: 768px) and (max-width: 991px) {
  .jn-price__now {
    font-size: 36px;
  }

  .jn-price__badge {
    margin-left: 0;
  }
}

/* ---------- mobile sticky bar ---------- */
.jn-mbar {
  display: none;
}

@media (max-width: 767px) {
  .jn-sidebar-col {
    width: 100%;
    margin: 0 0 24px;
  }

  .jn-mbar {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    background: #fff;
    border-top: 2px solid var(--jn-brand);
    box-shadow: 0 -8px 24px -12px rgba(43, 53, 78, 0.35);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .jn-mbar__timer {
    border: 0;
    border-bottom: 1px solid var(--jn-line);
    border-radius: 0;
    padding: 6px 12px;
    font-size: 13px;
  }

  .jn-mbar__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
  }

  .jn-price--compact {
    flex-wrap: nowrap;
    gap: 8px;
    margin: 0;
    min-width: 0;
  }

  .jn-price--compact .jn-price__now {
    font-size: 30px;
  }

  .jn-price--compact .jn-price__was {
    font-size: 14px;
  }

  .jn-price--compact .jn-price__vat {
    font-size: 12px;
  }

  .jn-price--compact .jn-price__badge {
    margin-left: 0;
    padding: 4px 7px;
    font-size: 13px;
  }

  .jn-btn--compact,
  .jn-btn--compact:visited {
    width: auto;
    min-height: 50px;
    flex: none;
    padding: 10px 20px;
    font-size: 17px;
  }

  /* room so the bar never covers the footer */
  body.single-course:has(.jn-mbar) {
    padding-bottom: 120px;
  }

  /* Hide the bar while the sidebar card is on screen (browsers with scroll-driven
     animations); elsewhere it simply stays visible. */
  @supports (animation-timeline: view()) {
    .a2n_c-tab_section {
      timeline-scope: --jn-card;
    }

    .jn-card {
      view-timeline: --jn-card block;
    }

    .jn-mbar {
      animation: jn-mbar-hide linear;
      animation-timeline: --jn-card;
      animation-range: cover 0% cover 100%;
    }
  }
}

/* image beside content on large phones / small tablets */
@media (min-width: 560px) and (max-width: 767px) {
  .jn-card {
    display: grid;
    grid-template-columns: 40% 1fr;
  }

  .jn-card__media {
    aspect-ratio: auto;
    min-height: 100%;
  }
}

@media (max-width: 380px) {
  .jn-price--compact .jn-price__badge {
    display: none;
  }
}

@keyframes jn-mbar-hide {
  0%,
  100% {
    transform: translateY(0);
  }

  10%,
  90% {
    transform: translateY(110%);
    visibility: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  .jn-btn {
    transition: none;
  }
}
