/* =========================================================
   EQDC — animation layer
   Adds motion only. It never sets colours, fonts, sizes or
   layout, so the existing theme is untouched.
   Hidden states apply only when JS has added .eq-js to <html>,
   so content is always visible without JavaScript.
   ========================================================= */

:root{
  --eq-ease: cubic-bezier(.22,.7,.2,1);
}

/* ---------- keyframes (only a "from" state: the element's own CSS is the end state) ---------- */
@keyframes eq-up    { from{opacity:0; transform:translateY(26px);} }
@keyframes eq-pop   { from{opacity:0; transform:scale(.94);} }
@keyframes eq-fade  { from{opacity:0;} }
@keyframes eq-drop  { from{opacity:0; transform:translateY(-8px);} }
@keyframes eq-slide { from{opacity:0; transform:translateX(60px);} }
@keyframes eq-dots  { to{background-position:20px 20px;} }
@keyframes eq-dots-br { from{background-position:100% 100%;} to{background-position:calc(100% + 20px) calc(100% + 20px);} }

/* ---------- scroll reveal: hidden state ---------- */
.eq-js :is(
  .section-head, .leadership-intro, .leader, .welcome, .org-copy, .org-card, .org-stat,
  .whatwedo-card, .charter-row, .centre, .accred-item, .recognitions .accred-col,
  .main-content > *, .vm-sidebar, .page-sidebar, .page-main > *,
  .test-item, .policy-card, .info-card, .location-card, .lab-card, .calib-item, .division,
  .officer, .vm-card, .sublab-block, .link-card, .badge-item, .faq, .tender-table-wrap,
  .contact-layout > *, .gallery-grid > *, .charter-thumb, footer .wrap > *
):not(.reveal):not(.eq-in){
  opacity:0;
}

/* ---------- scroll reveal: play ---------- */
.eq-js :is(
  .section-head, .leadership-intro, .leader, .welcome, .org-copy, .org-card, .org-stat,
  .whatwedo-card, .charter-row, .centre, .accred-item, .recognitions .accred-col,
  .main-content > *, .vm-sidebar, .page-sidebar, .page-main > *,
  .test-item, .policy-card, .info-card, .location-card, .lab-card, .calib-item, .division,
  .officer, .vm-card, .sublab-block, .link-card, .badge-item, .faq, .tender-table-wrap,
  .contact-layout > *, .gallery-grid > *, .charter-thumb, footer .wrap > *
).eq-in:not(.reveal){
  animation: eq-up .8s var(--eq-ease) backwards;
  animation-delay: var(--eq-d, 0ms);
}
/* images & gallery tiles scale in instead of sliding */
.eq-js .gallery-grid > .eq-in,
.eq-js .charter-thumb.eq-in{
  animation-name: eq-pop;
}

/* ---------- hero (home) — plays on load ---------- */
.hero .eyebrow     { animation: eq-up .8s var(--eq-ease) .05s backwards; }
.hero h1           { animation: eq-up .9s var(--eq-ease) .18s backwards; }
.hero .lede        { animation: eq-up .9s var(--eq-ease) .32s backwards; }
.hero .hero-actions{ animation: eq-up .9s var(--eq-ease) .46s backwards; }
.hero .mission-card{ animation: eq-up 1s  var(--eq-ease) .40s backwards; }
.hero .hero-dots   { animation: eq-fade 1.4s ease .5s backwards, eq-dots-br 4s linear 1.9s infinite; }

/* ---------- inner-page banner — plays on load ---------- */
.page-banner h1       { animation: eq-up .8s var(--eq-ease) .08s backwards; }
.page-banner .breadcrumb{ animation: eq-up .8s var(--eq-ease) .22s backwards; }
.page-banner::after   { animation: eq-slide 1s var(--eq-ease) backwards; }
.page-banner-dots     { animation: eq-fade 1.2s ease .4s backwards, eq-dots 4s linear 1.6s infinite; }

/* ---------- header: soft fade on load ---------- */
.masthead, header .header-inner, header .nav-bar{ animation: eq-fade .6s ease backwards; }

/* ---------- dropdown menus ---------- */
@media (min-width:901px){
  .dropdown-menu{ animation: eq-drop .22s ease; }
}
@media (max-width:900px){
  .dropdown.open .dropdown-menu{ animation: eq-fade .25s ease; }
}

/* ---------- hover motion (only on elements that had none; shadow is neutral black) ---------- */
@media (hover:hover){
  .whatwedo-card, .leader, .centre, .location-card, .lab-card, .org-card, .org-stat, .info-card, .vm-card{
    transition: transform .35s var(--eq-ease), box-shadow .35s var(--eq-ease);
  }
  .whatwedo-card:hover, .leader:hover, .centre:hover, .location-card:hover,
  .lab-card:hover, .org-card:hover, .info-card:hover, .vm-card:hover{
    transform: translateY(-6px);
    box-shadow: 0 16px 30px -14px rgba(0,0,0,.22);
  }
  .org-stat:hover{ transform: translateY(-3px); }

  .whatwedo-icon{ transition: transform .4s var(--eq-ease); }
  .whatwedo-card:hover .whatwedo-icon{ transform: scale(1.1) rotate(-4deg); }

  .charter-thumb{ transition: transform .5s var(--eq-ease); }
  .charter-row:hover .charter-thumb{ transform: scale(1.04); }

  .centre img, .lab-photo img, .leader img{ transition: transform .6s var(--eq-ease); }
  .centre:hover img, .lab-photo:hover img, .leader:hover img{ transform: scale(1.04); }
}

