/* AplusGen — Home page sections */

/* ============================================================
   1. Hero
   ============================================================ */
.hero { position: relative; overflow: hidden; }

/* Three tracks, but only two blocks. The middle track is an overlap zone that
   both the copy and the image occupy, so the headline runs over the left edge
   of the photograph the way the mockup shows. The image carries a fade across
   that zone so the text stays on near-white. */
.hero__grid {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)      /* copy only  */
    minmax(0, 0.26fr)   /* overlap    */
    minmax(0, 0.92fr);  /* image only */
  align-items: center;
}
.hero__copy {
  grid-area: 1 / 1 / 2 / 3;
  position: relative;
  z-index: 2;
  padding: var(--sp-12) 0 var(--sp-12)
           max(var(--gutter), calc((100vw - var(--container)) / 2 + var(--gutter)));
}
.hero__title {
  font-size: var(--fs-hero);
  font-weight: 700;
  letter-spacing: -0.015em;
  /* Let the headline set its own width and run past the copy column rather
     than wrapping early; the <br> controls the two lines. */
  width: max-content;
  max-width: 100%;
}
.hero__lead {
  margin-top: var(--sp-4);
  max-width: 46ch;   /* the paragraph stays at a readable measure */
  color: var(--muted);
  font-size: var(--fs-lead);
}
.hero__note { margin-top: var(--sp-3); font-size: var(--fs-xs); color: var(--muted); }
.hero__actions { display: flex; gap: var(--sp-3); margin-top: var(--sp-6); flex-wrap: wrap; }

.hero__media {
  grid-area: 1 / 2 / 2 / 4;
  position: relative;
  align-self: stretch;
  margin-right: max(0px, calc((100vw - var(--container)) / 2));
  min-height: 360px;
  overflow: hidden;
  background-image: url("../../assets/img/Home/home-hero.webp");
  background-repeat: no-repeat;
  background-position: 42% 46%;
  background-size: 108% auto;
  z-index: 1;
}

/* Fade the image into the page across the overlap zone. Without this the
   headline would sit on photographic detail and lose contrast. Replace the
   stops with the real image's composition once assets land. */
.hero__media::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(96deg,
    #fff 0%,
    rgba(255, 255, 255, 0.84) 12%,
    rgba(255, 255, 255, 0.38) 32%,
    rgba(255, 255, 255, 0.10) 48%,
    rgba(255, 255, 255, 0) 60%);
}

/* ---- Trust chips, overlapping the hero's bottom edge ---- */
.trustbar { position: relative; z-index: 3; margin-top: -26px; }
.trustbar__row { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.trustbar__item {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-md);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--navy);
}
.trustbar__item svg { width: 17px; height: 17px; flex: none; }

/* ============================================================
   2. Programs
   ============================================================ */
.programs__grid {
  display: grid;
  grid-template-columns: 1.28fr 1fr 1fr 1fr;
  gap: var(--sp-4);
  align-items: stretch;
}
.pcard {
  display: flex;
  flex-direction: column;
  padding: var(--sp-6);
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur-base) var(--ease),
              transform var(--dur-base) var(--ease);
}
.pcard:hover,
.pcard:focus-within { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.pcard--tint-blue { background: var(--tint-blue); border-color: transparent; }
.pcard--tint-grey { background: var(--tint-grey); border-color: transparent; }
.pcard--tint-purple { background: var(--tint-purple); border-color: transparent; }

.pcard--lead { flex-direction: row; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-4); }
.pcard--lead .pcard__book {
  width: 72px;
  height: auto;
  flex: none;
  object-fit: contain;
  filter: drop-shadow(0 4px 7px rgba(11, 42, 91, 0.16));
}
.pcard--lead .pcard__body { display: flex; flex-direction: column; height: 100%; }

.pcard__head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); flex-wrap: wrap; }
.pcard__icon { width: 46px; height: 46px; }
.pcard__icon svg { width: 100%; height: 100%; }
.pcard__title { font-size: var(--fs-h3); font-weight: 600; }
.pcard__title--blue { color: var(--blue-ink); }
.pcard__title--orange { color: var(--orange-ink); }
.pcard__title--navy { color: var(--navy); }
.pcard__title--purple { color: var(--purple-ink); }
.pcard__text { color: var(--muted); font-size: var(--fs-sm); margin-bottom: var(--sp-4); }
.pcard .arrow-link { margin-top: auto; }

