/* ============================================================
   DDinfoways — fluid interface layer (apple-design skill)
   Press states, springs, glass, typography, reduced motion.
   Loaded after each page's inline styles so it can refine them.
   ============================================================ */

:root{
  /* Spring curves — damping ~1.0 (smooth settle) and ~0.8 (slight bounce).
     cubic-bezier fallbacks first; linear() springs where supported. */
  --ease-spring: cubic-bezier(.33, 1, .4, 1);
  --ease-spring-bounce: cubic-bezier(.34, 1.3, .45, 1);
  --press-scale: .97;
}
@supports (transition-timing-function: linear(0, 1)){
  :root{
    --ease-spring: linear(
      0, .1153 2.4%, .2978 6.2%, .5547 11.8%, .7141 16%, .8318 20.5%,
      .9124 25.2%, .9603 30%, .9851 35.3%, .9961 41.2%, .9997 49.5%, 1
    );
    --ease-spring-bounce: linear(
      0, .2342 4.2%, .5841 10%, .8444 15.5%, .9826 20.6%, 1.0469 25.6%,
      1.0648 30.4%, 1.0479 37.5%, 1.0205 45.2%, 1.0043 54.4%, .9986 65%, 1
    );
  }
}

html{-webkit-text-size-adjust:100%}

/* ------------------------------------------------------------
   1 · Respond on press — feedback starts on touch-down.
   `scale` is its own property so it composes with the existing
   hover transforms instead of fighting them.
   ------------------------------------------------------------ */
.btn, .icon-btn, .menu-toggle, .faq-q, .announce a,
.mobile-menu a, .nav-links a, .dd-stmt-btn, .dd-stmt-close,
button[type="submit"]{
  -webkit-tap-highlight-color: transparent;
  scale: 1;
  transition-property: scale;
  transition-duration: .4s;
  transition-timing-function: var(--ease-spring-bounce);
}
.btn:active, .icon-btn:active, .menu-toggle:active, .announce a:active,
.mobile-menu a:active, .nav-links a:active,
.dd-stmt-overlay .dd-stmt-btn:active, .dd-stmt-overlay .dd-stmt-close:active,
button[type="submit"]:active{
  scale: var(--press-scale);
  transition-duration: 100ms;
  transition-timing-function: ease-out;
}
/* Larger surfaces compress less */
.svc, .stat, .client-logo, .feature, .step{ -webkit-tap-highlight-color: transparent; }
a.svc{ scale:1; transition: scale .45s var(--ease-spring); }
a.svc:active{ scale:.985; transition-duration:120ms; transition-timing-function:ease-out; }
.faq-q{ transform-origin:left center; }
.faq-q:active{ scale:.99; transition-duration:100ms; transition-timing-function:ease-out; }

/* ------------------------------------------------------------
   2 · Springs, not curves — retime the existing hover motion.
   ------------------------------------------------------------ */
.btn{
  transition:
    transform .45s var(--ease-spring),
    scale .4s var(--ease-spring-bounce),
    background .18s ease,
    color .18s ease,
    border-color .18s ease,
    box-shadow .45s var(--ease-spring);
}
.btn-arrow{ transition: transform .5s var(--ease-spring-bounce); }
.icon-btn{
  transition:
    transform .45s var(--ease-spring),
    scale .4s var(--ease-spring-bounce),
    background .18s ease,
    color .18s ease;
}
.svc{
  transition:
    transform .55s var(--ease-spring),
    box-shadow .55s var(--ease-spring),
    border-color .3s ease;
}
.faq-q .ic svg{ transition: transform .45s var(--ease-spring-bounce); }
.faq-a{ transition-timing-function: var(--ease-spring); }

/* Scroll reveals settle like a spring, slightly quicker and closer.
   apple-polish.js adds a per-sibling stagger via inline transition-delay. */
.reveal{
  transform: translateY(18px) scale(.995);
  transition: opacity .55s ease, transform .75s var(--ease-spring);
}
.reveal.in{ transform: translateY(0); }

/* ------------------------------------------------------------
   3 · Materials & depth — one translucent glass layer for the
   nav, with a scroll-edge shadow instead of a hard divider.
   ------------------------------------------------------------ */
.nav{
  background: rgba(245,241,234,.68);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  transition: border-color .2s ease, background .2s ease, box-shadow .35s ease;
}
.nav.scrolled{
  background: rgba(245,241,234,.78);
  border-bottom-color: transparent;
  box-shadow:
    0 1px 0 rgba(10,10,10,.05),
    0 16px 40px -28px rgba(10,10,10,.28);
}

/* Statement popup: materialize (blur + scale together), not a plain fade */
.dd-stmt-overlay{
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: opacity .35s ease, backdrop-filter .35s ease;
}
.dd-stmt-overlay .dd-stmt-card{
  transform: translateY(18px) scale(.96);
  filter: blur(6px);
  transition: transform .5s var(--ease-spring), filter .35s ease;
}
.dd-stmt-overlay.dd-show .dd-stmt-card{
  transform: translateY(0) scale(1);
  filter: blur(0);
}

