/* Shared by every page: fixed menu bar, mobile menu, back-to-top button, scroll motion. */
:root{ --bar-h:72px }
html{ scroll-padding-top:calc(var(--bar-h) + 12px) }

/* ---------- Menu bar: always present ---------- */
.site-bar{
  position:fixed; top:0; left:0; right:0; z-index:50;
  padding-top:env(safe-area-inset-top, 0px);
  border-bottom:1px solid transparent;
  transition:background-color .3s ease, border-color .3s ease, backdrop-filter .3s ease;
}
.site-bar.is-scrolled, .site-bar.open{
  background:color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter:blur(14px); backdrop-filter:blur(14px);
  border-bottom-color:var(--line);
}
.site-bar.open{ background:var(--bg) }
.site-bar .bar{
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  height:var(--bar-h); padding-block:0;
}
.mark{ font-family:var(--display); font-weight:700; font-size:1.55rem; line-height:1; letter-spacing:.32em; text-transform:uppercase; text-decoration:none; color:var(--fg) }
.nav{ display:flex; align-items:center; gap:26px }
.nav a{
  font-family:var(--mono); font-size:.74rem; letter-spacing:.14em; text-transform:uppercase; text-decoration:none; color:var(--fg);
  padding-block:6px;
}
.nav a:not(.pill){
  background-image:linear-gradient(var(--accent),var(--accent)); background-repeat:no-repeat; background-position:0 100%; background-size:0 1px;
  transition:background-size .3s ease, color .2s ease;
}
.nav a:not(.pill):hover, .nav a[aria-current="true"]{ color:var(--accent); background-size:100% 1px }
.nav .pill{ border:1px solid var(--fg); padding:9px 16px; transition:background-color .2s ease, color .2s ease }
.nav .pill:hover{ background:var(--fg); color:var(--bg) }
.menu-btn{
  display:none; font-family:var(--mono); font-size:.74rem; letter-spacing:.14em; text-transform:uppercase;
  background:transparent; color:var(--fg); border:1px solid var(--fg); padding:9px 16px; cursor:pointer;
}
@media (max-width:900px){
  .menu-btn{ display:inline-block }
  .nav{
    display:none; position:absolute; left:0; right:0; top:100%;
    flex-direction:column; align-items:stretch; gap:0;
    background:var(--bg); border-bottom:1px solid var(--line);
    padding:8px max(16px, env(safe-area-inset-left, 0px)) 22px;
  }
  .site-bar.open .nav{ display:flex }
  .nav a{ font-size:.9rem; padding:15px 0; border-bottom:1px solid var(--line); background-image:none !important }
  .nav .pill{ margin-top:18px; text-align:center; border:1px solid var(--fg); padding:14px 16px }
}

/* Progress line under the bar (only drawn where scroll-driven animation exists) */
.site-bar::after{
  content:""; position:absolute; left:0; right:0; bottom:-1px; height:2px;
  background:linear-gradient(90deg,var(--teal),var(--accent)); transform:scaleX(0); transform-origin:0 50%;
}

/* ---------- Back to top ---------- */
.to-top{
  position:fixed; z-index:40;
  right:max(16px, env(safe-area-inset-right, 0px)); bottom:max(16px, env(safe-area-inset-bottom, 0px));
  width:48px; height:48px; display:grid; place-items:center; padding:0;
  background:var(--bg); color:var(--fg); border:1px solid var(--fg); cursor:pointer;
  opacity:0; visibility:hidden; transform:translateY(8px);
  transition:opacity .25s ease, transform .25s ease, visibility .25s, background-color .2s ease, color .2s ease;
}
.to-top.show{ opacity:1; visibility:visible; transform:none }
.to-top:hover{ background:var(--fg); color:var(--bg) }
.to-top svg{ width:20px; height:20px; stroke:currentColor; fill:none; stroke-width:1.8; stroke-linecap:square }

/* ---------- Scroll motion (progressive: browsers without scroll-driven animation just show the static page) ---------- */
@media (prefers-reduced-motion:no-preference){
@supports (animation-timeline: view()){
  @keyframes rise{ from{opacity:0; transform:translate3d(0,40px,0)} to{opacity:1; transform:none} }
  @keyframes grow{ from{opacity:0; transform:scale(.8)} to{opacity:1; transform:none} }
  @keyframes leave{ to{opacity:0; transform:translate3d(0,-56px,0) scale(1.05)} }
  @keyframes drawx{ from{transform:scaleX(0)} to{transform:scaleX(1)} }
  @keyframes drawy{ from{transform:scaleY(0)} to{transform:scaleY(1)} }
  @keyframes fieldmove{ from{transform:translate3d(0,18%,0) scale(1.25)} to{transform:translate3d(0,-12%,0) scale(1)} }
  @keyframes progress{ to{transform:scaleX(1)} }

  .site-bar::after{ animation:progress linear both; animation-timeline:scroll(root block) }

  /* Home hero lifts away and softens as you scroll off it */
  .hero-body > div{ transform-origin:0 50%; animation:leave linear both; animation-timeline:scroll(root block); animation-range:0px 65vh }

  /* Headings and blocks rise into place as they enter */
  #why h2, #why .lead, #why .platforms > div, #services h2, #services .region, #process h2,
  .contact h2, .contact .intro, #contact form, .list li{
    animation:rise linear both; animation-timeline:view(); animation-range:entry 0% entry 70%;
  }
  #why .platforms > div:nth-child(2){ animation-range:entry 8% entry 78% }
  .svc{ animation:rise linear both; animation-timeline:view(); animation-range:entry 0% entry 65% }
  .svc:nth-child(2n){ animation-range:entry 10% entry 75% }
  .svc::after{ animation:fieldmove linear both; animation-timeline:view(); animation-range:cover 0% cover 100% }
  .steps li{ animation:rise linear both; animation-timeline:view(); animation-range:entry 0% entry 70% }
  .steps li:nth-child(2){ animation-range:entry 6% entry 76% }
  .steps li:nth-child(3){ animation-range:entry 12% entry 82% }
  .steps li:nth-child(4){ animation-range:entry 18% entry 88% }
  .steps::before{ transform-origin:0 0; animation:drawx linear both; animation-timeline:view(); animation-range:entry 0% cover 35% }
  @media (max-width:900px){
    .steps::before{ animation-name:drawy; animation-range:entry 0% cover 70% }
  }

  /* The idea grows into the frame, then the paragraphs follow */
  .band h2{ transform-origin:0 100%; animation:grow linear both; animation-timeline:view(); animation-range:entry 10% entry 100% }
  .band .cols p{ animation:rise linear both; animation-timeline:view(); animation-range:entry 0% entry 80% }
}
}
