/* ==========================================================================
   Darsely — Home Page (redesign)
   Depends on tokens from layout.css
   ========================================================================== */

body.home-page {
  background: var(--ds-bg);
  color: var(--ds-text);
}

body.home-page::after {
  display: none;
}

.h-wrap {
  width: 100%;
  padding-inline: var(--ds-gutter);
  margin-inline: auto;
  max-width: 1560px;
}

.h-section {
  padding-block: clamp(56px, 8vw, 96px);
  /* decorative glows must never widen the page on phones */
  overflow-x: clip;
}

/* Section heading */
.h-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.h-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--ds-accent-soft);
  color: var(--ds-accent-ink);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 12px;
}

.h-eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ds-accent-ink);
}

.h-title {
  color: var(--ds-ink);
  font-weight: 900;
  font-size: clamp(26px, 3.2vw, 40px);
  line-height: 1.3;
  margin: 0;
}

.h-sub {
  color: var(--ds-muted);
  font-size: 16px;
  line-height: 1.8;
  margin: 8px 0 0;
  max-width: 560px;
}

.h-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ds-primary);
  font-weight: 800;
  font-size: 15px;
  text-decoration: none !important;
  white-space: nowrap;
}

.h-link :is(i, svg) {
  transition: transform 0.2s ease;
}

.h-link:hover {
  color: var(--ds-primary-2);
}

.h-link:hover :is(i, svg) {
  transform: translateX(-4px);
}

/* Buttons */
.h-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 54px;
  padding: 0 28px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 16px;
  text-decoration: none !important;
  border: 1px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.h-btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--ds-primary), var(--ds-primary-2));
  box-shadow: 0 14px 30px rgba(50, 30, 72, 0.25);
}

.h-btn--primary:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 18px 36px rgba(50, 30, 72, 0.32);
}

.h-btn--light {
  color: var(--ds-primary);
  background: #fff;
  border-color: var(--ds-line);
}

.h-btn--light:hover {
  color: var(--ds-primary);
  border-color: rgba(50, 30, 72, 0.25);
  transform: translateY(-2px);
}

/* ─── Hero ───────────────────────────────────────────────────────────────── */

.h-hero {
  position: relative;
  overflow: hidden;
  padding-top: calc(var(--ds-header-h) + clamp(24px, 5vw, 56px));
  background:
    radial-gradient(800px 500px at 15% 30%, rgba(101, 220, 213, 0.28), transparent 65%),
    radial-gradient(700px 500px at 85% 0%, rgba(50, 30, 72, 0.08), transparent 70%),
    linear-gradient(180deg, #fff 0%, var(--ds-bg) 100%);
}

.h-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(50, 30, 72, 0.08) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  pointer-events: none;
}

.h-hero__grid {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: 40px;
}

.h-hero__title {
  color: var(--ds-ink);
  font-weight: 900;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.25;
  margin: 0 0 20px;
}

.h-hero__title span {
  position: relative;
  color: var(--ds-primary);
  white-space: nowrap;
}

.h-hero__title span::after {
  content: "";
  position: absolute;
  inset: auto 0 6px 0;
  height: 14px;
  border-radius: 8px;
  background: var(--ds-accent);
  opacity: 0.45;
  z-index: -1;
}

.h-hero__desc {
  color: var(--ds-muted);
  font-size: clamp(16px, 1.4vw, 19px);
  line-height: 1.9;
  max-width: 560px;
  margin: 0 0 32px;
}

.h-hero__cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.h-proof {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 36px;
}

.h-proof__avatars {
  display: flex;
}

.h-proof__avatars span {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid #fff;
  margin-left: -12px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 15px;
  box-shadow: var(--ds-shadow-sm);
}

