/* Space between editorial topics and adjacent content. */
#site-content {
  --topic-gap: 120px;
  --topic-half-previous-gap: 40px;
}

#site-content .mk-heading-label {
  display: block;
  margin-block: 0 var(--mk-eyebrow-gap, 20px);
  color: #6d5b47;
  font: 500 11px/1.5 "Space Grotesk", Arial, sans-serif;
  letter-spacing: .14em;
  text-transform: uppercase;
}

body.hp-site #site-content .mk-privacy-copy .mk-heading-label:has(+ h2) {
  margin-block-start: 56px;
}

body.hp-site #site-content .mk-privacy-copy .mk-heading-label + h2 {
  margin-block-start: 0;
}

/* Content on one background can share the gap with the previous section. */
#site-content .hp-gallery__section > .hp-gallery__inner:has(> .hp-gallery__heading :is(h1, h2, h3)),
.mk-about #site-content .mk-about-pair-start + .mk-about-pair-end:has(.mk-about-heading :is(h1, h2, h3)) {
  padding-block-start: calc(var(--topic-gap) - var(--topic-half-previous-gap));
}

#site-content .ad-section + .ad-mistakes:has(.ad-mistakes-title) {
  border-block-start: 0;
  padding-block-start: calc(var(--topic-gap) - var(--topic-half-previous-gap));
}

/* These adjacent sections meet at the visible end of the preceding content. */
.mk-kitchen-category[data-category-design] #site-content section.mk-brown-intro + .mk-category-copy:has(.mk-category-copy__grid h2),
.mk-kitchen-category[data-category-design] #site-content section.mk-workshop-gallery + .mk-brown-tips:has(h3),
.mk-kitchen-category[data-category-design] #site-content section.mk-category-continuation + .mk-brown-project:has(.mk-brown-project__heading h3),
.mk-kitchen-category[data-category-design] #site-content section.mk-category-copy + .mk-brown-project:has(.mk-brown-project__heading h3),
.mk-kitchen-category[data-category-design] #site-content section.mk-workshop-gallery + .mk-brown-project:has(.mk-brown-project__heading h3),
.mk-kitchen-category[data-category-design] #site-content section.mk-brown-combinations + .mk-category-copy:has(.mk-category-copy__grid :is(h2, h3)),
#site-content .ad-hero + .ad-section:has(h2),
.mk-design #site-content section.mk-design-step:has(.mk-design-copy-grid h3),
.mk-design #site-content #navrh-kuchyne-od-dizajne:has([data-sk-text-intro] h3),
.mk-workshop #site-content #vyroba-nabytku-na-mieru-vyhody:has(.mk-workshop-heading h3),
.mk-workshop #site-content #inspirujte-sa-nasimi-projektmi:has([data-sk-text-intro] h3) {
  padding-block-start: var(--topic-gap);
}

.mk-kitchen-category[data-category-design] #site-content section.mk-workshop-gallery:has(+ .mk-brown-project .mk-brown-project__heading h3),
.mk-kitchen-category[data-category-design] #site-content section.mk-brown-combinations:has(+ .mk-category-copy .mk-category-copy__grid :is(h2, h3)),
.mk-kitchen-category[data-category-design] #site-content section.mk-category-copy:has(+ .mk-brown-project .mk-brown-project__heading h3) {
  padding-block-end: 0;
}

/* A band takes the topic gap on the side where its own heading starts. */
#site-content .hp-intro > .hp-intro__inner:has(.hp-intro__heading h2),
#site-content .hp-process > .hp-process__inner:has(.hp-process__heading h2),
#site-content .hp-gallery-categories[data-card-section] .hp-gallery__inner:has(.hp-gallery-categories__heading h2),
#site-content .hp-services__related > .hp-services__inner:has(.hp-services__related-heading h2),
#site-content .ad-experience > .ad-section:has(h2),
.mk-about #site-content section.mk-about-pair-start:has(.mk-about-heading h3),
.mk-design #site-content .mk-design-consultation:has(h2),
.mk-refresh #site-content.mk-price-content :is(#kolko-stoji, #porovnanie):has(h2),
.mk-refresh #site-content.mk-price-content #co-ovplyvnuje-cenu > .price-section:has(h2),
.mk-workshop #site-content section.mk-workshop-range:has(.mk-workshop-heading h3),
#site-content .mk-privacy-copy + .mk-privacy-gallery #kategorie-kuchyn .hp-gallery__inner:has(h2) {
  padding-block-start: var(--topic-gap);
}

.mk-refresh #site-content.mk-price-content .price-projects:has(.price-section-heading h2) {
  padding-block-start: calc(var(--topic-gap) - 1px);
}

/* Colour page slideshows already end with a 40px outer margin. */
.mk-kitchen-category[data-category-design] #site-content section.slider.alt + section.mk-brown-combinations:has(.mk-category-copy__grid :is(h2, h3)) {
  padding-block-start: calc(var(--topic-gap) - var(--topic-half-previous-gap));
}

