/* Services, version 2 (?serv=2).
   Every person is a short video loop that always fills its tile (the video never changes size or
   position when a tile opens: that relayout caused a ~0.4s stall). On desktop the open tile shows a
   dark strip that slides up from the bottom with a transform, text on the left and the live screen on
   the right; the screen sits inside the strip and rides 40% over the video's edge. */

.svc-vid { display: none; }

[data-serv="2"] .svc-vid {
  display: block; position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: var(--fx) 30%;
}
[data-serv="2"] .svc-img { visibility: hidden; }

@media (min-width: 1200px) {
  /* the strip: same element as the closed title, now a full-width panel at the bottom */
  [data-serv="2"] .svc.is-on .svc-in {
    left: 0; right: 0; bottom: 0; width: auto;
    padding: 18px 22px 20px;
    background: #151515;
    box-shadow: 0 -1px 0 rgba(255,255,255,.08);
    animation: svc-strip-up .6s var(--ease-out) both;
  }
  @keyframes svc-strip-up { from { transform: translateY(100%); } }

  /* the text is already there when the strip rises (no height animation under it), in three short rows.
     The screen only covers the top of the strip's right side (60% of its height), so the title and the
     line keep clear of it while the last row, tags and "Explore More", runs the full width under it */
  [data-serv="2"] .svc.is-on .svc-in {
    display: grid; grid-template-columns: minmax(0, 1fr) auto calc(440px * var(--art-s) + 24px); column-gap: 16px;
    grid-template-areas: "title title ." "line line ." "tags tags tags";
    align-items: center;
  }
  [data-serv="2"] .svc.is-on .svc-in h3 { grid-area: title; }
  [data-serv="2"] .svc.is-on .svc-more { display: contents; max-height: none; opacity: 1; transition: none; }
  [data-serv="2"] .svc.is-on .svc-more p { grid-area: line; margin-top: 6px; }
  /* tags take the whole last row; "Explore More" shares the row at its right end */
  [data-serv="2"] .svc.is-on .svc-more .tags { grid-area: tags; margin-top: 12px; padding-right: 104px; }
  [data-serv="2"] .svc.is-on .svc-more .link { grid-area: tags; justify-self: end; margin-top: 12px; white-space: nowrap; }

  /* no text sits on the video any more: a light shade is enough */
  [data-serv="2"] .svc.is-on::after { background: linear-gradient(0deg, rgba(0,0,0,.3), rgba(0,0,0,0) 45%); }

  /* the screen lives inside the strip (moved there by js/servicios2.js): its top edge rides 40% over the video */
  [data-serv="2"] .svc-in > .art {
    top: 0; bottom: auto; right: 18px;
    transform: translateY(calc(-78.4px * var(--art-s))) scale(var(--art-s));
    transform-origin: right top;
  }

  /* where the open tile has no room for the screen, the text takes the whole strip */
  @container (max-width: 543px) { [data-serv="2"] .svc.is-on .svc-in { grid-template-columns: minmax(0, 1fr) auto 0; } }
}
@media (min-width: 1366px) and (max-width: 1499px) {
  @container (max-width: 569px) { [data-serv="2"] .svc.is-on .svc-in { grid-template-columns: minmax(0, 1fr) auto 0; } }
}
@media (min-width: 1500px) {
  /* a slightly smaller screen on big screens leaves the long titles ("Custom Software Development") one line */
  [data-serv="2"] .mosaic { --art-s: .5; }
  @container (max-width: 591px) { [data-serv="2"] .svc.is-on .svc-in { grid-template-columns: minmax(0, 1fr) auto 0; } }
}

@media (prefers-reduced-motion: reduce) {
  [data-serv="2"] .svc-vid { display: none; }
  [data-serv="2"] .svc-img { visibility: visible; }
  [data-serv="2"] .svc.is-on .svc-in { animation: none; }
}
