/*
 * Learning experience layer ("lx"): the shared pieces of the learning and getting-started pages
 * (Salah Studio, purification, New Muslim, courses and paths, Explore Islam, answers, glossary, articles,
 * worksheets, Islam in 60 Seconds).
 *
 * Built only on the design tokens in layout.css (--ip-*), so light, dark and right-to-left follow on their own.
 *   .lx-hero       the design's deep-green hero (--ip-jewel) with the "+" lattice, a turning star, crumbs,
 *                  title with a gold accent, actions, glass facts and a live side card (.lx-live)
 *   .lx-rail       a sticky chapter bar with scroll-spy and a reading-progress line
 *   .lx-card       the white rounded card of the home page, with .lx-head (title, sub, action)
 *   .lx-explorer   a list-and-panel stepper: a vertical progress rail on wide screens, chips on phones
 *   .lx-next       "what next" cards at the end of a page
 *   .lx-empty      an illustrated empty state with suggestions
 *   .lx-cover      generated geometric covers (courses and paths), keyed by category
 *   .lx-reveal     fade-and-rise on scroll; .lx-burst celebration particles; .lx-toast
 * Motion animates transform and opacity only, and stops for visitors who prefer reduced motion.
 */

/* ---------- Tokens ---------- */
.lx {
  --lx-radius: var(--ip-radius-xl);
  --lx-gap: clamp(.85rem, .6rem + 1vw, 1.35rem);
  --lx-gold: #f1d59a;
  --lx-gold-strong: #e6b85c;
  --lx-on-jewel: rgba(255, 255, 255, .86);
  --lx-on-jewel-muted: rgba(255, 255, 255, .7);
  color: var(--ip-ink);
}

/* ---------- Hero ---------- */
.lx-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: #fff;
  background: var(--ip-jewel);
  padding-block: clamp(1.6rem, 1.1rem + 2.4vw, 3.4rem) clamp(1.8rem, 1.2rem + 2.6vw, 3.6rem);
}
.lx-hero::before {
  /* the faint eight-point lattice, fading towards the copy */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: var(--ip-pattern-light);
  background-size: 120px 120px;
  -webkit-mask-image: linear-gradient(100deg, rgba(0, 0, 0, .25) 20%, #000 80%);
  mask-image: linear-gradient(100deg, rgba(0, 0, 0, .25) 20%, #000 80%);
}
[dir="rtl"] .lx-hero::before {
  -webkit-mask-image: linear-gradient(-100deg, rgba(0, 0, 0, .25) 20%, #000 80%);
  mask-image: linear-gradient(-100deg, rgba(0, 0, 0, .25) 20%, #000 80%);
}
.lx-hero::after {
  /* the gold hairline the home page draws under its bands */
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--lx-gold-strong), transparent);
  opacity: .7;
}
.lx-hero__star {
  position: absolute;
  z-index: -1;
  inset-inline-end: clamp(-160px, -8vw, -40px);
  top: 50%;
  width: clamp(260px, 34vw, 520px);
  aspect-ratio: 1;
  translate: 0 -50%;
  color: var(--lx-gold);
  opacity: .16;
  pointer-events: none;
  animation: lx-turn 180s linear infinite;
}
@keyframes lx-turn {
  to { transform: rotate(360deg); }
}
.lx-hero--compact {
  padding-block: clamp(1.4rem, 1rem + 1.6vw, 2.4rem);
}
.lx-hero__grid {
  position: relative;
  display: grid;
  gap: clamp(1.25rem, .8rem + 2vw, 2.5rem);
  align-items: center;
}
@media (min-width: 992px) {
  .lx-hero__grid--split {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, .9fr);
  }
}
.lx-crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem .5rem;
  margin: 0 0 .9rem;
  padding: 0;
  list-style: none;
  font-size: .82rem;
}
.lx-crumbs li {
  color: var(--lx-on-jewel-muted);
}
.lx-crumbs li + li::before {
  content: "/";
  margin-inline-end: .5rem;
  opacity: .5;
}
.lx-crumbs a {
  color: rgba(255, 255, 255, .92);
  text-decoration: none;
}
.lx-crumbs a:hover,
.lx-crumbs a:focus-visible {
  color: #fff;
  text-decoration: underline;
}
.lx-crumbs [aria-current="page"] {
  color: #fff;
  font-weight: 600;
}
.lx-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin: 0 0 .8rem;
  padding: .3rem .8rem;
  border: 1px solid rgba(241, 213, 154, .35);
  border-radius: var(--ip-radius-pill);
  background: rgba(255, 255, 255, .07);
  color: var(--lx-gold);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
