/* ==========================================================================
   Schilderwerken Mattheus - nav.css
   White sticky header with dark links, as in the ProRange reference.
   Mobile: slide-in panel, tap-to-expand submenus, never hover.
   ========================================================================== */

/* Transparent, so the page ground shows through: the warm band on inner
   pages, white on the home page. It only gains a surface once scrolled. */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 300;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background .35s var(--ease), border-color .35s var(--ease),
              box-shadow .35s var(--ease), transform .4s var(--ease);
}
.site-header.is-stuck {
  background: var(--white);
  border-bottom-color: var(--rule);
  box-shadow: 0 4px 24px rgba(23, 22, 22, .06);
}

/* Hide on scroll down, reveal on scroll up */
.site-header.is-hidden { transform: translateY(-100%); }
.site-header.is-open { transform: none; }
.site-header.is-solid { background: var(--white); border-bottom-color: var(--rule); }

.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem;
  min-height: 76px;
  padding-block: .8rem;
}

/* ------------------------------------------------------------------- Logo */
.brand { display: inline-flex; align-items: center; flex: none; text-decoration: none; }
.brand img { width: auto; height: 40px; background: none; transition: opacity .25s var(--ease); }
.brand:hover img { opacity: .8; }
@media (min-width: 720px) { .brand img { height: 46px; } }

/* --------------------------------------------------------- Desktop nav */
.nav-desktop { display: none; }

@media (min-width: 1060px) {
  .nav-desktop { display: flex; align-items: center; margin-left: auto; }
  .nav-desktop ul { display: flex; align-items: center; gap: .1rem; list-style: none; margin: 0; padding: 0; }
  .nav-desktop li { margin: 0; position: relative; }

  .nav-desktop a {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .7rem .9rem;
    font-size: .9375rem; font-weight: 500;
    color: var(--ink);
    text-decoration: none;
    position: relative;
    transition: color .25s var(--ease);
    white-space: nowrap;
  }
  .nav-desktop a::after {
    content: ""; position: absolute;
    left: .9rem; right: .9rem; bottom: .45rem;
    height: 1px; background: var(--ink);
    transform: scaleX(0); transform-origin: left;
    transition: transform .3s var(--ease);
  }
  .nav-desktop a:hover, .nav-desktop a:focus-visible { color: var(--body); }
  .nav-desktop a:hover::after, .nav-desktop a:focus-visible::after { transform: scaleX(1); }

  /* Active page: the reference marks it with a thin underline */
  .nav-desktop a[aria-current="page"] { color: var(--ink); }
  .nav-desktop a[aria-current="page"]::after { transform: scaleX(1); }
  .nav-desktop .has-sub[data-active="true"] > a::after { transform: scaleX(1); }

  .nav-desktop .caret { width: 9px; height: 9px; flex: none; color: var(--body); transition: transform .25s var(--ease); }
  .nav-desktop .has-sub:hover .caret, .nav-desktop .has-sub:focus-within .caret { transform: rotate(180deg); }

  /* Dropdown */
  .nav-desktop .sub {
    position: absolute; top: 100%; left: 0;
    min-width: 272px;
    background: var(--white);
    border: 1px solid var(--rule);
    box-shadow: 0 18px 44px rgba(23, 22, 22, .12);
    padding: .5rem;
    display: flex; flex-direction: column; align-items: stretch;
    opacity: 0; visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s;
  }
  .nav-desktop .has-sub:hover > .sub,
  .nav-desktop .has-sub:focus-within > .sub { opacity: 1; visibility: visible; transform: none; }
  .nav-desktop .sub li { width: 100%; }
  .nav-desktop .sub a {
    display: block; width: 100%;
    padding: .7rem .9rem;
    font-size: .9rem; color: var(--body);
    border-left: 2px solid transparent;
    white-space: normal;
  }
  .nav-desktop .sub a::after { display: none; }
  .nav-desktop .sub a:hover, .nav-desktop .sub a:focus-visible {
    background: var(--band); border-left-color: var(--ink); color: var(--ink);
  }
  .nav-desktop .sub a[aria-current="page"] { border-left-color: var(--ink); color: var(--ink); }
}

/* --------------------------------------------------------- Header actions */
.header-actions { display: flex; align-items: center; gap: .75rem; flex: none; }

.header-tel {
  display: none;
  align-items: center; gap: .5rem;
  text-decoration: none;
  font-weight: 700; font-size: .9375rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  padding: .5rem .25rem;
  min-height: 44px;
}
.header-tel svg { width: 17px; height: 17px; color: var(--lime); flex: none; }
.header-tel:hover { color: var(--body); }

.header-cta { display: none; }

@media (min-width: 640px) { .header-tel { display: inline-flex; } }
@media (min-width: 1060px) {
  .header-actions { margin-left: 1.5rem; }
  .header-cta { display: inline-flex; min-height: 46px; padding: .65rem 1.4rem; }
}

/* ----------------------------------------------------------- Hamburger */
.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px;
  flex: none; padding: 0;
  background: transparent;
  border: 1px solid var(--rule-dk);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .25s var(--ease), background .25s var(--ease);
  position: relative; z-index: 2;
}
.nav-toggle:hover { border-color: var(--ink); background: var(--band); }
.nav-toggle__box { position: relative; width: 20px; height: 14px; }
.nav-toggle__box span {
  position: absolute; left: 0;
  display: block; width: 100%; height: 2px;
  background: var(--ink);
  transition: transform .34s var(--ease-out), opacity .2s var(--ease), width .34s var(--ease-out);
}
.nav-toggle__box span:nth-child(1) { top: 0; }
.nav-toggle__box span:nth-child(2) { top: 6px; width: 75%; }
.nav-toggle__box span:nth-child(3) { top: 12px; }

