/* ==========================================================================
   Section 4 · expert level, in every tool. Light: on #F7F7F7 the
   text is black and the one marked word («מומחה») is blue. Design frames:
   1920 and 393. A part's name drops in letter by letter and its
   three images rise over it. Motion lives in js/s4.js. Every length is N * --u.
   ========================================================================== */
.s4 { --img-w: calc(420 * var(--u)); }
/* the stage is one small window high (100svh); when Safari hides its address bar the
   window grows and the section shows below the stage, so it is light as well */
.s4 { background: var(--soft-white); }
.s4__stage { background: var(--soft-white); color: var(--black); }
.s4 .grid { background-image: linear-gradient(90deg, rgba(5,5,5,.06) var(--hair), transparent var(--hair)); }

/* which part you are in: three small words at the top */
.s4__nav {
  position: absolute; top: calc(56 * var(--u)); left: 0; right: 0; z-index: 3; margin: 0;
  display: flex; justify-content: center; gap: calc(35 * var(--u));
  font-weight: 500; font-size: calc(22 * var(--u)); letter-spacing: .06em;
}
.s4__nav span { color: var(--silver-dark); opacity: .55; transition: color .4s, opacity .4s; }
.s4__nav span.is-on { color: var(--black); opacity: 1; }

/* the title */
.s4__head {
  position: absolute; inset: 0; padding: 0 var(--m);
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
}
.s4__kicker { margin: 0; font-weight: 500; font-size: calc(22 * var(--u)); letter-spacing: .08em; color: var(--silver-dark); }
.s4__title { margin: calc(24 * var(--u)) 0 0; font-weight: 700; font-size: calc(150 * var(--u)); line-height: 1.08; }

/* a part: the words in the middle, the images over them */
.s4__part { position: absolute; inset: 0; pointer-events: none; }
.s4__text {
  position: absolute; left: 0; right: 0; top: calc(350 * var(--u));
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.s4__count { margin: 0; font-weight: 500; font-size: calc(22 * var(--u)); letter-spacing: .08em; color: var(--silver-dark); opacity: 0; }
.s4__name { margin: calc(24 * var(--u)) 0 0; font-weight: 700; font-size: calc(220 * var(--u)); line-height: 1.15; overflow: hidden; white-space: nowrap; }
.s4__name i { display: inline-block; font-style: normal; transform: translateY(-110%); }
.s4__line { margin: calc(36 * var(--u)) 0 0; max-width: calc(820 * var(--u)); font-weight: 300; font-size: calc(40 * var(--u)); line-height: 1.4; color: #3D3D3D; opacity: 0; }

.s4__img {
  position: absolute; top: 0; margin: 0; z-index: 2; width: var(--img-w); aspect-ratio: 4 / 5;
  border-radius: calc(var(--img-w) * .035); overflow: hidden; background: #E6E6E6;
  box-shadow: 0 calc(25 * var(--u)) calc(60 * var(--u)) rgba(0,0,0,.14);
  transform: translate3d(0, 110vh, 0); will-change: transform;
}
.s4__img--l { left: calc(160 * var(--u)); }
.s4__img--r { left: calc(1420 * var(--u)); }
.s4__img--m { left: calc(750 * var(--u)); }
.s4__img img, .s4__seq { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
/* a frame sequence over the still: shown once its first frame has arrived */
.s4__seq { opacity: 0; }
.s4__seq.is-on { opacity: 1; }

/* ---- phone: the 393 frames ------------------------------------------------- */
@media (max-width: 899px) {
  .s4 { --img-w: calc(200 * var(--u)); }
  .s4__nav { top: calc(24 * var(--u)); gap: calc(22 * var(--u)); font-size: calc(14 * var(--u)); }
  .s4__kicker { font-size: calc(14 * var(--u)); }
  .s4__title { margin-top: calc(12 * var(--u)); font-size: calc(44 * var(--u)); }
  .s4__text { top: calc(306 * var(--u)); padding: 0 calc(24 * var(--u)); }
  .s4__count { font-size: calc(14 * var(--u)); }
  .s4__name { margin-top: calc(14 * var(--u)); font-size: calc(96 * var(--u)); }
  .s4__line { margin-top: calc(18 * var(--u)); max-width: calc(330 * var(--u)); font-size: calc(18 * var(--u)); }
  .s4__img--l { left: calc(24 * var(--u)); }
  .s4__img--r { left: calc(169 * var(--u)); }
  .s4__img--m { left: calc(96 * var(--u)); }
}

/* ---- reduced motion: no pin; each part is its name, its line, its images --- */
/* touch phone: with Safari's address bar hidden the window is taller than the
   stage (100svh), and a rising screen was cut on a hard line above the real
   bottom. The stage reaches the large viewport; the pin length stays on svh */
@media (max-width: 899px) and (pointer: coarse) {
  .s4__stage { height: 100vh; height: 100lvh; }
}

@media (prefers-reduced-motion: reduce) {
  .s4__stage { position: relative; padding: calc(160 * var(--u)) var(--m); }
  .s4__nav { display: none; }
  .s4__head, .s4__part, .s4__text { position: relative; inset: auto; top: auto; }
  .s4__part { margin-top: calc(160 * var(--u)); display: grid; grid-template-columns: repeat(3, 1fr); gap: calc(40 * var(--u)); }
  .s4__text { grid-column: 1 / -1; }
  .s4__count, .s4__line { opacity: 1; }
  .s4__name i { transform: none; }
  .s4__img { position: relative; left: auto; width: 100%; transform: none; }
  .s4__seq { display: none; }
}
@media (prefers-reduced-motion: reduce) and (max-width: 899px) {
  .s4__stage { padding: calc(80 * var(--u)) calc(24 * var(--u)); }
  .s4__part { margin-top: calc(80 * var(--u)); grid-template-columns: 1fr; }
  .s4__name { font-size: calc(76 * var(--u)); }        /* «משתפרת» at 96 is wider than the phone */
}
