/* ===========================================================================
   Header / navigation — enterprise navigation system.
   Loaded after site.css; reads the same design tokens (:root in site.css).
   Layout contract:
     >= 1025px  brand row + full-width navigation rail (no overlap possible)
     <= 1024px  brand row + off-canvas drawer with accordion submenus
   =========================================================================== */

/* ------------------------------------------------------------- skip link - */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ---------------------------------------------------------------- topbar - */
.topbar {
  background: var(--navy);
  color: var(--on-navy-dim);
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .08em;
  border-bottom: 1px solid var(--navy-line);
}
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 22px;
  min-height: 40px;
  flex-wrap: wrap;
}
.topbar__status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-transform: uppercase;
  min-width: 0;
}
.topbar__status::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(23, 169, 122, .18);
  flex: 0 0 auto;
}
.topbar__contact { display: inline-flex; align-items: center; gap: 10px 22px; flex-wrap: wrap; min-width: 0; }
.topbar a { color: var(--on-navy-dim); }
.topbar a:hover { color: #fff; text-decoration: none; }

/* -------------------------------------------------------------- masthead - */
.masthead {
  position: sticky;
  top: 0;
  z-index: 80;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.masthead.is-stuck { box-shadow: var(--shadow); }

.masthead__bar { background: var(--surface); }
.masthead__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 70px;
}

/* ----------------------------------------------------------------- brand - */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 40px; height: 40px;
  flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(150deg, var(--navy-2), var(--navy));
  color: #fff;
  font-family: var(--display);
  font-weight: 800;
  font-size: .84rem;
  letter-spacing: .04em;
}
.brand__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.brand__name {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.16rem;
  letter-spacing: -.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand__tag {
  font-family: var(--mono);
  font-size: .56rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --------------------------------------------------------------- actions - */
.masthead__actions { display: inline-flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.masthead__cta { white-space: nowrap; padding: 11px 18px; font-size: .9rem; }

.nav-burger {
  display: none;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font: 600 .88rem/1 var(--body);
  cursor: pointer;
}
.nav-burger:hover { background: var(--tint); }
.nav-burger__bars { position: relative; width: 16px; height: 10px; flex: 0 0 auto; }
.nav-burger__bars::before,
.nav-burger__bars::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  box-shadow: 0 4px 0 currentColor;
}
.nav-burger__bars::before { top: 0; }
.nav-burger__bars::after { display: none; }

/* ------------------------------------------------------ navigation rail - */
.navrail { border-top: 1px solid var(--rule-soft); background: var(--surface); }
.navrail__inner { display: flex; align-items: center; }

.nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 2px;
  min-width: 0;
  width: 100%;
}
.nav__item { position: relative; display: flex; }
.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 13px 12px;
  margin: 0;
  border: 0;
  background: none;
  border-radius: var(--radius-sm);
  font: 500 .875rem/1.2 var(--body);
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.nav__link:hover { background: var(--tint); color: var(--ink); text-decoration: none; }
.nav__link.is-active { color: var(--brand-dark); font-weight: 600; }
.nav__item::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--brand);
  transform: scaleX(0);
  transition: transform .18s ease;
}
.nav__item:has(.is-active)::after { transform: scaleX(1); }
.nav__caret { width: 10px; height: 6px; color: var(--muted); transition: transform .18s ease; }
.nav__item.is-open > .nav__link { background: var(--tint); color: var(--ink); }
.nav__item.is-open .nav__caret { transform: rotate(180deg); }

/* dropdown panel */
.dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  min-width: 268px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s;
  z-index: 90;
}
.nav__item.is-open > .dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown--flip { left: auto; right: 0; }
.dropdown__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.dropdown__link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: .9rem;
}
.dropdown__link:hover { background: var(--tint); color: var(--ink); text-decoration: none; }
.dropdown__link.is-active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.dropdown__link--overview { border-bottom: 1px solid var(--rule-soft); border-radius: var(--radius-sm) var(--radius-sm) 0 0; margin-bottom: 3px; }
.dropdown__hint { font-family: var(--mono); font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* --------------------------------------------------------------- drawer - */
.navdrawer { position: fixed; inset: 0; z-index: 120; }
.navdrawer[hidden] { display: none; }
.navdrawer__overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 21, 38, .55);
  opacity: 0;
  transition: opacity .22s ease;
}
.navdrawer__panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(380px, 88vw);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  box-shadow: var(--shadow-lift);
  transform: translateX(100%);
  transition: transform .26s cubic-bezier(.22, .8, .24, 1);
}
.navdrawer.is-open .navdrawer__overlay { opacity: 1; }
.navdrawer.is-open .navdrawer__panel { transform: translateX(0); }

.navdrawer__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--rule);
}
.brand--drawer .brand__name { font-size: 1.02rem; }
.navdrawer__close {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.navdrawer__close svg { width: 14px; height: 14px; }
.navdrawer__close:hover { background: var(--tint); }

.navdrawer__body { flex: 1 1 auto; overflow-y: auto; padding: 8px 12px 16px; -webkit-overflow-scrolling: touch; }
.drawernav { list-style: none; margin: 0; padding: 0; }
.drawernav__item { border-bottom: 1px solid var(--rule-soft); }
.drawernav__item:last-child { border-bottom: 0; }
.drawernav__trigger,
.drawernav__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 8px;
  border: 0;
  background: none;
  font: 600 .96rem/1.3 var(--body);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.drawernav__link:hover, .drawernav__trigger:hover { text-decoration: none; color: var(--brand-dark); }
.drawernav__trigger.is-active, .drawernav__link.is-active { color: var(--brand-dark); }
.drawernav__caret { width: 12px; height: 7px; color: var(--muted); flex: 0 0 auto; transition: transform .2s ease; }
.drawernav__trigger[aria-expanded="true"] .drawernav__caret { transform: rotate(180deg); }

.drawernav__sub {
  list-style: none;
  margin: 0 0 10px;
  padding: 0 0 0 12px;
  border-left: 2px solid var(--rule);
  display: none;
}
.drawernav__sub.is-open { display: block; }
.drawernav__sub a {
  display: block;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: .92rem;
}
.drawernav__sub a:hover { background: var(--tint); color: var(--ink); text-decoration: none; }
.drawernav__sub a.is-active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }

.navdrawer__foot { padding: 16px 18px; border-top: 1px solid var(--rule); display: grid; gap: 10px; }
.navdrawer__cta { width: 100%; }
.navdrawer__meta { font-family: var(--mono); font-size: .78rem; color: var(--muted-dark); }

body.nav-locked { overflow: hidden; }

/* ---------------------------------------------------------- breakpoints - */
@media (max-width: 1200px) {
  .nav__link { padding: 13px 10px; font-size: .84rem; }
}

/* Tablet & mobile: rail collapses into the drawer. */
@media (max-width: 1024px) {
  .navrail { display: none; }
  .nav-burger { display: inline-flex; }
  .masthead__inner { min-height: 64px; }
}

@media (max-width: 640px) {
  .masthead__cta { display: none; }
  .brand__mark { width: 36px; height: 36px; border-radius: 10px; }
  .brand__name { font-size: 1.02rem; }
  .brand__tag { font-size: .52rem; letter-spacing: .16em; }
  .topbar { font-size: .66rem; }
  .topbar__inner { justify-content: center; text-align: center; row-gap: 4px; padding-top: 8px; padding-bottom: 8px; }
}

@media (max-width: 380px) {
  .nav-burger__text { display: none; }
  .nav-burger { padding: 10px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .navdrawer__panel, .navdrawer__overlay, .dropdown, .nav__item::after { transition: none; }
}
