/*
 * Optional header offset overrides.
 *
 * Usage A (recommended):
 * - Add `etac-no-header-offset` to the body class.
 *   Then global top spacing for fixed header is removed for that page.
 *
 * Usage B (content-only):
 * - Add `etac-no-header-offset-content` to the first section you want
 *   to pull under the fixed header without changing global page spacing.
 */

/* A) Remove global fixed-header spacing for selected pages */
body.etac-no-header-offset .wp-site-blocks {
  padding-top: 0 !important;
}

body.admin-bar.etac-no-header-offset .wp-site-blocks {
  padding-top: 0 !important;
}

/* If global offset is already removed, do not double-shift marked content */
body.etac-no-header-offset .etac-no-header-offset-content {
  margin-top: 0 !important;
}

/* B) Pull only specific content block up under the header */
.etac-no-header-offset-content {
  margin-top: calc(var(--etac-header-h) * -1);
}

body.admin-bar .etac-no-header-offset-content {
  margin-top: calc((var(--etac-header-h) + 32px) * -1);
}

@media (max-width: 782px) {
  body.admin-bar .etac-no-header-offset-content {
    margin-top: calc((var(--etac-header-h) + 46px) * -1);
  }
}

/*
 * Auto mode for modern browsers:
 * if a marked content block exists on the page, remove global offset.
 */
@supports selector(.wp-site-blocks:has(.etac-no-header-offset-content)) {
  .wp-site-blocks:has(.etac-no-header-offset-content) {
    padding-top: 0 !important;
  }

  body.admin-bar .wp-site-blocks:has(.etac-no-header-offset-content) {
    padding-top: 0 !important;
  }

  .etac-no-header-offset-content {
    margin-top: 0 !important;
  }
}
