/* =========================================================
   PTK HOME BLOCKS v1.2.10 — SCOPED SPACING RESET
   Removes shortcode line boxes without changing the body.
========================================================= */

/* The final visible gap between every PTK home block. */
:where(.ptk-home-section, .ptk-home-hero) {
  margin-block-start: 0 !important;
  margin-block-end: var(--ptk-home-block-gap, 18px) !important;
}

/*
 * WordPress and page builders may add an outer shortcode box. Its inherited
 * line box can create extra vertical space even when the section margin is
 * already correct. Apply the proven 0.05 value only to that outer shell.
 */
:where(
  .wp-block-shortcode,
  .ptk-home-shortcode-wrap,
  .elementor-widget-shortcode,
  .elementor-widget-container
):has(:is(.ptk-home-section, .ptk-home-hero)) {
  margin-block-start: 0 !important;
  margin-block-end: 0 !important;
  padding-block-start: 0 !important;
  padding-block-end: 0 !important;
  line-height: 0.05 !important;
}

/* Restore readable text rhythm inside the actual plugin output. */
:where(
  .wp-block-shortcode,
  .ptk-home-shortcode-wrap,
  .elementor-widget-shortcode,
  .elementor-widget-container
):has(:is(.ptk-home-section, .ptk-home-hero))
  :is(.ptk-home-section, .ptk-home-hero) {
  line-height: 1.5;
}

/* Remove Classic Editor line breaks inserted directly between PTK blocks. */
:is(.ptk-home-section, .ptk-home-hero) + br,
br:has(+ :is(.ptk-home-section, .ptk-home-hero)) {
  display: none !important;
}

/* Remove empty paragraphs (including a paragraph containing one BR) only
   when they sit immediately beside a PTK home block. */
:is(.ptk-home-section, .ptk-home-hero) + p:empty,
:is(.ptk-home-section, .ptk-home-hero) + p:has(> br:only-child),
p:empty:has(+ :is(.ptk-home-section, .ptk-home-hero)),
p:has(> br:only-child):has(+ :is(.ptk-home-section, .ptk-home-hero)) {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 0.05 !important;
}

@media (max-width: 768px) {
  :where(.ptk-home-section, .ptk-home-hero) {
    margin-block-end: var(--ptk-home-block-gap, 18px) !important;
  }
}
