/* Pol Liria: movement.
   1. the logo and the section rings draw themselves, as the circle of the brand mark
   2. the hero comes in once, on load
   3. blocks rise and pictures open as they scroll into view (CSS scroll-driven animations, no library)
   4. the cursor over a film becomes a disc that says what a click does
   Every piece is off for visitors who ask for reduced motion, and browsers without scroll-driven
   animations simply show everything in place. */

@property --sweep { syntax: "<angle>"; inherits: false; initial-value: 360deg; }
@keyframes draw-ring { from { --sweep: 0deg; } to { --sweep: 360deg; } }

/* ---------------------------------------------------------------- 1. the mark draws itself */
.nav__logo .logo, .sec-label__n::before { -webkit-mask: conic-gradient(from -90deg, #000 var(--sweep), transparent 0); mask: conic-gradient(from -90deg, #000 var(--sweep), transparent 0); }
.sec-label__n { position: relative; border-color: transparent !important; }
.sec-label__n::before { content: ""; position: absolute; inset: -1.5px; border-radius: 50%; border: 1.5px solid currentColor; pointer-events: none; }

@media (prefers-reduced-motion: no-preference) {
  .nav .nav__logo .logo { animation: draw-ring 1.3s cubic-bezier(.65, 0, .25, 1) .15s both; }
  .nav .wordmark { animation: word-in .7s cubic-bezier(.2, .7, .2, 1) .7s both; }
  @keyframes word-in { from { opacity: 0; clip-path: inset(0 100% 0 0); } to { opacity: 1; clip-path: inset(0 0 0 0); } }

  /* ---------------------------------------------------------------- 2. the hero, once on load */
  .hero-x__text > * { animation: rise-in .9s cubic-bezier(.2, .7, .2, 1) both; }
  .hero-x__text > :nth-child(1) { animation-delay: .1s; }
  .hero-x__text > :nth-child(2) { animation-delay: .2s; }
  .hero-x__text > :nth-child(3) { animation-delay: .32s; }
  .hero-x__text > :nth-child(4) { animation-delay: .44s; }
  .hero-x__media { animation: open-left 1.2s cubic-bezier(.7, 0, .2, 1) .15s both; }
  .hero-x__media > img { animation: settle 1.8s cubic-bezier(.2, .7, .2, 1) .15s both; }
  .hero-x__play { animation: pop-in .6s cubic-bezier(.3, 1.4, .5, 1) 1.1s both; }
  .page-head .wrap > * { animation: rise-in .9s cubic-bezier(.2, .7, .2, 1) both; }
  .page-head .wrap > :nth-child(2) { animation-delay: .1s; }
  .page-head .wrap > :nth-child(3) { animation-delay: .2s; }
  .page-head .wrap > :nth-child(4) { animation-delay: .3s; }
  @keyframes rise-in { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
  @keyframes open-left { from { clip-path: inset(0 0 0 100% round var(--rad) 0 0 var(--rad)); } to { clip-path: inset(0 0 0 0 round var(--rad) 0 0 var(--rad)); } }
  @keyframes settle { from { transform: scale(1.14); } to { transform: none; } }
  @keyframes pop-in { from { opacity: 0; scale: .6; } to { opacity: 1; scale: 1; } }
  @media (max-width: 1023px) { @keyframes open-left { from { clip-path: inset(0 0 100% 0 round var(--rad)); } to { clip-path: inset(0 0 0 0 round var(--rad)); } } }

  /* ---------------------------------------------------------------- 3. on scroll */
  @supports (animation-timeline: view()) {
    /* the section rings draw as their header comes up; the footer mark too */
    .sec-label__n::before, .site-foot .logo { animation: draw-ring linear both; animation-timeline: view(); animation-range: entry 20% entry 100%; }
    .site-foot .logo { -webkit-mask: conic-gradient(from -90deg, #000 var(--sweep), transparent 0); mask: conic-gradient(from -90deg, #000 var(--sweep), transparent 0); }

    /* headings and their lines rise into place */
    .sec-head__text > *, .sec-head__action, .cta-band__row > *, .reel-hint, .contact__panel > *, .site-foot__top > * {
      animation: rise-scroll linear both; animation-timeline: view(); animation-range: entry 0% entry 75%;
    }
    .sec-head__text > :nth-child(2) { animation-range: entry 8% entry 85%; }
    .sec-head__text > :nth-child(3) { animation-range: entry 16% entry 95%; }
    @keyframes rise-scroll { from { opacity: 0; transform: translateY(48px); } to { opacity: 1; transform: none; } }

    /* rows of things come in one after another */
    .vgrid > li, .svc, .steps > li, .facts__row > div, .bento figure {
      animation: rise-scroll linear both; animation-timeline: view(); animation-range: entry 0% entry 70%;
    }
    :is(.vgrid > li, .svc, .steps > li, .facts__row > div):nth-child(2) { animation-range: entry 10% entry 80%; }
    :is(.vgrid > li, .svc, .steps > li, .facts__row > div):nth-child(3) { animation-range: entry 20% entry 90%; }
    :is(.vgrid > li, .svc, .steps > li, .facts__row > div):nth-child(4) { animation-range: entry 30% entry 100%; }

    /* pictures open from the foot and settle from a slight zoom */
    .svc__media, .bento figure > img { animation: open-up linear both; animation-timeline: view(); animation-range: entry 0% entry 90%; }
    .svc__media > img { animation: settle linear both; animation-timeline: view(); animation-range: entry 0% entry 100%; }
    @keyframes open-up { from { clip-path: inset(18% 0 0 0 round var(--rad)); } to { clip-path: inset(0 0 0 0 round var(--rad)); } }

    /* the step numbers count off as a line drawn across the top of each step */
    .steps > li { position: relative; border-top-color: color-mix(in oklab, var(--ink) 18%, transparent); }
    .steps > li::before { content: ""; position: absolute; left: 0; right: 0; top: -2px; height: 2px; background: var(--ink); transform-origin: left; animation: line-draw linear both; animation-timeline: view(); animation-range: entry 40% entry 100%; }
    @keyframes line-draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }

    /* the film wall slides in slightly, each film a step behind */
    .reel-item { animation: rise-scroll linear both; animation-timeline: view(); animation-range: entry 0% entry 70%; }
    .reel-item:nth-child(2) { animation-range: entry 8% entry 80%; }
    .reel-item:nth-child(3) { animation-range: entry 16% entry 90%; }
    .reel-item:nth-child(4) { animation-range: entry 24% entry 100%; }
  }
}

/* ---------------------------------------------------------------- 4. the cursor over a film (fine pointers only) */
.vcursor { position: fixed; left: 0; top: 0; z-index: 90; width: 96px; height: 96px; margin: -48px 0 0 -48px; border-radius: 50%;
  display: grid; place-items: center; text-align: center; padding: 8px;
  background: var(--action); color: var(--action-ink); font: 500 14px/1.15 var(--font-display); letter-spacing: .01em;
  pointer-events: none; opacity: 0; scale: .3; transition: opacity .25s, scale .35s cubic-bezier(.3, 1.4, .5, 1); will-change: transform; }
.vcursor.is-on { opacity: 1; scale: 1; }
@media (hover: hover) and (pointer: fine) {
  html.has-vcursor [data-cursor] { cursor: none; }
  html.has-vcursor .vcard[data-cursor]:hover .vcard__play, html.has-vcursor .hero-x__media:hover .hero-x__play, html.has-vcursor .reel-item:hover .reel-item__sound { visibility: hidden; }
}
@media (prefers-reduced-motion: reduce) { .vcursor { transition: opacity .15s; scale: 1; } }
