/* Shared frontend enhancements; legacy-components.css owns base geometry. */

/* Keep the established high-contrast arrow above the compatibility rule. */
body a.back-to-top {
	color: #2e4050 !important;
}

body a.back-to-top:focus-visible,
.rd-table-scroll:focus-visible {
	outline: 2px solid #2e4050;
	outline-offset: 3px;
}

/* Keyboard focus must never remain inside an offscreen fixed header. */
.site-header:focus-within {
	top: 0 !important;
}

/* Match featured images to the text canvas and keep the fixed header compact. */
@media screen {
	body .site-content {
		margin-top: calc(var(--rd-header-height) + 16px);
	}

	.post-thumbnail img.wp-post-image {
		width: 100%;
		height: auto;
	}
}

/* A single no-sidebar canvas avoids a width reversal at the parent breakpoints.
 * The outer 5% gutters give 90% of site-inner; the existing 1320px site-inner
 * and this 1080px content cap preserve the established wide desktop layout.
 */
@media screen {
	body.no-sidebar .site-content {
		padding-inline: 5%;
	}

	body.no-sidebar .entry-header,
	body.no-sidebar .post-thumbnail,
	body.no-sidebar .entry-content,
	body.no-sidebar .entry-summary,
	body.no-sidebar .entry-footer,
	body.no-sidebar .comments-area,
	body.no-sidebar .image-navigation,
	body.no-sidebar .post-navigation,
	body.no-sidebar .pagination,
	body.no-sidebar .page-header,
	body.no-sidebar .page-content,
	body.no-sidebar .content-bottom-widgets {
		width: auto;
		max-width: min(100%, 1080px);
		margin-inline: auto;
	}
}

/* Match the measured closed mobile header before frontend measurement. */
@media screen and (max-width: 47.9375em) {
	html:root {
		--rd-header-height: 63px;
	}

	/* Parent button margins otherwise expand the 710–767px header to 84px. */
	body .site-header-main {
		min-height: 63px;
	}

	body .site-header .menu-toggle {
		min-height: 44px;
		margin-block: 0;
	}

	.site-header.rd-menu-open .site-header-main {
		grid-template-rows: minmax(63px, auto) minmax(0, 1fr);
	}
}

/* The tablet menu keeps its existing 81px header with a full touch target. */
@media screen and (min-width: 48em) and (max-width: 56.874em) {
	body .site-header-main {
		min-height: 81px;
	}

	body .site-header .menu-toggle {
		min-height: 44px;
		margin-block: 0;
	}
}

/* Opt-in only: the unwrapped table layout stays unchanged on larger screens. */
.rd-table-scroll {
	display: contents;
}

