/**
 * Knowledge base article (0.14.0).
 *
 * Replaces Elementor single 5508 (+ section 11444): the text at a readable
 * measure with a sticky "Op deze pagina" next to it, the advice band (dark
 * green, 60° cut top left, as on expertise detail) or the contact block with
 * the shared modern form, and "Meer uit de kennisbank". Hero and cards:
 * kb-base.css; the form: forms/form.css + forms/contact-form.css.
 *
 * Breakpoints: laptop ≤1366, tablet ≤1024, mobile ≤767.
 */

/* ── Article: TOC left (sticky), text right ───────────────────────────── */
.r4y-template .r4y-kb-article {
    padding-block: var(--r4y-kb-space);
}
.r4y-template .r4y-kb-article__inner--toc {
    display: grid;
    grid-template-columns: minmax(240px, 3fr) minmax(0, 9fr);
    gap: 40px clamp(40px, 5vw, 80px);
    align-items: start;
}
/* Next to the TOC the text fills the rest of the container (feedback Alex 2026-11-08: 68ch felt
   cramped); without a TOC it keeps a readable maximum width. */
.r4y-template .r4y-kb-article__body {
    min-width: 0;
    max-width: 880px;
}
.r4y-template .r4y-kb-article__inner--toc .r4y-kb-article__body {
    max-width: none;
}

/* "Op deze pagina": crème card with a gold top rule (as on expertise detail). */
.r4y-template .r4y-kb-article__toc {
    position: sticky;
    top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--r4y-kb-header) + 32px);
    max-height: calc(100vh - var(--wp-admin--admin-bar--height, 0px) - var(--r4y-kb-header) - 64px);
    overflow-y: auto;
    padding: 24px 26px;
    border-top: 2px solid var(--r4y-kit-secondary);
    background-color: var(--r4y-kit-accent);
    scrollbar-width: thin;
}
.r4y-template .r4y-kb .r4y-kb-article__toc-title {
    margin-bottom: 14px;
    font-family: var(--r4y-font-body);
    font-size: 12px;
    font-weight: var(--r4y-fw-semibold);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--r4y-kit-secondary);
}
.r4y-template .r4y-main .r4y-kb-article__toc-list {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: r4y-kb-toc;
}
.r4y-template .r4y-kb-article__toc-list > li {
    counter-increment: r4y-kb-toc;
}
.r4y-template .r4y-kb-article__toc-list > li + li {
    border-top: 1px solid var(--r4y-color-field-border);
}
.r4y-template a.r4y-kb-article__toc-link {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    padding: 10px 0;
    font-size: var(--r4y-fs-sm);
    font-weight: var(--r4y-fw-regular);
    line-height: 1.4;
    color: var(--r4y-kit-primary);
    text-decoration: none;
    transition: color var(--r4y-transition);
}
.r4y-template a.r4y-kb-article__toc-link::before {
    content: counter(r4y-kb-toc, decimal-leading-zero);
    font-size: 12px;
    font-weight: var(--r4y-fw-semibold);
    font-variant-numeric: tabular-nums;
    line-height: 1.65;
    color: var(--r4y-kit-secondary);
}
.r4y-template a.r4y-kb-article__toc-link:hover,
.r4y-template a.r4y-kb-article__toc-link.is-current { color: var(--r4y-kit-secondary); }
.r4y-template a.r4y-kb-article__toc-link.is-current { font-weight: var(--r4y-fw-medium); }
.r4y-template a.r4y-kb-article__toc-link:focus-visible {
    outline: 2px solid var(--r4y-kit-secondary);
    outline-offset: 2px;
}

/* ── The text ─────────────────────────────────────────────────────────── */
.r4y-template .r4y-kb .r4y-kb-article__lead {
    margin-bottom: 48px;
    padding-bottom: 48px;
    border-bottom: 1px solid var(--r4y-color-field-border);
    font-family: var(--r4y-font-heading);
    font-size: clamp(21px, 1.9vw, 26px);
    font-weight: var(--r4y-fw-light);
    line-height: 1.4;
    color: var(--r4y-kit-primary);
}
.r4y-template .r4y-kb .r4y-kb-article__lead > * + * { margin-top: 0.8em; }

