/* ============================================================================
   ApexEvolv — MOTION styles. Pairs with assets/js/motion.js.

   What is here is what the site actually uses. The clip-wipe, parallax,
   marquee and 3D tilt were carried for a while and referenced by nothing;
   the tilt in particular fought the system — a panel tipping toward the
   cursor is a floating card, and there are no floating cards any more.

   The rule for anything added back: motion earns its place by making a
   change legible, not by making the page feel busy. Everything here is
   opt-in by data attribute and everything stops under reduced motion.
   ============================================================================ */

/* ---------- reveal (rebuilt 25 Nov 2026) ----------
   VISIBLE BY DEFAULT. Nothing in this block hides anything unless <html>
   carries .js-reveal, which the one-line script at the top of every page's
   <head> adds only once JavaScript is running, and takes away again if
   motion.js has not started within a couple of seconds of the page loading.
   With scripting off, for a printer, a link preview or a crawler reading the
   HTML, every word is simply there. The hidden starting state also lives
   only under prefers-reduced-motion:no-preference, so with reduced motion
   on nothing is ever hidden and nothing has to arrive.

   Even then, only what is on screen when the page opens starts hidden (and
   arrives at once). Everything further down is PARKED, visible, with
   .rv-park, and only takes its starting state when the reader starts to
   scroll, while it is still off screen. So a full-page screenshot, a
   crawler that renders the page, or anyone who never scrolls sees the whole
   page.

   motion.js adds .in to start an item (its place in a staggered group
   comes in --rv-d) and .rv-done once it has arrived, or both at once for an
   item that must not animate: already above the window, landed on by a
   jump, or met while scrolling fast. .rv-done takes the reveal's
   transition off again, so such an item is simply there, and an item that
   has arrived gets its own transitions back (a link's hover, say).

   While the reader scrolls fast, <html> carries .rv-rush and nothing waits
   hidden at all: a flick can carry content into view faster than the
   browser reports it, so the whole page is shown for as long as the rush
   lasts. When it ends, what is on screen is put in place first, and only
   content still off screen goes back to waiting.

   Opacity and transform only: nothing here touches layout, so a reveal can
   never shift the page. The item rises 20px. Opacity resolves before the
   transform does (.6s against .8s), so it is readable while it settles the
   last few pixels; equal durations make the arrival feel abrupt. One soft
   ease-out curve for all of it.

   Only content carries data-rv. Section grounds, cards and panels are never
   hidden; inside a card it is the card's text that arrives.
   data-rv="img" is the one variant: the box stays, its picture fades (Our
   Mission's ridges band, whose melt into the dark chapter below it has to
   be painted from the start). */
:root{--rv-y:20px;--rv-fade:.6s;--rv-move:.8s;--rv-ease:cubic-bezier(.22,1,.36,1)}
@media(prefers-reduced-motion:no-preference){
  html.js-reveal:not(.rv-rush) [data-rv]:not([data-rv="img"]):not(.in):not(.rv-park){opacity:0;transform:translate3d(0,var(--rv-y),0)}
  html.js-reveal [data-rv]:not([data-rv="img"]):not(.rv-done):not(.rv-park){
    transition:opacity var(--rv-fade) var(--rv-ease) var(--rv-d,0ms),
               transform var(--rv-move) var(--rv-ease) var(--rv-d,0ms)}
  html.js-reveal:not(.rv-rush) [data-rv="img"]:not(.in):not(.rv-park) img{opacity:0}
  html.js-reveal [data-rv="img"]:not(.rv-done):not(.rv-park) img{transition:opacity var(--rv-fade) var(--rv-ease) var(--rv-d,0ms)}
  html.js-reveal:not(.rv-rush) .mline:not(.in):not(.rv-park) > span{transform:translate3d(0,105%,0)}
  html.js-reveal .mline:not(.rv-done):not(.rv-park) > span{transition:transform var(--rv-move) var(--rv-ease) var(--rv-d,0ms)}
}

/* ---------- masked lines ----------
   Each line gets its own overflow:hidden box so it can slide up from
   beneath it (the rise itself is in the reveal block above, so it too
   happens only under .js-reveal). Headings are set at line-height 1.08,
   which is tighter than the font's own glyph area — so the mask was
   shearing the descender off any line with a g, y or p in it.
   "engagements." was the obvious one.

   The fix is leading, not padding. Padding makes the mask taller without
   moving the hidden line, and at translateY(105%) the waiting line would
   then peek into the padded strip. Extra line-height moves both together:
   the mask grows, and 105% of a taller line still clears it.

   The two negative margins put the layout back exactly where it was — the
   first pulls the heading up by the leading added above the first line, the
   second closes the gap the leading opened between lines. What is left over
   is a sliver below the last line, which is precisely where a descender
   needs it. */