html[lang="ar"] .lx-eyebrow,
html[lang="ur"] .lx-eyebrow {
  letter-spacing: 0;
  font-size: .9rem;
  text-transform: none;
}
.lx-title {
  margin: 0 0 .7rem;
  font-family: var(--ip-font-display);
  font-size: clamp(1.9rem, 1.35rem + 2.3vw, 3.1rem);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -.028em;
  color: #fff;
  text-wrap: balance;
}
.lx-title em {
  font-style: normal;
  color: var(--lx-gold);
}
html[lang="ar"] .lx-title { font-family: var(--ip-font-arabic); font-weight: 700; line-height: 1.45; letter-spacing: 0; }
html[lang="ur"] .lx-title { font-family: var(--ip-font-urdu); font-weight: 400; line-height: 1.9; letter-spacing: 0; }
.lx-hero--compact .lx-title {
  font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.5rem);
}
.lx-lead {
  max-width: 42rem;
  margin: 0;
  font-size: clamp(.98rem, .93rem + .25vw, 1.08rem);
  line-height: 1.65;
  color: var(--lx-on-jewel);
  text-wrap: pretty;
}
.lx-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-top: 1.25rem;
}
.lx-facts {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin: 1.15rem 0 0;
  padding: 0;
  list-style: none;
}
.lx-facts li {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .35rem .75rem;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--ip-radius-pill);
  background: rgba(255, 255, 255, .07);
  color: var(--lx-on-jewel);
  font-size: .82rem;
}
.lx-facts strong {
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.lx-facts i {
  color: var(--lx-gold);
}
/* The review badge keeps its own colours on the green. */
.lx-hero .ip-review-badge,
.lx-hero .review-badge {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .2);
}

/* A live card beside the copy: today's step, progress, a countdown, "continue where you left off". */
.lx-live {
  position: relative;
  display: grid;
  gap: .85rem;
  padding: clamp(1rem, .8rem + 1vw, 1.4rem);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--lx-radius);
  background: linear-gradient(160deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .05));
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .18);
  color: #fff;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.lx-live__label {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin: 0;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--lx-gold);
}
html[lang="ar"] .lx-live__label,
html[lang="ur"] .lx-live__label { letter-spacing: 0; font-size: .85rem; }
.lx-live__title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
}
.lx-live__text {
  margin: 0;
  font-size: .88rem;
  color: var(--lx-on-jewel);
}
.lx-live a:not(.ip-btn) {
  color: var(--lx-gold);
}
.lx-live__row {
  display: flex;
  align-items: center;
  gap: .9rem;
}

/* A progress ring (stroke-dashoffset is set by learn-x.js, or inline with --p 0-100). */
.lx-ring {
  --p: 0;
  --size: 64px;
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background:
    radial-gradient(closest-side, var(--lx-ring-hole, rgba(9, 45, 32, .92)) 78%, transparent 79% 100%),
    conic-gradient(var(--lx-ring-fill, var(--lx-gold-strong)) calc(var(--p) * 1%), var(--lx-ring-track, rgba(255, 255, 255, .16)) 0);
  font-weight: 800;
  font-size: .9rem;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.lx-ring--light {
  --lx-ring-hole: var(--ip-surface);
  --lx-ring-fill: var(--ip-primary);
  --lx-ring-track: var(--ip-surface-3);
  color: var(--ip-ink);
}

/* Linear progress */
.lx-bar {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: var(--ip-radius-pill);
  background: var(--ip-surface-3);
}
.lx-bar > span {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform: scaleX(var(--lx-p, 0));
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ip-green-500), var(--ip-green-400) 60%, var(--lx-gold-strong));
  transition: transform .6s var(--ip-ease);
}
[dir="rtl"] .lx-bar > span {
  transform-origin: right center;
}
.lx-hero .lx-bar,
.lx-live .lx-bar {
  background: rgba(255, 255, 255, .16);
}