.r4y-template .r4y-kb .r4y-kb-article__content {
    font-size: var(--r4y-fs-md);
    font-weight: var(--r4y-fw-light);
    line-height: 1.8;
    color: var(--r4y-color-text);
}
.r4y-template .r4y-kb .r4y-kb-article__content > :first-child { margin-top: 0; }
.r4y-template .r4y-kb .r4y-kb-article__content > :last-child { margin-bottom: 0; }
/* Spacing from the CSS (the empty spacer paragraphs are removed in PHP). */
.r4y-template .r4y-kb .r4y-kb-article__content > * + * { margin-top: 1.1em; }
.r4y-template .r4y-kb .r4y-kb-article__content h2 {
    margin-top: 2.2em;
    font-family: var(--r4y-font-heading);
    font-size: clamp(28px, 2.6vw, 38px);
    font-weight: var(--r4y-fw-light);
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--r4y-kit-primary);
    text-wrap: balance;
}
.r4y-template .r4y-kb .r4y-kb-article__content :is(h3, h4, h5) {
    margin-top: 2em;
    font-family: var(--r4y-font-heading);
    font-size: clamp(21px, 1.8vw, 25px);
    font-weight: var(--r4y-fw-regular);
    line-height: 1.25;
    color: var(--r4y-kit-primary);
    text-wrap: balance;
}
.r4y-template .r4y-kb .r4y-kb-article__content :is(h2, h3, h4) :is(strong, b) { font-weight: inherit; }
.r4y-template .r4y-kb .r4y-kb-article__content :is(h2, h3, h4) + * { margin-top: 0.6em; }
.r4y-template .r4y-kb .r4y-kb-article__content :is(h2, h3) {
    scroll-margin-top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--r4y-kb-header) + 32px);
}
.r4y-template .r4y-kb .r4y-kb-article__content :is(ul, ol) { padding-inline-start: 22px; }
.r4y-template .r4y-kb .r4y-kb-article__content ul { list-style-type: disc; }
.r4y-template .r4y-kb .r4y-kb-article__content li + li { margin-top: 0.4em; }
.r4y-template .r4y-kb .r4y-kb-article__content li > :is(ul, ol) { margin-top: 0.4em; }
.r4y-template .r4y-kb .r4y-kb-article__content li::marker { color: var(--r4y-kit-secondary); }
.r4y-template .r4y-kb .r4y-kb-article__content a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--r4y-kit-secondary);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    overflow-wrap: anywhere; /* long DOI links in the source lists */
    transition: color var(--r4y-transition);
}
.r4y-template .r4y-kb .r4y-kb-article__content a:hover { color: var(--r4y-kit-secondary); }
.r4y-template .r4y-kb .r4y-kb-article__content blockquote {
    margin-inline: 0;
    padding: 4px 0 4px 28px;
    border-left: 2px solid var(--r4y-kit-secondary);
    font-family: var(--r4y-font-heading);
    font-size: clamp(19px, 1.6vw, 23px);
    font-style: normal;
    line-height: 1.45;
    color: var(--r4y-kit-primary);
}
.r4y-template .r4y-kb .r4y-kb-article__content blockquote > * + * { margin-top: 0.6em; }
/* The closing quote ("Of zoals Jung het verwoordde: …"), set as an h3/h4 in the editor. */
.r4y-template .r4y-kb .r4y-kb-article__content .r4y-kb-article__closing {
    margin-top: 2.4em;
    font-family: var(--r4y-font-heading);
    font-size: clamp(21px, 1.9vw, 26px);
    font-weight: var(--r4y-fw-light);
    line-height: 1.4;
    color: var(--r4y-kit-primary);
    text-wrap: pretty;
}
.r4y-template .r4y-kb .r4y-kb-article__closing::before {
    content: "";
    display: block;
    width: 32px;
    height: 1px;
    margin-bottom: 20px;
    background-color: var(--r4y-kit-secondary);
}
.r4y-template .r4y-kb .r4y-kb-article__closing :is(strong, b) { font-weight: inherit; }
.r4y-template .r4y-kb .r4y-kb-article__content hr {
    height: 1px;
    margin-block: 2.4em;
    border: 0;
    background-color: var(--r4y-color-field-border);
}
.r4y-template .r4y-kb .r4y-kb-article__content img { max-width: 100%; height: auto; }