.h-proof__avatars span:nth-child(1) { background: #321e48; }
.h-proof__avatars span:nth-child(2) { background: #43637e; }
.h-proof__avatars span:nth-child(3) { background: #0e7c76; }
.h-proof__avatars span:nth-child(4) { background: #65dcd5; color: #1a0f26; font-weight: 800; font-size: 12px; }

.h-proof strong {
  display: block;
  color: var(--ds-ink);
  font-size: 16px;
  font-weight: 800;
}

.h-proof small {
  color: var(--ds-muted);
  font-size: 14px;
}

.h-hero__visual {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  min-height: 520px;
}

.h-hero__blob {
  position: absolute;
  bottom: 0;
  width: min(88%, 560px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--ds-accent) 0%, #2f8f96 55%, var(--ds-primary) 100%);
  opacity: 0.95;
  transform: translateY(18%);
}

.h-hero__img {
  position: relative;
  width: min(92%, 560px);
  height: auto;
  filter: drop-shadow(0 30px 40px rgba(26, 15, 38, 0.18));
}

.h-float {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--ds-shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.8);
  animation: h-float 6s ease-in-out infinite;
}

.h-float .ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 17px;
}

.h-float strong {
  display: block;
  color: var(--ds-ink);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
}

.h-float small {
  color: var(--ds-muted);
  font-size: 12px;
}

.h-float--a { top: 14%; right: 0; }
.h-float--a .ico { background: var(--ds-accent-soft); color: var(--ds-accent-ink); }
.h-float--b { bottom: 18%; left: 0; animation-delay: -3s; }
.h-float--b .ico { background: #fff4e0; color: #d97706; }

@keyframes h-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Stats bar */
.h-stats {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 24px;
  box-shadow: var(--ds-shadow-md);
  margin-top: 8px;
  transform: translateY(0);
}

.h-stat {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 26px 28px;
}

.h-stat + .h-stat {
  border-right: 1px solid var(--ds-line);
}

.h-stat .ico {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: var(--ds-bg);
  color: var(--ds-primary);
  flex-shrink: 0;
}

.h-stat strong {
  display: block;
  color: var(--ds-ink);
  font-size: 26px;
  font-weight: 900;
  line-height: 1.2;
}

.h-stat span {
  color: var(--ds-muted);
  font-size: 14px;
  font-weight: 600;
}

.h-hero {
  padding-bottom: 40px;
}

/* ─── Courses ────────────────────────────────────────────────────────────── */

.h-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.h-chip {
  height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--ds-line);
  background: #fff;
  color: var(--ds-text);
  font-family: "Cairo", sans-serif;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.h-chip:hover {
  border-color: rgba(50, 30, 72, 0.25);
}

.h-chip.is-active {
  background: var(--ds-primary);
  border-color: var(--ds-primary);
  color: #fff;
}

.h-chip b {
  display: inline-block;
  min-width: 22px;
  margin-right: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(50, 30, 72, 0.07);
  font-size: 12px;
}

.h-chip.is-active b {
  background: rgba(255, 255, 255, 0.2);
}

.h-courses {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.c-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 22px;
  overflow: hidden;
  color: inherit;
  text-decoration: none !important;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.c-card:hover {
  color: inherit;
  transform: translateY(-6px);
  box-shadow: var(--ds-shadow-lg);
  border-color: transparent;
}

.c-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--ds-bg);
}

.c-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.c-card:hover .c-card__media img {
  transform: scale(1.06);
}

.c-card__media::after {
  content: "";
  position: absolute;
  inset: 50% 0 0 0;
  background: linear-gradient(180deg, transparent, rgba(26, 15, 38, 0.45));
}

.c-badge {
  position: absolute;
  z-index: 1;
  top: 12px;
  right: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ds-primary);
  font-weight: 800;
  font-size: 12px;
}

.c-badge--hot {
  top: 46px;
  background: #FBBF24;
  color: #451A03;
}

.c-badge--free {
  right: auto;
  left: 12px;
  background: var(--ds-accent);
  color: var(--ds-ink);
}

.c-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 18px 20px 20px;
}

.c-card__subject {
  color: var(--ds-accent-ink);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 6px;
}

.c-card__title {
  color: var(--ds-ink);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.55;
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(17px * 1.55 * 2);
}

.c-card__teacher {
  color: var(--ds-muted);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
}

.c-card__meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 0;
  margin-top: auto;
  border-top: 1px dashed var(--ds-line);
  color: var(--ds-muted);
  font-size: 13px;
  font-weight: 600;
}

.c-card__meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.c-card__meta :is(i, svg) {
  color: var(--ds-primary-2);
}

.c-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
}

.c-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.c-price strong {
  color: var(--ds-ink);
  font-size: 22px;
  font-weight: 900;
}

.c-price small {
  color: var(--ds-muted);
  font-size: 13px;
  font-weight: 700;
}

.c-price del {
  color: #a3a1b3;
  font-size: 13px;
}