/* The first heading in each group is measured from the incoming side of the section. */
.mk-kitchens #site-content :is(.mk-kitchens-white-group, .mk-kitchens-warm-group) .mk-kitchens-topic:first-child:has(h2) {
  padding-block-start: var(--topic-gap);
}

.mk-kitchens #site-content :is(.mk-kitchens-white-group, .mk-kitchens-warm-group) .mk-kitchens-topic + .mk-kitchens-topic:has(h2) {
  border-block-start: 0;
  padding-block-start: calc(var(--topic-gap) - var(--topic-half-previous-gap));
}

/* The contact heading includes the label's 17.6px line box and its trailing gap. */
#site-content .uf-contact > .uf-shell {
  padding-block: calc(var(--topic-gap) - 17.6px - var(--mk-eyebrow-gap)) var(--topic-gap);
}

/* The billing divider follows the end of the form and contact details. */
body.hp-site #site-content .uf-contact .contact-billing:has(#contact-billing-heading) {
  margin-block-start: 60px;
}

/* FAQ owns both sides, including the shared gap next to a photographic CTA. */
body #site-content section.mk-faq-system[data-faq-system="standard"]:not(#faq-nabytok-na-mieru-dizajne-a-dknabytok),
.mk-about #site-content #faq-nabytok-na-mieru-dizajne-a-dknabytok {
  padding-block: var(--topic-gap);
}

.mk-about #site-content #faq-nabytok-na-mieru-dizajne-a-dknabytok .faq-list {
  padding-block-start: 0;
}

/* Photographic banners start at the end of the preceding section's outer gap. */
.mk-kitchen-category[data-category-design] #site-content .mk-brown-tips:has(+ #fullScreenBg),
.mk-about #site-content #vas-styl:has(+ #fullScreenBg),
.mk-design #site-content .mk-design-pillars:has(+ #fullScreenBg) {
  padding-block-end: var(--topic-gap);
}

.mk-kitchen-category[data-category-design] #site-content .mk-brown-tips:has(+ #fullScreenBg) .mk-category-copy__body > :last-child {
  margin-block-end: 0;
}

/* Full-width CTA bands measure their inner space from the background edges. */
#site-content .ad-cta,
.mk-refresh #site-content.mk-price-content .price-cta {
  padding-block: var(--topic-gap);
}

#site-content .hp-contact > .hp-contact__inner,
#site-content .uf-quote-section > .uf-quote-grid {
  padding-block: var(--topic-gap);
}

/* End the coloured band after the last content row. Adjacent rows on the same band share it. */
#site-content .hp-production > .hp-production__inner,
#site-content .hp-process > .hp-process__inner,
#site-content .hp-gallery__section > .hp-gallery__inner,
#site-content section.hp-gallery-categories[data-card-section] > .hp-gallery__inner,
#site-content .hp-services__related > .hp-services__inner,
#site-content .ad-mistakes:has(+ .ad-experience),
#site-content .ad-experience > .ad-section,
.mk-about #site-content .mk-about-pair-end.mk-workshop-band,
.mk-design #site-content .mk-design-consultation,
.mk-design #site-content section.mk-design-intro:has(+ .mk-design-consultation),
.mk-workshop #site-content section.mk-workshop-range,
.mk-workshop #site-content #inspirujte-sa-nasimi-projektmi:has(+ .mk-workshop-related),
.mk-kitchens #site-content :is(.mk-kitchens-white-group, .mk-kitchens-warm-group) .mk-kitchens-topic:last-child,
.mk-refresh #site-content.mk-price-content #kolko-stoji,
.mk-refresh #site-content.mk-price-content #co-ovplyvnuje-cenu > .price-section,
.mk-refresh #site-content.mk-price-content .price-story:has(+ .price-faq-section) > .price-section {
  padding-block-end: var(--topic-gap);
}

/* Out-of-flow project navigation can sit between the hero and the intro in the DOM. */
.mk-kitchen-category[data-category-design] #site-content section.mk-brown-intro:has(.mk-brown-intro__copy :is(h1, h2)),
.mk-about #site-content #o-nas:has(.mk-about-heading :is(h1, h2)),
.mk-design #site-content .mk-design-intro:has(.mk-design-copy-grid :is(h1, h2)) {
  padding-block-start: var(--topic-gap);
}

/* Profile padding belongs to the surrounding content, outside the portrait and card. */
.mk-kitchen-category[data-category-design] #site-content .mk-brown-designer[data-sk-designer] {
  margin-block-start: var(--topic-gap);
}

.mk-kitchen-category[data-category-design] #site-content section:is(.mk-category-copy, .mk-brown-intro):has(+ section.slider.alt) {
  padding-block-end: calc(var(--topic-gap) - var(--topic-half-previous-gap));
}

/* The photos own the incoming gap. A following text block owns the outgoing gap. */
.mk-kitchen-category[data-category-design] #site-content section.mk-brown-project + section.mk-workshop-gallery,
.mk-design #site-content section.mk-design-step + :is(section.mk-workshop-gallery, section.mk-design-plans, section.mk-design-tour),
.mk-workshop #site-content .hp-process + section.mk-workshop-gallery,
.mk-workshop #site-content section.mk-workshop-gallery + section.workshop-reasons {
  padding-block-start: var(--topic-gap);
}

