*, *::after, *::before {
    padding: 0;
    margin : 0;

    box-sizing: border-box;

    font-size: inherit;
}

/* TYPOGRAPHY: sizes, weights and line heights of the design (see variables.css) */

body {
    font-family: var(--font-family--text);
    font-size: var(--font-size--text);
    font-weight: var(--font-weight--regular);
    line-height: var(--line-height--text);
    letter-spacing: var(--letter-spacing--text);
}

/* Surface: background with the matching text color (see .surface--* in variables.css) */
body,
[class*="surface--"] {
    background-color: var(--surface--background);
    color: var(--surface--text);
}

/*
 * Words longer than the line (e.g. URLs as link text in the privacy policy) break instead of overflowing 320px
 * (WCAG 1.4.10). Only words that don't fit at all are broken, all other text is unchanged. Running text in narrow
 * content elements is hyphenated before (see Text.css).
 */
body {
    overflow-wrap: break-word;
}

/* Long words (e.g. "Ansprechpartner*innen") are hyphenated or broken, so they don't overflow 320px (WCAG 1.4.10) */
:is(h1, h2, h3, h4, h5, h6) {
    letter-spacing: var(--letter-spacing--headline);
    text-wrap: balance;
    hyphens: auto;
    overflow-wrap: break-word;
}

/* Font and weight of h1 and h2 depend on the page layout (sub page / start page, see variables.css) */
h1 {
    font-family: var(--font-family--h1);
    font-size: var(--font-size--h1);
    font-weight: var(--font-weight--h1);
    line-height: var(--line-height--h1);
    word-spacing: var(--word-spacing--h1);
}

h2 {
    font-family: var(--font-family--h2);
    font-size: var(--font-size--h2);
    font-weight: var(--font-weight--h2);
    line-height: var(--line-height--headline);
    word-spacing: var(--word-spacing--h2);
}

/* Font and weight of the sub headlines depend on the program design (see variables.css) */
h3 {
    font-family: var(--font-family--sub-headline);
    font-size: var(--font-size--h3);
    font-weight: var(--font-weight--sub-headline);
    line-height: var(--line-height--sub-headline);
}

:is(h4, h5, h6) {
    font-family: var(--font-family--sub-headline);
    font-size: var(--font-size--h4);
    font-weight: var(--font-weight--sub-headline);
    line-height: var(--line-height--sub-headline);
}

:is(strong, b) {
    font-weight: var(--font-weight--bold);
}

/* Large headline of the start page */
.text--display {
    font-size: var(--font-size--display);
    font-weight: var(--font-weight--bold);
    line-height: var(--line-height--display);
}

/* Intro text: intro of the header (subheader), hero subline and teaser of records */
.text--lead {
    font-size: var(--font-size--text-large);
    line-height: var(--line-height--text-large);
	font-weight: var(--font-weight--bold);
}

