/* One shared surface for content panels, matching the homepage introduction. */
body.kk-text-panels {
    --kk-text-panel-background: rgba(255, 255, 255, .8);
    --kk-text-panel-color: #3c3c3c;
    --kk-text-panel-radius: 7px;
    --kk-text-panel-padding: clamp(20px, 4vw, 48px);
}

/* Keep builder pages transparent around their individual panels. Captions,
   navigation, standalone section headings and sliders are not text panels. */
body.kk-text-panels .kk-text-panel,
body.kk-text-panels .x-main > .hentry > .entry-wrap:not(:has(.cs-content)):not(.kk-text-panel-off),
body.kk-text-panels .cs-content .x-column:has(> .x-text:not(.popisek)):not(.kk-text-panel-off),
body.kk-text-panels .cs-content .x-block-grid-item:has(.entry-summary):not(.kk-text-panel-off) {
    /* Existing builder columns have inline backgrounds and padding. */
    background-color: var(--kk-text-panel-background) !important;
    padding: var(--kk-text-panel-padding) !important;
    border: 0;
    border-radius: var(--kk-text-panel-radius) !important;
    box-shadow: none;
    color: var(--kk-text-panel-color);
    text-shadow: none;
}

/* The legacy CSS paints only sidebar layouts. Let the entry own the panel
   for both sidebar and full-width layouts, without two translucent layers. */
body.kk-text-panels:not(.home) .x-main:is(.left, .right):has(> .hentry > .entry-wrap:not(:has(.cs-content)):not(.kk-text-panel-off)) {
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}

body.kk-text-panels :is(
    .kk-text-panel,
    .x-main > .hentry > .entry-wrap:not(:has(.cs-content)):not(.kk-text-panel-off),
    .cs-content .x-column:has(> .x-text:not(.popisek)):not(.kk-text-panel-off),
    .cs-content .x-block-grid-item:has(.entry-summary):not(.kk-text-panel-off)
) :is(h1, h2, h3, h4, h5, h6, blockquote) {
    color: var(--kk-text-panel-color);
    text-shadow: none;
}

body.kk-text-panels .x-main > .hentry > .entry-wrap:not(:has(.cs-content)):not(.kk-text-panel-off) > .entry-header .entry-title {
    margin-top: 0;
}

/* Magazine cards already have an inner gutter in the legacy CSS. */
body.kk-text-panels .cs-content .x-block-grid-item:has(.entry-summary):not(.kk-text-panel-off) .entry-summary {
    padding: 0;
}