@media screen and (max-width: 47.9375em) {
	.rd-table-scroll {
		display: block;
		max-width: 100%;
		overflow-x: auto;
	}

	.rd-table-scroll > table {
		min-width: 34rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	html:root {
		scroll-behavior: auto !important;
	}

	.site-header,
	.back-to-top,
	.neuseeland-cta-button {
		transition: none !important;
	}
}

/* Persistent cues for editorial links, without changing typography or boxes. */
.entry-content :where(p, li, dd, dt, td, th, figcaption) a[href]:not(:where(
	.toc a,
	.toc-subpage,
	nav a,
	[role="navigation"] a,
	.neuseeland-cta-button,
	.formentera-cta-button,
	.cta-button,
	.box2-button,
	.button,
	.wp-element-button,
	.wp-block-button__link,
	.wp-block-file__button,
	[role="button"],
	:has(img, picture, svg, video, canvas)
)) {
	box-shadow: none;
	text-decoration: underline;
	text-decoration-thickness: 0.06em;
	text-underline-offset: 0.14em;
	text-decoration-skip-ink: auto;
}


/* Shared design roles. A domain may override these from its existing settings. */
:root {
	--rd-link: currentColor;
	--rd-action: #333;
	--rd-action-hover: #222;
	--rd-action-active: #111;
	--rd-action-text: #fff;
	--rd-surface: #fafafa;
	--rd-border: #f0f0f0;
	--rd-focus: #2e4050;
	--rd-button-radius: 8px;
	--rd-control-font: Merriweather, Georgia, serif;
	--rd-header-height: 81px;
	--rd-admin-bar-height: 0px;
}

/* Compatible aliases keep authored links and their surrounding boxes intact. */
body .entry-content :is(a.box2-button, a.cta-button, a.neuseeland-cta-button) {
	display: inline-block;
	box-sizing: border-box;
	max-inline-size: 100%;
	min-block-size: 44px;
	padding: 0.625rem 1.125rem;
	border: 0;
	border-radius: var(--rd-button-radius);
	background: var(--rd-action);
	color: var(--rd-action-text);
	font-family: var(--rd-control-font);
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.5;
	letter-spacing: normal;
	text-align: center;
	text-transform: none;
	text-decoration: none;
	white-space: normal;
	overflow-wrap: anywhere;
	box-shadow: none;
	transition: background-color 0.2s ease;
}

body .entry-content :is(a.box2-button, a.cta-button, a.neuseeland-cta-button):visited {
	color: var(--rd-action-text);
}

body .entry-content :is(a.box2-button, a.cta-button, a.neuseeland-cta-button):hover {
	background: var(--rd-action-hover);
	color: var(--rd-action-text);
	box-shadow: none;
}

body .entry-content :is(a.box2-button, a.cta-button, a.neuseeland-cta-button):active {
	background: var(--rd-action-active);
	color: var(--rd-action-text);
}

body .entry-content :is(a.box2-button, a.cta-button, a.neuseeland-cta-button):focus-visible,
.rd-content-jump a:focus-visible,
.rd-toc:focus-visible,
.rd-toc-toggle:focus-visible,
.rd-toc a:focus-visible,
.rd-subpage-link:focus-visible {
	outline: 2px solid var(--rd-focus);
	outline-offset: 3px;
}

.entry-content :is(.cta-box, .box2) {
	background: var(--rd-surface);
	border-color: var(--rd-border);
}

.entry-content .box2-buttons {
	gap: 0.5rem;
}

.entry-content .box2-buttons .box2-button {
	flex: 1 1 12rem;
	min-inline-size: min(100%, 10rem);
}

.rd-breadcrumbs {
	font-size: 1rem;
	line-height: 1.75;
}

.rd-editorial {
	font-size: 0.875rem;
	line-height: 1.7;
	color: #575757;
}

.rd-content-jump {
	margin-block: 1rem 1.25rem;
}

.rd-content-jump a {
	color: var(--rd-link);
	text-decoration: underline;
	text-underline-offset: 0.14em;
}

.rd-toc {
	margin-block: 1.5rem;
}

.rd-toc,
.entry-content h2[id] {
	scroll-margin-top: calc(var(--rd-header-height) + var(--rd-admin-bar-height) + 1rem);
}

body.admin-bar {
	--rd-admin-bar-height: 32px;
}

@media screen and (max-width: 48.875em) {
	body.admin-bar {
		--rd-admin-bar-height: 46px;
	}
}

.rd-toc-title {
	margin-block: 0 0.5rem;
}

body .entry-content button.rd-toc-toggle {
	display: block;
	box-sizing: border-box;
	inline-size: 100%;
	max-inline-size: 100%;
	min-block-size: 44px;
	padding: 0.625rem 0.875rem;
	border: 1px solid var(--rd-link);
	border-radius: var(--rd-button-radius);
	background: var(--rd-surface);
	color: var(--rd-link);
	font-family: var(--rd-control-font);
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.5;
	letter-spacing: normal;
	text-align: start;
	text-transform: none;
	white-space: normal;
	overflow-wrap: anywhere;
	cursor: pointer;
	box-shadow: none;
}

body .entry-content button.rd-toc-toggle:hover,
body .entry-content button.rd-toc-toggle:active {
	background: #fff;
	color: var(--rd-link);
}

.rd-toc > .toc {
	margin-block: 0.5rem 0;
}

.rd-toc-toggle[hidden],
.rd-toc-title[hidden],
.rd-toc > .toc[hidden] {
	display: none !important;
}

.rd-subpages {
	background: var(--rd-surface);
	border-inline-start: 5px solid var(--rd-link);
	border-radius: 10px;
	padding: 15px;
	margin-block: 30px;
}

.rd-subpage-link {
	color: var(--rd-link);
}

@media (prefers-reduced-motion: reduce) {
	body .entry-content :is(a.box2-button, a.cta-button, a.neuseeland-cta-button) {
		transition: none;
	}
}

/* Reviewed table variants; existing declarations and responsive behavior. */

    table:where(.rd-ferry-table) {
        width: 100%;
        border-collapse: collapse;
    }
    :where(.rd-ferry-table) th, :where(.rd-ferry-table) td {
        border: 1px solid #ddd;
        padding: 10px;
        text-align: left;
    }
    :where(.rd-ferry-table) th {
        background-color: #f4f4f4;
    }
    :where(.rd-ferry-table) tr:nth-child(even) {
        background-color: #f9f9f9;
    }
    /* Responsives Design */
    @media screen and (max-width: 768px) {
        table:where(.rd-ferry-table), :where(.rd-ferry-table) thead, :where(.rd-ferry-table) tbody, :where(.rd-ferry-table) th, :where(.rd-ferry-table) td, :where(.rd-ferry-table) tr {
            display: block;
        }
        /* Preserve real header cells for assistive reading in the card view. */
        :where(.rd-ferry-table) thead tr {
            position: absolute;
            width: 1px;
            height: 1px;
            margin: -1px;
            padding: 0;
            border: 0;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            clip-path: inset(50%);
            white-space: nowrap;
        }
        :where(.rd-ferry-table) tr {
            margin-bottom: 10px;
            border: 1px solid #ddd;
            padding: 10px;
        }
        :where(.rd-ferry-table) td {
            display: flow-root;
            text-align: right;
            overflow-wrap: anywhere;
        }
        :where(.rd-ferry-table) td::before {
            content: attr(data-label);
            float: left;
            width: calc(50% - 12px);
            margin-right: 12px;
            font-weight: bold;
            text-align: left;
            white-space: normal;
            overflow-wrap: anywhere;
        }
        /* Alternierende Hintergrundfarben für bessere Lesbarkeit */
        :where(.rd-ferry-table) tr:nth-child(odd) {
            background-color: #f1f1f1;
        }
        :where(.rd-ferry-table) tr:nth-child(even) {
            background-color: #ffffff;
        }
        /* Leere Zellen in der Mobilansicht ausblenden */
        :where(.rd-ferry-table) td:empty {
            display: none;
        }
    }


  .rd-time-table {
      width: 100%;
      border-collapse: collapse;
  }
  .rd-time-table th,
  .rd-time-table td {
      border: 1px solid #ddd;
      padding: 10px;
      text-align: left;
  }
  .rd-time-table th {
      background-color: #f4f4f4;
  }
  .rd-time-table tr:nth-child(even) {
      background-color: #f9f9f9;
  }
  @media screen and (max-width: 768px) {
      .rd-time-table,
      .rd-time-table thead,
      .rd-time-table tbody,
      .rd-time-table th,
      .rd-time-table td,
      .rd-time-table tr {
          display: block;
      }
      /* Preserve real header cells for assistive reading in the card view. */
      .rd-time-table thead tr {
          position: absolute;
          width: 1px;
          height: 1px;
          margin: -1px;
          padding: 0;
          border: 0;
          overflow: hidden;
          clip: rect(0, 0, 0, 0);
          clip-path: inset(50%);
          white-space: nowrap;
      }
      .rd-time-table tr {
          margin-bottom: 20px;
          border: 1px solid #ddd;
          padding: 10px;
          background: #fff;
      }
      .rd-time-table td {
          display: flow-root;
          text-align: left;
          border: none;
          border-bottom: 1px solid #eee;
          overflow-wrap: anywhere;
      }
      .rd-time-table td::before {
          content: attr(data-label);
          float: left;
          width: calc(50% - 12px);
          margin-right: 12px;
          font-weight: bold;
          white-space: normal;
          overflow-wrap: anywhere;
      }
      .rd-time-table td:last-child {
          border-bottom: none;
      }
  }


/* Open the existing WordPress navigation within the visible mobile viewport. */
.site-header.rd-nav-enhanced:not(.hide-header),
.site-header.rd-nav-enhanced:focus-within {
	top: var(--rd-menu-top, 0px) !important;
}

@media screen and (max-width: 56.874em) {
	.site-header.rd-menu-open {
		top: var(--rd-menu-top, 0px) !important;
		height: auto;
		max-height: var(--rd-menu-height, 100vh);
		box-sizing: border-box;
		background-color: #fff;
	}

	.site-header.rd-menu-open .site-header-main {
		display: grid;
		align-items: stretch;
		grid-template-columns: minmax(0, 1fr) auto;
		grid-template-rows: auto minmax(0, 1fr);
		max-height: var(--rd-menu-height, 100vh);
	}

	.site-header.rd-menu-open .site-header-menu {
		grid-column: 1 / -1;
		min-height: 0;
		margin-bottom: 0;
		overflow-y: auto;
		overscroll-behavior-y: contain;
		-webkit-overflow-scrolling: touch;
		background-color: #fff;
		padding-bottom: env(safe-area-inset-bottom, 0px);
		scroll-behavior: auto;
	}
}

/* Validated fixes previously held only in Additional CSS. */
@media screen and (max-width: 47.9375em) {
	body .entry-content table.content-table a.box2-button {
		min-inline-size: 0;
	}
}

@media screen and (max-width: 56.874em) {
	.site-header.rd-menu-open .site-branding {
		align-self: center;
	}
}

/* Without JavaScript all native menu links stay visible in normal document flow. */
html.no-js:root {
	--rd-header-height: 0px;
}

.no-js body .site-header {
	position: static;
	height: auto;
	max-height: none;
}

.no-js body .site-content {
	margin-top: 16px;
}