/* The legacy dark theme colours every p (dark.css, body.dark p); the learning layer keeps its own. */
body.dark .lx .lx-eyebrow,
body.dark .lx .lx-live__label { color: var(--lx-gold); }
body.dark .lx .lx-lead,
body.dark .lx .lx-live__text { color: var(--lx-on-jewel); }
body.dark .lx .lx-live__title { color: #fff; }
body.dark .lx .lx-kicker { color: var(--ip-accent-strong); }

/* ---------- Sticky chapter rail ---------- */
.lx-rail {
  position: sticky;
  top: var(--ip-header-h);
  z-index: 1010;
  border-bottom: 1px solid var(--ip-line);
  background: color-mix(in srgb, var(--ip-bg) 88%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  backdrop-filter: blur(16px) saturate(1.6);
}
.lx-rail__inner {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.lx-rail__list {
  display: flex;
  flex: 1;
  gap: .25rem;
  margin: 0;
  padding: .5rem 0;
  overflow-x: auto;
  list-style: none;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.lx-rail__list::-webkit-scrollbar {
  display: none;
}
.lx-rail__list li {
  scroll-snap-align: start;
}
.lx-rail__link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .42rem .8rem;
  border-radius: var(--ip-radius-pill);
  color: var(--ip-ink-2);
  font-size: .84rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color .2s var(--ip-ease), color .2s var(--ip-ease);
}
.lx-rail__link i {
  color: var(--ip-muted);
  transition: color .2s var(--ip-ease);
}
.lx-rail__link:hover {
  background: var(--ip-primary-soft);
  color: var(--ip-primary);
}
.lx-rail__link.is-active {
  background: var(--ip-primary);
  color: var(--ip-primary-ink);
}
.lx-rail__link.is-active i {
  color: inherit;
}
.lx-rail__aside {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: none;
}
.lx-rail__progress {
  position: absolute;
  inset-inline: 0;
  bottom: -1px;
  height: 2px;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--ip-green-500), var(--lx-gold-strong, #e6b85c));
}
[dir="rtl"] .lx-rail__progress {
  transform-origin: right center;
}
@media (max-width: 575.98px) {
  .lx-rail__aside .lx-hide-sm {
    display: none;
  }
}

/* ---------- Sections and cards ---------- */
.lx-section {
  padding-block: clamp(1rem, .7rem + 1.2vw, 1.75rem);
  scroll-margin-top: calc(var(--ip-header-h) + 64px);
}
.lx-section:first-of-type {
  padding-top: clamp(1.25rem, 1rem + 1.2vw, 2rem);
}
.lx-card {
  position: relative;
  padding: clamp(1rem, .8rem + 1vw, 1.5rem);
  border: 1px solid var(--ip-line);
  border-radius: var(--lx-radius);
  background: var(--ip-surface);
  box-shadow: var(--ip-shadow-sm);
}
.lx-card--flush {
  padding: 0;
  overflow: hidden;
}
.lx-card--tint {
  background:
    radial-gradient(80% 120% at 100% 0%, var(--ip-primary-soft), transparent 60%),
    var(--ip-surface);
}
.lx-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem 1rem;
  margin-bottom: 1rem;
}
.lx-head__title {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin: 0;
  font-family: var(--ip-font-display);
  font-size: clamp(1.12rem, 1.02rem + .45vw, 1.4rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.012em;
  color: var(--ip-ink);
}
html[lang="ar"] .lx-head__title { font-family: var(--ip-font-arabic); letter-spacing: 0; }
html[lang="ur"] .lx-head__title { font-family: var(--ip-font-urdu); font-weight: 400; line-height: 1.9; letter-spacing: 0; }
.lx-head__sub {
  margin: 0;
  color: var(--ip-muted);
  font-size: .9rem;
}
.lx-head__action {
  margin-inline-start: auto;
}
.lx-kicker {
  display: block;
  width: 100%;
  margin: 0;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ip-accent-strong);
}
html[lang="ar"] .lx-kicker,
html[lang="ur"] .lx-kicker { letter-spacing: 0; font-size: .85rem; }

/* Pastel tiles (the home page's Quick Start language) */
.lx-tone-green { --lx-tone-bg: var(--ip-tile-emerald-bg); --lx-tone-fg: var(--ip-tile-emerald-fg); --lx-tone-grad: var(--ip-icon-green); }
.lx-tone-blue { --lx-tone-bg: var(--ip-tile-sky-bg); --lx-tone-fg: var(--ip-tile-sky-fg); --lx-tone-grad: var(--ip-icon-blue); }
.lx-tone-purple { --lx-tone-bg: var(--ip-tile-violet-bg); --lx-tone-fg: var(--ip-tile-violet-fg); --lx-tone-grad: var(--ip-icon-purple); }
.lx-tone-orange { --lx-tone-bg: var(--ip-tile-gold-bg); --lx-tone-fg: var(--ip-tile-gold-fg); --lx-tone-grad: var(--ip-icon-orange); }
.lx-tone-red { --lx-tone-bg: var(--ip-tile-rose-bg); --lx-tone-fg: var(--ip-tile-rose-fg); --lx-tone-grad: var(--ip-icon-red); }
.lx-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 13px;
  background: var(--lx-tone-bg, var(--ip-tile-emerald-bg));
  color: var(--lx-tone-fg, var(--ip-tile-emerald-fg));
  font-size: 1.15rem;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 10%, transparent), inset 0 1px 0 rgba(255, 255, 255, .6);
}
.lx-icon--lg {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 16px;
  font-size: 1.45rem;
}