/* ---------- soft cross-fade between pages (supported browsers only) ---------- */
@view-transition{ navigation:auto; }
::view-transition-old(root), ::view-transition-new(root){ animation-duration:.25s; }

/* ---------- print & reduced motion: no motion, everything visible ---------- */
@media print{
  .eq-js *{ opacity:1 !important; animation:none !important; }
}
@media (prefers-reduced-motion: reduce){
  .eq-js *, .eq-js *::before, .eq-js *::after{
    animation:none !important;
  }
  .eq-js :is(
    .section-head, .leadership-intro, .leader, .welcome, .org-copy, .org-card, .org-stat,
    .whatwedo-card, .charter-row, .centre, .accred-item, .recognitions .accred-col,
    .main-content > *, .vm-sidebar, .page-sidebar, .page-main > *,
    .test-item, .policy-card, .info-card, .location-card, .lab-card, .calib-item, .division,
    .officer, .vm-card, .sublab-block, .link-card, .badge-item, .faq, .tender-table-wrap,
    .contact-layout > *, .gallery-grid > *, .charter-thumb, footer .wrap > *
  ){ opacity:1 !important; }
  .whatwedo-card:hover, .leader:hover, .centre:hover, .location-card:hover, .lab-card:hover,
  .org-card:hover, .info-card:hover, .vm-card:hover, .org-stat:hover,
  .charter-row:hover .charter-thumb, .whatwedo-card:hover .whatwedo-icon{ transform:none !important; }
  @view-transition{ navigation:none; }
}


/* =========================================================
   PART 2 — complete hover system (every page)
   Motion + neutral shadow only; existing hover colours stay.
   Where an element already had a transition, it is repeated
   here with the new property added so nothing is lost.
   ========================================================= */