/* Small text: paragraphs of the text element (see Text.css), card texts */
.text--small {
    font-size: var(--font-size--text-small);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/*
 * LINKS in the text color of their surface, underlined (they must not be identified by color only, WCAG 1.4.1).
 * Components without underline (buttons, navigations, cards) remove it themselves.
 */
a {
    color: inherit;
    text-decoration-line: underline;
    text-decoration-thickness: var(--text-decoration-thickness--regular);
    text-underline-offset: .2em;
}

/* Visible focus for every link, components may override it */
a:focus-visible {
    outline: var(--outline-width--default) solid currentColor;
    outline-offset: var(--outline-offset--default);
}

/*
 * SKIP LINK to the main content (see Page layout): visually hidden until it is focused, then shown at the top
 * left of the document above the sticky header. Absolute, not fixed: it is the target of the back to top link
 * (#top) as well, the browser doesn't scroll to a fixed element.
 */
a.sr-only:focus-visible {
    position: absolute;
    top: var(--layout--gap--small);
    left: var(--layout--gap--small);
    z-index: 1000;
    width: auto;
    height: auto;
    margin: 0;
    padding: var(--space--xs) var(--padding--default);
    overflow: visible;
    clip: auto;
    white-space: normal;
    border: var(--border-width--default) solid var(--color--dark-grey);
    border-radius: var(--border-radius--round);
    background-color: var(--color--white);
    color: var(--color--dark-grey);
    font-size: var(--font-size--button);
    font-weight: var(--font-weight--bold);
    line-height: var(--line-height--single);
    text-decoration: underline;
    box-shadow: 0 0 0 var(--outline-offset--default) var(--color--white);
    outline-color: var(--color--dark-grey);
}

/*
 * BUTTONS: buttons and button links of the design (E1-E3), one set for all components and the RTE link classes.
 * The components choose the variant in their templates, editors in the RTE link wizard (see Configuration/RTE).
 * - .btn                E1 compact: border dark grey, fully rounded, width by content. All variants are inverted on
 *                       hover (filled dark grey, primary outlined), except the accent
 * - .btn--primary       filled dark grey, hover outlined (e.g. submit of the program filter)
 * - .btn--accent        E3 accent: border orange, hover filled orange with dark grey text
 * - .btn--full          full width of its container, label at the left (e.g. funding type card, design C3)
 * - .btn--wide          E2 full width with icon in a circle at the right, single line (long text is cut with "…"
 *                       inside .btn__label). Icon by link target: arrow (default), .btn--external (arrow ↗, also
 *                       absolute links of the RTE), .btn--download (arrow down, also links to /fileadmin/ of the RTE)
 * - .btn--small         compact padding
 * - .btn--smaller       small text and padding (e.g. filter tags)
 * - .btn--icon          icon in a circle at the right, the icon is a child <span class="btn--icon--open|close|remove">
 * - .btn--social        round social media icon button (G6, H1), the network by .btn--social--facebook|instagram|
 *                       linkedin|tiktok|vimeo|x|website, the link text is hidden visually but stays the accessible name
 * White surface, on the light surfaces (e.g. the light grey section) the buttons take the color of the surface, so they
 * appear transparent with border only. Inverted in contrast mode.
 */
.btn {
    --btn--background: var(--color--white);
    --btn--text      : var(--color--dark-grey);
    --btn--border    : var(--color--dark-grey);
    --btn--icon      : var(--icon--arrow-right--stroke-2);

    display: inline-flex;
    align-items: center;
    gap: var(--layout--gap--default);
    max-width: 100%;
    padding: var(--space--xs) var(--padding--default);
    border: var(--border-width--default) solid var(--btn--border);
    border-radius: var(--border-radius--round);
    background-color: var(--btn--background);
    color: var(--btn--text);
    font-family: var(--font-family--text);
    font-size: var(--font-size--button);
    font-weight: var(--font-weight--bold);
    line-height: var(--line-height--single);
    text-decoration: none;
    cursor: pointer;
}

/*
 * Light surfaces with dark grey text: background of the surface instead of white (design), the hover stays inverted.
 * Not transparent, the hover and the focus offset use the background as text and shadow color.
 */
:is(.surface--light-grey, .surface--light-blue, .surface--yellow) .btn {
    --btn--background: var(--surface--background);
}

/*
 * Page footer (dark grey): outlined white, filled white on hover. Only the page footer, not the <footer> of the
 * record details (e.g. "back to the list" of news). Inverted like all buttons in contrast mode (rule below).
 */
body > footer .btn {
    --btn--background: var(--color--dark-grey);
    --btn--text      : var(--color--white);
    --btn--border    : var(--color--white);
}

/* The primary button (e.g. newsletter subscription) is outlined in the footer as well, filled on hover */
body > footer .btn--primary {
    background-color: var(--btn--background);
    color: var(--btn--text);
}

body > footer .btn--primary:hover {
    background-color: var(--btn--text);
    color: var(--btn--background);
}

:root[data-contrast-mode="active"] .btn {
    --btn--background: #000000;
    --btn--text      : #FFFFFF;
    --btn--border    : #FFFFFF;
}

/*
 * Focus ring in the border color, not in the text color: filled buttons (primary, social media icons of the footer)
 * have the surface color as text color, so a currentColor outline would vanish on the surface (e.g. dark grey on the
 * dark grey footer). Also inside content elements: their focus rule (currentColor, see BaseContentElement.css) has the
 * specificity 0,3,0 by the [tabindex] inside :is() and is loaded later, so the element type is added here (0,3,1).
 */
.btn:focus-visible,
.content-element :is(a, button).btn:focus-visible {
    outline: var(--outline-width--default) solid var(--btn--border);
    outline-offset: var(--outline-offset--default);
    box-shadow: 0 0 0 var(--outline-offset--default) var(--btn--background);
}

.btn:hover,
.btn--primary {
    background-color: var(--btn--text);
    color: var(--btn--background);
}

.btn--primary:hover {
    background-color: var(--btn--background);
    color: var(--btn--text);
}

.btn--accent {
    border-color: var(--color--orange);
}

/* Hover filled orange, the text stays dark grey (inverted as all buttons in contrast mode) */
:root:not([data-contrast-mode="active"]) .btn--accent:hover {
    background-color: var(--color--orange);
    color: var(--btn--text);
}

/* Label at the left like E2 (design B6, C2, C3) */
.btn--full {
    display: flex;
    justify-content: flex-start;
    width: 100%;
}

.btn--wide {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

/*
 * Label of components (not in the RTE, its links wrap instead). The vertical padding keeps the descenders (g, p, y)
 * visible despite overflow: hidden with line-height 1, the negative margin keeps the button height.
 */
.btn--wide .btn__label {
    overflow: hidden;
    margin-block: -.25em;
    padding-block: .25em;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Icon in a circle, as mask filled with the text color */
.btn--wide::after {
    content: "";
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    background-color: currentColor;
    mask: var(--btn--icon) center / contain no-repeat;
}

.btn--external,
.btn--wide[href^="http"] {
    --btn--icon: var(--icon--link--stroke-2);
}

.btn--download,
.btn--wide[href^="/fileadmin/"] {
    --btn--icon: var(--icon--download--stroke-2);
}

/*
 * Loading (e.g. "Load more", see LoadMore.js): the icon is a rotating spinner, the label shows the loading text.
 * Without motion the spinner stands still, the loading text is shown anyway.
 */
.btn[aria-disabled="true"] {
    cursor: progress;
}

.btn--wide[aria-disabled="true"] {
    --btn--icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M10 1A9 9 0 1 1 1 10'/%3E%3C/svg%3E");
}

@media (prefers-reduced-motion: no-preference) {
    .btn--wide[aria-disabled="true"]::after {
        animation: btn--spin 1s linear infinite;
    }
}

@keyframes btn--spin {
    to { rotate: 1turn; }
}


.btn--small {
    padding: var(--space--xs) var(--space--s);
}

.btn--smaller {
    max-height: 2rem;
    padding: .25rem 1rem;
    font-size: var(--font-size--text-small);
    font-weight: var(--font-weight--regular);
}

/* Stroke width of icon border and icon (1px or 2px, see --icon--*--stroke-* in variables.css) */
.btn--icon {
    --btn--icon--height: calc(100% - .75rem);
    --btn--icon--stroke: 2px;
    --icon--open  : var(--icon--open--stroke-2);
    --icon--close : var(--icon--close--stroke-2);
    --icon--remove: var(--icon--remove--stroke-2);

    position: relative;
    padding-right: 3rem;
}

.btn--icon.btn--smaller {
    --btn--icon--height: calc(100% - .5rem);
    --btn--icon--stroke: var(--border-width--default);
    --icon--open  : var(--icon--open--stroke-2);
    --icon--close : var(--icon--close--stroke-2);
    --icon--remove: var(--icon--remove--stroke-2);
}

.btn--icon > span[class*="btn--icon--"] {
    position: absolute;

    height: var(--btn--icon--height);
    width: auto;
    aspect-ratio: 1;

    right: 1rem;

    border: var(--btn--icon--stroke) solid currentColor;
    border-radius: var(--border-radius--round);
}

/* Icon as mask, so it always takes the button's text color (primary buttons, hover, contrast mode) */
.btn--icon > span[class*="btn--icon--"]::before {
    content: "";
    position: absolute;
    inset: 0;

    background-color: currentColor;
    mask: var(--btn--icon--image) center / contain no-repeat;
}

.btn--icon--open {
    --btn--icon--image: var(--icon--open);
}

.btn--icon--close {
    --btn--icon--image: var(--icon--close);
}

.btn--icon--remove {
    --btn--icon--image: var(--icon--remove);
}

/*
 * Social media icon buttons, 47px in diameter (design G6, H1). The link text is set to font size 0, so screen readers
 * still read it as the name of the link, editors should name the network (e.g. "NRW KULTURsekretariat on Instagram").
 * Icon as mask, so it takes the button's text color (icons in variables.css).
 * Content: white with dark grey border and icon, inverted on hover (filled dark grey, white icon) like the other
 * buttons. Footer: white with dark grey icon (see layout.css), inverted on hover (footer background with white border
 * and icon), the opposite of the other footer buttons, which are outlined and filled white on hover.
 * The icon covers the whole button and is centered by the mask, out of the flow, as the hidden link text would
 * otherwise still take the gap of .btn next to it.
 */
body > footer .btn--social {
    background-color: var(--btn--text);
    color: var(--btn--background);
}

body > footer .btn--social:hover {
    background-color: var(--btn--background);
    border-color: var(--btn--border);
    color: var(--btn--text);
}

.btn--social {
    position: relative;
    width: 2.9375rem;
    height: 2.9375rem;
    padding: 0;
    font-size: 0;
    vertical-align: middle;
}

.btn--social::before {
    content: "";
    position: absolute;
    inset: 0;
    background-color: currentColor;
    mask: var(--btn--social--icon) center / 60% 60% no-repeat;
}

.btn--social--website {
    --btn--social--icon: var(--icon--website);
}

.btn--social--facebook {
    --btn--social--icon: var(--icon--facebook);
}

.btn--social--instagram {
    --btn--social--icon: var(--icon--instagram);
}

.btn--social--linkedin {
    --btn--social--icon: var(--icon--linkedin);
}

.btn--social--tiktok {
    --btn--social--icon: var(--icon--tiktok);
}

.btn--social--vimeo {
    --btn--social--icon: var(--icon--vimeo);
}

.btn--social--x {
    --btn--social--icon: var(--icon--x);
}

/*
 * IMAGE FORMATS (see ImageViewHelper): the image fills its container in the aspect ratio of its format, at all widths.
 * The image is cropped to the format already, object-fit only applies if the space differs (e.g. heroes, CTA with long
 * text), the object position follows the focus area of the crop.
 * Pictures of the heroes switch to the format of "image--from-md-<format>" from 48rem viewport width on, like their
 * source.
 */
.image--format {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* The picture of the heroes is the box of its image */
picture:has(> .image--format) {
    display: block;
}

.image--wide      { aspect-ratio: var(--ratio--wide); }
.image--landscape { aspect-ratio: var(--ratio--landscape); }
.image--classic   { aspect-ratio: var(--ratio--classic); }
.image--square    { aspect-ratio: var(--ratio--square); }

/*
 * Images without format (heroes, ImageFormat::HERO): the aspect ratio of the crop (width and height attributes), at most
 * as wide as the container. Components set a fixed height, wider images are cut around the focus area then.
 */
.image--free {
    display: block;
    max-width: 100%;
    height: auto;
    object-fit: cover;
}

@media (min-width: 48rem) {
    .image--from-md-wide     { aspect-ratio: var(--ratio--wide); }
    .image--from-md-landscape { aspect-ratio: var(--ratio--landscape); }
    .image--from-md-classic   { aspect-ratio: var(--ratio--classic); }
    .image--from-md-square    { aspect-ratio: var(--ratio--square); }
}

/*
 * COPYRIGHT of images (not in automatic lists like the distributor): round button with "©" at the bottom left of the
 * image, styled like the arrow of the CTA with image (design D1). On click the copyright opens to the right on white.
 * A <details> element: keyboard (Enter, Space) and the state (expanded) for screen readers without JavaScript, the
 * button is named by its hidden label, the "©" is decorative.
 *
 * The image wrapper (.with-copyright) is the containing block and a container, so the text never gets wider than the
 * image (narrow CTA images clip their overflow). Components move the button by --copyright--left /
 * --copyright--bottom (e.g. aligned with the content of the hero).
 * Dark grey on white in all surfaces (12.63:1), the border keeps the button visible on light images.
 */
.with-copyright {
    container-type: inline-size;
    position: relative;
}

.copyright {
    --copyright--size: 1.875rem;

    position: absolute;
    left: var(--copyright--left, var(--padding--default));
    bottom: var(--copyright--bottom, var(--padding--default));
    z-index: 2;
    color: var(--color--dark-grey);
    font-size: var(--font-size--text-small);
    line-height: var(--line-height--text-small);
}

.copyright__toggle {
    display: grid;
    place-items: center;
    width: var(--copyright--size);
    height: var(--copyright--size);
    border: var(--border-width--default) solid currentColor;
    border-radius: var(--border-radius--round);
    background-color: var(--color--white);
    list-style: none;
    cursor: pointer;
}

.copyright__toggle::-webkit-details-marker {
    display: none;
}

/* Without alternative text (decorative), the first declaration is the fallback for older browsers */
.copyright__toggle::before {
    content: "©";
    content: "©" / "";
    font-size: 1.125rem;
    line-height: 1;
}

.copyright__toggle:focus-visible {
    outline: var(--outline-width--default) solid var(--color--dark-grey);
    outline-offset: var(--outline-offset--default);
    box-shadow: 0 0 0 var(--outline-offset--default) var(--color--white);
}

/* Right of the button, as high as the button at least */
.copyright__text {
    position: absolute;
    left: calc(100% + var(--layout--gap--small));
    bottom: 0;
    width: max-content;
    max-width: min(20rem, 100cqi - var(--copyright--size) - 2 * var(--padding--default) - var(--layout--gap--small));
    min-height: var(--copyright--size);
    padding: .25rem .75rem;
    border: var(--border-width--default) solid transparent; /* visible in forced colors mode */
    border-radius: calc(var(--copyright--size) / 2);
    background-color: var(--color--white);
}

:root[data-contrast-mode="active"] .copyright {
    color: #FFFFFF;
}

:root[data-contrast-mode="active"] :is(.copyright__toggle, .copyright__text) {
    background-color: #000000;
}

.list__wrapper[class*="list--grid--"] {
    container: list--wrapper / inline-size;

    list-style: none;

    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--grid--gap);
}

.list__wrapper.list--cards .list__item {
    padding: var(--card--padding);
    border: var(--card--border);
    border-radius: var(--card--radius);
}

.list__item {
    grid-column: span 6;

    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: var(--grid--gap);
}


/*
 * Columns of the lists (cards, distributor): 2 from 30rem, the full number from 45rem list width on. 45rem is the main
 * column at its max width, also next to the aside and in a frame (see BaseContentElement.css).
 */
@container list--wrapper (min-width: 30rem) {
    .list__item {
        grid-column: span 3;
    }
    .list__wrapper.list--grid--1 .list__item {
        grid-column: span 6;
    }
}


@container list--wrapper (min-width: 45rem) {
    .list__item {
        grid-column: span 2;
    }

    .list__wrapper.list--grid--2 .list__item {
        grid-column: span 3;
    }

    .list__wrapper.list--grid--1 .list__item {
        grid-column: span 6;
    }
}