:root { --wp-admin-bar-offset: 0px; --header-height: 72px; /* --sticky-header-bg: #fff; */ }

/* Header-Basis */
.site-header, header.site-header, header[role="banner"], #site-header, header#site-header {
  z-index: 9999;
  will-change: transform, height, box-shadow;
  transition: box-shadow .2s ease, height .2s ease, padding .2s ease, background-color .2s ease;
}

/* Fixiert, sobald „stuck“ */
.is-stuck {
  position: fixed !important;
  top: var(--wp-admin-bar-offset, 0px) !important;
  left: 0 !important; right: 0 !important;
  width: 100% !important;
  margin: 0 !important;
  transform: none !important; /* verhindert wegrutschen durch Theme-Animationen */
  box-shadow: 0 6px 24px rgba(0,0,0,.08);
  background: var(--sticky-header-bg, inherit);
}

/* Leichter Shrink */
.is-shrunk {
  padding-top: clamp(6px, 1.2vh, 10px);
  padding-bottom: clamp(6px, 1.2vh, 10px);
}

/* Adminbar berücksichtigen */
body.admin-bar .is-stuck {
  top: var(--wp-admin-bar-offset, 32px) !important;
}

/* Gegen verdeckte Anker/Überschriften */
:where(h1,h2,h3,h4,h5,h6,[id]) { 
  scroll-margin-top: calc(var(--header-height) + var(--wp-admin-bar-offset, 0px) + 12px); 
}

/* Debug: rote gestrichelte Linie, wenn aktiv */
.osh-debug .is-stuck { outline: 2px dashed rgba(255,0,0,.6); }