/* Chips used as filters */
.lx-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.lx-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 36px;
  padding: .35rem .85rem;
  border: 1px solid var(--ip-line);
  border-radius: var(--ip-radius-pill);
  background: var(--ip-surface);
  color: var(--ip-ink-2);
  font-size: .84rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .2s var(--ip-ease), background-color .2s var(--ip-ease), color .2s var(--ip-ease), transform .2s var(--ip-ease);
}
.lx-chip:hover {
  border-color: var(--ip-primary);
  color: var(--ip-primary);
}
.lx-chip[aria-pressed="true"],
.lx-chip[aria-selected="true"],
.lx-chip.is-active {
  border-color: transparent;
  background: var(--ip-primary);
  color: var(--ip-primary-ink);
}
.lx-chip.is-active .lx-chip__count,
.lx-chip[aria-pressed="true"] .lx-chip__count,
.lx-chip[aria-selected="true"] .lx-chip__count {
  background: var(--ip-primary-ink);
  color: var(--ip-primary);
}
.lx-chip__count {
  min-width: 1.4rem;
  padding: 0 .35rem;
  border-radius: var(--ip-radius-pill);
  background: color-mix(in srgb, currentColor 14%, transparent);
  font-size: .72rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Instant search field (light surfaces) */
.lx-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem;
  padding-inline-start: 2.75rem;
  border: 1px solid var(--ip-line-strong);
  border-radius: var(--ip-radius-pill);
  background: var(--ip-surface);
  box-shadow: 0 18px 40px -26px rgba(13, 59, 41, .45);
  transition: border-color .2s var(--ip-ease), box-shadow .2s var(--ip-ease);
}
.lx-search:focus-within {
  border-color: var(--ip-primary);
  box-shadow: 0 18px 40px -26px rgba(13, 59, 41, .45), 0 0 0 4px var(--ip-primary-soft);
}
.lx-search > i {
  position: absolute;
  inset-inline-start: 1.05rem;
  color: var(--ip-primary);
  font-size: 1.05rem;
}
.lx-search input {
  flex: 1;
  min-width: 0;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--ip-ink);
  font-size: 1rem;
}
.lx-search input:focus {
  outline: none;
}
.lx-search input::placeholder {
  color: var(--ip-muted);
}
.lx-search kbd {
  padding: .15rem .45rem;
  border: 1px solid var(--ip-line);
  border-radius: 6px;
  background: var(--ip-surface-2);
  color: var(--ip-muted);
  font-size: .72rem;
  box-shadow: none;
}
.lx-hero .lx-search {
  border-color: transparent;
  box-shadow: 0 20px 44px -18px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .2);
}
.lx-hero .lx-search:focus-within {
  box-shadow: 0 20px 44px -18px rgba(0, 0, 0, .55), 0 0 0 3px var(--lx-gold-strong);
}