.c-price--free strong {
  color: var(--ds-accent-ink);
}

.c-card__go {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--ds-bg);
  color: var(--ds-primary);
  font-weight: 800;
  font-size: 14px;
  transition: background 0.2s ease, color 0.2s ease;
}

.c-card:hover .c-card__go {
  background: var(--ds-primary);
  color: #fff;
}

.c-card__go :is(i, svg) {
  font-size: 12px;
  transition: transform 0.2s ease;
}

.c-card:hover .c-card__go :is(i, svg) {
  transform: translateX(-3px);
}

.h-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 16px;
  color: var(--ds-muted);
  font-weight: 700;
  background: #fff;
  border: 1px dashed var(--ds-line);
  border-radius: 22px;
}

/* ─── Teachers ───────────────────────────────────────────────────────────── */

.h-teachers {
  background: #fff;
  border-block: 1px solid var(--ds-line);
}

.h-nav-btns {
  display: flex;
  gap: 8px;
}

.h-nav-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--ds-line);
  background: #fff;
  color: var(--ds-primary);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.h-nav-btn:hover {
  background: var(--ds-primary);
  border-color: var(--ds-primary);
  color: #fff;
}

.h-chips--scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.h-chips--scroll::-webkit-scrollbar {
  display: none;
}

.t-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 2 * 24px) / 3);
  gap: 24px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 4px 4px 12px;
  margin: -4px -4px 0;
}

.t-track::-webkit-scrollbar {
  display: none;
}

/* Banner images are 720×394 designs with the name baked in — show them whole */
.t-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--ds-line);
  border-radius: 24px;
  overflow: hidden;
  scroll-snap-align: start;
  text-decoration: none !important;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.t-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--ds-shadow-lg);
  border-color: transparent;
}

.t-card.skeleton {
  aspect-ratio: 720 / 500;
  border: 0;
}

.t-card__media {
  aspect-ratio: 720 / 394;
  overflow: hidden;
  background: #fdf3dc;
}

.t-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.t-card:hover .t-card__media img {
  transform: scale(1.04);
}

.t-card__info {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px 18px;
  border-top: 1px solid var(--ds-line);
}

.t-card__text {
  flex: 1;
  min-width: 0;
}

.t-card__info h3 {
  color: var(--ds-ink);
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.t-card__row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.t-card__subject {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--ds-accent-soft);
  color: var(--ds-accent-ink);
  font-size: 12px;
  font-weight: 800;
}

.t-card__stats {
  display: flex;
  gap: 12px;
  color: var(--ds-muted);
  font-size: 13px;
  font-weight: 600;
}

.t-card__stats :is(i, svg) {
  margin-left: 4px;
  color: var(--ds-primary-2);
}

.t-card__arrow {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ds-bg);
  color: var(--ds-primary);
  transition: background 0.2s ease, color 0.2s ease;
}

.t-card:hover .t-card__arrow {
  background: var(--ds-primary);
  color: #fff;
}

/* Mobile carousel nav (shown only on phones) */
.h-carousel-nav {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
}

.h-carousel-nav[hidden] {
  display: none !important;
}

.h-carousel-count {
  min-width: 56px;
  text-align: center;
  color: var(--ds-muted);
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.h-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

/* ─── App banner ─────────────────────────────────────────────────────────── */

.h-app {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 28px 36px;
  border-radius: 28px;
  background: linear-gradient(120deg, #0e7c76 0%, #43637e 55%, #321e48 100%);
  color: #fff;
}

.h-app::after {
  content: "";
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  left: -80px;
  top: -160px;
  background: rgba(101, 220, 213, 0.25);
  filter: blur(10px);
  pointer-events: none;
}

.h-app__icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 30px;
  background: rgba(255, 255, 255, 0.14);
}

.h-app h3 {
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  margin: 0 0 4px;
}

.h-app p {
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 15px;
}

.h-app .h-btn {
  position: relative;
  z-index: 1;
  background: #fff;
  color: var(--ds-ink);
}

.h-app .h-btn :is(i, svg) {
  color: #34a853;
  font-size: 20px;
}

/* ─── Why Darsely ────────────────────────────────────────────────────────── */

.h-why {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 48px;
  align-items: center;
}

.h-why__visual {
  position: relative;
  border-radius: 32px;
  padding: 24px;
  /* The illustration has a white background, so the card is plain white to blend with it */
  background: #fff;
  border: 1px solid var(--ds-line);
  box-shadow: var(--ds-shadow-md);
  text-align: center;
}

.h-why__visual::before,
.h-why__visual::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
}