/* ============================================================
   3. Why Families Choose AplusGen — 6 tinted tiles
   Static information cards: tint only, no shadow (Review V1 §5.5).
   ============================================================ */
.why__grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--sp-3);
}
.wtile {
  padding: var(--sp-6) var(--sp-4);
  border-radius: var(--r-lg);
  text-align: center;
}
.wtile .ibadge { margin: 0 auto var(--sp-3); background: transparent; }
.wtile__title { font-size: var(--fs-body); font-weight: 600; margin-bottom: var(--sp-2); }
.wtile__text { font-size: var(--fs-xs); color: var(--muted); line-height: 1.55; }

.wtile--blue   { background: var(--tint-blue); }
.wtile--orange { background: var(--tint-orange); }
.wtile--green  { background: var(--tint-green); }
.wtile--purple { background: var(--tint-purple); }
.wtile--amber  { background: var(--tint-amber); }
.wtile--teal   { background: var(--tint-teal); }

/* Titles use the -ink variants: a bright semantic color on its own tint is
   worse than on white (orange/tint-orange was 2.72:1). */
.wtile--blue   .wtile__title { color: var(--blue-ink); }
.wtile--orange .wtile__title { color: var(--orange-ink); }
.wtile--green  .wtile__title { color: var(--green-ink); }
.wtile--purple .wtile__title { color: var(--purple-ink); }
.wtile--amber  .wtile__title { color: var(--amber-ink); }
.wtile--teal   .wtile__title { color: var(--teal-ink); }

/* ============================================================
   4. Thinkers banner
   ============================================================ */
.thinkers {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  min-height: 190px;
  display: flex;
  align-items: center;
  background-color: #e7edf5;
  background-image: url("../../assets/img/Home/home-banner-thinkers.webp");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

/* Scrim so the copy can run further across the photograph and still sit on
   near-white. Retune the stops against the real image. */
.thinkers::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(95deg,
    rgba(255, 255, 255, 0.94) 0%,
    rgba(255, 255, 255, 0.78) 40%,
    rgba(255, 255, 255, 0) 68%);
}

.thinkers__inner {
  position: relative;
  z-index: 2;
  padding: var(--sp-8) var(--sp-12);
  max-width: 740px;   /* wider, and free to overlap the photo */
}
/* Deliberately a step below --fs-h2: the <br> sets two lines, and at h2 size
   the first line overran its box and wrapped to three. */
.thinkers__title {
  font-size: var(--fs-h2-sm);
  font-weight: 600;
}
.thinkers__text { margin-top: var(--sp-3); color: var(--muted); }

/* ============================================================
   5. Learning Journey — 6 steps with dashed connectors
   ============================================================ */
.journey {
  --ring: 54px;      /* connector geometry is derived from this, not hardcoded */
  --conn-inset: 11px;/* breathing room between a ring and the dashes */
  --conn-w: 2px;     /* one stroke weight for dashes and arrowhead alike */
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: start;
}
.jstep { text-align: center; padding-inline: 6px; position: relative; }
.jstep__ring {
  width: var(--ring); height: var(--ring);
  margin: 0 auto var(--sp-3);
  border-radius: 50%;
  border: 2px solid currentColor;
  display: grid;
  place-content: center;
  background: #fff;
}
.jstep__ring svg { width: 24px; height: 24px; }
.jstep__title { font-size: var(--fs-body); font-weight: 600; color: var(--navy); }
.jstep__text { font-size: var(--fs-xs); color: var(--muted); margin-top: 5px; line-height: 1.5; }

/* Connectors are decorative; currentColor here only tints ring + arrow.
 *
 * Dashes come from a gradient rather than `border-style: dashed`, which lets
 * the browser pick uneven dash lengths. The arrowhead is a rotated corner —
 * a two-line chevron at the same 2px weight as the dashes — instead of a
 * filled CSS triangle, which read far heavier than the line it terminated.
 *
 * Both are positioned off --ring, so resizing the circles keeps them aligned.
 */
.jstep + .jstep::before,
.jstep + .jstep::after {
  content: "";
  position: absolute;
  color: inherit;
  opacity: 0.6;
}

