/* ==========================================================================
   Wraptech Machines — navigation
   Desktop mega menu + mobile drill-down panels.
   Loaded after styles.css and pages.css; reuses the same :root tokens.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Skip link
   -------------------------------------------------------------------------- */
.skip-link{
  position:absolute; left:-9999px; top:0; z-index:200;
  background:var(--white); color:var(--ink);
  padding:.7rem 1.1rem; border-radius:0 0 10px 0;
  font-family:var(--font-head); font-weight:600; font-size:.85rem;
}
.skip-link:focus{ left:0; }

/* --------------------------------------------------------------------------
   Header shell
   -------------------------------------------------------------------------- */
.header-inner{ gap:16px; }
.header-actions{ display:flex; align-items:center; gap:10px; margin-left:auto; }
.btn-sm{ padding:.55rem 1rem; font-size:.8rem; border-radius:10px; }

/* --------------------------------------------------------------------------
   Desktop mega nav
   -------------------------------------------------------------------------- */
.meganav{ display:flex; align-items:center; margin-left:18px; }
.meganav-list{ display:flex; align-items:center; gap:2px; }
.meganav-item{ position:static; }           /* panels are full-width */

.meganav-link{
  display:inline-flex; align-items:center; gap:.35rem;
  font-family:var(--font-head); font-size:.86rem; font-weight:500;
  color:#D8E4EF; background:none; border:0; cursor:pointer;
  padding:.6rem .8rem; border-radius:9px;
  transition:color .16s ease, background .16s ease;
}
.meganav-link:hover,
.meganav-item.is-open > .meganav-link{ color:var(--white); background:rgba(255,255,255,.1); }
.meganav-link.is-current{ color:var(--white); background:rgba(255,255,255,.14); }

/* --------------------------------------------------------------------------
   Mega panel
   -------------------------------------------------------------------------- */
.megapanel{
  position:absolute; left:0; right:0; top:100%;
  background:var(--white);
  border-top:1px solid var(--line);
  box-shadow:0 24px 48px rgba(7,18,74,.16);
  opacity:0; visibility:hidden; transform:translateY(-8px);
  transition:opacity .18s ease, transform .18s ease, visibility .18s;
  z-index:70;
}
.meganav-item.is-open > .megapanel{ opacity:1; visibility:visible; transform:translateY(0); }

.megapanel-inner{
  display:grid; grid-template-columns:250px 1fr;
  gap:36px; padding-block:32px 0;
  max-height:calc(100vh - var(--header-h) - 20px); overflow-y:auto;
}
.megapanel-intro{
  border-right:1px solid var(--line); padding-right:32px;
}
/* Five tracks or more need the width back from the intro column */
.megapanel-inner--wide{ grid-template-columns:200px 1fr; gap:28px; }
.megapanel-inner--wide .megapanel-intro{ padding-right:24px; }
.megapanel-inner--wide .megapanel-cols{ gap:22px 22px; }
.megapanel-inner--wide .megacol-list--multi{ column-gap:22px; }
.megapanel-blurb{ font-size:.92rem; color:var(--body); margin-bottom:1rem; }

.megapanel-cols{
  display:grid;
  /* --tracks is set per panel in header.php: the total number of grid tracks
     once any over-long column has been allowed to continue into further ones */
  grid-template-columns:repeat(var(--tracks, 4), minmax(0,1fr));
  gap:24px 28px;
  padding-bottom:28px;
}
.megapanel-cols--flat{ grid-template-columns:1fr; }

/* A column whose list exceeds MEGA_COL_MAX claims extra tracks (--span) and
   lets CSS balance the links across them, so nothing is truncated.
   Doubled class so this wins over the base .megacol-list{display:grid}
   regardless of where either rule sits in the file. */
.megacol{ grid-column:span var(--span, 1); }
.megacol-list.megacol-list--multi{
  display:block;
  column-count:var(--span, 1);
  column-gap:28px;
}
.megacol-list--multi li{ break-inside:avoid; }
.megacol-list--multi li + li{ margin-top:1px; }

.megacol-head{
  display:block;
  font-family:var(--font-head); font-size:.9rem; font-weight:700; color:var(--ink);
  padding-bottom:.5rem; margin-bottom:.5rem;
  border-bottom:1px solid var(--line);
  transition:color .16s ease;
}
.megacol-head:hover{ color:var(--blue); }