/* ---------- Explorer: a list of steps beside one panel ---------- */
.lx-explorer {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--lx-gap);
}
.lx-explorer__nav {
  position: relative;
}
@media (min-width: 992px) {
  .lx-explorer {
    grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
    align-items: start;
  }
  .lx-explorer__nav {
    position: sticky;
    top: calc(var(--ip-header-h) + 72px);
    max-height: calc(100vh - var(--ip-header-h) - 96px);
    overflow-y: auto;
    scrollbar-width: thin;
  }
}
.lx-explorer__list {
  position: relative;
  display: grid;
  gap: .2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
/* The progress rail: a track down the numbers with a green fill to the current step. */
.lx-explorer__list::before,
.lx-explorer__list::after {
  content: "";
  position: absolute;
  inset-inline-start: 1.32rem;
  top: 1.2rem;
  bottom: 1.2rem;
  width: 2px;
  border-radius: 2px;
  background: var(--ip-line);
}
.lx-explorer__list::after {
  background: linear-gradient(180deg, var(--ip-green-500), var(--lx-gold-strong, #e6b85c));
  transform-origin: top center;
  transform: scaleY(var(--lx-fill, 0));
  transition: transform .5s var(--ip-ease);
}
.lx-explorer__tab {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  padding-block: .42rem .42rem; padding-inline: .55rem .6rem;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--ip-ink-2);
  font-size: .88rem;
  text-align: start;
  cursor: pointer;
  transition: background-color .2s var(--ip-ease), border-color .2s var(--ip-ease), color .2s var(--ip-ease);
}
.lx-explorer__tab:hover {
  background: var(--ip-surface);
  border-color: var(--ip-line);
}
.lx-explorer__tab[aria-selected="true"] {
  background: var(--ip-surface);
  border-color: color-mix(in srgb, var(--ip-primary) 35%, var(--ip-line));
  box-shadow: var(--ip-shadow-sm);
  color: var(--ip-ink);
}
.lx-explorer__num {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 1.65rem;
  height: 1.65rem;
  border: 2px solid var(--ip-line-strong);
  border-radius: 50%;
  background: var(--ip-surface);
  color: var(--ip-muted);
  font-size: .72rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  transition: background-color .25s var(--ip-ease), border-color .25s var(--ip-ease), color .25s var(--ip-ease), transform .25s var(--ip-spring);
}
.lx-explorer__tab.is-seen .lx-explorer__num {
  border-color: var(--ip-primary);
  background: var(--ip-primary-soft);
  color: var(--ip-primary);
}
.lx-explorer__tab[aria-selected="true"] .lx-explorer__num {
  border-color: var(--ip-primary);
  background: var(--ip-primary);
  color: var(--ip-primary-ink);
  transform: scale(1.12);
}
.lx-explorer__label {
  display: grid;
  min-width: 0;
  line-height: 1.3;
}
.lx-explorer__label strong {
  overflow: hidden;
  font-weight: 650;
  font-size: .86rem;
  text-overflow: ellipsis;
}
.lx-explorer__label small {
  overflow: hidden;
  color: var(--ip-muted);
  font-size: .76rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.lx-explorer__ar {
  margin-inline-start: auto;
  color: var(--ip-accent-strong);
  font-family: var(--ip-font-arabic);
  font-size: .88rem;
  line-height: 1.3;
  white-space: nowrap;
}
.lx-explorer__stage {
  position: relative;
  min-width: 0;
}
.lx-explorer__panel {
  animation: lx-panel-in .35s var(--ip-ease) both;
}
.lx-explorer__panel[hidden] {
  display: none;
}
@keyframes lx-panel-in {
  from { opacity: 0; transform: translateY(8px); }
}
.lx-explorer__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--ip-line-strong);
}
.lx-explorer__count {
  color: var(--ip-muted);
  font-size: .85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
/* Before the script runs (or without it) every panel shows, one after another. */
.lx-explorer:not(.is-ready) .lx-explorer__panel + .lx-explorer__panel {
  margin-top: var(--lx-gap);
}
.lx-explorer:not(.is-ready) .lx-explorer__foot {
  display: none;
}
/* Phones: the list becomes a row of numbered chips above the panel. */
@media (max-width: 991.98px) {
  .lx-explorer__list {
    display: flex;
    gap: .35rem;
    padding: .15rem .1rem .55rem;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .lx-explorer__list::-webkit-scrollbar {
    display: none;
  }
  .lx-explorer__list::before,
  .lx-explorer__list::after {
    display: none;
  }
  .lx-explorer__list li {
    scroll-snap-align: center;
    flex: none;
  }
  .lx-explorer__tab {
    width: auto;
    max-width: 15rem;
    padding-block: .35rem .35rem; padding-inline: .4rem .7rem;
    border-color: var(--ip-line);
    border-radius: var(--ip-radius-pill);
    background: var(--ip-surface);
  }
  .lx-explorer__label small,
  .lx-explorer__ar {
    display: none;
  }
  .lx-explorer__label strong {
    white-space: nowrap;
  }
  .lx-explorer--dots .lx-explorer__label {
    display: none;
  }
  .lx-explorer--dots .lx-explorer__tab {
    padding: .3rem;
  }
}

/* A step's progress strip, used above a stepper's panel. */
.lx-steps-progress {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}
.lx-steps-progress .lx-bar {
  flex: 1;
}

/* ---------- "What next" ---------- */
.lx-next {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: var(--lx-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}
.lx-next__card {
  position: relative;
  display: flex;
  align-items: center;
  gap: .85rem;
  height: 100%;
  padding: 1rem 1.1rem;
  overflow: hidden;
  border: 1px solid var(--ip-line);
  border-radius: var(--ip-radius-lg);
  background: linear-gradient(135deg, var(--lx-tone-bg, var(--ip-tile-emerald-bg)), var(--ip-surface) 70%);
  color: var(--ip-ink);
  text-decoration: none;
  transition: transform .3s var(--ip-ease), box-shadow .3s var(--ip-ease), border-color .3s var(--ip-ease);
}
.lx-next__card:hover,
.lx-next__card:focus-visible {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--lx-tone-fg, var(--ip-primary)) 35%, var(--ip-line));
  box-shadow: var(--ip-shadow-md);
  color: var(--ip-ink);
}
.lx-next__text {
  display: grid;
  gap: .1rem;
  min-width: 0;
}
.lx-next__text strong {
  font-size: .95rem;
  line-height: 1.3;
}
.lx-next__text small {
  color: var(--ip-muted);
  font-size: .8rem;
  line-height: 1.4;
}
.lx-next__go {
  margin-inline-start: auto;
  color: var(--lx-tone-fg, var(--ip-primary));
  transition: transform .3s var(--ip-ease);
}
.lx-next__card:hover .lx-next__go {
  transform: translateX(4px);
}
[dir="rtl"] .lx-next__card:hover .lx-next__go {
  transform: translateX(-4px);
}
[dir="rtl"] .lx-flip {
  transform: scaleX(-1);
}

/* ---------- Empty states ---------- */
.lx-empty {
  position: relative;
  display: grid;
  justify-items: center;
  gap: .6rem;
  padding: clamp(1.75rem, 1.2rem + 2.5vw, 3.25rem) clamp(1rem, .5rem + 2vw, 2.5rem);
  overflow: hidden;
  border: 1px solid var(--ip-line);
  border-radius: var(--lx-radius);
  background:
    radial-gradient(60% 80% at 50% 0%, var(--ip-primary-soft), transparent 70%),
    var(--ip-surface);
  box-shadow: var(--ip-shadow-sm);
  text-align: center;
}
.lx-empty::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: var(--ip-girih);
  background-size: 120px 120px;
  -webkit-mask-image: radial-gradient(60% 60% at 50% 30%, #000, transparent 75%);
  mask-image: radial-gradient(60% 60% at 50% 30%, #000, transparent 75%);
  opacity: .9;
}
.lx-empty > * {
  position: relative;
}
.lx-empty__art {
  width: clamp(140px, 30vw, 200px);
  height: auto;
  margin-bottom: .25rem;
}
.lx-empty__title {
  margin: 0;
  font-family: var(--ip-font-display);
  font-size: clamp(1.2rem, 1.05rem + .7vw, 1.6rem);
  font-weight: 700;
  color: var(--ip-ink);
  text-wrap: balance;
}
.lx-empty__text {
  max-width: 34rem;
  margin: 0;
  color: var(--ip-muted);
  line-height: 1.6;
  text-wrap: pretty;
}
.lx-empty__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem;
  margin-top: .5rem;
}
.lx-empty__links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: .6rem;
  width: min(100%, 52rem);
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
  text-align: start;
}
/* Floating parts of the empty-state art */
.lx-float {
  animation: lx-float 6s ease-in-out infinite;
}
.lx-float--2 {
  animation-delay: -2s;
}
.lx-float--3 {
  animation-delay: -4s;
}
@keyframes lx-float {
  50% { transform: translateY(-6px); }
}
.lx-spin {
  transform-box: fill-box;
  transform-origin: center;
  animation: lx-turn 40s linear infinite;
}

/* ---------- Generated covers ---------- */
.lx-cover {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--lx-c1, #10503a);
  isolation: isolate;
}
.lx-cover svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.lx-cover__glyph {
  position: absolute;
  inset-inline-start: 1rem;
  bottom: .9rem;
  display: inline-grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 14px;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  font-size: 1.2rem;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 22px -12px rgba(0, 0, 0, .6);
}
.lx-cover__word {
  position: absolute;
  inset-inline-end: 1rem;
  bottom: .7rem;
  color: rgba(255, 255, 255, .9);
  font-family: var(--ip-font-arabic);
  font-size: clamp(1.3rem, 1.1rem + 1vw, 1.9rem);
  line-height: 1.3;
  unicode-bidi: isolate;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .35);
}
.lx-cover .lx-cover__motif {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 1.2s var(--ip-ease);
}
a:hover .lx-cover .lx-cover__motif,
.lx-tilt:hover .lx-cover .lx-cover__motif {
  transform: rotate(22.5deg) scale(1.04);
}