/* Dashed run, spanning the gap between the two rings. */
.jstep + .jstep::before {
  top: calc(var(--ring) / 2 - var(--conn-w) / 2);
  left: calc(-50% + var(--ring) / 2 + var(--conn-inset));
  right: calc(50% + var(--ring) / 2 + var(--conn-inset));
  height: var(--conn-w);
  border-radius: var(--conn-w);
  background: repeating-linear-gradient(
    to right,
    currentColor 0 5px,
    transparent 5px 11px);
}

/* Chevron at the leading end of the run. */
.jstep + .jstep::after {
  --head: 9px;
  top: calc(var(--ring) / 2 - var(--head) / 2);
  right: calc(50% + var(--ring) / 2 + var(--conn-inset) - var(--head) / 2);
  width: var(--head);
  height: var(--head);
  border-top: var(--conn-w) solid currentColor;
  border-right: var(--conn-w) solid currentColor;
  border-top-right-radius: 1px;
  transform: rotate(45deg);
}

.jstep--blue   { color: var(--blue); }
.jstep--green  { color: var(--green); }
.jstep--teal   { color: var(--teal); }
.jstep--orange { color: var(--orange); }
.jstep--amber  { color: var(--amber); }
.jstep--purple { color: var(--purple); }

/* ============================================================
   6. Educators & Leaders — static cards, border only
   ============================================================ */
.teachers__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--sp-3);
}
.tcard { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-4); }
.tcard > div:last-child { min-width: 0; }
.tcard__avatar {
  width: 54px;
  height: 54px;
  flex: none;
  overflow: hidden;
  border: 2px solid #fff;
  border-radius: 50%;
  background-color: var(--tint-blue);
  background-repeat: no-repeat;
  box-shadow: 0 0 0 1px var(--line);
}
.tcard__avatar--yang {
  background-image: url("../../assets/img/People/Experts/YangXie.jpg");
  background-position: 50% 24%;
  background-size: 115%;
}
.tcard__avatar--li {
  background-image: url("../../assets/img/People/Experts/LiSu.png");
  background-position: 50% 22%;
  background-size: 145%;
}
.tcard__avatar--alex {
  background-image: url("../../assets/img/People/High/ALex.png");
  background-position: 50% 15%;
  background-size: 190%;
}
.tcard__avatar--eric {
  background-image: url("../../assets/img/People/High/EricXiu.jpg");
  background-position: 50% 15%;
  background-size: 180%;
}
.tcard__avatar--julian {
  background-image: url("../../assets/img/People/High/JulianZhu.png");
  background-position: 50% 12%;
  background-size: 185%;
}
.tcard__name { font-size: var(--fs-sm); font-weight: 700; color: var(--navy); }
.tcard__role { font-size: var(--fs-xs); font-weight: 600; color: var(--blue-ink); margin-top: 2px; }
.tcard__cred { font-size: var(--fs-xs); color: var(--muted); margin-top: var(--sp-1); line-height: 1.45; }
.tcard__meta {
  font-size: var(--fs-xs);
  color: var(--faint);
  margin-top: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--line);
}

/* ============================================================
   7. Testimonials
   ============================================================ */
.quotes__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }
.qcard { position: relative; padding: var(--sp-6); }
.qcard__mark {
  font-family: var(--font-head);
  font-size: 2.6rem;
  line-height: 1;
  color: var(--line);
  position: absolute;
}
.qcard__mark--open { top: var(--sp-3); left: var(--sp-3); }
.qcard__mark--close { bottom: 0; right: var(--sp-4); }
.qcard__text {
  font-size: var(--fs-sm);
  color: var(--ink);
  padding-left: var(--sp-6);
  min-height: 66px;
}
.qcard__foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
  padding-left: var(--sp-6);
}
.stars { color: #8a5a00; letter-spacing: 2px; font-size: var(--fs-sm); }
.qcard__who { text-align: right; }
.qcard__name { font-size: var(--fs-sm); font-weight: 700; color: var(--navy); }
.qcard__rel { font-size: var(--fs-xs); color: var(--faint); }

/* Dots: 8px visual, 44px hit area (Review V1 §8.2). */
.dots { display: flex; justify-content: center; margin-top: var(--sp-4); }
.dots button {
  width: var(--tap-min);
  height: var(--tap-min);
  padding: 0;
  border: 0;
  background: none;
  display: grid;
  place-content: center;
}
.dots button::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  border-radius: var(--r-pill);
  background: #b9c4d4;
  transition: background var(--dur-fast) var(--ease), width var(--dur-fast) var(--ease);
}
.dots button[aria-current="true"]::before { background: var(--blue-ink); width: 22px; }

