/*
 * Home page: «مسیر ساده» (.sp, templates/home/sections/simple_path.html) and
 * «نقشه‌ی راه یادگیری» (.hr, templates/home/sections/roadmap.html).
 *
 * Loaded only on the home page, after parvaz.css, and built on the site's own
 * colours (--pz-*), the home sections' ink (--hs-ink) and their buttons
 * (.hs-btn), so both blocks look like the rest of the page. learning.js plays
 * the timeline and the kids/adults switch; without it everything is shown.
 */

.sp,
.hr {
  --lp-brand: var(--pz-primary-text);
  --lp-brand-2: var(--pz-primary);
  --lp-brand-rgb: var(--pz-primary-rgb);
  --lp-hero-2: var(--pz-darkdeep);
  --lp-accent: var(--pz-secondary);
  --lp-sun: #ffc23d;
  --lp-ok: var(--pz-success);
  --lp-ink: var(--hs-ink, #12202b);
  --lp-muted: var(--pz-muted);
  --lp-card: #fff;
  --lp-soft: var(--pz-soft);
  --lp-line: rgb(var(--pz-primary-rgb) / 12%);
  --lp-shadow: 0 18px 40px -28px rgb(11 30 48 / 45%);
}

html.dark :is(.sp, .hr) {
  --lp-card: #151a47;
  --lp-line: rgb(255 255 255 / 11%);
  --lp-shadow: 0 18px 40px -26px rgb(0 0 0 / 70%);
}

/* the kids' view keeps its sky colours */
.hr-view--kids {
  --lp-brand: #1678d2;
  --lp-brand-2: #3aa0ff;
  --lp-hero-2: #1b5fc4;
  --lp-accent: #ff6b4a;
}

html.dark .hr-view--kids { --lp-brand: #8cc8ff; }

/* entrance (only once learning.js has set html.lp-animate) */
html.lp-animate :is(.sp, .hr) [data-reveal]:not(.is-in) {
  opacity: 0;
  transform: translateY(1.25rem);
}

html.lp-animate :is(.sp, .hr) [data-reveal] {
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ============================================================ home: «مسیر ساده» (.sp) */
.sp {
  --sp-line-x: 1.35rem;
  position: relative;
  margin-block-start: clamp(1.5rem, 4vw, 2.75rem);
}

.sp__line {
  position: absolute;
  inset-block: 0.5rem;
  inset-inline-start: calc(var(--sp-line-x) - 2px);
  inline-size: 4px;
  overflow: hidden;
  background: rgb(var(--lp-brand-rgb) / 12%);
  border-radius: 999px;
}

html.dark .sp__line { background: rgb(255 255 255 / 10%); }

.sp__bar {
  position: absolute;
  inset: 0;
  display: block;
  background: linear-gradient(to bottom, var(--lp-brand-2), var(--lp-accent));
  transform: scaleY(1);
  transform-origin: 50% 0;
}

.sp.is-live .sp__bar { transform: scaleY(0); }

.sp__list {
  display: grid;
  gap: clamp(1.75rem, 5vw, 3.5rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.sp-item {
  position: relative;
  display: grid;
  grid-template-columns: calc(var(--sp-line-x) * 2) minmax(0, 1fr);
  gap: 0.75rem 1rem;
  align-items: start;
}

.sp-item__point {
  position: relative;
  z-index: 1;
  display: grid;
  grid-row: 1 / span 2;
  grid-column: 1;
  place-items: center;
  justify-self: center;
  inline-size: 2.7rem;
  aspect-ratio: 1;
  font-weight: 900;
  color: var(--lp-muted);
  background: var(--lp-card);
  border: 3px solid rgb(var(--lp-brand-rgb) / 18%);
  border-radius: 50%;
  transition: background-color 0.4s, color 0.4s, border-color 0.4s, transform 0.4s;
}

.sp-item.is-active .sp-item__point,
.sp:not(.is-live) .sp-item__point {
  color: #fff;
  background: linear-gradient(135deg, var(--lp-brand-2), var(--lp-accent));
  border-color: var(--lp-card);
  box-shadow: 0 0 0 6px rgb(229 83 45 / 14%);
  transform: scale(1.06);
}

.sp-item__content { grid-column: 2; min-inline-size: 0; }
.sp-item__media { grid-column: 2; min-inline-size: 0; }

.sp-item__title {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  margin: 0 0 0.45rem;
  font-size: clamp(1.15rem, 3vw, 1.5rem);
  font-weight: 900;
  line-height: 1.5;
  color: var(--hs-ink, var(--lp-ink));
}

.sp-item__icon {
  display: grid;
  flex: none;
  place-items: center;
  inline-size: 2.9rem;
  aspect-ratio: 1;
  color: var(--lp-accent);
  background: rgb(229 83 45 / 10%);
  border-radius: 0.95rem;
}

.sp-item__text { margin: 0; font-size: 1rem; line-height: 2.05; color: var(--lp-muted); }

.sp-item__link {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  margin-block-start: 0.6rem;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--lp-brand);
}

.sp-item__image {
  display: block;
  inline-size: 100%;
  max-inline-size: 26rem;
  block-size: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 1.75rem;
  box-shadow: var(--lp-shadow);
}

@media (min-width: 900px) {
  .sp { --sp-line-x: 50%; }
  .sp__line { inset-inline-start: calc(50% - 2px); }
  .sp-item { grid-template-columns: minmax(0, 1fr) 5rem minmax(0, 1fr); align-items: center; gap: 2rem; }
  .sp-item__point { grid-row: 1; grid-column: 2; inline-size: 3.4rem; font-size: 1.1rem; }
  .sp-item__content { grid-row: 1; grid-column: 1; }
  .sp-item__media { grid-row: 1; grid-column: 3; }
  .sp-item--even .sp-item__content { grid-column: 3; }
  .sp-item--even .sp-item__media { grid-column: 1; }
  .sp-item--even :is(.sp-art, .sp-item__image) { margin-inline-start: auto; }
  .sp-item:not(.sp-item--even) .sp-item__content { text-align: end; }
  .sp-item:not(.sp-item--even) .sp-item__title { flex-direction: row-reverse; }
  .sp-item__image,
  .sp-art { max-inline-size: 24rem; }
}

/* a step's illustration (no picture uploaded) */
.sp-art {
  --sp-a: #13777b;
  --sp-b: #0b4e53;
  position: relative;
  display: grid;
  place-items: center;
  inline-size: 100%;
  max-inline-size: 22rem;
  aspect-ratio: 5 / 4;
  isolation: isolate;
}

.sp-art--2 { --sp-a: #ff8a5c; --sp-b: #e5532d; }
.sp-art--3 { --sp-a: #3aa0ff; --sp-b: #1b5fc4; }
.sp-art--4 { --sp-a: #8f74ff; --sp-b: #5a3fd1; }
.sp-art--5 { --sp-a: #ffc23d; --sp-b: #e0891a; }

.sp-art__blob {
  position: absolute;
  inset: 6% 4%;
  z-index: -1;
  background:
    radial-gradient(circle at 30% 25%, rgb(255 255 255 / 35%), transparent 40%),
    linear-gradient(140deg, var(--sp-a), var(--sp-b));
  border-radius: 42% 58% 55% 45% / 48% 42% 58% 52%;
  box-shadow: 0 30px 60px -36px var(--sp-b);
}

@keyframes sp-morph {
  0%, 100% { border-radius: 42% 58% 55% 45% / 48% 42% 58% 52%; }
  50% { border-radius: 58% 42% 45% 55% / 42% 58% 42% 58%; }
}

html.lp-animate .sp-art__blob { animation: sp-morph 12s ease-in-out infinite; }

.sp-art__screen {
  display: grid;
  gap: 0.6rem;
  justify-items: center;
  inline-size: 62%;
  padding: 0.75rem 0.85rem 1rem;
  background: var(--lp-card);
  border-radius: 1.2rem;
  box-shadow: 0 26px 50px -26px rgb(0 0 0 / 45%);
  transform: rotate(-3deg);
}

.sp-item--even .sp-art__screen { transform: rotate(3deg); }

.sp-art__bar { display: flex; gap: 0.25rem; justify-self: start; }
.sp-art__bar i { inline-size: 0.45rem; aspect-ratio: 1; background: rgb(127 140 150 / 35%); border-radius: 50%; }
.sp-art__bar i:first-child { background: #ff6b5b; }

.sp-art__tile {
  display: grid;
  place-items: center;
  inline-size: 4.6rem;
  aspect-ratio: 1;
  color: #fff;
  background: linear-gradient(140deg, var(--sp-a), var(--sp-b));
  border-radius: 1.2rem;
  box-shadow: 0 14px 26px -14px var(--sp-b);
}

.sp-art__levels { display: flex; gap: 0.2rem; direction: ltr; }

.sp-art__levels b {
  padding: 0.05rem 0.35rem;
  font-size: 0.62rem;
  color: var(--lp-muted);
  background: var(--lp-soft);
  border-radius: 0.35rem;
}

.sp-art__levels b:nth-child(3) { color: #fff; background: var(--sp-b); }

.sp-art__meter { inline-size: 100%; block-size: 0.45rem; overflow: hidden; background: var(--lp-soft); border-radius: 999px; }
.sp-art__meter i { display: block; inline-size: 62%; block-size: 100%; background: linear-gradient(90deg, var(--sp-a), var(--sp-b)); border-radius: inherit; }

.sp-art__chat { display: grid; gap: 0.3rem; inline-size: 100%; direction: ltr; }

.sp-art__chat i {
  justify-self: start;
  padding: 0.15rem 0.55rem;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 700;
  color: var(--lp-ink);
  background: var(--lp-soft);
  border-radius: 0.7rem 0.7rem 0.7rem 0.2rem;
}

.sp-art__chat i:nth-child(2) { justify-self: end; color: #fff; background: var(--sp-b); border-radius: 0.7rem 0.7rem 0.2rem; }

.sp-art__road { display: flex; gap: 0.3rem; align-items: center; inline-size: 100%; justify-content: space-between; }
.sp-art__road i { flex: none; inline-size: 0.8rem; aspect-ratio: 1; background: var(--lp-soft); border: 2px solid var(--sp-b); border-radius: 50%; }
.sp-art__road i:nth-child(-n + 3) { background: var(--sp-b); }

.sp-art__chart { display: flex; gap: 0.3rem; align-items: flex-end; block-size: 3rem; }
.sp-art__chart i { inline-size: 0.6rem; background: linear-gradient(var(--sp-a), var(--sp-b)); border-radius: 0.3rem 0.3rem 0 0; }
.sp-art__chart i:nth-child(1) { block-size: 30%; }
.sp-art__chart i:nth-child(2) { block-size: 45%; }
.sp-art__chart i:nth-child(3) { block-size: 40%; }
.sp-art__chart i:nth-child(4) { block-size: 65%; }
.sp-art__chart i:nth-child(5) { block-size: 80%; }
.sp-art__chart i:nth-child(6) { block-size: 100%; }

.sp-art__seal { display: flex; gap: 0.35rem; align-items: center; color: var(--sp-b); }
.sp-art__seal b { font-size: 1.4rem; font-weight: 900; }

.sp-art__chip {
  position: absolute;
  display: grid;
  place-items: center;
  inline-size: 2.3rem;
  aspect-ratio: 1;
  color: #fff;
  background: var(--lp-accent);
  border: 3px solid var(--lp-card);
  border-radius: 50%;
  box-shadow: var(--lp-shadow);
}

.sp-art__chip--1 { inset-block-start: 8%; inset-inline-end: 10%; background: var(--lp-sun); }
.sp-art__chip--2 { inset-block-end: 10%; inset-inline-start: 8%; background: var(--lp-ok); }

@keyframes sp-float { from { transform: translateY(0); } to { transform: translateY(-8px); } }
html.lp-animate .sp-art__chip--1 { animation: sp-float 2.8s ease-in-out infinite alternate; }
html.lp-animate .sp-art__chip--2 { animation: sp-float 3.4s 0.4s ease-in-out infinite alternate; }

/* ============================================================ home: «نقشه‌ی راه» (.hr) */
.hr { margin-block-start: clamp(1.25rem, 3vw, 2rem); }

.hr-switch {
  display: none;
  gap: 0.3rem;
  justify-self: center;
  margin: 0 auto 1.5rem;
  padding: 0.3rem;
  inline-size: max-content;
  max-inline-size: 100%;
  background: var(--lp-card);
  border: 1px solid var(--lp-line);
  border-radius: 999px;
  box-shadow: var(--lp-shadow);
}

.hr.is-switchable .hr-switch { display: flex; }

.hr-switch__btn {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  min-block-size: 2.75rem;
  padding: 0.4rem 1.2rem;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--lp-muted);
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 999px;
}

.hr-switch__btn[aria-pressed="true"] { color: #fff; background: linear-gradient(135deg, var(--lp-brand-2), var(--lp-hero-2)); }
.hr-view[hidden] { display: none; }
.hr-view + .hr-view { margin-block-start: 2.5rem; }
.hr.is-switchable .hr-view + .hr-view { margin-block-start: 0; }
.hr-view__title { margin: 0; font-size: 1.25rem; font-weight: 900; text-align: center; color: var(--hs-ink, var(--lp-ink)); }
.hr-view__lead { max-inline-size: 36rem; margin: 0.3rem auto 1.5rem; font-size: 0.95rem; line-height: 2; text-align: center; color: var(--lp-muted); }

.hr-road {
  position: relative;
  display: grid;
  gap: 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: hr;
}

.hr-road::before {
  position: absolute;
  inset-block: 1.5rem;
  inset-inline-start: calc(1.6rem - 2px);
  inline-size: 4px;
  content: "";
  background: repeating-linear-gradient(to bottom, var(--lp-accent) 0 10px, transparent 10px 18px);
  border-radius: 999px;
  opacity: 0.55;
}

.hr-stop {
  position: relative;
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
}

.hr-stop__station {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  inline-size: 3.2rem;
  aspect-ratio: 1;
  font-size: 0.8rem;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, var(--lp-brand-2), var(--lp-hero-2));
  border: 4px solid var(--lp-card);
  border-radius: 50%;
  box-shadow: var(--lp-shadow);
}

.hr-view--kids .hr-stop__station { border-radius: 1rem; }
.hr-view--kids .hr-stop:nth-child(even) .hr-stop__station { background: linear-gradient(135deg, var(--lp-sun), var(--lp-accent)); }
.hr-stop--goal .hr-stop__station { background: var(--lp-ok); }

.hr-stop__body {
  display: grid;
  gap: 0.1rem;
  min-inline-size: 0;
  padding: 0.7rem 0.95rem;
  background: var(--lp-card);
  border: 1px solid var(--lp-line);
  border-radius: 1.1rem;
  box-shadow: var(--lp-shadow);
}

.hr-stop__title { font-weight: 900; color: var(--lp-ink); }
.hr-stop__books { overflow: hidden; font-size: 0.78rem; font-weight: 700; color: var(--lp-brand); text-align: end; text-overflow: ellipsis; white-space: nowrap; }
.hr-stop__meta { font-size: 0.75rem; color: var(--lp-muted); }

/* wide screens: the stations run along a winding horizontal road */
@media (min-width: 992px) {
  .hr-road {
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    gap: 0.75rem;
    padding-block: 2.5rem 0;
  }
  .hr-road::before {
    inset-block: 4.1rem auto;
    inset-inline: 4% 4%;
    inline-size: auto;
    block-size: 4px;
    background: repeating-linear-gradient(to left, var(--lp-accent) 0 10px, transparent 10px 18px);
  }
  .hr-stop { grid-template-columns: none; grid-template-rows: auto 1fr; justify-items: center; align-items: start; text-align: center; }
  .hr-stop__body { justify-items: center; inline-size: 100%; block-size: 100%; }
  .hr-stop__books { text-align: center; max-inline-size: 100%; }
}


/* phones: smaller buttons under the roadmap, side by side */
@media (max-width: 639px) {
  .hr .hs-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .hr .hs-btn {
    min-block-size: 2.6rem;
    padding: 0.5rem 0.7rem;
    font-size: 0.82rem;
  }

  .sp-item__title { font-size: 1.1rem; }
  .sp-item__icon { inline-size: 2.4rem; }
  .sp-item__text { font-size: 0.92rem; }
  .sp-art { max-inline-size: 17rem; margin-inline: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .sp *,
  .hr * {
    transition: none !important;
    animation: none !important;
  }
}