.mk-kitchen-category[data-category-design] #site-content section.mk-workshop-gallery:has(+ .mk-category-continuation) {
  padding-block-end: var(--topic-gap);
}

.mk-about #site-content #nas-tim {
  padding-block: var(--topic-gap);
}

#site-content .hp-gallery__section .hp-gallery__heading,
.mk-refresh #site-content.mk-price-content .price-projects .price-section-heading {
  margin-block-end: var(--topic-gap);
}

#site-content .hp-gallery__section .hp-gallery-more {
  margin-block-start: var(--topic-gap);
  padding-block-start: 0;
}

.mk-refresh #site-content.mk-price-content .price-projects {
  padding-block-end: var(--topic-gap);
}

/* Text paired with a heading has one gap before its follow-up cards or caption. */
#site-content .hp-intro__lead + .hp-intro__benefits,
.mk-kitchen-category[data-category-design] #site-content section.mk-brown-combinations .mk-brown-combinations__grid {
  margin-block-start: var(--topic-gap);
}

.mk-kitchens #site-content .projects-title:has(.mk-kitchens-intro),
.mk-design #site-content #navrh-kuchyne-od-dizajne [data-sk-text-intro] {
  margin-block-end: var(--topic-gap);
}

/* These introductions keep a shorter gap before their own cards or comparison. */
#site-content section.hp-gallery-categories[data-card-section] .hp-gallery-categories__heading,
.mk-workshop #site-content :is(#vyroba-nabytku-na-mieru-vyhody, .mk-workshop-range) .mk-workshop-heading[data-sk-text-intro],
.mk-refresh #site-content.mk-price-content #porovnanie .price-section-heading {
  margin-block-end: 40px;
}

/* Measure from the last line of the taller column when the intro sits side by side. */
@media (min-width: 901px) {
  .mk-workshop #site-content :is(#vyroba-nabytku-na-mieru-vyhody, .mk-workshop-range) .mk-workshop-heading[data-sk-text-intro] h3,
  .mk-refresh #site-content.mk-price-content #porovnanie .price-section-heading h2 {
    margin-block-end: 0;
  }
}

.mk-kitchens #site-content section.projects:has(.mk-kitchens-intro) {
  padding-block-start: var(--topic-gap);
}

.mk-kitchens #site-content .projects-title.alt:has(.mk-kitchens-white-group) {
  margin-block-start: 0;
}

/* Keep the project anchor at the end of the grid without adding an empty row. */
.mk-kitchens #site-content .js-projects-ajax {
  position: relative;
}

.mk-kitchens #site-content .js-projects-ajax > .js-infi {
  position: absolute;
  inset-block-end: 0;
  inset-inline: 0;
}

.mk-kitchen-category[data-category-design] #site-content section.mk-category-copy:is(.mk-brown-combinations, :has(+ .mk-brown-project)) .mk-category-copy__body > :last-child,
.mk-kitchen-category[data-category-design] #site-content section.mk-category-copy:is(.mk-brown-combinations, :has(+ .mk-brown-project)) .mk-category-copy__body > :is(ul, ol):last-child > li:last-child {
  margin-block-end: 0;
}

/* Photo and copy share one outer rhythm, including when the tracks stack. */
#site-content .hp-gallery-story-section > .hp-gallery__inner,
#site-content .hp-services__design-section > .hp-services__inner {
  padding-block: var(--topic-gap);
}

#site-content .hp-production > .hp-production__inner,
.mk-workshop #site-content section.mk-workshop-intro:has(.mk-workshop-intro__grid[data-sk-photo-copy]),
.mk-design #site-content #od-navrhu-k-realizacii-kuchyne:has([data-sk-photo-copy]),
.mk-refresh #site-content.mk-price-content .price-story > .price-section:has(.price-story-grid) {
  padding-block-start: var(--topic-gap);
}

#site-content .hp-production__features {
  margin-block-start: var(--topic-gap);
}

.mk-workshop #site-content section.mk-workshop-intro:has(+ .hp-process) {
  padding-block-end: var(--topic-gap);
}

#site-content .ad-workshop[data-sk-photo-copy] {
  margin-block: var(--topic-gap);
}

/* The video starts one gap after the photo and copy. */
.mk-workshop #site-content section.workshop-reasons:has([data-sk-text-media]) + #video-vyroby {
  padding-block-start: var(--topic-gap);
}

/* The YouTube link sits inside the space measured from the player. */
.mk-workshop #site-content #video-vyroby p.mk-workshop-video-link {
  box-sizing: border-box;
  min-block-size: var(--topic-gap);
  margin-block: 0;
  padding-block-start: var(--sk-video-link-gap);
}

.mk-workshop #site-content #video-vyroby:has(.mk-workshop-video-link) + #vyroba-nabytku-na-mieru-vyhody {
  padding-block-start: 0;
}

.mk-workshop #site-content #vyroba-nabytku-na-mieru-vyhody:has(+ .mk-workshop-range) {
  padding-block-end: var(--topic-gap);
}