/* ============================================================
   8. Closing CTA band
   ============================================================ */
.cta-band {
  position: relative;
  background: #fff;
  color: #fff;
  overflow: hidden;
}
.cta-band__grid {
  min-height: 216px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background-image: url("../../assets/img/Home/home-cta.webp");
  background-repeat: no-repeat;
  background-position: center -20px;
  background-size: 100% auto;
  padding-block: 80px var(--sp-6);
}
.cta-band__copy { width: min(100%, 720px); text-align: center; }
.cta-band__title { color: #fff; font-size: var(--fs-h2); font-weight: 600; }
.cta-band__text { margin-top: var(--sp-3); color: #e3ecff; font-size: var(--fs-sm); }
.cta-band__actions { display: flex; gap: var(--sp-3); justify-content: center; margin-top: var(--sp-4); flex-wrap: wrap; }
.cta-band .btn--white { background: #fff; color: var(--navy); }
.cta-band .btn--white:hover { background: #e9f0ff; }
.cta-band :focus-visible { outline-color: #fff; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1100px) {
  .programs__grid { grid-template-columns: repeat(2, 1fr); }
  .why__grid { grid-template-columns: repeat(3, 1fr); }
  .teachers__grid { grid-template-columns: repeat(3, 1fr); }
  .journey { grid-template-columns: repeat(3, 1fr); row-gap: var(--sp-8); }
  .jstep:nth-child(3n + 1)::before,
  .jstep:nth-child(3n + 1)::after { display: none; }
}

@media (max-width: 900px) {
  /* Stacked: no overlap, no fade — copy above a plain image. */
  .hero__grid { grid-template-columns: 1fr; }
  .hero__copy { grid-area: auto; padding: var(--sp-8) var(--gutter) var(--sp-6); }
  .hero__title { width: auto; }
  .hero__lead { max-width: none; }
  .hero__media { grid-area: auto; margin-right: 0; }
  .hero__media::before {
    background: linear-gradient(180deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0) 22%);
  }
  /* Copy and CTAs stay ahead of the image on narrow screens — DOM order,
     visual order and tab order all agree (Review V1 §7.3, appendix B.2.4). */
  .hero__media {
    height: 280px;
    min-height: 280px;
    background-position: center 46%;
    background-size: cover;
  }
  .trustbar { margin-top: var(--sp-4); }
  .cta-band__grid {
    background-size: auto 180%;
    background-position: 28% 30%;
  }
  .cta-band__grid { min-height: 270px; padding-block: var(--sp-8); }
  .thinkers__inner { padding: var(--sp-6); }
}

@media (max-width: 640px) {
  .programs__grid,
  .why__grid,
  .teachers__grid { grid-template-columns: 1fr; }
  .journey { grid-template-columns: 1fr; row-gap: var(--sp-6); }
  .jstep::before, .jstep::after { display: none !important; }
  .pcard--lead { flex-direction: column; }
  .pcard--lead .pcard__book { width: 84px; }
  .hero__actions .btn { width: 100%; }
  .cta-band__grid {
    background-size: auto 215%;
    background-position: 25% 28%;
  }
  .cta-band__grid { min-height: 330px; }
  .cta-band__copy {
    padding: var(--sp-6) var(--sp-4);
    border-radius: var(--r-lg);
    background: rgba(7, 35, 105, 0.62);
    backdrop-filter: blur(2px);
  }

  /* One card at a time, swipeable, snapping — dots stay in sync via JS. */
  .quotes__grid {
    grid-template-columns: none;
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: var(--sp-3);
    padding-bottom: var(--sp-1);
    scrollbar-width: none;
  }
  .quotes__grid::-webkit-scrollbar { display: none; }
  .qcard { flex: 0 0 88%; scroll-snap-align: center; }
}