/* ---------- Folds: a long chapter shows its opening, then "Read more" (learn-x.js) ---------- */
.lx-fold {
  position: relative;
}
.lx-fold.is-folded {
  max-height: var(--lx-fold-h, 560px);
  overflow: hidden;
}
.lx-fold.is-folded::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 160px;
  background: linear-gradient(180deg, transparent, var(--lx-fold-bg, var(--ip-bg)) 80%);
  pointer-events: none;
}
.lx-fold__more {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: .4rem;
  margin: .75rem auto 0;
  padding: .55rem 1.1rem;
  border: 1px solid color-mix(in srgb, var(--ip-primary) 35%, var(--ip-line));
  border-radius: var(--ip-radius-pill);
  background: var(--ip-surface);
  color: var(--ip-primary);
  font-weight: 700;
  font-size: .88rem;
  box-shadow: var(--ip-shadow-md);
  cursor: pointer;
}
.lx-fold.is-folded > .lx-fold__more {
  position: absolute;
  inset-inline: 0;
  bottom: 1rem;
  width: max-content;
}
.lx-fold:not(.is-folded) > .lx-fold__more i {
  transform: rotate(180deg);
}

/* ---------- Motion helpers ---------- */
.lx-reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .6s var(--ip-ease), transform .6s var(--ip-ease);
  transition-delay: calc(var(--lx-i, 0) * 60ms);
}
.lx-reveal.is-in {
  opacity: 1;
  transform: none;
}
.lx-tilt {
  transform: perspective(900px) rotateX(var(--lx-rx, 0deg)) rotateY(var(--lx-ry, 0deg)) translateY(var(--lx-lift, 0));
  transition: transform .35s var(--ip-ease), box-shadow .35s var(--ip-ease), border-color .35s var(--ip-ease);
}
.lx-tilt:hover {
  --lx-lift: -4px;
}
.lx-glow {
  position: relative;
}
.lx-glow::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(240px circle at var(--lx-mx, 50%) var(--lx-my, 50%), rgba(255, 255, 255, .28), transparent 60%);
  opacity: 0;
  transition: opacity .3s var(--ip-ease);
  pointer-events: none;
}
.lx-glow:hover::after {
  opacity: 1;
}

