/* ==========================================================================
   Team-Led Results: motion layer (proposals 1-5)
   --------------------------------------------------------------------------
   Additive only. Every rule here is scoped under html.tlr-motion or
   html.tlr-reduced, so with no JavaScript, or before the head snippet runs,
   the site renders exactly as it does today.

   Hooks: elements opt in with a data-tlr-motion="..." attribute (see
   MOTION-HANDOFF.md). Adding these attributes is the only markup change
   this layer needs on existing elements.

   Two classes on <html>:
     tlr-motion   set by the inline head snippet when motion is welcome
     tlr-reduced  set instead when prefers-reduced-motion: reduce
     tlr-ready    set by tlr-motion.js once its observers are running.
                  Anything that waits for an observer is gated on it, so a
                  script failure can never leave content in its "before" state.
   ========================================================================== */

:root {
  --tlr-ease-out: cubic-bezier(.2, .8, .2, 1);
  --tlr-ease-spring: cubic-bezier(.34, 1.45, .64, 1);
  --tlr-ease-marker: cubic-bezier(.6, .05, .25, 1);
  --tlr-marker: #FFE600;   /* match the site's existing highlight yellow */
}
@property --tlr-hl-a { syntax: '<number>'; inherits: false; initial-value: 1; }

/* --------------------------------------------------------------------------
   1. HERO: lines arrive in order, then the marker swipes behind WITH
   -------------------------------------------------------------------------- */
html.tlr-motion [data-tlr-motion="hero-line-1"] { animation: tlr-rise .55s var(--tlr-ease-out) .15s both; }
html.tlr-motion [data-tlr-motion="hero-line-2"] { animation: tlr-rise .55s var(--tlr-ease-out) .55s both; }

/* The marker keeps its exact resting look: same color, same radius, same
   padding. The color moves from the span itself to a ::before layer so it
   can sweep. */
html.tlr-motion [data-tlr-motion="hero-marker"],
html.tlr-reduced [data-tlr-motion="hero-marker"] {
  position: relative;
  isolation: isolate;
  background-color: transparent !important;
}
html.tlr-motion [data-tlr-motion="hero-marker"]::before,
html.tlr-reduced [data-tlr-motion="hero-marker"]::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--tlr-marker);
  border-radius: inherit;
  transform-origin: 0 50%;
}
html.tlr-motion [data-tlr-motion="hero-marker"]::before { animation: tlr-swipe .55s var(--tlr-ease-marker) 1.1s both; }
html.tlr-reduced [data-tlr-motion="hero-marker"]::before { animation: tlr-fade .6s ease .3s both; }

/* Book: settles once on load (translate/rotate), tilts toward the cursor
   on desktop (transform). Separate properties, so they never fight. */
html.tlr-motion [data-tlr-motion="hero-book"] {
  animation: tlr-land .9s var(--tlr-ease-spring) .05s both;
  transform: perspective(1100px) rotateY(var(--tlr-ry, 0deg)) rotateX(var(--tlr-rx, 0deg));
  transition: transform .5s var(--tlr-ease-out);
}