/* Tables: hairline rows, a crème header with a gold rule, scroll sideways on small screens.
   Header = <th> or the <thead> row (all pasted tables have one, 2026-11-08). */
.r4y-template .r4y-kb .r4y-kb-article__content > .r4y-kb-article__table { margin-block: 2em; }
.r4y-template .r4y-kb-article__table {
    overflow-x: auto;
    border-block: 1px solid var(--r4y-color-field-border);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.r4y-template .r4y-kb .r4y-kb-article__table table {
    width: 100%;
    min-width: 560px;
    margin: 0;
    border: 0;
    border-collapse: collapse;
    font-size: 15px;
    font-weight: var(--r4y-fw-light);
    line-height: 1.55;
}
.r4y-template .r4y-kb .r4y-kb-article__table :is(th, td) {
    padding: 14px 18px;
    border: 0;
    border-top: 1px solid var(--r4y-color-field-border);
    background: none;
    text-align: start;
    vertical-align: top;
}
.r4y-template .r4y-kb .r4y-kb-article__table tr:first-child > :is(th, td) { border-top: 0; }
.r4y-template .r4y-kb .r4y-kb-article__table :is(td, th) > p { margin: 0; }
.r4y-template .r4y-kb .r4y-kb-article__table :is(td, th) :is(strong, b) {
    font-weight: var(--r4y-fw-semibold);
    color: var(--r4y-kit-primary);
}
/* Header row */
.r4y-template .r4y-kb .r4y-kb-article__table :is(th, thead td) {
    border-bottom: 2px solid var(--r4y-kit-secondary);
    background-color: var(--r4y-kit-accent);
    font-size: 12px;
    font-weight: var(--r4y-fw-semibold);
    line-height: 1.4;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--r4y-kit-primary);
}
.r4y-template .r4y-kb .r4y-kb-article__table :is(th, thead td) :is(strong, b) { font-weight: inherit; }
/* Grouped rows: an empty first cell continues the label above ("Techniek, bouw & industrie"),
   so that cell gets no line and the group reads as one block; a new group gets a darker line. */
.r4y-template .r4y-kb .r4y-kb-article__table tbody tr:has(> td:first-child:empty) > td:first-child {
    border-top-color: transparent;
}
.r4y-template .r4y-kb .r4y-kb-article__table tbody:has(> tr > td:first-child:empty) > tr:not(:first-child):has(> td:first-child:not(:empty)) > td {
    border-top-color: var(--r4y-color-field-hover);
}
.r4y-template .r4y-kb .r4y-kb-article__cta { margin-top: 48px; }

/* ── Adviesgesprek (section 11444): dark green band, cut top left ─────── */
.r4y-template .r4y-kb-advice {
    position: relative;
    overflow: hidden;
    margin-inline: var(--r4y-gutter);
    padding-block: var(--r4y-kb-space);
    background-color: var(--r4y-kit-primary);
    clip-path: var(--r4y-kb-cut-tl);
}
.r4y-template .r4y-kb-advice__inner {
    position: relative;
    z-index: 1;
    padding-inline: clamp(0px, 4vw, 60px);
}
.r4y-template .r4y-kb .r4y-kb-advice .r4y-kb__heading,
.r4y-template .r4y-kb .r4y-kb-advice__text { color: var(--r4y-kit-white); }
.r4y-template .r4y-kb .r4y-kb-advice__text {
    max-width: 62ch;
    margin: 20px 0 32px;
    font-size: 17px;
    font-weight: var(--r4y-fw-light);
    line-height: 1.7;
}
.r4y-template .r4y-kb-advice a.r4y-button--primary { background-color: var(--r4y-kit-secondary); }
.r4y-template .r4y-kb-advice a.r4y-button--primary:hover,
.r4y-template .r4y-kb-advice a.r4y-button--primary:focus { background-color: var(--r4y-kit-white); color: var(--r4y-kit-primary); }
.r4y-template .r4y-kb-advice__mark {
    position: absolute;
    right: -40px;
    bottom: -90px;
    width: clamp(260px, 34vw, 520px);
    color: var(--r4y-kit-secondary);
    opacity: 0.55;
    pointer-events: none;
}

