/* ==========================================================================
   CAPABILITIES — the four pillars side by side, a spotlight running along them
   All four cards stand whole, white and navy in turn. One at a time is the current one (.is-active): it
   stands a little higher with a deeper shadow, its icon box fills, its glow grows, its numeral catches
   the light, and the light under the row runs to it (the beam: fa.js writes --bx and --bw from the
   card). The script (fa.js, CAPABILITIES) moves it on by itself and as it is asked; as the screen
   arrives it deals the cards from the heading into their places (.is-stacked, each card's --dx).
   Wide screens: one screen, the heading at the start (the right in Persian), the cards across the rest,
   the controls under the row and the band at the bottom. Narrow screens: the heading, then a row of
   full cards you swipe, the current one in the middle, the controls under it.
   ========================================================================== */
.pillars { position: relative; }
.pillars__bg { display: none; } /* (the large lettering behind the pillars: off for now) */
.track__intro h2 { line-height: 1.3; color: var(--navy); }

/* a card: a large outlined numeral at the top, the icon in its box at the other corner, the title low in
   the card and the text under it; a soft glow rising from its lower corner */
.pcard {
  position: relative; z-index: calc(4 - var(--k, 0)); display: flex; flex-direction: column; min-width: 0;
  padding: var(--pad, 24px); border-radius: 26px; background: var(--white); border: 1px solid var(--line-dark); color: var(--navy);
  box-shadow: 0 34px 70px -52px rgba(14, 49, 121, 0.5); overflow: hidden; isolation: isolate; cursor: pointer;
  transition: transform 0.6s var(--ease), box-shadow 0.6s var(--ease), border-color 0.6s;
}
.pcard--dark { background: var(--navy); color: var(--mist); border-color: transparent; }
.pcard:focus-visible { border-radius: 26px; outline-offset: 5px; }
.pcard::before {
  content: ""; position: absolute; z-index: -1; inset-inline-end: -130px; bottom: -150px; width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(78, 114, 184, 0.26), transparent 70%); opacity: 0.6; pointer-events: none;
  transition: opacity 0.8s, transform 0.9s var(--ease);
}
.pcard--dark::before { background: radial-gradient(circle, rgba(125, 162, 234, 0.34), transparent 70%); }
/* where the pointer is, the card catches the light */
.pcard::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity 0.4s;
  background: radial-gradient(420px circle at var(--gx, 50%) var(--gy, 50%), rgba(78, 114, 184, 0.13), transparent 60%);
}
.pcard--dark::after { background: radial-gradient(420px circle at var(--gx, 50%) var(--gy, 50%), rgba(226, 231, 234, 0.11), transparent 60%); }
.pcard.is-lit::after { opacity: 1; }