/* ------------------------------------------------------------
   4 · Typography — optical sizing on, balanced display lines.
   Large text keeps its negative tracking; body stays near 0.
   ------------------------------------------------------------ */
h1, h2, .h-display{ font-optical-sizing: auto; text-wrap: balance; }
.hero-trust .num, .stat .num{ letter-spacing: -.02em; }

/* ------------------------------------------------------------
   5 · Craft — visible keyboard focus, calmer marquees.
   ------------------------------------------------------------ */
:focus-visible{ outline: 2px solid currentColor; outline-offset: 3px; border-radius: 4px; }
.btn:focus-visible, .icon-btn:focus-visible, .menu-toggle:focus-visible{ border-radius: 999px; outline-offset: 2px; }
.client-marquee:hover .client-marquee-track,
.announce .marquee:hover span{ animation-play-state: paused; }

/* ------------------------------------------------------------
   6 · Reduced motion — gentler equivalents, never nothing.
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  .announce .marquee span,
  .client-marquee-track.to-left,
  .client-marquee-track.to-right{ animation: none !important; transform: none !important; }
  .reveal{ transform: none; transition: opacity .3s ease; }
  .btn, .icon-btn, .svc, .btn-arrow, .faq-q, a.svc{
    transition-duration: .15s;
    transition-timing-function: ease;
  }
  .btn:hover, .btn-dark:hover, .btn-lime:hover, .icon-btn:hover, .svc:hover{ transform: none; }
  .btn:active, .icon-btn:active, a.svc:active, .faq-q:active{ scale: 1; opacity: .75; }
  .dd-stmt-overlay{ -webkit-backdrop-filter: none; backdrop-filter: none; }
  .dd-stmt-overlay .dd-stmt-card{
    transform: none; filter: none;
    transition: opacity .25s ease;
  }
}

/* ------------------------------------------------------------
   7 · Reduced transparency / increased contrast — frost the glass.
   ------------------------------------------------------------ */
@media (prefers-reduced-transparency: reduce){
  .nav, .nav.scrolled{
    background: var(--paper, #f5f1ea);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
@media (prefers-contrast: more){
  .nav, .nav.scrolled{
    background: var(--paper, #f5f1ea);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom: 1px solid var(--ink, #0a0a0a);
    box-shadow: none;
  }
}

/* ------------------------------------------------------------
   8 · Scroll-driven reveals, site-wide — apple-polish.js tags
   cards and section heads that start below the fold (so nothing
   already on screen ever flashes), reveals them with a spring as
   they enter, and removes the tag once settled so each element
   returns to its page's own hover timing.
   ------------------------------------------------------------ */
.ap-reveal{
  opacity: 0;
  transform: translateY(18px) scale(.995);
  transition: opacity .55s ease, transform .8s var(--ease-spring);
  will-change: transform, opacity;
}
.ap-reveal.ap-in{ opacity: 1; transform: none; }

/* ------------------------------------------------------------
   9 · Scroll edge, not hard dividers — the sticky header's 1px
   border fades out and a soft shadow fades in only once content
   actually scrolls underneath it.
   ------------------------------------------------------------ */
body > header{
  transition: box-shadow .35s ease, border-color .35s ease, background .35s ease;
}
body > header.ap-scrolled{
  border-bottom-color: transparent;
  box-shadow:
    0 1px 0 rgba(10,10,10,.05),
    0 16px 40px -28px rgba(10,10,10,.28);
}

/* ------------------------------------------------------------
   10 · Depth on interactive cards — link cards lift toward the
   pointer with a spring and read "thicker" via a layered shadow.
   Hover implies clickability, so only anchors lift.
   ------------------------------------------------------------ */
a.card{
  scale: 1;
  transition:
    transform .55s var(--ease-spring),
    scale .45s var(--ease-spring),
    box-shadow .55s var(--ease-spring),
    border-color .3s ease;
}
a.card:active{ scale: .985; transition-duration: 120ms; transition-timing-function: ease-out; }
@media (hover: hover){
  a.card:hover{
    transform: translateY(-4px);
    box-shadow:
      0 2px 4px rgba(10,10,10,.04),
      0 24px 48px -24px rgba(10,10,10,.2);
  }
}

/* ------------------------------------------------------------
   11 · Materialize the services dropdown — the menu arrives as a
   surface (blur + scale together, anchored to its trigger), not
   a plain pop.
   ------------------------------------------------------------ */
.service-picker .service-menu{ transform-origin: top center; }
.service-picker[open] .service-menu{ animation: ap-materialize .45s var(--ease-spring); }
@keyframes ap-materialize{
  from{ opacity: 0; transform: translateY(-8px) scale(.98); filter: blur(4px); }
  to{ opacity: 1; transform: none; filter: none; }
}

/* Gentler equivalents for the new motion. */
@media (prefers-reduced-motion: reduce){
  .ap-reveal{ transform: none; transition: opacity .3s ease; will-change: auto; }
  .service-picker[open] .service-menu{ animation: none; }
  a.card{ transition-duration: .15s; transition-timing-function: ease; }
  a.card:hover{ transform: none; }
  a.card:active{ scale: 1; opacity: .75; }
}