.mline{display:block;overflow:hidden;line-height:1.34}
.mline:first-child{margin-top:-.13em}
.mline + .mline{margin-top:-.26em}
.mline > span{display:block}

/* ---------- magnetic ----------
   Needs a transition of its own to settle back after the pointer leaves. */
[data-magnet]{transition:transform .35s var(--e),background .3s,color .3s}

/* ---------- counters ----------
   Their own column width, so a count from 0 to 120 never reflows the row. */
[data-count]{font-variant-numeric:tabular-nums}

/* ---------- scroll progress ----------
   One hairline. At 2px it was a loading bar across the top of the page; at
   1px it is the same information stated at the weight everything else on
   the site uses for a rule. */
.prog{position:fixed;inset:0 0 auto;height:1px;z-index:95;background:var(--gold);
  transform-origin:0 50%;transform:scaleX(0);will-change:transform}

/* ---------- section index ----------
   The rail down the right edge: one hairline per section, the current one
   filled champagne, and clicking one jumps to its section. It lived in
   index.html while it was a homepage device; it is here because every page
   has it now, and only index.html still writes its own markup. Everywhere
   else motion.js builds the marks from the page's own sections.

   Thin marks, and the active one differs by LENGTH rather than by weight.
   It used to grow from 1px tall to 2px, which is the mark getting heavier;
   a rule that gets longer reads as a position on a scale, which is what
   this actually is. Every mark stays a hairline.

   mix-blend-mode:difference is gone. It was how the marks stayed legible
   over both grounds — by inverting against whatever passed beneath — but it
   also mangles any colour you give them, so the active mark could never be
   champagne. The index reads the ground the same way the header does,
   probing at the MIDDLE of the window rather than at the bar, because that
   is where these marks actually sit.

   Champagne is ground-dependent, as everywhere: --gold on dark, --goldDeep
   on ivory, because the fill measures 1.8:1 on ivory and would vanish. */