.h-why__visual::before {
  width: 180px;
  height: 180px;
  top: -40px;
  left: -40px;
  background: var(--ds-accent);
  opacity: 0.35;
  filter: blur(30px);
}

.h-why__visual::after {
  width: 220px;
  height: 220px;
  bottom: -50px;
  right: -50px;
  background: var(--ds-primary-2);
  opacity: 0.18;
  filter: blur(40px);
}

.h-why__visual img {
  width: 100%;
  max-width: 460px;
  height: auto;
}

.h-why__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 28px;
}

.h-feature {
  padding: 24px;
  border-radius: 22px;
  background: #fff;
  border: 1px solid var(--ds-line);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.h-feature:hover {
  transform: translateY(-4px);
  box-shadow: var(--ds-shadow-md);
}

.h-feature .ico {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 20px;
  margin-bottom: 16px;
  background: var(--ds-accent-soft);
  color: var(--ds-accent-ink);
}

.h-feature:nth-child(2) .ico { background: #f1ecf7; color: var(--ds-primary); }
.h-feature:nth-child(3) .ico { background: #eaf0f5; color: var(--ds-primary-2); }
.h-feature:nth-child(4) .ico { background: #fff4e0; color: #d97706; }

.h-feature h4 {
  color: var(--ds-ink);
  font-size: 17px;
  font-weight: 800;
  margin: 0 0 8px;
}

.h-feature p {
  color: var(--ds-muted);
  font-size: 14px;
  line-height: 1.8;
  margin: 0;
}

/* ─── Final CTA ──────────────────────────────────────────────────────────── */

.h-cta {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: clamp(40px, 6vw, 72px) 24px;
  border-radius: 32px;
  background: linear-gradient(135deg, var(--ds-primary) 0%, #2b3f5c 60%, #0e7c76 100%);
  color: #fff;
}

.h-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}

.h-cta h2 {
  position: relative;
  color: #fff;
  font-size: clamp(26px, 3.4vw, 42px);
  font-weight: 900;
  margin: 0 0 12px;
}

.h-cta p {
  position: relative;
  color: rgba(255, 255, 255, 0.8);
  font-size: 17px;
  margin: 0 auto 28px;
  max-width: 560px;
}

.h-cta__btns {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.h-cta .h-btn--light {
  border-color: transparent;
}

.h-btn--outline-light {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.h-btn--outline-light:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 1280px) {
  .h-courses {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

}

@media (max-width: 991px) {
  .h-hero {
    padding-top: calc(var(--ds-header-h) + 32px);
  }

  .h-hero__grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 24px;
  }

  .h-hero__desc {
    margin-inline: auto;
  }

  .h-hero__cta,
  .h-proof {
    justify-content: center;
  }

  .h-hero__visual {
    min-height: 0;
    width: 100%;
    max-width: 440px;
    margin-inline: auto;
  }

  .h-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .h-stat:nth-child(3) {
    border-right: 0;
  }

  .h-stat:nth-child(n + 3) {
    border-top: 1px solid var(--ds-line);
  }

  /* Courses, teachers and filter chips become full-bleed swipeable rows */
  .h-courses,
  .t-track {
    display: grid;
    grid-template-columns: none;
    grid-auto-flow: column;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--ds-gutter);
    scrollbar-width: none;
    margin-inline: calc(var(--ds-gutter) * -1);
    padding-inline: var(--ds-gutter);
  }

  .h-courses::-webkit-scrollbar,
  .t-track::-webkit-scrollbar {
    display: none;
  }

  .h-courses {
    grid-auto-columns: 44%;
    gap: 16px;
    padding-block: 4px 12px;
  }

  .t-track {
    grid-auto-columns: 46%;
    gap: 16px;
    margin-top: 0;
    padding-block: 4px 12px;
  }

  /* Chips wrap onto new lines instead of running off the edge */
  .h-chips,
  .h-chips--scroll {
    display: flex;
    flex-wrap: wrap;
    overflow: visible;
    gap: 8px;
    margin-bottom: 20px;
  }

  .c-card,
  .t-card {
    scroll-snap-align: start;
  }

  .h-why {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .h-why__visual {
    order: 2;
    max-width: 560px;
    width: 100%;
    margin-inline: auto;
  }

  .h-why__visual::before {
    top: -20px;
    left: 0;
  }

  .h-why__visual::after {
    bottom: -20px;
    right: 0;
  }

  .h-app {
    grid-template-columns: auto 1fr;
  }

  .h-app .h-btn {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (max-width: 640px) {
  .h-section {
    padding-block: 48px;
  }

  .h-head {
    gap: 12px;
    margin-bottom: 20px;
  }

  .h-title {
    font-size: 24px;
  }

  .h-sub {
    font-size: 15px;
    line-height: 1.7;
  }

  .h-nav-btns {
    display: none;
  }

  /* Hero */
  .h-hero {
    padding-top: calc(var(--ds-header-h) + 20px);
    padding-bottom: 28px;
  }

  .h-hero__title {
    font-size: 32px;
    margin-bottom: 14px;
  }

  .h-hero__title span::after {
    height: 10px;
    bottom: 4px;
  }

  .h-hero__desc {
    font-size: 15px;
    line-height: 1.8;
    margin-bottom: 22px;
  }

  .h-hero__cta {
    gap: 10px;
  }

  .h-btn {
    flex: 1 1 100%;
    height: 50px;
    font-size: 15px;
  }

  .h-proof {
    margin-top: 22px;
  }

  .h-hero__visual {
    max-width: 320px;
  }

  .h-float {
    display: none;
  }

  .h-stats {
    border-radius: 20px;
  }

  .h-stat {
    gap: 12px;
    padding: 16px 14px;
  }

  .h-stat .ico {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 16px;
  }

  .h-stat strong {
    font-size: 19px;
  }

  .h-stat span {
    font-size: 12px;
    line-height: 1.4;
  }

  /* Carousels: exactly one full-width card, navigated with buttons or swipe */
  .h-courses,
  .t-track {
    grid-auto-columns: 100%;
    gap: 16px;
    margin-inline: 0;
    padding-inline: 0;
    scroll-padding-inline: 0;
    padding-block: 4px 8px;
  }

  .c-card,
  .t-card {
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  /* Touch screens keep :hover after a tap — the clipped shadow looked like a grey box */
  .c-card:hover,
  .t-card:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--ds-line);
  }

  .h-carousel-nav {
    display: flex;
  }

  /* Filter chips: an evenly sized grid that always fits — no sideways scrolling */
  .h-chips,
  .h-chips--scroll {
    display: grid;
    grid-auto-flow: row;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-columns: auto;
    gap: 8px;
    overflow: visible;
    margin-inline: 0;
    padding-inline: 0;
    margin-bottom: 18px;
  }

  .h-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: auto;
    min-height: 44px;
    padding: 6px 8px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.35;
    white-space: normal;
    text-align: center;
  }

  .h-chip b {
    margin-right: 0;
  }

  .h-chip__extra {
    display: none;
  }

  /* Teachers: "all grades" on its own row, then one row per stage */
  #teacher-filters .h-chip[data-grade="all"] {
    grid-column: 1 / -1;
  }

  /* Features: compact rows with the icon beside the text */
  .h-why__grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 20px;
  }

  .h-feature {
    display: grid;
    grid-template-columns: 44px 1fr;
    column-gap: 14px;
    padding: 16px;
    border-radius: 18px;
  }

  .h-feature .ico {
    grid-row: span 2;
    width: 44px;
    height: 44px;
    margin-bottom: 0;
    font-size: 17px;
  }

  .h-feature h4 {
    font-size: 15px;
    margin-bottom: 4px;
  }

  .h-feature p {
    font-size: 13px;
    line-height: 1.7;
  }

  .h-why__visual {
    padding: 14px;
    border-radius: 22px;
  }

  .h-app {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 26px 20px;
    border-radius: 22px;
  }

  .h-app__icon {
    margin-inline: auto;
  }

  .h-app h3 {
    font-size: 19px;
  }

  .h-app .h-btn {
    justify-self: stretch;
  }

  .h-cta {
    border-radius: 22px;
    padding: 36px 20px;
  }

  .h-cta p {
    font-size: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .h-float {
    animation: none;
  }
}