@keyframes tlr-rise  { from { opacity: 0; translate: 0 10px; } }
@keyframes tlr-swipe { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes tlr-land  { from { translate: 0 18px; rotate: -3deg; } }
@keyframes tlr-fade  { from { opacity: 0; } }

/* --------------------------------------------------------------------------
   2. HIGHLIGHTER: each existing highlight sweeps in once, left to right
   -------------------------------------------------------------------------- */
/* !important is needed only because the current highlights may use inline
   styles. The resting state (background-size 100%) is identical to today. */
html.tlr-ready [data-tlr-motion="highlight"] {
  background-color: transparent !important;
  background-image: linear-gradient(rgba(255, 230, 0, var(--tlr-hl-a)), rgba(255, 230, 0, var(--tlr-hl-a))) !important;
  background-repeat: no-repeat !important;
  background-position: 0 0 !important;
  background-size: 100% 100% !important;
}
html.tlr-motion.tlr-ready [data-tlr-motion="highlight"]:not(.tlr-in) { background-size: 0% 100% !important; }
html.tlr-motion.tlr-ready [data-tlr-motion="highlight"].tlr-in { transition: background-size var(--tlr-hl-dur, .8s) var(--tlr-ease-marker) var(--tlr-hl-delay, 0s); }
html.tlr-reduced.tlr-ready [data-tlr-motion="highlight"]:not(.tlr-in) { --tlr-hl-a: 0; }
html.tlr-reduced.tlr-ready [data-tlr-motion="highlight"].tlr-in { transition: --tlr-hl-a .5s ease var(--tlr-hl-delay, 0s); }

/* What You'll Learn: the existing colored dots pop in order */
html.tlr-motion.tlr-ready [data-tlr-motion="dots"]:not(.tlr-in) [data-tlr-motion="dot"] { transform: scale(0); }
html.tlr-motion.tlr-ready [data-tlr-motion="dots"].tlr-in [data-tlr-motion="dot"] { transition: transform .5s var(--tlr-ease-spring) calc(var(--tlr-i, 0) * .14s); }

/* --------------------------------------------------------------------------
   3. FOUR FOUNDATIONS: a ground line draws, each illustration grows from it
   -------------------------------------------------------------------------- */
/* The line is an SVG that tlr-motion.js inserts (decorative, aria-hidden),
   positioned at the bottom edge of the illustrations. Desktop row only. */
.tlr-ground { position: absolute; left: -8px; right: -8px; width: calc(100% + 16px); /* site edit: an SVG does not stretch between left and right */ height: 18px; margin-top: -9px; pointer-events: none; overflow: visible; }
.tlr-ground path { fill: none; stroke: #082246; stroke-width: 3; stroke-linecap: round; opacity: .55; } /* site edit: non-scaling-stroke removed so the draw-in covers the stretched line */
html.tlr-motion .tlr-ground path { stroke-dasharray: 1; stroke-dashoffset: 1; }
html.tlr-motion [data-tlr-motion="foundations"].tlr-in .tlr-ground path { stroke-dashoffset: 0; transition: stroke-dashoffset 2.3s cubic-bezier(.45, 0, .4, 1) .1s; }

html.tlr-ready [data-tlr-motion="foundation-art"] { transform-origin: 50% 100%; }
html.tlr-motion.tlr-ready [data-tlr-motion="foundation-step"]:not(.tlr-in) [data-tlr-motion="foundation-art"] { opacity: 0; transform: translateY(14px) scale(.55); }
html.tlr-motion.tlr-ready [data-tlr-motion="foundation-step"].tlr-in [data-tlr-motion="foundation-art"] { transition: opacity .35s ease var(--tlr-d, 0s), transform .75s var(--tlr-ease-spring) var(--tlr-d, 0s); }
html.tlr-reduced.tlr-ready [data-tlr-motion="foundation-step"]:not(.tlr-in) [data-tlr-motion="foundation-art"] { opacity: 0; }
html.tlr-reduced.tlr-ready [data-tlr-motion="foundation-step"].tlr-in [data-tlr-motion="foundation-art"] { transition: opacity .6s ease var(--tlr-d, 0s); }

/* --------------------------------------------------------------------------
   4. DOMINO CHAIN above "Start with one small move."
   -------------------------------------------------------------------------- */
/* The container is the one new element in the markup (decorative,
   aria-hidden). It stays empty and takes no space until the script fills it. */
[data-tlr-motion="dominoes"] { position: relative; margin: 0 auto; max-width: 100%; }
[data-tlr-motion="dominoes"]:empty { display: none; }
.tlr-dom-floor { position: absolute; left: 0; right: 0; bottom: -2px; height: 3px; border-radius: 3px; background: #082246; opacity: .2; }
.tlr-dom { position: absolute; bottom: 0; box-sizing: border-box; border: 2.5px solid #111111; border-radius: 4px; transform-origin: 100% 100%; }
.tlr-dom::after { content: ""; position: absolute; left: 18%; right: 18%; top: 50%; border-top: 2px solid #111111; opacity: .7; }

/* --------------------------------------------------------------------------
   5. POLISH
   -------------------------------------------------------------------------- */
/* 5a. Buttons lift on hover and press on click.
   Replace the selector list with the site's EXISTING button classes.
   Do not add classes to buttons. Transform and shadow only, so no layout shift. */
html.tlr-motion :is(.btn) { transition: transform .18s var(--tlr-ease-out), box-shadow .18s var(--tlr-ease-out); }
html.tlr-motion :is(.btn):hover { transform: translateY(-2px); box-shadow: 0 5px 0 rgba(8, 34, 70, .22); }
html.tlr-motion :is(.btn):active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(8, 34, 70, .22); transition-duration: .06s; }

/* 5b. Sticky pre-order bar slides up after the hero leaves, and hides over
   the pre-order section. The JS only toggles .tlr-sticky-show. It does not
   touch the bar's content, close button or dismissal logic. */
html.tlr-ready [data-tlr-motion="sticky-bar"] { transition: transform .45s var(--tlr-ease-out), visibility 0s linear .45s; }
html.tlr-ready [data-tlr-motion="sticky-bar"]:not(.tlr-sticky-show) { transform: translateY(calc(100% + 60px)); visibility: hidden; }
html.tlr-ready [data-tlr-motion="sticky-bar"].tlr-sticky-show { transition: transform .5s var(--tlr-ease-spring), visibility 0s; }
html.tlr-reduced.tlr-ready [data-tlr-motion="sticky-bar"]:not(.tlr-sticky-show) { transform: none; opacity: 0; }
html.tlr-reduced.tlr-ready [data-tlr-motion="sticky-bar"] { transition: opacity .3s ease, visibility 0s linear .3s; }

/* 5c. "Read 3 more endorsements": the opening is animated by tlr-motion.js
   (height plus a staggered fade). Optional chevron hook: */
html.tlr-ready [data-tlr-motion="more-chevron"] { display: inline-block; transition: transform .35s var(--tlr-ease-out); }
html.tlr-ready [aria-expanded="true"] [data-tlr-motion="more-chevron"] { transform: rotate(180deg); }

/* 5d. Page transition between / and /teams (Chrome, Edge, Safari 18.2+;
   other browsers navigate normally). Load this file on both pages. */
@view-transition { navigation: auto; }
[data-tlr-motion="header"] { view-transition-name: tlr-header; }
::view-transition-group(*) { animation-duration: .45s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
::view-transition-old(root) { animation: .3s ease both tlr-vt-out; }
::view-transition-new(root) { animation: .45s cubic-bezier(.2, .8, .2, 1) both tlr-vt-in; }
@keyframes tlr-vt-out { to { opacity: 0; transform: translateY(-12px); } }
@keyframes tlr-vt-in { from { opacity: 0; transform: translateY(24px); } }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
