/* ==========================================================================
   ABOUT — the meeting of «می‌خواهیم» and «می‌توانیم», and the principles as
   one screen that turns by itself (assets/js/fa.js, ABOUT). Loaded after fa.css.
   ========================================================================== */

/* ---------- The meeting ----------
   Each word is its ink (all that stays: it turns blue) and its inner quotation mark (it melts away).
   The ink is painted with two layers clipped to its letters: a narrow band of light, and under it the
   colour, the word's own (--c0) on one side of a soft front and the site's blue (--c1) on the other.
   The script moves both across the phrase the way it reads (--lx, --fx: px from the ink's left edge). */
.gap__word { z-index: 1; --c1: #6b9bf7; }
.gap__word--want { --c0: #ffffff; }
.gap__word--can { --c0: rgba(226, 231, 234, 0.78); }
.gap__q { display: inline-block; color: var(--c0); will-change: transform, opacity, filter; }
.gap__ink {
  display: inline-block; line-height: 1.6;
  /* room around the letters (the colour is painted inside the box only, and Persian letters reach a
     little past their advance); the negative margin keeps the words' spacing as it was */
  padding-inline: 0.16em; margin-inline: -0.16em;
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0) calc(var(--lx, -999px) - var(--lw, 40px)), rgba(255, 255, 255, var(--la, 0.85)) var(--lx, -999px), rgba(255, 255, 255, 0) calc(var(--lx, -999px) + var(--lw, 40px))),
    linear-gradient(90deg, var(--c0) calc(var(--fx, 99999px) - var(--fw, 80px)), var(--c1) calc(var(--fx, 99999px) + var(--fw, 80px)));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
/* English: the front runs left to right, so the blue lies on its left (and waits off to the left before) */
[dir="ltr"] .gap__ink {
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0) calc(var(--lx, -999px) - var(--lw, 40px)), rgba(255, 255, 255, var(--la, 0.85)) var(--lx, -999px), rgba(255, 255, 255, 0) calc(var(--lx, -999px) + var(--lw, 40px))),
    linear-gradient(90deg, var(--c1) calc(var(--fx, -99999px) - var(--fw, 80px)), var(--c0) calc(var(--fx, -99999px) + var(--fw, 80px)));
}

/* the glint where the two inner marks melt: a soft point of light and its thin flare, as a lens draws a
   bright point (sized in em: the script gives it the words' font size; --gk is its strength) */
