/* Sticky header that tightens on scroll */
header{position:sticky;top:0;z-index:50;transition:box-shadow .3s ease}
header > div{transition:padding .3s ease}
header img{transition:height .3s ease}
header.is-scrolled{box-shadow:0 6px 24px rgba(0,0,0,.08)}
header.is-scrolled > div{padding-top:8px !important;padding-bottom:8px !important}
header.is-scrolled img{height:60px !important}
@media (max-width: 800px){header{position:static}}

/* Buttons and cards feel responsive */
a.nel-btn-dark,a.nel-btn-light,button{transition:background-color .2s ease,transform .2s ease}
a.nel-btn-dark:hover,a.nel-btn-light:hover,button:hover{transform:translateY(-1px)}
.nel-card{transition:background-color .25s ease}
.nel-card span:last-child{transition:transform .25s ease}
.nel-card:hover span:last-child{transform:translateX(6px)}
a[aria-label^="Call"]{transition:background-color .2s ease,border-color .2s ease}
a[aria-label^="Call"]:hover{background:#000;border-color:#000;color:#fff}

@media (prefers-reduced-motion: no-preference){
  /* Hero: headline rises in, contour lines drift like a live seismic display */
  #top h1,#top h1 ~ p,#top h1 ~ div,.nec-hero h1,.nec-hero h1 ~ p,.nec-hero h1 ~ div{animation:nec-rise .9s cubic-bezier(.2,.7,.2,1) both}
  #top h1 ~ p,.nec-hero h1 ~ p{animation-delay:.12s}
  #top h1 ~ div,.nec-hero h1 ~ div{animation-delay:.24s}
  #top > svg path,.nec-hero > svg path{animation:nec-drift 16s ease-in-out infinite alternate}
  #top > svg path:nth-child(2n),.nec-hero > svg path:nth-child(2n){animation-duration:21s;animation-delay:-6s}
  #top > svg path:nth-child(3n),.nec-hero > svg path:nth-child(3n){animation-duration:26s;animation-delay:-11s}

  /* Project diagrams draw themselves as they scroll into view */
  .js #projects article.rv svg path[stroke="#ffffff"]{stroke-dasharray:480;stroke-dashoffset:480;transition:stroke-dashoffset 1.9s cubic-bezier(.6,0,.2,1) .35s}
  .js #projects article.rv.in svg path[stroke="#ffffff"]{stroke-dashoffset:0}
  .js #projects article.rv svg rect{transform-box:fill-box;transform-origin:left center;transform:scaleX(0);transition:transform 1s cubic-bezier(.6,0,.2,1)}
  .js #projects article.rv.in svg rect{transform:scaleX(1)}
  .js #projects article.rv.in svg rect:nth-of-type(1){transition-delay:.3s}
  .js #projects article.rv.in svg rect:nth-of-type(2){transition-delay:.8s}
  .js #projects article.rv.in svg rect:nth-of-type(3){transition-delay:1.3s}
  .js #projects article.rv svg circle{opacity:0;transition:opacity .4s ease 2s}
  .js #projects article.rv.in svg circle{opacity:1}
  #projects svg ellipse{transform-box:fill-box;transform-origin:center;animation:nec-plume 3.2s ease-in-out infinite}

  /* Scroll reveal */
  .js .rv{opacity:0;transform:translateY(26px);transition:opacity .8s cubic-bezier(.2,.7,.2,1),transform .8s cubic-bezier(.2,.7,.2,1)}
  .js .rv.in{opacity:1;transform:none}
}
@keyframes nec-plume{0%,100%{transform:scale(1);opacity:.85}50%{transform:scale(1.18,1.3);opacity:1}}
@keyframes nec-rise{from{opacity:0;transform:translateY(28px)}to{opacity:1;transform:none}}
@keyframes nec-drift{from{transform:translate(0,0)}to{transform:translate(-40px,14px)}}

/* ---------- Phone and small-tablet layout ---------- */
.nec-menu{display:none}
@media (max-width: 860px){
  /* Compact header: logo left, menu button right; nav drops down */
  header.nec-header{position:sticky;top:0}
  header.nec-header > div{flex-wrap:nowrap !important;padding:10px 20px !important;gap:12px !important}
  header.nec-header img{height:52px !important}
  header.nec-header.is-scrolled img{height:44px !important}
  .nec-desc{display:none !important}
  .nec-menu{display:flex;flex-direction:column;justify-content:center;gap:7px;width:46px;height:46px;padding:0 12px;margin-left:auto;background:none;border:1px solid #d0d0d0;border-radius:50%;cursor:pointer;color:#000}
  .nec-menu span{display:block;height:1.6px;background:currentColor;transition:transform .25s ease}
  .nec-menu[aria-expanded="true"] span:first-child{transform:translateY(4.3px) rotate(45deg)}
  .nec-menu[aria-expanded="true"] span:last-child{transform:translateY(-4.3px) rotate(-45deg)}
  .nec-nav{position:absolute;left:0;right:0;top:100%;background:#fff;border-bottom:1px solid #e3e3e3;box-shadow:0 18px 30px rgba(0,0,0,.08);
    flex-direction:column;align-items:stretch !important;gap:0 !important;padding:8px 20px 20px;
    visibility:hidden;opacity:0;transform:translateY(-8px);transition:opacity .2s ease,transform .2s ease,visibility 0s linear .2s}
  .nec-header.is-open .nec-nav{visibility:visible;opacity:1;transform:none;transition:opacity .2s ease,transform .2s ease}
  .nec-nav > a{font-size:20px;padding:14px 0;border-bottom:1px solid #eeeeee}
  .nec-nav > a[aria-label^="Call"]{width:auto !important;height:auto !important;border:0 !important;border-bottom:1px solid #eeeeee !important;border-radius:0 !important;justify-content:flex-start !important;gap:10px}
  .nec-nav > a[aria-label^="Call"]::after{content:"(346) 396-4091"}
  .nec-nav > a[aria-label^="Call"]:hover{background:none;color:inherit}
  .nec-nav > a.nel-btn-dark{margin-top:16px;border:0;text-align:center;padding:16px 22px !important}

  /* Gutters and hero */
  div[style*="max-width: 1240px"]{padding-left:20px !important;padding-right:20px !important}
  #top > div{min-height:0 !important;padding-top:56px !important;padding-bottom:64px !important;gap:40px !important}
  #top p:first-child{font-size:12px !important;letter-spacing:.12em !important;line-height:1.6}
  #top h1 ~ p{font-size:18px !important}
  #top h1 ~ div a{flex:1 1 100%;text-align:center}

  /* Contact: clean stacked rows, no decorative lines */
  #contact{padding-top:80px !important}
  #contact > svg{display:none}
  #contact .nec-ml{max-width:100%}
  #contact form button{width:100%}
  #contact .nec-contact-cell{flex:1 1 100% !important;padding:22px 0 !important;border-right:0 !important;border-bottom:1px solid #2b2b2b}
  #contact .nec-contact-cell:last-child{border-bottom:0}
  #contact .nec-contact-cell span:last-child{font-size:22px !important;overflow-wrap:normal !important;word-break:normal !important}
  #contact > div:last-child{margin-top:64px !important}

  /* Footer: stacked, two-column service links */
  .nec-footer > div{flex-direction:column;align-items:flex-start !important;gap:16px !important}
  .nec-footer nav{display:grid !important;grid-template-columns:1fr 1fr;gap:10px 24px !important;width:100%}
}
