/* =====================================================================
   Collabera motion system for Cognixia (loaded after collabera-type.css)
   One set of timing tokens and one motion language for every page.
   Nothing here changes how anything looks at rest; it only adds motion
   on hover, press, selection, opening and scroll.

   Tokens
     --cb-dur-press   100ms  press feedback
     --cb-dur-fast    150ms  hover-out, colour returns
     --cb-dur-base    200ms  hover-in, selection, underline
     --cb-dur-slow    300ms  card lift, panels opening
     --cb-dur-reveal  600ms  scroll and hero reveals (marketing exception)
     --cb-dur-media   700ms  slow photo zoom inside cards (marketing exception)
     --cb-ease-out    cubic-bezier(.22,1,.36,1)  entering, hover-in
     --cb-ease-in-out cubic-bezier(.65,0,.35,1)  leaving, returning
   Distances: lift 4px, rise 16px, photo zoom 1.03, arrow nudge 4px.
     --cb-dur-count   1500ms number roll (+110ms per digit, marketing exception)
   Stagger: 60ms per item, at most 5 steps (300ms).

   Rules
   - Only transform, translate, opacity and colours animate. No layout properties.
   - Hover motion only on devices with a real hover pointer.
   - Keyboard focus is never animated; focus rings appear instantly.
   - prefers-reduced-motion: every movement is removed; colour changes stay.
   - Selectors sit in the "collabera-motion" cascade layer, declared right
     after "collabera-type" at the top of every page, so they win over the
     theme's own !important transitions.
   ===================================================================== */

:root{
  --cb-dur-press:100ms;
  --cb-dur-fast:150ms;
  --cb-dur-base:200ms;
  --cb-dur-slow:300ms;
  --cb-dur-reveal:600ms;
  --cb-dur-media:700ms;
  --cb-ease-out:cubic-bezier(.22,1,.36,1);
  --cb-ease-in-out:cubic-bezier(.65,0,.35,1);
  --cb-lift:-4px;
  --cb-rise:16px;
  --cb-zoom:1.03;
  --cb-nudge:4px;
  --cb-stagger:60ms;
  --cb-select:rgba(195,158,97,.32); /* Secondary light gold #C39E61 at 32% */
}

