/*
 * Frontend + Editor: apply offset when a block has the data attribute.
 * Longevity: Gutenberg markup can change slightly; we therefore also target common nested sticky
 * elements and use logical properties where available.
 */

/* 1) If the sticky element itself carries the attribute */
[data-wolff-sticky-top] {
  /* If theme already sets position: sticky via Gutenberg, we only adjust top inset. */
  top: var(--wolff-sticky-top, auto);
  inset-block-start: var(--wolff-sticky-top, auto);
}

/* 2) If the sticky class lands on a nested wrapper, still apply the same offset */
[data-wolff-sticky-top] .is-position-sticky,
[data-wolff-sticky-top].is-position-sticky {
  top: var(--wolff-sticky-top, auto);
  inset-block-start: var(--wolff-sticky-top, auto);
}

/* 3) Optional future-proof alias (non-breaking) */
[data-avs-sticky-top] {
  top: var(--wolff-sticky-top, auto);
  inset-block-start: var(--wolff-sticky-top, auto);
}

/* Make sure calc() works for admin bar (when present). Gutenberg defines this var in many contexts. */
:root {
  --wolff-adminbar-height: var(--wp-admin--admin-bar--height, 0px);
}