.gap__glint { position: absolute; left: 50%; top: 50%; width: 0; height: 0; z-index: 2; opacity: 0; pointer-events: none; will-change: transform, opacity; }
.gap__glint::before, .gap__glint::after { content: ""; position: absolute; left: 0; top: 0; border-radius: 50%; }
.gap__glint::before { width: 0.62em; height: 0.62em;
  background: radial-gradient(closest-side, #ffffff 0%, rgba(214, 228, 255, 0.9) 22%, rgba(130, 168, 255, 0.4) 52%, rgba(78, 114, 184, 0) 100%);
  transform: translate(-50%, -50%) scale(calc(0.35 + 0.65 * var(--gk, 0))); }
.gap__glint::after { width: 3.6em; height: max(2px, 0.05em);
  background: radial-gradient(closest-side, #ffffff 0%, rgba(170, 198, 255, 0.75) 30%, rgba(78, 114, 184, 0) 100%);
  transform: translate(-50%, -50%) scaleX(calc(0.2 + 0.8 * var(--gk, 0))); }

/* the bloom of the light that passes through the phrase: a soft glow behind the letters */
.gap__bloom { position: absolute; left: 50%; top: 50%; z-index: 0; width: 2.4em; height: 1.5em; border-radius: 50%; opacity: 0; pointer-events: none; will-change: transform, opacity;
  background: radial-gradient(closest-side, rgba(150, 182, 255, 0.5), rgba(78, 114, 184, 0.22) 55%, rgba(78, 114, 184, 0)); }

/* phones held sideways: a short screen; the words, their stage and the goal close up so the whole scene fits */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 540px) {
  .gap { padding-top: calc(var(--header-h) + 4px); padding-bottom: 14px; }
  .gap__lead { margin-top: 6px; font-size: 15px; }
  .gap__stage { height: 92px; margin: 6px 0 2px; }
  .gap__word { font-size: 34px; }
  .gap__goal { margin-top: 4px; font-size: 17px; line-height: 1.6; }
}

/* ---------- The principles ---------- */
.plist__head { display: block; width: 100%; text-align: start; line-height: inherit; }
/* the count and the controls under the heading */
.principles__nav { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 26px; }

/* wide screens (the script sets .is-auto): one screen; every title in view, the one in focus open */
.prin.is-auto .principles { align-items: center; }
.prin.is-auto .principles__aside { position: static; }
.prin.is-auto .principles__aside .count b { font-size: clamp(40px, 6.2vh, 56px); }
.prin.is-auto .plist li { cursor: pointer; align-items: start; grid-template-columns: clamp(42px, 6vh, 60px) 1fr; padding: clamp(9px, 1.7vh, 24px) 0; }
.prin.is-auto .plist li:not(.is-focus):hover { opacity: 0.62; }
.prin.is-auto .plist .ico { width: clamp(42px, 6vh, 60px); height: clamp(42px, 6vh, 60px); border-radius: 16px; }
.prin.is-auto .plist h3 { min-height: clamp(42px, 6vh, 60px); display: flex; align-items: center; font-size: clamp(19px, min(2vw, 3vh), 28px); }
/* a principle's text folds away: its row eases between nothing and its full height */
.prin.is-auto .plist__more { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.7s var(--ease); }
/* folded away, the text is also hidden from screen readers (once it has finished folding) */
.prin.is-auto .plist__more > div { min-height: 0; overflow: hidden; visibility: hidden; transition: visibility 0s 0.7s; }
.prin.is-auto .plist li.is-focus .plist__more > div { visibility: visible; transition-delay: 0s; }
.prin.is-auto .plist p { margin-top: 6px; font-size: clamp(14.5px, 1.95vh, 17px); line-height: 1.9; opacity: 0; transition: opacity 0.35s; }
.prin.is-auto .plist li.is-focus .plist__more { grid-template-rows: 1fr; }
.prin.is-auto .plist li.is-focus p { opacity: 1; transition: opacity 0.6s 0.2s; }
/* reduced motion: the text is there the moment its principle opens (the site-wide rule shortens transitions, not their delays) */
@media (prefers-reduced-motion: reduce) { .prin.is-auto .plist li.is-focus p { transition-delay: 0s; } }
/* short windows (a laptop's browser leaves about 600px): the rows and the text close up, so the band still fits under them */
@media (min-width: 900.02px) and (max-height: 640px) {
  .prin.is-auto .plist li { grid-template-columns: 38px 1fr; padding-block: 6px; }
  .prin.is-auto .plist .ico { width: 38px; height: 38px; border-radius: 13px; }
  .prin.is-auto .plist h3 { min-height: 38px; }
  .prin.is-auto .plist p { font-size: 13.5px; line-height: 1.8; }
}

/* arriving from another screen (the script sets .is-arrived for 1.2 s): the count swells once and the other titles
   light in turn (--i: a title's place in the list), a quiet fan that says there are five */
@media (prefers-reduced-motion: no-preference) {
  .prin.is-arrived .principles__aside .count b { animation: prin-count 0.5s var(--ease); }
  .prin.is-arrived .plist li:not(.is-focus) { animation: prin-fan 0.6s ease-in-out calc(var(--i, 0) * 80ms); }
}
@keyframes prin-count { 50% { transform: scale(1.12); } }
@keyframes prin-fan { 50% { opacity: 0.7; } }

/* the services band closes this screen (build_fa.py: hubfoot(), the section's last child): the section keeps its
   one screen, the principles take the room above the band and centre in it, and the band lies on the screen's
   bottom edge, so the section has no bottom padding of its own (fa-hubfoot.css pulls the band by -var(--sp)) */
@media (min-width: 900.02px) {
  .section.prin { --sp: 0px; padding-bottom: 0; }
  .prin > .principles { flex: 1 1 auto; }
}

/* narrow screens: a plain list, every principle open; nothing to count or turn */
@media (max-width: 900px) {
  .principles__nav { display: none; }
}

/* ---------- The logo above the story: the Persian word mark on the Persian page ---------- */
.story__logo { display: block; width: clamp(220px, 24vw, 360px); height: auto; margin-bottom: clamp(4px, 1.4vh, 16px); }
@media (max-width: 900px) { .story__logo { width: min(72vw, 300px); margin-bottom: 14px; } }