.megacol-list{ display:grid; gap:1px; }
.megacol-list a{
  display:block; padding:.34rem .5rem; margin-left:-.5rem;
  border-radius:8px; font-size:.86rem; color:var(--body);
  transition:background .14s ease, color .14s ease;
}
.megacol-list a:hover{ background:var(--tint); color:var(--blue); }
/* Items without a route of their own (anchors on the parent page) used to
   render lighter and smaller than real pages. That encoded a routing detail
   the visitor cannot interpret and made one panel look like three, so links
   now read identically whatever they point at. Only descriptive sentences
   (.megacol-blurb) stay muted. */
.megacol-list--plain a:hover{ color:var(--blue); }
.megacol-more a{ font-weight:600; color:var(--blue); }

/* branches with no children (Services) — one long list in columns */
.megacol-list--split{
  columns:3; column-gap:28px; display:block; padding-bottom:4px;
}
.megacol-list--split li{ break-inside:avoid; }

.megapanel-foot{
  grid-column:1 / -1;
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  flex-wrap:wrap;
  margin:0 -24px; padding:16px 24px;
  border-top:1px solid var(--line);
  background:var(--tint-2);
}
.megapanel-foot span{ font-size:.88rem; color:var(--body); }

.megapanel-scrim{
  position:fixed; inset:var(--header-h) 0 0 0;
  background:rgba(7,18,74,.32);
  opacity:0; transition:opacity .2s ease;
  z-index:55;
}
.megapanel-scrim.is-visible{ opacity:1; }

/* --------------------------------------------------------------------------
   Mobile drill-down
   -------------------------------------------------------------------------- */
.burger{ display:none; }

.mobilenav{
  position:fixed; inset:0; z-index:120;
  background:rgba(7,18,74,.45);
  opacity:0; transition:opacity .22s ease;
}
.mobilenav.is-open{ opacity:1; }

.mobilenav-sheet{
  position:absolute; inset:0 0 0 auto;
  width:min(420px, 100%);
  background:var(--navy); color:#D8E4EF;
  display:flex; flex-direction:column;
  transform:translateX(100%);
  transition:transform .26s cubic-bezier(.32,.72,0,1);
}
.mobilenav.is-open .mobilenav-sheet{ transform:translateX(0); }

.mobilenav-bar{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 20px;
  border-bottom:1px solid rgba(255,255,255,.12);
  flex:none;
}
.mobilenav-brand{ font-family:var(--font-head); font-weight:700; color:var(--white); font-size:1rem; letter-spacing:-.01em; }
.mobilenav-close{
  background:none; border:0; color:#D8E4EF;
  font-size:1.8rem; line-height:1; cursor:pointer; padding:0 .2rem;
}

/* the sliding viewport */
.mpanel-viewport{ position:relative; flex:1; overflow:hidden; }

.mpanel{
  position:absolute; inset:0;
  display:flex; flex-direction:column;
  overflow-y:auto; -webkit-overflow-scrolling:touch;
  transform:translateX(100%);
  transition:transform .26s cubic-bezier(.32,.72,0,1);
  visibility:hidden;
  background:var(--navy);
}
.mpanel.is-active{ transform:translateX(0); visibility:visible; }
.mpanel.is-behind{ transform:translateX(-28%); visibility:visible; }

.mpanel-head{
  display:flex; align-items:center; gap:10px;
  padding:12px 20px;
  border-bottom:1px solid rgba(255,255,255,.1);
  position:sticky; top:0; background:var(--navy); z-index:2;
}
.mpanel-back{
  display:inline-flex; align-items:center; gap:.4rem;
  background:none; border:0; cursor:pointer;
  color:var(--blue); font-family:var(--font-head); font-size:.82rem; font-weight:600;
  padding:.3rem .1rem;
}
.mback-icon{
  width:7px; height:7px; border-left:2px solid currentColor; border-bottom:2px solid currentColor;
  transform:rotate(45deg);
}
.mpanel-title{
  margin:0; font-family:var(--font-head); font-weight:700; font-size:.92rem;
  color:var(--white);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}