.dots{position:fixed;right:clamp(16px,2.2vw,30px);top:50%;
  transform:translateY(-50%);z-index:80;
  display:flex;flex-direction:column;align-items:flex-end;gap:12px;
  color:#fff;transition:color .4s var(--e),opacity .45s var(--e)}
.dots--light{color:var(--onIvory)}
/* the hit area is larger than the mark — a 1px line is not a target */
.dots button{position:relative;display:block;padding:5px 0 5px 14px}
/* The active mark grows by SCALING, not by animating width. Width is a
   layout property; scaleX is composited, and the marks are right-aligned so
   scaling from the right edge produces exactly the same movement. */
.dots i{display:block;width:28px;height:1px;background:currentColor;opacity:.5;
  transform:scaleX(.43);transform-origin:100% 50%;
  transition:transform .5s var(--e),opacity .4s var(--e),background-color .4s var(--e)}
.dots button:hover i,.dots button:focus-visible i{opacity:.85}
.dots button.on i{transform:none;opacity:1}
/* Since 26 Nov 2026 each mark takes the colour of the ground behind it
   (.lt over a light one, set by motion.js per mark), not the whole rail from
   one reading at the middle of the window: an edge between a black and a
   white section can run through the rail. Ivory and champagne on dark ground,
   ink and deep champagne on light. */
.dots button{color:#F4F3EF;transition:color .4s var(--e)}
.dots button.lt{color:#121214}
.dots button.on i{background-color:#D6BE93}
.dots button.on.lt i{background-color:#7C5E24}
/* Where a picture runs to the edge under the rail (Our Mission's ridges, the
   service pages' dark chapters, Expertise's functions), the section's colour
   says nothing about what is behind a mark. Over a picture (.pic, set by
   motion.js) a mark takes its full colour and sits on a small frosted
   capsule of the ground it reads against, dark under ivory marks, white
   under ink ones, so it keeps its contrast whatever the picture does at
   that point. motion.js picks .lt from the picture's own brightness there,
   so the capsule mostly matches what is behind it and barely shows.
   Elsewhere the resting mark is mixed solid from its colour and its
   section's ground (--halo, set by motion.js), the same colour the old 50%
   opacity gave. */
.dots i{position:relative}
.dots button::before{content:"";position:absolute;top:50%;right:-5px;width:22px;height:9px;margin-top:-4.5px;
  border-radius:9px;background:rgba(18,17,15,.62);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);
  opacity:0;pointer-events:none;transition:opacity .3s var(--e),width .5s var(--e)}
.dots button.lt::before{background:rgba(255,255,255,.72)}
.dots button.on::before{width:38px}
.dots button.pic::before{opacity:1}
.dots button.pic:not(.on) i{opacity:1}
@supports (background-color:color-mix(in srgb,red 50%,blue)){
  .dots i{opacity:1;background-color:color-mix(in srgb,currentColor 50%,var(--halo,transparent))}
  .dots button:not(.on):hover i,.dots button:not(.on):focus-visible i{opacity:1;
    background-color:color-mix(in srgb,currentColor 85%,var(--halo,transparent))}
  .dots button.pic:not(.on) i{background-color:currentColor}}

/* The client's brief of 26 Nov 2026.
   NAMES. Each mark carries its section's name (.dots__t, written by
   motion.js, hidden from assistive technology because the button's
   aria-label already says it). It shows to the left of the mark on hover
   and keyboard focus, and briefly for the section the reader has just
   settled in (.say). The style is the site's small label: micro size, 700,
   tracked .14em, upper case, champagne. It sits on a small pill of the
   ground it is over, so it reads where it crosses text or a picture.
   WHERE. Hidden over the hero and once the contact close comes into view
   (.dots--off, set by motion.js), by fading out. It stays reachable by
   keyboard and shows again while it holds keyboard focus (focus-visible
   only, so a mark clicked with the mouse, which keeps focus, does not keep
   the rail up over the close and the footer). Only from 1280px wide,
   where the margin beside the content is clear. Below that it is not
   shown at all.
   CONTRAST. The resting marks are at 50% of the ground's ink rather than
   28%, which takes them past 3:1 on white, ivory and black alike. */
.dots--off{opacity:0;pointer-events:none}
.dots--off:has(:focus-visible){opacity:1;pointer-events:auto}
.dots__t{position:absolute;top:50%;right:40px;transform:translate(6px,-50%);
  padding:7px 11px 6px;border-radius:980px;white-space:nowrap;pointer-events:none;
  font-size:var(--t-micro);font-weight:700;letter-spacing:.14em;line-height:1.2;text-transform:uppercase;
  color:#7C5E24;background:rgba(255,255,255,.92);box-shadow:0 0 0 1px rgba(18,18,20,.08);
  -webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);
  opacity:0;transition:opacity .3s var(--e),transform .3s var(--e)}
.dots button:not(.lt) .dots__t{color:#D6BE93;background:rgba(18,17,15,.88);box-shadow:0 0 0 1px rgba(244,243,239,.14)}
.dots button:hover .dots__t,.dots button:focus-visible .dots__t,.dots button.say .dots__t{opacity:1;transform:translate(0,-50%)}
@media(max-width:1279px){.dots{display:none}}
@media(prefers-reduced-motion:reduce){
  .dots i{transition:none}
  .dots__t{transform:translate(0,-50%);transition:opacity .2s linear}}

/* ---------- scroll cue ---------- */
.cue{display:flex;flex-direction:column;align-items:center;gap:10px;
  font-size:var(--t-micro);letter-spacing:.14em;text-transform:uppercase;
  color:var(--mu2)}
.cue i{width:1px;height:38px;background:linear-gradient(var(--gold),transparent);
  display:block;animation:cuedrop 2.4s ease-in-out infinite}
@keyframes cuedrop{
  0%{opacity:0;transform:scaleY(0);transform-origin:top}
  40%{opacity:1;transform:scaleY(1);transform-origin:top}
  100%{opacity:0;transform:scaleY(1);transform-origin:bottom}}

@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.001ms!important;
    transition-duration:.001ms!important;scroll-behavior:auto!important}
  .cue i{animation:none}
}

/* ---------- print ----------
   Whatever has or has not been revealed on screen, the page prints whole. */
@media print{
  html.js-reveal [data-rv],html.js-reveal .mline > span{opacity:1!important;transform:none!important;transition:none!important}
  html.js-reveal [data-rv="img"] img{opacity:1!important;transition:none!important}
}
