/* ==========================================================================
   Header — overlay on the hero, then a calm sticky bar
   [data-state] is set from the real hero position (js/header.js):
   top → transparent · over-hero → solid black · solid → white
   Height never changes between states (no layout jump).
   V4: ALL-CAPS desktop menu, phone block, Leistungen megamenu, side drawer.
   ========================================================================== */

.site-header {
  /* light content on the hero */
  --fg: var(--c-white);
  --fg-muted: rgb(255 255 255 / 0.68);
  --line-strong: rgb(255 255 255 / 0.4);
  --focus: var(--c-white);

  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  color: var(--fg);
  background: transparent;
  border-bottom: 1px solid transparent;
  transition:
    background-color 420ms var(--ease-out),
    border-color 420ms var(--ease-out),
    color 420ms var(--ease-out);
}
/* V4.1: with the mega-menu open at the top the header stays transparent over
   the hero, as in Hero-design.png */
.site-header[data-state='over-hero'] {
  background: var(--c-black);
  border-bottom-color: rgb(255 255 255 / 0.1);
}
.site-header[data-state='solid'] {
  --fg: var(--c-ink);
  --fg-muted: var(--c-steel-500);
  --line-strong: var(--c-steel-300);
  --focus: var(--c-precision);
  background: rgb(255 255 255 / 0.97);
  border-bottom-color: var(--c-line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2vw, 36px);
  height: var(--header-h);
}

/* --- Logo: both lockups share one cell and crossfade (identical viewBox) */
.site-header__brand {
  flex: none;
  display: grid;
  padding-block: 6px;
}
.site-header__logo {
  grid-area: 1 / 1;
  width: clamp(176px, 14vw, 226px);
  height: auto;
  transition: opacity 420ms var(--ease-out);
}
.site-header__logo--master {
  opacity: 0;
}
.site-header[data-state='solid'] .site-header__logo--master {
  opacity: 1;
}
.site-header[data-state='solid'] .site-header__logo--reversed {
  opacity: 0;
}

/* --- Desktop navigation: ALL CAPS, compact, tracked */
.site-nav {
  margin-left: auto;
}
.site-nav__list {
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.45vw, 28px);
}
.site-nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--fg);
}
/* hover: precise hairline grows from the left */
.site-nav__link::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0.1em;
  bottom: 9px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-mid) var(--ease-out);
}
.site-nav__link:hover::after,
.site-nav__link:focus-visible::after,
.has-mega .site-nav__item--mega > .site-nav__link::after {
  transform: scaleX(1);
}
/* current page: one small square above the label (logo "intervention point") */
.site-nav__link::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 5px;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  background: var(--c-copper);
  transform: scale(0);
  transition: transform var(--t-mid) var(--ease-out);
}
.site-nav__link[aria-current='page']::before {
  transform: scale(1);
}

/* --- Megamenu trigger (link + separate disclosure button) */
.site-nav__item--mega {
  display: flex;
  align-items: center;
}
.site-nav__more {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 44px;
  margin-left: 2px;
  color: var(--fg);
}
.site-nav__more svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  transition: transform var(--t-mid) var(--ease-out);
}
.site-nav__more[aria-expanded='true'] svg {
  transform: rotate(180deg);
}

/* --- Megamenu panel — V4.1 = Hero-design.png (opened state).
   A white shell exactly as wide as the header's content container (not full
   bleed, not a narrow dropdown); bottom-right corner cut (unghi-taiat.svg).
   Reference at 1440: shell 1320 × 249, padding 20/16/20/25, columns
   intro 308 · tile 01 580 · tile 02 367, gap 12; tiles 210 high. */