/* the numeral, outlined; a glint runs through it as its card becomes the current one */
.pcard .num {
  display: block; width: fit-content; font-size: var(--nf, 120px); font-weight: 700; line-height: 0.8; color: transparent;
  -webkit-text-stroke: 1.2px rgba(78, 114, 184, 0.42); transition: -webkit-text-stroke-color 0.6s;
  background: linear-gradient(105deg, transparent 38%, rgba(78, 114, 184, 0.5) 50%, transparent 62%) 100% 0 / 300% 100% no-repeat;
  -webkit-background-clip: text; background-clip: text;
}
.pcard--dark .num { -webkit-text-stroke-color: rgba(226, 231, 234, 0.3); background-image: linear-gradient(105deg, transparent 38%, rgba(226, 231, 234, 0.55) 50%, transparent 62%); }
.pcard .ico {
  position: absolute; top: var(--pad, 24px); inset-inline-end: var(--pad, 24px); width: var(--ib, 54px); height: var(--ib, 54px); border-radius: 16px;
  display: grid; place-items: center; background: var(--mist); color: var(--navy); transition: background-color 0.6s, color 0.6s;
}
.pcard--dark .ico { background: rgba(226, 231, 234, 0.1); color: var(--mist); }
.pcard .ico svg { width: 54%; height: 54%; }
.pcard h3 { margin-top: auto; padding-top: 12px; font-size: calc(var(--hf, 24px) * var(--fit, 1)); line-height: 1.45; color: var(--navy); }
.pcard--dark h3 { color: var(--white); }
.pcard p { margin-top: clamp(8px, 1.3vh, 14px); font-size: calc(var(--pf, 15px) * var(--fit, 1)); line-height: 1.85; color: #3d4147; }
.pcard--dark p { color: var(--on-navy); }

/* the current card */
.pcard.is-active { z-index: 5; transform: translateY(calc(-1 * var(--lift, 10px))); box-shadow: 0 46px 80px -44px rgba(14, 49, 121, 0.62); border-color: rgba(78, 114, 184, 0.34); }
.pcard--dark.is-active { border-color: transparent; }
.pcard.is-active::before { opacity: 1; transform: scale(1.3); }
.pcard.is-active .ico { background: var(--navy); color: var(--white); }
.pcard--dark.is-active .ico { background: var(--mist); color: var(--navy); }
.pcard.is-active .num { -webkit-text-stroke-color: rgba(78, 114, 184, 0.9); animation: pcard-glint 1.5s var(--ease) 0.1s both; }
.pcard--dark.is-active .num { -webkit-text-stroke-color: rgba(226, 231, 234, 0.72); }
/* (the glint runs the way the page reads: right to left in Persian) */
@keyframes pcard-glint { from { background-position: 0 0; } to { background-position: 100% 0; } }
@keyframes pcard-glint-ltr { from { background-position: 100% 0; } to { background-position: 0 0; } }
[dir="ltr"] .pcard.is-active .num { animation-name: pcard-glint-ltr; }

/* the controls and the count beside them («ستون ۱ از ۴») */
.pillars__bar { display: flex; align-items: center; justify-content: center; gap: 18px; font-size: 14px; color: var(--graphite); }
.pillars__bar > span { min-width: 6.4em; font-variant-numeric: tabular-nums; }

/* ---------- wide screens: one screen ---------- */
@media (min-width: 900.02px) {
  .pillars {
    --rail: max(0px, 76px - var(--gutter));   /* more room at the end edge, clear of the step rail */
    --iw: clamp(220px, 19vw, 360px);           /* the heading's column */
    --igap: clamp(24px, 2.6vw, 56px);          /* between the heading and the cards */
    --cgap: clamp(10px, 1vw, 20px);            /* between the cards */
    --pad: clamp(16px, min(1.5vw, 2.6vh), 30px);
    --nf: clamp(60px, min(8vw, 17vh - 50px), 150px); /* the numeral, larger where the screen is tall */
    --ib: clamp(38px, min(3.2vw, 6vh), 56px);      /* the icon's box */
    --hf: clamp(14.5px, min(1.25vw, 2.3vh), 23px); /* the title */
    --pf: clamp(12.5px, min(0.98vw, 1.85vh), 15.5px); /* the text */
    --lift: clamp(6px, 1.2vh, 12px);
    height: 100vh; height: 100svh; overflow: hidden; display: flex; flex-direction: column;
    padding: calc(var(--header-h) + clamp(6px, 1.6vh, 18px)) var(--gutter) 0;
  }
  .pillars > .track { flex: 1 1 0; min-height: 0; display: flex; align-items: center; gap: var(--igap); padding-inline-end: var(--rail); }
  .track__intro { flex: 0 0 var(--iw); }
  .track__intro h2 { font-size: clamp(34px, min(3.3vw, 6.2vh), 62px); margin: clamp(10px, 1.8vh, 20px) 0 clamp(10px, 1.6vh, 18px); }
  .track__intro p { font-size: clamp(15px, 1.1vw, 18px); }
  /* the cards and the controls under them, together in the middle of the room beside the heading */
  .track__main { --barh: 44px; --bargap: clamp(14px, 2vh, 22px); flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: center; }
  /* the row: as tall as the room allows (at most a tall card), every card as tall as the row */
  .track__row { position: relative; flex: none; height: min(100% - var(--lift) - var(--bargap) - var(--barh) - 6px, 660px); display: flex; gap: var(--cgap); }
  .track__row > .pcard { flex: 1 1 0; }
  /* under the row a hairline, and on it the light that runs to the current card */
  .track__row::after { content: ""; position: absolute; inset-inline: 0; bottom: -11px; height: 1px; background: rgba(14, 49, 121, 0.1); pointer-events: none; }
  .track__beam {
    position: absolute; left: 0; bottom: -12px; z-index: 1; width: var(--bw, 0px); height: 3px; border-radius: 3px; pointer-events: none;
    background: linear-gradient(90deg, rgba(78, 114, 184, 0), var(--blue) 30%, var(--blue) 70%, rgba(78, 114, 184, 0));
    box-shadow: 0 0 14px rgba(78, 114, 184, 0.55); transform: translateX(var(--bx, 0px));
    transition: transform 0.7s var(--ease), width 0.7s var(--ease), opacity 0.5s 0.45s;
  }
  /* the controls under the middle of the cards */
  .pillars__bar { flex: none; height: var(--barh); margin-top: var(--bargap); }
  section.pillars > .hubfoot { flex: none; }
  /* (short screens: the lines of text a little closer) */
  @media (max-height: 800px) { .pcard p { line-height: 1.72; } }

  /* The deal: away from the screen the cards lie stacked on the first one, by the heading, each a little
     turned; as the screen arrives they spread out to their places, the farthest furthest. */
  .pillars .pcard { transition: transform 0.6s var(--ease), box-shadow 0.6s var(--ease), border-color 0.6s,
    translate 0.9s var(--ease) calc(var(--k, 0) * 45ms), rotate 0.9s var(--ease) calc(var(--k, 0) * 45ms); }
  .pillars.is-stacked .pcard { translate: var(--dx, 0px) 0; rotate: calc(var(--k, 0) * var(--dr, -1.2deg)); }
  [dir="ltr"] .pillars.is-stacked .pcard { --dr: 1.2deg; }
  .pillars.is-stacked .track__beam { opacity: 0; transition: none; }
  .pillars.is-snap .pcard { transition: none; }
}

/* ---------- narrow screens: a row of cards to swipe ---------- */
@media (max-width: 900px) {
  .pillars {
    --sp: 64px; --cw: min(84vw, 440px);
    --nf: 88px; --ib: 48px; --hf: 20px; --pf: 14.5px; --lift: 0px;
    padding: 70px var(--gutter) var(--sp);
  }
  .track__intro h2 { font-size: clamp(32px, 8.4vw, 46px); margin: 14px 0 10px; }
  .track__intro p { font-size: 16px; }
  /* the row runs from edge to edge; each card snaps to its middle */
  .track__row {
    position: relative; display: flex; gap: 14px; margin: 22px calc(-1 * var(--gutter)) 0; padding: 4px calc((100% + 2 * var(--gutter) - var(--cw)) / 2) 22px;
    overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .track__row::-webkit-scrollbar { display: none; }
  .track__row > .pcard { flex: 0 0 var(--cw); scroll-snap-align: center; scroll-snap-stop: always; min-height: 0; transition: opacity 0.5s, box-shadow 0.6s var(--ease); }
  /* (the neighbours that show at the edges wait, paler) */
  .track__row > .pcard:not(.is-active) { opacity: 0.55; }
  .pcard h3 { padding-top: 26px; }
  .track__beam { display: none; }
  .pillars__bar { margin-top: 4px; }
  .pillars__bar > span { display: none; }
  section.pillars > .hubfoot { margin-top: 56px; }
}

/* reduced motion: nothing moves or is dealt; the current card is marked by its light alone */
@media (prefers-reduced-motion: reduce) {
  .pillars .pcard, .pcard::before, .pcard .ico, .track__beam { transition: none; }
  .pcard.is-active { transform: none; }
  .pcard.is-active::before { transform: none; }
  .pcard.is-active .num { animation: none; }
}