@media (hover:hover) and (prefers-reduced-motion:no-preference){

  /* --- buttons: lift + soft shadow (existing colour change kept) --- */
  .cta-btn{ transition: background .15s ease, transform .25s var(--eq-ease), box-shadow .25s var(--eq-ease); }
  .hero .btn-outline{ transition: all .15s ease, transform .25s var(--eq-ease), box-shadow .25s var(--eq-ease); }
  .download-btn, .external-btn, .staff-link{
    transition: background .15s ease, color .15s ease, transform .25s var(--eq-ease), box-shadow .25s var(--eq-ease);
  }
  .cta-btn:hover, .btn-outline:hover, .download-btn:hover, .external-btn:hover, .staff-link:hover{
    transform: translateY(-2px);
    box-shadow: 0 10px 18px -10px rgba(0,0,0,.35);
  }
  .cta-btn:active, .btn-outline:active, .download-btn:active, .external-btn:active, .staff-link:active{
    transform: translateY(0); box-shadow:none;
  }

  /* --- logo --- */
  .brand img{ transition: transform .45s var(--eq-ease); }
  .brand:hover img{ transform: scale(1.04); }

  /* --- navigation links: slide a little (colours handled by the page) --- */
  .dropdown-menu a{ transition: background-color .2s, color .2s, transform .25s var(--eq-ease); }
  .dropdown-menu a:hover{ transform: translateX(5px); }
  .vm-sidebar a, .page-sidebar a{ transition: color .15s ease, transform .25s var(--eq-ease); }
  .vm-sidebar a:hover, .page-sidebar a:hover{ transform: translateX(6px); }
  footer a{ transition: color .15s ease, transform .25s var(--eq-ease); }
  footer a:hover{ transform: translateX(5px); }

  /* --- inline links: underline draws in from the left --- */
  .breadcrumb a, .main-content p a, .main-content li a, .page-main p a, .page-main li a,
  .location-detail a, .info-row a, .place-body a, .reach a, .where a{
    background-image: linear-gradient(currentColor, currentColor);
    background-repeat: no-repeat;
    background-position: 0 100%;
    background-size: 0 1px;
    transition: background-size .35s var(--eq-ease), color .15s ease;
  }
  .breadcrumb a:hover, .main-content p a:hover, .main-content li a:hover, .page-main p a:hover,
  .page-main li a:hover, .location-detail a:hover, .info-row a:hover, .place-body a:hover{
    background-size: 100% 1px;
  }

  /* --- cards that already had a hover: add a shadow, keep their own transition --- */
  .badge-item, .calib-item, .consult-item, .test-item{
    transition: border-color .2s ease, transform .25s var(--eq-ease), box-shadow .3s var(--eq-ease);
  }
  .badge-item:hover, .calib-item:hover, .consult-item:hover, .test-item:hover{
    box-shadow: 0 14px 26px -16px rgba(0,0,0,.28);
  }

  /* --- cards with no hover before --- */
  .policy-card, .director-card, .main-card, .content-card, .lab-profile, .mission-card, .tender-table-wrap{
    transition: box-shadow .4s var(--eq-ease);
  }
  .policy-card:hover, .director-card:hover, .main-card:hover, .content-card:hover,
  .lab-profile:hover, .mission-card:hover, .tender-table-wrap:hover{
    box-shadow: 0 18px 34px -20px rgba(0,0,0,.25);
  }

  .officer, .division, .sublab-block, .step, .pillar, .way, .verb, .place, .floor-cell,
  .tag, .vm-tag, .node, .faq, .location-card, .lab-card, .info-card{
    transition: transform .3s var(--eq-ease), box-shadow .3s var(--eq-ease);
  }
  .officer:hover, .division:hover, .sublab-block:hover, .step:hover, .pillar:hover, .way:hover,
  .verb:hover, .place:hover, .floor-cell:hover, .faq:hover{
    transform: translateY(-4px);
    box-shadow: 0 14px 26px -18px rgba(0,0,0,.28);
  }
  .tag:hover, .vm-tag:hover, .node:hover{ transform: translateY(-2px); }

  /* --- rows & list items --- */
  .charter-row{ transition: transform .35s var(--eq-ease); }
  .charter-row:hover{ transform: translateX(6px); }

  .accred-item{ transition: transform .3s var(--eq-ease); }
  .accred-item:hover{ transform: translateX(5px); }
  .accred-check{ transition: transform .3s var(--eq-ease); }
  .accred-item:hover .accred-check{ transform: scale(1.18); }

  .custom-list li, .policy-list li, .facility-list li, .range-list li, .training-list li, .main-content ul li{
    transition: transform .25s var(--eq-ease);
  }
  .custom-list li:hover, .policy-list li:hover, .facility-list li:hover,
  .range-list li:hover, .training-list li:hover, .main-content ul li:hover{
    transform: translateX(4px);
  }

  .info-row .info-icon, .info-icon{ transition: transform .3s var(--eq-ease); }
  .info-row:hover .info-icon{ transform: scale(1.15); }

  .faq summary{ transition: transform .25s var(--eq-ease); }
  .faq summary:hover{ transform: translateX(4px); }

  /* --- tables: accent bar slides in on the hovered row --- */
  table td{ transition: background-color .2s ease, box-shadow .25s ease; }
  table tbody tr:hover td:first-child, table tr:hover > td:first-child{
    box-shadow: inset 3px 0 0 var(--orange, #ed6c00);
  }

  /* --- partner logos --- */
  .logo-track a{ transition: transform .3s var(--eq-ease); }
  .logo-track a:hover{ transform: translateY(-4px) scale(1.06); }

  /* --- form fields: gentle halo on hover (focus style untouched) --- */
  .form-field input:hover:not(:focus), .form-field textarea:hover:not(:focus){
    box-shadow: 0 0 0 3px rgba(237,108,0,.12);
  }
}

/* =========================================================
   PART 3 — animated background
   Two huge, very soft glows drift slowly behind the page, and
   the hero / inner-page banners get a moving glow. Colours are
   the site's own orange and teal at low opacity.
   ========================================================= */
@keyframes eq-drift-a { to{ transform: translate3d(14vmax, 10vmax, 0) scale(1.18); } }
@keyframes eq-drift-b { to{ transform: translate3d(-16vmax, -9vmax, 0) scale(1.12); } }
@keyframes eq-drift-c { to{ transform: translate3d(32%, 18%, 0) scale(1.25); } }

html::before, html::after{
  content:""; position:fixed; z-index:-1; pointer-events:none;
  border-radius:50%; will-change:transform;
}
html::before{
  width:70vmax; height:70vmax; top:-30vmax; left:-24vmax;
  background:radial-gradient(circle, rgba(237,108,0,.11) 0%, rgba(237,108,0,0) 65%);
  animation: eq-drift-a 28s ease-in-out infinite alternate;
}
html::after{
  width:64vmax; height:64vmax; bottom:-32vmax; right:-22vmax;
  background:radial-gradient(circle, rgba(18,64,63,.09) 0%, rgba(18,64,63,0) 65%);
  animation: eq-drift-b 34s ease-in-out infinite alternate;
}

/* moving glow inside hero and banners (sits behind their text) */
.hero, .page-banner{ isolation:isolate; }
.hero::before, .page-banner::before{
  content:""; position:absolute; z-index:-1; pointer-events:none;
  width:55%; aspect-ratio:1; border-radius:50%; left:-12%; top:-35%;
  background:radial-gradient(circle, rgba(237,108,0,.16) 0%, rgba(237,108,0,0) 65%);
 
  will-change:transform;
}

@media (max-width:700px){
  html::before, html::after{ width:110vmax; height:110vmax; }
}
@media print{
  html::before, html::after, .hero::before, .page-banner::before{ display:none !important; }
}
@media (prefers-reduced-motion: reduce){
  html::before, html::after, .hero::before, .page-banner::before{ animation:none !important; }
}