@layer collabera-motion{

/* ---------- Text selection (brand gold tint) ---------- */
html body ::selection{background:var(--cb-select) !important;color:inherit !important}

/* ---------- 1. Colour feedback on every link and control ---------- */
/* Leaving a hover is faster than entering it. */
html body :is(main,footer,.site-footer) :is(a,button,summary,label):not(#cb){
  transition-property:color,background-color,border-color,text-decoration-color,opacity,transform,translate !important;
  transition-duration:var(--cb-dur-fast) !important;
  transition-timing-function:var(--cb-ease-in-out) !important;
}
@media (hover:hover) and (pointer:fine){
  html body :is(main,footer,.site-footer) :is(a,button,summary,label):hover:not(#cb){
    transition-duration:var(--cb-dur-base) !important;
    transition-timing-function:var(--cb-ease-out) !important;
  }
}

/* ---------- 2. Buttons: soft press ---------- */
html body :is(.button,.header-cta,button.filter,.archive-pagination a):active:not(#cb){
  transform:scale(.97) !important;
  transition-duration:var(--cb-dur-press) !important;
}

/* ---------- 3. Text links: the underline redraws from the left ---------- */
html body :is(main,footer) :is(a.text-link,a.card-link,a.yield-cta):not(#cb){position:relative}
html body :is(main,footer) :is(a.text-link,a.card-link,a.yield-cta):not(#cb)::after{
  content:"";position:absolute;left:0;right:0;bottom:-1px;height:1px;
  background:currentColor;transform:scaleX(0);transform-origin:right center;
  transition:transform var(--cb-dur-fast) var(--cb-ease-in-out);pointer-events:none;
}
@media (hover:hover) and (pointer:fine){
  html body :is(main,footer) :is(a.text-link,a.card-link,a.yield-cta):hover:not(#cb),
  html body .cb-card:hover :is(a.text-link,a.card-link):not(#cb){border-bottom-color:transparent !important}
  html body :is(main,footer) :is(a.text-link,a.card-link,a.yield-cta):hover:not(#cb)::after,
  html body .cb-card:hover :is(a.text-link,a.card-link):not(#cb)::after{
    transform:scaleX(1);transform-origin:left center;
    transition:transform var(--cb-dur-slow) var(--cb-ease-out);
  }
}

/* Pill and outline buttons keep their own hover; no underline is drawn on them */
html body :is(.button,.h-ghost,[class*="ghost"],[class*="btn"]):not(#cb)::after{content:none}

/* Outline buttons get a soft fill of their own text colour on hover */
@media (hover:hover) and (pointer:fine){
  html body :is(a.h-ghost,.button.ghost,.button.secondary):hover:not(#cb){
    background-color:color-mix(in srgb,currentColor 10%,transparent) !important;
  }
}

/* Arrows inside links and buttons nudge forward (wrapped by collabera-motion.js) */
html body .cb-arrow{display:inline-block;transition:translate var(--cb-dur-fast) var(--cb-ease-in-out)}
@media (hover:hover) and (pointer:fine){
  html body :is(a,button):hover .cb-arrow,html body .cb-card:hover .cb-arrow{translate:var(--cb-nudge) 0;transition:translate var(--cb-dur-base) var(--cb-ease-out)}
}

/* ---------- 4. Cards: lift, quiet shadow, slow photo zoom ---------- */
/* .cb-card is added by collabera-motion.js to any card that opens one page. */
html body .cb-card:not(#cb){
  transition:transform var(--cb-dur-base) var(--cb-ease-in-out),box-shadow var(--cb-dur-base) var(--cb-ease-in-out),border-color var(--cb-dur-base) var(--cb-ease-in-out),background-color var(--cb-dur-base) var(--cb-ease-in-out) !important;
  cursor:pointer;
}
html body .cb-card :is(img,picture img):not(#cb){
  transition:transform var(--cb-dur-slow) var(--cb-ease-in-out) !important;
}
@media (hover:hover) and (pointer:fine){
  html body .cb-card:hover:not(#cb){
    transform:translateY(var(--cb-lift)) !important;
    box-shadow:0 18px 36px -24px rgba(5,38,43,.35) !important;
    transition-duration:var(--cb-dur-slow) !important;
    transition-timing-function:var(--cb-ease-out) !important;
  }
  html body .cb-card:hover :is(img,picture img):not(#cb){
    transform:scale(var(--cb-zoom)) !important;
    transition:transform var(--cb-dur-media) var(--cb-ease-out) !important;
  }
}
/* Borderless cards (photo + text on the page background) don't lift; their photo
   zooms and their link underline redraws instead. */
@media (hover:hover) and (pointer:fine){
  html body .cb-card.cb-card--soft:hover:not(#cb){transform:none !important;box-shadow:none !important}
}
html body .cb-card:active:not(#cb){transform:translateY(0) scale(.995) !important;transition-duration:var(--cb-dur-press) !important}
/* photo frames clip the zoom so nothing grows past its edge */
html body .cb-card .cb-media:not(#cb){overflow:hidden}

/* Photos that sit on their own (not in a card) never move. */

/* ---------- 5. Selection: tabs, filters, chips, current section ---------- */
html body :is([aria-pressed],[aria-selected],[aria-current],.type-tabs a,.quick-nav a,.archive-subnav a,.contact-chips label):not(#cb){
  transition-property:color,background-color,border-color,box-shadow,transform !important;
  transition-duration:var(--cb-dur-base) !important;
  transition-timing-function:var(--cb-ease-out) !important;
}
html body .cb-selected-pop:not(#cb){animation:cb-select-pop var(--cb-dur-slow) var(--cb-ease-out)}
@keyframes cb-select-pop{0%{transform:scale(.96)}100%{transform:scale(1)}}

/* Current-section indicator in the in-page navigation grows from the left */
html body :is(.quick-nav,.about-page-nav) a:not(#cb){position:relative}
html body :is(.quick-nav,.about-page-nav) a:not(#cb)::after{
  content:"";position:absolute;left:0;right:0;bottom:-6px;height:2px;background:var(--cb-gold-dark,#C39E61);
  transform:scaleX(0);transform-origin:left center;transition:transform var(--cb-dur-slow) var(--cb-ease-out);pointer-events:none;
}
html body :is(.quick-nav,.about-page-nav) a[aria-current]:not(#cb)::after{transform:scaleX(1)}

/* ---------- 6. Disclosures: content settles in when opened ---------- */
html body details[open] > :not(summary):not(#cb){animation:cb-settle var(--cb-dur-slow) var(--cb-ease-out) both}
@keyframes cb-settle{from{opacity:0;translate:0 -4px}to{opacity:1;translate:0 0}}

/* ---------- 7. Hero: copy settles in once on load ---------- */
html.cb-motion main > section:first-of-type :has(> h1) > *:not(#cb){
  animation:cb-rise var(--cb-dur-reveal) var(--cb-ease-out) both;
}
html.cb-motion main > section:first-of-type :has(> h1) > :nth-child(2):not(#cb){animation-delay:60ms}
html.cb-motion main > section:first-of-type :has(> h1) > :nth-child(3):not(#cb){animation-delay:120ms}
html.cb-motion main > section:first-of-type :has(> h1) > :nth-child(4):not(#cb){animation-delay:180ms}
html.cb-motion main > section:first-of-type :has(> h1) > :nth-child(5):not(#cb){animation-delay:240ms}
html.cb-motion main > section:first-of-type :has(> h1) > :nth-child(n+6):not(#cb){animation-delay:300ms}
@keyframes cb-rise{from{opacity:0;translate:0 12px}to{opacity:1;translate:0 0}}

/* ---------- 8. Scroll reveal (collabera-motion.js tags the elements) ---------- */
html.cb-motion .cb-reveal:not(#cb){
  opacity:0;translate:0 var(--cb-rise);
  transition:opacity var(--cb-dur-reveal) var(--cb-ease-out),translate var(--cb-dur-reveal) var(--cb-ease-out) !important;
  transition-delay:calc(var(--cb-i,0) * var(--cb-stagger)) !important;
}
html.cb-motion .cb-reveal.cb-in:not(#cb){opacity:1;translate:0 0}

/* ---------- 9. Rolling numbers (built by collabera-motion.js) ---------- */
html body .cb-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
html body .cb-odo-wrap{white-space:nowrap}
html body .cb-odo{position:relative;display:inline-block;clip-path:inset(0 -0.5em);
  -webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 22%,#000 78%,transparent 100%);
          mask-image:linear-gradient(to bottom,transparent 0,#000 22%,#000 78%,transparent 100%)}
html body .cb-odo-sizer{visibility:hidden}
html body .cb-odo-strip{position:absolute;left:0;right:0;top:0;display:flex;flex-direction:column;align-items:center;will-change:transform}
html body .cb-odo-strip > span{display:block;height:var(--h);line-height:var(--h)}
html body .cb-odo-static{display:inline-block}

/* The gold accent of a revealed heading rolls up a beat after the heading */
html.cb-motion h2.cb-reveal .up:not(#cb){opacity:0;translate:0 .35em;transition:opacity 400ms var(--cb-ease-out) 200ms,translate 400ms var(--cb-ease-out) 200ms !important}
html.cb-motion h2.cb-reveal.cb-in .up:not(#cb){opacity:1;translate:0 0}

/* ---------- Reduced motion: no movement anywhere ---------- */
@media (prefers-reduced-motion:reduce){
  html body *:not(#cb),html body *:not(#cb)::after,html body *:not(#cb)::before{
    animation:none !important;
    transition-property:color,background-color,border-color,opacity !important;
  }
  html body .cb-card:hover:not(#cb),html body .cb-card:hover img:not(#cb),html body :is(.button,.header-cta,button.filter):active:not(#cb){transform:none !important}
  html body .cb-arrow{translate:none !important}
  html body :is(main,footer) :is(a.text-link,a.card-link,a.yield-cta)::after{display:none}
}

}