.mega {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  padding-inline: var(--gutter);
  pointer-events: none;
}
.mega[hidden] {
  display: none;
}
/* invisible bridge: the pointer can travel from the trigger into the panel */
.mega::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 18px;
  pointer-events: auto;
}
.mega__shell {
  --fg: var(--c-ink);
  --fg-2: var(--c-steel-700);
  --fg-muted: var(--c-steel-500);
  --line-strong: var(--c-ink);
  --eyebrow: var(--c-ink);
  --mark: var(--c-precision);
  --focus: var(--c-precision);
  --cut: clamp(30px, 3.27vw, 52px); /* ≈ 47 px at 1440 (measured) */
  pointer-events: auto;
  display: grid;
  grid-template-columns: minmax(0, 308fr) minmax(0, 580fr) minmax(0, 367fr);
  column-gap: 12px;
  max-width: var(--content);
  margin-inline: auto;
  padding: 20px 16px 20px 25px;
  color: var(--fg);
  background: var(--c-white);
}
.mega.is-open .mega__shell {
  animation: mega-in 260ms var(--ease-out);
}
@keyframes mega-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}
.mega__intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-top: 8px;
}
.mega__eyebrow {
  margin-bottom: 18px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2em;
}
.mega__text {
  max-width: 29ch;
  font-size: 0.8125rem;
  line-height: 1.3;
  color: var(--fg);
}
.mega__all {
  margin-top: auto;
}
.mega__tiles {
  display: contents;
}
.mega__tile a {
  --cut: clamp(26px, 2.74vw, 44px); /* ≈ 39.5 px at 1440 (measured) */
  position: relative;
  isolation: isolate;
  display: block;
  height: clamp(180px, 14.6vw, 236px); /* 210 at 1440 */
  overflow: hidden;
  color: #fff;
  background: var(--c-black);
}
.mega__tile picture,
.mega__tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
  transition: transform 700ms var(--ease-out);
}
.mega__tile--01 img {
  object-position: 62% 40%;
}
.mega__tile--02 img {
  object-position: 55% 45%;
}
/* readability: black at the bottom → transparent towards the top */
.mega__tile a::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(0deg, rgb(0 0 0 / 0.92) 0%, rgb(0 0 0 / 0.62) 34%, rgb(0 0 0 / 0.12) 70%, rgb(0 0 0 / 0) 100%);
}
/* the large numeral, cut by the tile edges (01 lower-left, 02 top-left) */
.mega__num {
  position: absolute;
  font-family: var(--f-display);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #fff;
  pointer-events: none;
}
.mega__tile--01 .mega__num {
  left: -0.44em;
  bottom: -0.3em;
  font-size: clamp(96px, 9.7vw, 156px);
}
.mega__tile--02 .mega__num {
  left: 15px;
  top: -0.25em;
  font-size: clamp(44px, 4.1vw, 66px);
}
.mega__body {
  position: absolute;
  bottom: 16px;
  display: grid;
  gap: 8px;
}
.mega__tile--01 .mega__body {
  left: 25.7%; /* 149 / 580 */
  right: 56px;
}
.mega__tile--02 .mega__body {
  left: 19px;
  right: 40px;
}
.mega__name {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(0.875rem, 0.4rem + 0.9vw, 1.3125rem);
  line-height: 1.1;
  text-transform: uppercase;
}
.mega__desc {
  max-width: 36ch;
  font-size: 0.78125rem;
  line-height: 1.25;
  color: rgb(255 255 255 / 0.9);
}
.mega__arrow {
  --sg-size: clamp(22px, 2vw, 30px);
  position: absolute;
  top: 17px;
  right: 16px;
  color: #fff;
}
.mega__tile a:hover img,
.mega__tile a:focus-visible img {
  transform: scale(1.04);
}
.mega__tile a:hover .mega__arrow,
.mega__tile a:focus-visible .mega__arrow {
  transform: translate(3px, -3px);
}
.mega__tile a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -5px;
}

/* --- Utility: phone block (icon spans both lines) + CTA */
.site-header__utility {
  flex: none;
  display: flex;
  align-items: center;
  gap: clamp(16px, 1.6vw, 26px);
}
.phone-block {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-block: 4px;
  color: var(--fg);
}
.phone-icon {
  flex: none;
  width: 17px;
  height: 30px; /* = both text lines */
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linejoin: round;
}
.phone-icon__dot {
  fill: var(--c-copper);
  stroke: none;
}
.phone-block__lines {
  display: grid;
  width: max-content;
  line-height: 1.2;
}
.phone-block__number {
  font-weight: 600;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
/* the hours line is spread to exactly the width of the number above */
.phone-block__hours {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--fg-muted);
}
.phone-block:hover .phone-block__number,
.phone-block:focus-visible .phone-block__number {
  text-decoration: underline;
  text-decoration-color: var(--c-copper);
  text-underline-offset: 4px;
}

.site-header__compact {
  display: none;
  margin-left: auto;
  align-items: center;
  gap: 6px;
}
.site-header__call {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg);
}
.site-header__call .phone-icon {
  width: 11px;
  height: 22px;
}

