/**
 * Hello Home — DC Academy course rail.
 *
 * The rail is a plain horizontal scroller: swipe, momentum and keyboard
 * scrolling come from the browser, and the arrows scroll to an exact card
 * position. Tabs filter in the page, so switching level costs no request.
 */

.hello-academy {
  --hello-pad-y: clamp(64px, 7vw, 104px);
  --hello-pad-x: 0; /* the rail bleeds; the header pads itself */
  --hello-width: 100%;
  --hello-rail-pad: clamp(20px, 5vw, 80px);
  background: #f4f4f4;
  color: #0d0d0d;
}

.hello-academy .hello-widget__inner {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

/* ---- header ------------------------------------------------------------- */

.hello-academy__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: 0 var(--hello-rail-pad);
}

.hello-academy__intro {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 720px;
}

.hello-academy__heading {
  margin: 0;
  font-size: clamp(36px, 4.2vw, 64px) !important;
  line-height: 1.02 !important;
  font-weight: 900 !important;
  letter-spacing: -1.5px;
}

.hello-academy__lead {
  margin: 0;
  font-size: clamp(18px, 1.5vw, 22px);
  line-height: 1.4;
  font-weight: 700;
}

.hello-academy__standfirst {
  margin: 0;
  font-size: 17px;
  line-height: 1.5;
  color: #444;
}

/* ---- tabs and arrows ---------------------------------------------------- */

.hello-academy__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
}

.hello-academy__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px;
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 999px;
}

.hello-academy__tab {
  -webkit-appearance: none;
  appearance: none;
  height: 42px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #444;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.hello-academy__tab.is-active {
  background: #0d0d0d;
  color: #fff;
  font-weight: 700;
}
.hello-academy__tab:focus-visible {
  outline: 2px solid var(--hello-accent);
  outline-offset: 2px;
}

.hello-academy__arrows {
  display: flex;
  gap: 6px;
}

.hello-academy__arrow {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 0;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid #d6d6d6;
  border-radius: 50%;
  color: #8a8a8a;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.hello-academy__arrow:hover,
.hello-academy__arrow:focus-visible {
  color: #0d0d0d;
  border-color: #0d0d0d;
  outline: none;
}

/* ---- rail --------------------------------------------------------------- */

.hello-academy__rail {
  display: flex;
  gap: 20px;
  padding: 4px var(--hello-rail-pad) 12px;
  overflow-x: auto;
  /**
   * No scroll snapping, deliberately.
   *
   * A snapping rail fights every programmatic scroll that is not already on
   * a snap point: behavior:'smooth' gets interrupted and returned to the
   * start, and animating scrollLeft by hand is dragged back a frame at a
   * time. Both were measured on this rail. Snapping only tidies the end of a
   * swipe; arrows that work are worth more than that.
   */
  scroll-padding-left: var(--hello-rail-pad);
  scrollbar-width: none;
  outline: none;
}
.hello-academy__rail::-webkit-scrollbar {
  display: none;
}
.hello-academy__card {
  flex: 0 0 clamp(280px, 26vw, 360px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease;
}
.hello-academy__card.is-hidden {
  display: none;
}
.hello-academy__card:hover {
  transform: translateY(-2px);
}

/* ---- thumbnail ---------------------------------------------------------- */

/**
 * border-radius: 0 is deliberate. The theme gives every <button> a 100px
 * radius, and a card with a trailer renders its thumbnail AS a button -- at
 * this height the corners meet and the image reads as an oval. Cards without
 * a trailer are <a> or <div> and were unaffected, which is why only some of
 * them looked wrong.
 */
.hello-academy__thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #131313;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
}
@supports not (aspect-ratio: 16 / 9) {
  .hello-academy__thumb { height: 0; padding-bottom: 56.25%; }
}

.hello-academy__img {
  position: absolute;
  inset: 0;
  background-size: cover;
  /* Faces sit high in these stills; centring crops foreheads. */
  background-position: center 25%;
}

/**
 * No artwork -- an accent panel carrying the course name, as the comp does.
 * Better than an empty frame, and it is what a card whose post is missing
 * falls back to.
 */
.hello-academy__blank {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  padding: 20px 22px;
  background: var(--hello-accent);
  text-align: left;
}
.hello-academy__blank-kicker {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #ffd5dc;
}
.hello-academy__blank-title {
  font-size: 22px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #fff;
}

.hello-academy__badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #0d0d0d;
}

.hello-academy__play {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--hello-accent);
  color: #fff;
  transition: transform 0.2s ease;
}
.hello-academy__play svg {
  margin-left: 3px; /* optical centring of the triangle */
}
.hello-academy__thumb:hover .hello-academy__play,
.hello-academy__thumb:focus-visible .hello-academy__play {
  transform: scale(1.08);
}

/* ---- card body ---------------------------------------------------------- */

.hello-academy__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  padding: 20px 22px 22px;
}

.hello-academy__meta {
  margin: 0;
  min-height: 16px; /* keeps titles aligned when a card has no stats line */
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--hello-accent);
}

.hello-academy__title {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.3px;
  text-wrap: pretty;
}

.hello-academy__desc {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: #4a4a4a;
}

.hello-academy__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid #eee;
}

.hello-academy__byline {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.hello-academy__byline-label {
  font-size: 12px;
  font-weight: 600;
  color: #8a8a8a;
}
.hello-academy__byline-name {
  font-size: 15px;
  font-weight: 700;
  color: #0d0d0d;
}

/* ---- call to action ----------------------------------------------------- */

.hello-academy__cta {
  display: flex;
  justify-content: center;
  padding: 0 20px;
}
.hello-academy .hello-btn.hello-academy__cta-btn {
  height: 60px;
  padding: 0 36px;
  border-radius: 8px;
  font-size: 17px;
  font-weight: 800;
  text-align: center;
}

@media (max-width: 767px) {
  .hello-academy__head {
    flex-direction: column;
    align-items: flex-start;
  }
  /* Arrows are redundant once the rail is swipeable by thumb. */
  .hello-academy__arrows {
    display: none;
  }

  /**
   * The level tabs stack.
   *
   * In a row they are both too wide and too narrow: four labels of unequal
   * length will not fit on one line, and wrapping leaves a ragged two-and-a-
   * bit rows inside the pill. Stacked, each is a full-width row of even
   * height, which also gives a thumb a sane target.
   */
  .hello-academy__controls,
  .hello-academy__tabs {
    width: 100%;
  }
  .hello-academy__tabs {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 4px;
    border-radius: 18px;
  }
  .hello-academy__tab {
    width: 100%;
    height: 46px;
    text-align: center;
  }

  /**
   * One card per screen, and snapping back on.
   *
   * 100% of the rail's content box is the viewport less both gutters, so a
   * card fills the screen between them. Free scrolling would then leave two
   * half cards showing, so the rail snaps here -- safe at this width because
   * the arrows, the programmatic scrolls that snapping broke, are hidden
   * above. Swipe, momentum and the tab reset all still work.
   */
  .hello-academy__rail {
    scroll-snap-type: x mandatory;
  }
  .hello-academy__card {
    flex: 0 0 100%;
    scroll-snap-align: start;
  }
  .hello-academy .hello-btn.hello-academy__cta-btn {
    width: 100%;
    height: auto;
    min-height: 60px;
    padding: 14px 20px;
    font-size: 16px;
  }
}
