/* ==========================================================================
   Content edge: the ONE distance from the screen edge to the content column.
   ==========================================================================

   The page container (.container, #primary) is:
     < 768px   full width, 16px side padding
     768px     730px, centred
     1024px    93%, centred
     1280px+   min(1360px, 100vw - 80px), centred   (40px gutters on laptops)

   --zd-edge is that same gutter, measured from the viewport edge. Anything
   that breaks out to full width (.alignfull, 100vw) keeps its BACKGROUND on
   the wrapper and must put its CONTENT back on this line with var(--zd-edge).
   Never hardcode (100vw - 1360px) / 2: it goes negative below 1360px and the
   content then touches the screen edge (bug fixed 2026-12-04).

   Plain CSS, no build. Loaded after the theme stylesheet (inc/register-scripts.php).
   Verify with scripts/edge-check/edge-check.mjs (edges, fingerprint + compare). */

:root {
	--zd-edge: 1rem;
}

@media (min-width: 768px) {
	:root {
		--zd-edge: calc((100vw - 45.625rem) / 2); /* the 730 container */
	}
}

@media (min-width: 1024px) {
	:root {
		--zd-edge: 3.5vw; /* (100% - 93%) / 2 */
	}
}

@media (min-width: 1280px) {
	:root {
		--zd-edge: max(2.5rem, calc((100vw - 85rem) / 2)); /* 1360px, at least 40px */
	}
}

/* 1. Full-width sections that start at the content line (title above a
      carousel, carousels themselves). The carousel still runs off the right. */
.left-padding-container {
	padding-left: var(--zd-edge) !important;
}

/* 2. Full-width core group (modern markup, no __inner-container): the
      background stays edge to edge, its children sit in the container.
      Full-width children (alignfull carousels) still reach both edges,
      because their negative margins are computed from this padded box. */
.wp-block-group.alignfull.is-layout-constrained {
	padding-left: var(--zd-edge);
	padding-right: var(--zd-edge);
}

/* The .pseudo-dashed top/bottom line has width 100% but no `left`, so on a
   padded box it starts at the content edge and overflows the screen by the
   padding (/za-nas/). Pin it to the box edge: still a full-width line. */
.wp-block-group.alignfull.is-layout-constrained.pseudo-dashed.top::after,
.wp-block-group.alignfull.is-layout-constrained.pseudo-dashed.bottom::after {
	left: 0;
}

/* 3. Kadence rows nested in a full-width Kadence column (service template,
      departments, pages built from it). Was contained only from 1280px. */
@media (min-width: 768px) {
	.alignfull > .kt-inside-inner-col > .kb-row-layout-wrap > .kt-row-column-wrap:not(:has(.auto-scroll-carousel)) {
		max-width: calc(100vw - 2 * var(--zd-edge)) !important;
		margin-left: auto;
		margin-right: auto;
	}
}

/* 4. Header on laptops: the menu stylesheet set 1360px after the theme's
      laptop cap and won, so the logo touched the edge at 1280-1439px. */
@media (min-width: 1280px) {
	.site-header .header-wrap .header-container {
		max-width: calc(100vw - 2 * var(--zd-edge)) !important;
	}
}

/* 5. Blocks whose own stylesheet hardcodes the desktop formula from 768px up
      (their phone values are left as they are). */
@media (min-width: 768px) {
	:root .doctors-list__title,
	:root .services-list__scroller,
	:root .doctors-on-shift__header,
	:root .doctors-on-shift__by-doctor {
		padding-left: var(--zd-edge);
	}
}

/* 6. Lab category grid (/lab-tests/, /laboratorni-izsledvania/): 4 columns of
      `1fr` cannot shrink below the longest title, so at 1024-1279 the grid was
      wider than the screen and the page scrolled sideways. Three columns there. */
@media (min-width: 1024px) and (max-width: 1279px) {
	.lab-tests-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/* 7. Dashed-separator strips (service template: cells with .pseudo-dashed):
      Kadence gives every cell 2rem left padding at <=1024px, which made up for
      the missing gutter. With the gutter fixed, the left-hand cells keep it off
      the container line. Drop it for the cells in the left grid column, as on
      desktop (4 columns = 2x2 on tablet, see _general.scss; 3 columns stay 3). */
@media (min-width: 768px) and (max-width: 1024px) {
	.kt-row-column-wrap.kt-has-4-columns.kt-row-layout-equal > .wp-block-kadence-column.pseudo-dashed:nth-child(odd) > .kt-inside-inner-col,
	.kt-row-column-wrap.kt-has-3-columns > .wp-block-kadence-column.pseudo-dashed:first-child > .kt-inside-inner-col,
	.kt-row-column-wrap.kt-has-2-columns > .wp-block-kadence-column.pseudo-dashed:first-child > .kt-inside-inner-col {
		padding-left: 0 !important;
	}
}

/* 8. Phones: rows that sit straight in a padded full-width group were given
      their own side padding in the editor (Kadence "xs" = 1rem) to make up for
      the missing gutter (2008 „АКТУАЛНИ“), and dashed-strip cells (stacked on
      phones, /za-nas/ „Онлайн записване“) the same. The group pads now; drop
      the copy so it is not doubled. Rows with their own background
      keep it (there it is inner padding of the coloured box). */
@media (max-width: 767px) {
	.wp-block-group.alignfull.is-layout-constrained > .kb-row-layout-wrap:not(.kt-row-has-bg) > .kt-row-column-wrap,
	.wp-block-group.alignfull.is-layout-constrained > .wp-block-group > .kb-row-layout-wrap:not(.kt-row-has-bg) > .kt-row-column-wrap,
	.wp-block-group.alignfull.is-layout-constrained .wp-block-kadence-column.pseudo-dashed > .kt-inside-inner-col {
		padding-left: 0 !important;
		padding-right: 0 !important;
	}
}