.nav-toggle[aria-expanded="true"] .nav-toggle__box span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__box span:nth-child(2) { opacity: 0; width: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__box span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.nav-toggle[aria-expanded="true"] { border-color: var(--ink); background: var(--band); }

@media (min-width: 1060px) { .nav-toggle { display: none; } }

/* ------------------------------------------------------- Mobile panel */
.nav-scrim {
  position: fixed; inset: 0; z-index: 390;
  background: rgba(23, 22, 22, .42);
  opacity: 0; visibility: hidden;
  transition: opacity .4s var(--ease), visibility .4s;
  border: 0; padding: 0; cursor: pointer;
}
.nav-scrim.is-visible { opacity: 1; visibility: visible; }

.nav-mobile {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 400;
  width: min(400px, 88vw);
  background: var(--white);
  border-left: 1px solid var(--rule);
  box-shadow: -24px 0 60px rgba(23, 22, 22, .18);
  transform: translateX(100%);
  transition: transform .44s var(--ease-out);
  display: flex; flex-direction: column;
  overscroll-behavior: contain;
}
.nav-mobile.is-open { transform: translateX(0); }

.nav-mobile__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem var(--gutter);
  border-bottom: 1px solid var(--rule);
  flex: none; min-height: 76px;
}
.nav-mobile__head .brand img { height: 36px; }
.nav-mobile__head .lb-btn {
  width: 44px; height: 44px;
  display: inline-grid; place-items: center;
  background: transparent; color: var(--ink);
  border: 1px solid var(--rule-dk); cursor: pointer;
  transition: all .25s var(--ease);
}
.nav-mobile__head .lb-btn:hover { background: var(--ink); border-color: var(--ink); color: var(--white); }
.nav-mobile__head .lb-btn svg { width: 18px; height: 18px; }

.nav-mobile__scroll {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: .5rem var(--gutter) 1.5rem;
}

.nav-mobile ul { list-style: none; margin: 0; padding: 0; }
.nav-mobile li { margin: 0; border-bottom: 1px solid var(--rule); }

.nav-mobile a {
  display: flex; align-items: center;
  padding: 1rem 0; min-height: 52px;
  font-family: var(--font);
  font-size: 1.05rem; font-weight: 700; letter-spacing: -.012em;
  color: var(--ink);
  text-decoration: none;
  transition: color .25s var(--ease), padding-left .25s var(--ease);
}
.nav-mobile a:hover, .nav-mobile a:focus-visible { color: var(--body); padding-left: .4rem; }
.nav-mobile a[aria-current="page"] { color: var(--body); }

.nav-mobile .sub-row { display: flex; align-items: center; gap: .5rem; }
.nav-mobile .sub-row > a { flex: 1; }

.sub-toggle {
  flex: none;
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--rule-dk);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .25s var(--ease);
}
.sub-toggle svg { width: 13px; height: 13px; color: var(--ink); transition: transform .3s var(--ease); }
.sub-toggle:hover { border-color: var(--ink); background: var(--band); }
.sub-toggle[aria-expanded="true"] { background: var(--ink); border-color: var(--ink); }
.sub-toggle[aria-expanded="true"] svg { transform: rotate(180deg); color: var(--white); }

/* Collapsible submenu */
.nav-mobile .sub {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .38s var(--ease-out);
}
/* min-height:0 removes the grid item's automatic min-content floor, without
   which `grid-template-rows: 0fr` refuses to collapse back to zero. */
.nav-mobile .sub > div { overflow: hidden; min-height: 0; }
.nav-mobile .sub.is-open { grid-template-rows: 1fr; }

.nav-mobile .sub li { border-bottom: 0; }
.nav-mobile .sub li:first-child { padding-top: .25rem; }
.nav-mobile .sub li:last-child { padding-bottom: .85rem; }
.nav-mobile .sub a {
  font-family: var(--font);
  font-size: .9375rem; font-weight: 500;
  color: var(--body);
  padding: .6rem 0 .6rem 1rem;
  min-height: 46px;
  border-left: 1px solid var(--rule-dk);
}
.nav-mobile .sub a:hover, .nav-mobile .sub a:focus-visible {
  color: var(--ink); border-left-color: var(--ink); padding-left: 1.25rem;
}
.nav-mobile .sub a[aria-current="page"] { color: var(--ink); border-left-color: var(--ink); }

@supports not (grid-template-rows: 1fr) {
  .nav-mobile .sub { display: block; max-height: 0; overflow: hidden; transition: max-height .38s var(--ease-out); }
  .nav-mobile .sub.is-open { max-height: 600px; }
}

.nav-mobile__foot {
  flex: none;
  padding: 1.25rem var(--gutter) calc(1.25rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule);
  display: grid; gap: .75rem;
  background: var(--band);
}
.nav-mobile__foot .btn { width: 100%; }
.nav-mobile__foot .m-tel {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  text-decoration: none;
  font-family: var(--font); font-weight: 700;
  font-size: 1.15rem; letter-spacing: -.02em;
  color: var(--ink);
  min-height: 48px;
  font-variant-numeric: tabular-nums;
}
.nav-mobile__foot .m-tel svg { width: 18px; height: 18px; color: var(--lime); }

@media (min-width: 1060px) {
  .nav-mobile, .nav-scrim { display: none; }
}