/* ── Contact: crème band, text left, the shared form right ────────────── */
.r4y-template .r4y-kb-contact {
    padding-block: var(--r4y-kb-space);
    scroll-margin-top: var(--r4y-kb-header);
    background-color: var(--r4y-kit-accent);
}
.r4y-template .r4y-kb-contact__inner {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 40px clamp(40px, 7vw, 120px);
    align-items: start;
}
.r4y-template .r4y-kb-contact__mark {
    display: block;
    width: 44px;
    margin-bottom: 24px;
    color: var(--r4y-kit-secondary);
}
.r4y-template .r4y-kb .r4y-kb-contact__text {
    max-width: 44ch;
    margin-top: 20px;
    font-size: 17px;
    font-weight: var(--r4y-fw-light);
    line-height: 1.7;
}

/* ── Meer uit de kennisbank ───────────────────────────────────────────── */
.r4y-template .r4y-kb-related {
    padding-block: var(--r4y-kb-space);
}
.r4y-template .r4y-kb-related__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px 40px;
    margin-bottom: 40px;
}
.r4y-template a.r4y-kb-related__all {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    font-family: var(--r4y-font-body);
    font-weight: var(--r4y-fw-medium);
    color: var(--r4y-kit-primary);
    text-decoration: none;
    transition: color var(--r4y-transition);
}
.r4y-template a.r4y-kb-related__all::after {
    content: "→" / "";
    color: var(--r4y-kit-secondary);
    transition: transform var(--r4y-transition) var(--r4y-ease-out);
}
.r4y-template a.r4y-kb-related__all:hover { color: var(--r4y-kit-secondary); }
.r4y-template a.r4y-kb-related__all:hover::after { transform: translateX(4px); }
.r4y-template a.r4y-kb-related__all:focus-visible {
    outline: 2px solid var(--r4y-kit-secondary);
    outline-offset: 3px;
}

/* ── Tablet ≤1024: TOC above the text, not sticky ────────────────────── */
@media (max-width: 1024px) {
    .r4y-template .r4y-kb-article__inner--toc { grid-template-columns: minmax(0, 1fr); }
    .r4y-template .r4y-kb-article__toc {
        position: static;
        max-width: 560px;
        max-height: none;
    }
    .r4y-template .r4y-kb-contact__inner { grid-template-columns: minmax(0, 1fr); }
    .r4y-template .r4y-kb-related .r4y-kb-grid > :nth-child(3) { display: none; }
}

/* ── Mobile ≤767 ───────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .r4y-template .r4y-kb .r4y-kb-article__lead { margin-bottom: 36px; padding-bottom: 36px; font-size: 20px; }
    .r4y-template .r4y-kb .r4y-kb-article__content { font-size: var(--r4y-fs-base); line-height: 1.7; }
    .r4y-template .r4y-kb .r4y-kb-article__content blockquote { padding-left: 20px; }
    .r4y-template .r4y-kb-advice { margin-inline: 0; }
    .r4y-template .r4y-kb-advice__inner { padding-top: 24px; }
    .r4y-template .r4y-kb-advice__mark { right: -60px; bottom: -50px; width: 240px; opacity: 0.4; }
    .r4y-template .r4y-kb-related .r4y-kb-grid > :nth-child(3) { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
    .r4y-template a.r4y-kb-related__all::after { transition: none; }
}