/* Celebration: stars and petals thrown from a point, then a toast. */
.lx-burst {
  position: fixed;
  z-index: 2000;
  width: 0;
  height: 0;
  pointer-events: none;
}
.lx-burst i {
  position: absolute;
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--c, #e6b85c);
  opacity: 0;
  animation: lx-burst 1.1s cubic-bezier(.15, .7, .3, 1) forwards;
  animation-delay: var(--d, 0ms);
}
.lx-burst i.is-star {
  width: 14px;
  height: 14px;
  border-radius: 0;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
@keyframes lx-burst {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(.4) rotate(0); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1) rotate(var(--r, 180deg)); }
}
.lx-toast {
  position: fixed;
  z-index: 2001;
  inset-inline: 0;
  bottom: clamp(1rem, 3vw, 2rem);
  width: max-content;
  max-width: calc(100vw - 32px);
  margin-inline: auto;
  padding: .75rem 1.1rem;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: var(--ip-radius-pill);
  background: #0d3b29;
  color: #fff;
  font-weight: 600;
  font-size: .92rem;
  box-shadow: var(--ip-shadow-lg);
  animation: lx-toast .4s var(--ip-spring) both;
}
.lx-toast i {
  margin-inline-end: .4rem;
  color: var(--lx-gold-strong, #e6b85c);
}
@keyframes lx-toast {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
}

/* Count-up numbers keep their width. */
[data-lx-count] {
  font-variant-numeric: tabular-nums;
}

.lx-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

@media (prefers-reduced-motion: reduce) {
  .lx-hero__star,
  .lx-float,
  .lx-spin {
    animation: none;
  }
  .lx-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .lx-tilt {
    transform: none;
  }
  .lx-explorer__panel {
    animation: none;
  }
  .lx-burst {
    display: none;
  }
}

@media print {
  .lx-rail,
  .lx-hero__star,
  .lx-burst,
  .lx-toast {
    display: none !important;
  }
  .lx-hero {
    background: none !important;
    color: #000;
  }
  .lx-hero .lx-title,
  .lx-hero .lx-lead {
    color: #000;
  }
  .lx-explorer__panel[hidden] {
    display: block !important;
  }
}