.mpanel-list{ padding:8px 12px 20px; display:grid; gap:2px; }

.mlink{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  width:100%; text-align:left;
  background:none; border:0; cursor:pointer;
  color:#D8E4EF; font-family:var(--font-head); font-size:.95rem; font-weight:500;
  padding:.85rem .8rem; border-radius:10px;
  transition:background .14s ease, color .14s ease;
}
.mlink:hover, .mlink:focus-visible{ background:rgba(255,255,255,.08); color:var(--white); }
.mlink--overview{ color:var(--blue); font-weight:600; }
.mlink--item{ font-weight:400; font-size:.88rem; color:#9FB3C6; }
.mchev{
  flex:none; width:7px; height:7px;
  border-right:2px solid currentColor; border-top:2px solid currentColor;
  transform:rotate(45deg); opacity:.55;
}

.mobilenav-foot{
  margin-top:auto; padding:18px 20px 26px;
  border-top:1px solid rgba(255,255,255,.12);
}
.mobilenav-contact{
  margin:14px 0 0; font-size:.86rem; line-height:1.7; text-align:center;
}
.mobilenav-contact a{ color:#9FB3C6; }
.mobilenav-contact a:hover{ color:var(--white); }

/* --------------------------------------------------------------------------
   Breakpoint — mega menu out, drill-down in
   -------------------------------------------------------------------------- */
@media (max-width:1100px){
  .megapanel-cols{ grid-template-columns:repeat(3, minmax(0,1fr)); }
  .meganav-link{ padding:.6rem .6rem; font-size:.82rem; }
}

@media (max-width:1000px){
  .meganav{ display:none; }
  .burger{ display:flex; flex-direction:column; gap:5px; background:none; border:0; cursor:pointer; padding:8px; }
  .burger span{ width:22px; height:2px; background:var(--white); border-radius:2px; }
  .megapanel-scrim{ display:none; }
}

@media (max-width:560px){
  .header-cta{ display:none; }          /* the sheet has its own CTA */
  .mobilenav-sheet{ width:100%; }
}

@media (prefers-reduced-motion: reduce){
  .mpanel, .mobilenav-sheet, .megapanel{ transition:none; }
}

/* --------------------------------------------------------------------------
   Sitemap page
   -------------------------------------------------------------------------- */
.sitemap-grid{ display:grid; grid-template-columns:repeat(2,1fr); gap:24px; align-items:start; }
.sitemap-branch{
  background:var(--white); border:1px solid var(--line);
  border-radius:var(--r-lg); padding:26px; box-shadow:var(--shadow-sm);
  break-inside:avoid;
}
.sitemap-branch > h2{
  font-size:1.15rem; padding-bottom:.6rem; margin-bottom:1rem;
  border-bottom:2px solid var(--blue);
}
.sitemap-branch ul{ display:grid; gap:2px; }
.sitemap-branch li{ font-size:.9rem; }
.sitemap-branch a{ color:var(--body); }
.sitemap-branch a:hover{ color:var(--blue); text-decoration:underline; }
.sm-l1 > a{ font-family:var(--font-head); font-weight:600; color:var(--ink); }
.sm-l2{ padding-left:16px; border-left:1px solid var(--line); margin-left:4px; }
.sm-l3{ padding-left:16px; border-left:1px solid var(--line); margin-left:4px; }
.sm-items{ padding-left:16px; margin-left:4px; }
.sm-items li{ font-size:.82rem; color:var(--muted); }
.sm-path{ font-size:.72rem; color:var(--muted); font-family:ui-monospace, SFMono-Regular, Menlo, monospace; }

@media (max-width:900px){ .sitemap-grid{ grid-template-columns:1fr; } }

/* Leaf column in a mega panel — heading plus one line, no link list */
.megacol-blurb{ margin:0; font-size:.82rem; color:var(--muted); line-height:1.6; }

/* Panel with one or two columns of content — keep the tracks narrow so the
   links sit next to the intro rather than stranded across a wide grid */
.megapanel-cols--few{ grid-template-columns:repeat(2, minmax(0, 280px)); justify-content:start; }
@media (max-width:900px){ .megapanel-cols--few{ grid-template-columns:1fr; } }
