/* ==========================================================================
   Scroll-driven motion (#76). Native CSS scroll timelines only: no JavaScript,
   no scroll listener (animations.js keeps the one observer), and the browser
   runs them off the main thread. Everything here is inside BOTH guards:

   - @supports (animation-timeline: view()): a browser without scroll
     timelines never applies these rules and shows every element at rest.
   - prefers-reduced-motion: no-preference: nothing here runs for a visitor
     who asked for less motion. motion.css's sweep is the second net.

   Transform, clip-path and opacity only. Each row's reason, and the
   candidates that were cut, are in docs/awwwards/ntc-terrace/motion.md.
   Registered after motion.css.
   ========================================================================== */

@keyframes ntc-fx-drift   { from { transform: translateY(24px); } to { transform: translateY(-24px); } }
@keyframes ntc-fx-rise    { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ntc-fx-roll    { from { transform: translateY(100%); clip-path: inset(0 0 100% 0); } to { transform: none; clip-path: inset(0); } }
@keyframes ntc-fx-chant   { from { transform: translateX(var(--ntc-fx-chant, -6%)); } to { transform: none; } }
@keyframes ntc-fx-ground  { from { clip-path: inset(8% 4%); } to { clip-path: inset(0); } }
@keyframes ntc-fx-grow-x  { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes ntc-fx-grow-y  { from { transform: scaleY(0); } to { transform: scaleY(1); } }

@supports (animation-timeline: view()) {
@media (prefers-reduced-motion: no-preference) {

  /* 1. Join band: "JOIN THE CHIEFS." slides in from -6% as the band enters,
     like a chant rolling along the terrace. Half the travel on a phone. */
  html .ntc-joinband__title {
    animation: ntc-fx-chant linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 45%;
  }

  /* 2. Grounds wipe in: a section on a new ground (purple, gold, bone) opens
     from inset(8% 4%) to full bleed while its top travels to mid-screen. It
     marks the change of chapter. Ink and raised sections, which are the
     page's default ground, do not move. */
  .ntc-sec.ntc-ground--secondary,
  .ntc-sec.ntc-ground--gold,
  .ntc-sec.ntc-ground--bone,
  html .ntc-joinband {
    animation: ntc-fx-ground linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 50%;
  }

  /* 3. Numbers (spec row): each figure rolls up through its own box, scrubbed,
     80ms of scroll apart in the scoreboard's voice. No count-up. */
  .ntc-numbers__value {
    animation: ntc-fx-roll linear both;
    animation-timeline: view();
    animation-range: entry 40% cover 40%;
  }
  .ntc-numbers__item:nth-child(2) .ntc-numbers__value { animation-range: entry 55% cover 44%; }
  .ntc-numbers__item:nth-child(3) .ntc-numbers__value { animation-range: entry 70% cover 48%; }
  .ntc-numbers__item:nth-child(4) .ntc-numbers__value { animation-range: entry 85% cover 52%; }

  /* 4. Honours: a winner's title draws a 3px gold underline left to right as
     it passes the middle of the screen, like a result going up on the board. */
  .ntc-timeline__result--winner { position: relative; width: fit-content; }
  .ntc-timeline__result--winner::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -4px;
    height: 3px;
    background: currentColor;
    transform-origin: left;
    animation: ntc-fx-grow-x linear both;
    animation-timeline: view();
    animation-range: entry 100% cover 50%;
  }

  /* 5. Reading progress: a 3px gold line grows with the page's scroll. Under
     the compact masthead from 768, along the top edge of the thumb bar on a
     phone. Neither bar moves; only the line inside it scales. */
  html .ntc-masthead-compact::after,
  html .ntc-thumbbar::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--color-accent-base);
    transform-origin: left;
    pointer-events: none;
    animation: ntc-fx-grow-x linear both;
    animation-timeline: scroll(root);
  }
  html .ntc-masthead-compact::after { bottom: -3px; }
  html .ntc-thumbbar::before { top: -3px; }

  /* Cards (spec row): partner tiles, news and product cards rise 24px and
     fade as they enter, the second and third column a little later so a row
     arrives left to right. */
  .ntc-ltiles__tile,
  .ntc-ncard,
  .ntc-pgrid__card {
    animation: ntc-fx-rise linear both;
    animation-timeline: view();
    animation-range: entry 10% entry 80%;
  }
  .ntc-ltiles__tile:nth-child(3n+2), .ntc-ncard:nth-child(3n+2), .ntc-pgrid__card:nth-child(4n+2) { animation-range: entry 20% entry 90%; }
  .ntc-ltiles__tile:nth-child(3n),   .ntc-ncard:nth-child(3n),   .ntc-pgrid__card:nth-child(4n+3) { animation-range: entry 30% entry 100%; }
  .ntc-pgrid__card:nth-child(4n) { animation-range: entry 40% cover 40%; }

  /* Desktop only (M10 turns these off on a phone). */
  @media (min-width: 768px) {
    /* Owned photo (spec row): the photo drifts +24 to -24px across the
       viewport while its gold block stays put, so the offset frame reads as
       two layers. */
    .ntc-owned__img {
      animation: ntc-fx-drift linear both;
      animation-timeline: view();
    }
  }
  @media (min-width: 1024px) {
    /* Quote bar (spec row): the gold bar beside the founder's quote grows
       down from the top as the quote enters. The border becomes a pseudo
       element so it can scale; it is the same 6px gold bar at rest. */
    .ntc-lquote { position: relative; border-left-color: transparent; }
    .ntc-lquote::before {
      content: "";
      position: absolute;
      top: 0;
      bottom: 0;
      left: -6px;
      width: 6px;
      background: var(--color-accent-base);
      transform-origin: top;
      animation: ntc-fx-grow-y linear both;
      animation-timeline: view();
      animation-range: entry 20% cover 40%;
    }
  }
  @media (max-width: 767px) {
    html .ntc-joinband__title { --ntc-fx-chant: -3%; }
  }
}
}