/* --- Menu toggle (two precise bars) */
.menu-toggle {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
}
.menu-toggle__bars,
.menu-toggle__bars::before {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--fg);
  transition: background-color 420ms var(--ease-out);
}
.menu-toggle__bars {
  position: relative;
  transform: translateY(-4px);
}
.menu-toggle__bars::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 16px;
}

/* --- Side drawer (mobile + tablet) */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 70;
}
.drawer[hidden] {
  display: none;
}
.drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0.5);
  animation: fade-in var(--t-mid) var(--ease-out);
}
.drawer__panel {
  --fg: var(--c-ink);
  --fg-muted: var(--c-steel-500);
  --line-strong: var(--c-steel-300);
  --focus: var(--c-precision);
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 88vw);
  display: flex;
  flex-direction: column;
  gap: 32px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 clamp(20px, 5vw, 32px) 32px;
  background: var(--c-white);
  color: var(--fg);
  box-shadow: -24px 0 60px -20px rgb(0 0 0 / 0.4);
  animation: drawer-in 340ms var(--ease-out);
}
.drawer.is-closing .drawer__panel {
  animation: drawer-out 220ms var(--ease-inout) forwards;
}
.drawer.is-closing .drawer__backdrop {
  animation: fade-out 220ms var(--ease-inout) forwards;
}
@keyframes drawer-in {
  from {
    transform: translateX(100%);
  }
}
@keyframes drawer-out {
  to {
    transform: translateX(100%);
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes fade-out {
  to {
    opacity: 0;
  }
}
.drawer__head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  background: var(--c-white);
  border-bottom: 1px solid var(--c-line);
}
.drawer__logo {
  width: 150px;
  height: auto;
}
.drawer__close {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: -10px;
}
.drawer__close svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}
.drawer__nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  font-family: var(--f-display);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}
.drawer__nav > ul > li {
  border-bottom: 1px solid var(--c-line);
}
.drawer__nav a[aria-current='page'] {
  color: var(--c-precision);
}
.drawer__nav a[aria-current='page']::after {
  content: '';
  width: 7px;
  height: 7px;
  background: var(--c-copper);
}
.drawer__row {
  display: flex;
  align-items: center;
}
.drawer__row a {
  flex: 1;
}
.drawer__sub-toggle {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: -10px;
}
.drawer__sub-toggle svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  transition: transform var(--t-mid) var(--ease-out);
}
.drawer__sub-toggle[aria-expanded='true'] svg {
  transform: rotate(180deg);
}
.drawer__sub {
  padding: 0 0 12px 2px;
}
.drawer__sub a {
  justify-content: flex-start;
  gap: 12px;
  min-height: 46px;
  font-family: var(--f-text);
  font-size: 0.9375rem;
  font-weight: 600;
  text-transform: none;
}
.drawer__sub .tabular {
  color: var(--c-precision);
  font-size: 0.75rem;
}
.drawer__contact {
  display: grid;
  gap: 24px;
}
.drawer__list {
  display: grid;
  gap: 14px;
}
.drawer__list > div {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 12px;
}
.drawer__list dt {
  padding-top: 3px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-steel-500);
}
.drawer__list dd a {
  font-weight: 600;
  font-size: 1.0625rem;
  font-variant-numeric: tabular-nums;
}
.drawer__list .muted {
  font-size: 0.8125rem;
  color: var(--c-steel-500);
}

/* --- Breakpoints */
@media (max-width: 1399px) {
  .phone-block__lines {
    display: none;
  }
  .phone-block {
    width: 44px;
    height: 44px;
    justify-content: center;
    border: 1px solid var(--line-strong);
  }
  .phone-block .phone-icon {
    width: 11px;
    height: 22px;
  }
}
@media (max-width: 1199px) {
  .site-nav,
  .site-header__utility {
    display: none;
  }
  .site-header__compact {
    display: flex;
  }
}
@media (min-width: 1200px) {
  .drawer {
    display: none !important;
  }
}
@media (max-width: 419px) {
  .site-header__call-label {
    display: none;
  }
  .site-header__call {
    width: 44px;
    padding: 0;
    justify-content: center;
  }
  .site-header__logo {
    width: min(170px, 48vw);
  }
}
@media (prefers-reduced-motion: reduce) {
  .drawer__panel,
  .drawer__backdrop,
  .mega.is-open {
    animation: none;
  }
}
