:root { --desktop-header: 128px; }

@media (min-width: 761px) {
  html { scroll-padding-top: calc(var(--desktop-header) + 16px); }
}

.header {
  --header-foreground: var(--paper);
  --header-accent: #bdc4f1;
  --header-text-shadow: 0 1px 8px #000a;
  --header-background: transparent;
  --header-blur: none;
  --header-divider: transparent;
  position: fixed;
  inset: 0 0 auto;
  display: block;
  height: var(--desktop-header);
  padding: 0 var(--pad);
  z-index: 80;
  color: var(--header-foreground);
  background: var(--header-background);
  border-bottom: 0;
  backdrop-filter: var(--header-blur);
  -webkit-backdrop-filter: var(--header-blur);
  box-shadow: 0 1px 0 var(--header-divider);
  transition: background .22s ease, box-shadow .22s ease;
}

.header[data-scrolled="true"] {
  --header-background: rgba(255, 255, 255, .9);
  --header-blur: blur(14px) saturate(1.1);
  --header-divider: #11161d14;
}

.header[data-surface="light"] {
  --header-foreground: var(--ink);
  --header-accent: #505f9b;
  --header-text-shadow: 0 1px 6px #fffb;
}

.header-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(20px, 2vw, 36px);
  width: 100%;
  height: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

.header .brand {
  justify-self: start;
  min-width: 0;
}

.header .brand img {
  flex: 0 0 auto;
  width: 120px;
  height: 120px;
  object-fit: contain;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  filter: none;
}

.header:not([data-surface="light"]) .brand img {
  filter: brightness(0) invert(1) drop-shadow(0 2px 8px #0005);
}

.header .desktop-nav {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  justify-self: stretch;
  gap: clamp(12px, 1.35vw, 24px);
  min-width: 0;
  padding-inline: clamp(0px, 1.7vw, 30px);
  font-size: clamp(14px, 1.04vw, 17px);
  font-weight: 600;
  line-height: 1.4;
}

.header .desktop-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 12px 0;
  color: var(--header-foreground);
  text-shadow: var(--header-text-shadow);
  white-space: nowrap;
}

.header .desktop-nav a::after {
  bottom: 3px;
  height: 2px;
  background: var(--header-accent);
}

.header .desktop-nav a.is-current,
.header .desktop-nav a[aria-current="location"] { color: var(--header-foreground); }
.header .desktop-nav a.is-current::after,
.header .desktop-nav a[aria-current="location"]::after,
.header .desktop-nav a:focus-visible::after { transform: scaleX(1); }

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  gap: 20px;
  min-width: 0;
}

.header .header-contact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: 14px;
  height: 46px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .005em;
  line-height: 1.4;
  white-space: nowrap;
  transition: background .2s ease, border-color .2s ease;
}

.header .header-contact span { font-size: 20px; line-height: 1; }
.header .header-contact:hover { background: #293552; border-color: #293552; }
.header:not([data-surface="light"]) .header-contact {
  background: var(--paper);
  border-color: var(--paper);
  color: var(--ink);
}
.header:not([data-surface="light"]) .header-contact:hover { background: #dce0f3; border-color: #dce0f3; }
.header a:focus-visible,
.header button:focus-visible { outline: 2px solid var(--header-accent); outline-offset: 4px; }
.header .menu-toggle { display: none; }

body.menu-open .header { background: var(--header-background); }
body.menu-open .header:not([data-surface="light"]) { --header-background: var(--ink); }
body.menu-open .header[data-surface="light"] { --header-background: var(--paper); }

.mobile-nav a { position: relative; width: fit-content; max-width: 100%; }
.mobile-nav a::after {
  content: '';
  position: absolute;
  inset: auto 0 5px;
  height: 1px;
  background: #bdc4f1;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .2s ease;
}
.mobile-nav a.is-current,
.mobile-nav a[aria-current="location"] { color: #bdc4f1; }
.mobile-nav a.is-current::after,
.mobile-nav a[aria-current="location"]::after { transform: scaleX(1); }

@media (min-width: 761px) and (max-width: 1100px) {
  :root { --desktop-header: 104px; }
  .header { padding-inline: clamp(22px, 3vw, 36px); }
  .header-inner { grid-template-columns: auto minmax(0, 1fr); gap: 24px; }
  .header .brand img { width: 94px; height: 94px; }
  .header .desktop-nav { justify-content: space-between; padding-inline: 0; font-size: 14px; }
  .header-actions { display: none; }
}

@media (max-width: 760px) {
  .header {
    height: var(--mobile-header, 76px);
    padding: env(safe-area-inset-top, 0px) max(var(--pad), env(safe-area-inset-right, 0px)) 0 max(var(--pad), env(safe-area-inset-left, 0px));
  }
  .header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
  .header .brand img { width: 74px; height: 74px; }
  .header .desktop-nav, .header-actions { display: none; }
  .header .menu-toggle {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    gap: 5.5px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid currentColor;
    border-radius: 50%;
    background: transparent;
    box-shadow: var(--header-text-shadow);
  }
  .header .menu-toggle span {
    display: block;
    flex: 0 0 1.5px;
    width: 20px;
    height: 1.5px;
    background: currentColor;
    transform-origin: center;
    transition: transform .2s var(--ease);
  }
  .header .menu-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.5px) rotate(45deg); }
  .header .menu-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.5px) rotate(-45deg); }
}

@media (prefers-reduced-motion: reduce) {
  .header,
  .header .header-contact,
  .header .menu-toggle span,
  .mobile-nav a::after { transition: none; }
}
