/* =============================================================================
   RIN Diabetes – Hauptstylesheet
   Barrierefrei (WCAG 2.1 AA), responsiv, Markenfarben aus dem RIN-Logo.
   ========================================================================== */

/* ---------------------------------------------------------------------------
   Design-Tokens (Custom Properties)
   Farben abgeleitet aus RIN_2020_Logo_Wortmarke_randlos.png:
   - Dunkelblau #104070  (Kontrast auf Weiß ~9.4:1 -> AAA)
   - Hellblau   #28A8D8  (nur für Deko/Flächen, nicht für kleinen Text auf Weiß)
   --------------------------------------------------------------------------- */
:root {
	--rin-primary: #104070;
	--rin-primary-dark: #0b2e52;
	--rin-primary-darker: #082138;
	--rin-accent: #28a8d8;
	--rin-accent-dark: #1273a0; /* Kontrast auf Weiß ~4.6:1 -> AA für Text */
	--rin-text: #1a1a1a;
	--rin-text-muted: #4a4a4a; /* Kontrast auf Weiß ~9:1 */
	--rin-bg: #ffffff;
	--rin-bg-alt: #f2f6fa;
	--rin-border: #d4dde6;
	--rin-focus: #b8300a; /* kräftiger, deutlich sichtbarer Fokus-Ring */

	--rin-font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--rin-font-heading: var(--rin-font-body);

	--rin-maxw: 1120px;
	--rin-maxw-narrow: 760px;
	--rin-space: 1rem;
	--rin-radius: 8px;
	--rin-shadow: 0 2px 8px rgba(16, 64, 112, 0.12);
}

/* ---------------------------------------------------------------------------
   Reset / Basis
   --------------------------------------------------------------------------- */
*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	font-size: 100%;
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	scrollbar-gutter: stable;
}

body {
	margin: 0;
	background: var(--rin-bg);
	color: var(--rin-text);
	font-family: var(--rin-font-body);
	font-size: 1.0625rem;
	line-height: 1.6;
	/* Sticky footer: Footer immer am unteren Rand, nicht fixiert. */
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
}

img {
	max-width: 100%;
	height: auto;
	display: block;
}

a {
	color: var(--rin-primary);
	text-decoration: underline;
	text-underline-offset: 2px;
}

a:hover,
a:focus {
	color: var(--rin-primary-dark);
	text-decoration-thickness: 2px;
}

h1, h2, h3, h4 {
	font-family: var(--rin-font-heading);
	line-height: 1.25;
	color: var(--rin-primary);
	margin: 0 0 0.5em;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: clamp(1.15rem, 2vw, 1.35rem); }

p { margin: 0 0 1rem; }

/* Sichtbarer Fokus für alle interaktiven Elemente (WCAG 2.4.7) */
:focus-visible {
	outline: 3px solid var(--rin-focus);
	outline-offset: 2px;
	border-radius: 2px;
}

/* Nur visuell verstecken, für Screenreader verfügbar */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------------------------------------------------------------------------
   Skip-Link (WCAG 2.4.1)
   --------------------------------------------------------------------------- */
.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 1000;
	background: var(--rin-primary);
	color: #fff;
	padding: 0.75rem 1.25rem;
	border-radius: 0 0 var(--rin-radius) 0;
}

.skip-link:focus {
	left: 0;
	color: #fff;
}

/* ---------------------------------------------------------------------------
   Layout-Container
   --------------------------------------------------------------------------- */
.container {
	width: 100%;
	max-width: var(--rin-maxw);
	margin-inline: auto;
	padding-inline: 1.25rem;
}

.container--narrow {
	max-width: var(--rin-maxw-narrow);
}

.site-main:focus {
	outline: none;
}

.site-main {
	flex: 1 0 auto;
	margin-bottom:150px;
}

/* ---------------------------------------------------------------------------
   Header
   --------------------------------------------------------------------------- */
.site-header {
	background: var(--rin-bg);
}

.site-header__inner {
	max-width: var(--rin-maxw);
	margin-inline: auto;
	padding: 2rem 1.25rem;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}

@media (max-width: 768px) {
	.site-header__inner {
		padding: 0.5rem 1.25rem;
	}
}

.site-branding__link {
	display: block;
	line-height: 0;
	text-decoration: none;
}

.site-branding__logo {
	width: auto;
	height: clamp(56px, 8vw, 88px);
	aspect-ratio: 1725 / 624;
}

/* Förderlogos */
/* Desktop: Förderlogos im Header sichtbar, Bar vor Footer versteckt. */
.site-funders-bar {
	display: none;
	background: var(--rin-bg);
	border-top: 1px solid var(--rin-border);
	padding-block: 1.25rem;
	margin-top: auto;
}

.site-funders {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
}

.site-funders__label {
	font-size: 0.8125rem;
	color: var(--rin-text-muted);
}

.site-funders__logo {
	height: 44px;
	width: auto;
}

.site-funders__logo:nth-of-type(1) { aspect-ratio: 3057 / 625; }
.site-funders__logo:nth-of-type(2) { aspect-ratio: 640 / 159; }

/* ---------------------------------------------------------------------------
   Navigation
   --------------------------------------------------------------------------- */
.site-nav {
	background: var(--rin-primary);
	border-bottom: 3px solid var(--rin-accent);
}

.site-nav__toggle {
	display: none;
	align-items: center;
	gap: 0.5rem;
	width: 100%;
	padding: 0.85rem 1.25rem;
	background: var(--rin-primary);
	color: #fff;
	border: 0;
	font-size: 1.0625rem;
	cursor: pointer;
}

.site-nav__toggle-icon,
.site-nav__toggle-icon::before,
.site-nav__toggle-icon::after {
	display: block;
	width: 22px;
	height: 2px;
	background: #fff;
	position: relative;
}

.site-nav__toggle-icon::before,
.site-nav__toggle-icon::after {
	content: "";
	position: absolute;
	left: 0;
}

.site-nav__toggle-icon::before { top: -7px; }
.site-nav__toggle-icon::after { top: 7px; }

.site-nav__list {
	max-width: var(--rin-maxw);
	margin: 0 auto;
	/* Gleiche seitliche Einrückung wie .container -> bündig mit Logo und Fließtext. */
	padding: 0 1.25rem;
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	/* Abstände zwischen den Menüpunkten ausschließlich über den flex gap. */
	gap: 2rem;
}

.site-nav__list a {
	position: relative;
	display: block;
	/* Kein Horizontal-Padding: erster Punkt bündig links; Text vertikal zentriert. */
	padding: 1rem 0;
	color: #fff;
	text-decoration: none;
	font-weight: 600;
	letter-spacing: 0.01em;
}

.site-nav__list a::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0.7rem;
	height: 2px;
	background: var(--rin-accent);
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform 0.2s ease;
}

.site-nav__list a:hover::after,
.site-nav__list a:focus::after,
.site-nav__list .current-menu-item > a::after,
.site-nav__list .current_page_item > a::after {
	transform: scaleX(1);
}

.site-nav__list .current-menu-item > a,
.site-nav__list .current_page_item > a {
	color: #fff;
}

/* ---------------------------------------------------------------------------
   Inhaltsbereiche
   --------------------------------------------------------------------------- */
.page-content,
.news {
	padding-block: 2.5rem;
}

.single-post {
	padding-top: 0;
	padding-bottom: 0;
}

.page-header {
	margin-bottom: 1.5rem;
}

.entry-content {
	max-width: 72ch;
}

.entry-content h2 { margin-top: 2rem; }
.entry-content h3 { margin-top: 1.5rem; }

.entry-content ul,
.entry-content ol {
	padding-left: 1.5rem;
}

.entry-content a {
	font-weight: 600;
}

/* ---------------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------------- */
.button {
	display: inline-block;
	background: var(--rin-primary);
	color: #fff;
	border: 2px solid var(--rin-primary);
	padding: 0.7rem 1.4rem;
	border-radius: var(--rin-radius);
	font-size: 1.0625rem;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.button:hover,
.button:focus {
	background: var(--rin-primary-dark);
	color: #fff;
}

.button[hidden] {
	display: none;
}

/* ---------------------------------------------------------------------------
   News-Bereich
   --------------------------------------------------------------------------- */
.news {
	background: var(--rin-bg-alt);
	border-top: 1px solid var(--rin-border);
}

.news__heading {
	text-align: center;
	margin-bottom: 1.75rem;
}

.news__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 1.5rem;
}

.news-card {
	background: var(--rin-bg);
	border: 1px solid var(--rin-border);
	border-radius: var(--rin-radius);
	overflow: hidden;
	box-shadow: var(--rin-shadow);
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.news-card:hover,
.news-card:focus-within {
	transform: translateY(-3px);
	box-shadow: 0 6px 16px rgba(16, 64, 112, 0.2);
}

.news-card__link {
	display: flex;
	flex-direction: column;
	height: 100%;
	text-decoration: none;
	color: var(--rin-text);
}

.news-card__media {
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var(--rin-bg-alt);
}

.news-card__media--empty {
	background: linear-gradient(135deg, var(--rin-primary), var(--rin-accent));
}

.news-card__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.news-card__body {
	padding: 1rem 1.1rem 1.25rem;
}

.news-card__date {
	display: block;
	font-size: 0.85rem;
	color: var(--rin-text-muted);
	margin-bottom: 0.35rem;
}

.news-card__title {
	font-size: 1.15rem;
	margin: 0;
	color: var(--rin-primary);
}

.news-card__link:hover .news-card__title,
.news-card__link:focus .news-card__title {
	text-decoration: underline;
	text-underline-offset: 2px;
}

.news__status {
	text-align: center;
	min-height: 1.5rem;
	margin-top: 1rem;
	color: var(--rin-text-muted);
}

.news__status--error {
	color: var(--rin-focus);
	font-weight: 600;
}

.news__actions {
	text-align: center;
	margin-top: 1.5rem;
}

.news__empty {
	text-align: center;
	color: var(--rin-text-muted);
}

/* ---------------------------------------------------------------------------
   Einzelbeitrag
   --------------------------------------------------------------------------- */
.single-post__back {
	margin-top: 1.25rem;
	margin-bottom: 0.5rem;
}

.single-post__meta {
	color: var(--rin-text-muted);
	font-size: 0.9rem;
}

.single-post__figure {
	margin: 0 0 1.5rem;
}

.single-post__image {
	width: 100%;
	border-radius: var(--rin-radius);
}

/* ---------------------------------------------------------------------------
   Post-Listen / Pagination
   --------------------------------------------------------------------------- */
.post-list {
	list-style: none;
	padding: 0;
}

.post-list__item {
	padding-block: 1.5rem;
	border-bottom: 1px solid var(--rin-border);
}

.pagination {
	margin-top: 2rem;
}

.pagination .page-numbers {
	display: inline-block;
	padding: 0.4rem 0.75rem;
	margin-right: 0.25rem;
	text-decoration: none;
	border: 1px solid var(--rin-border);
	border-radius: var(--rin-radius);
}

.pagination .current {
	background: var(--rin-primary);
	color: #fff;
	border-color: var(--rin-primary);
}

/* ---------------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------------- */
.site-footer {
	background: var(--rin-primary-darker);
	color: #eaf1f7;
}

.site-footer__inner {
	max-width: var(--rin-maxw);
	margin-inline: auto;
	padding: 1.5rem 1.25rem;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}

.site-footer__copyright {
	margin: 0;
}

.site-footer__list {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 1.25rem;
	margin: 0;
	padding: 0;
}

.site-footer__list a {
	color: #fff;
}

.site-footer__list a:hover,
.site-footer__list a:focus {
	color: #fff;
}

/* ---------------------------------------------------------------------------
   Responsiv – Mobile Navigation
   --------------------------------------------------------------------------- */
@media (max-width: 768px) {
	.site-nav__toggle {
		display: flex;
	}

	.site-nav__list {
		display: none;
		flex-direction: column;
		gap: 0;
		padding-bottom: 0.5rem;
	}

	.site-nav.is-open .site-nav__list {
		display: flex;
	}

	.site-nav__list a {
		padding: 0.9rem 1.25rem;
	}

	/* Auf schmalen Viewports: dezenter Akzentbalken links statt Unterstrich. */
	.site-nav__list a::after {
		left: 0;
		right: auto;
		top: 0.5rem;
		bottom: 0.5rem;
		width: 3px;
		height: auto;
		transform: scaleY(0);
		transform-origin: center top;
	}

	.site-nav__list a:hover::after,
	.site-nav__list a:focus::after,
	.site-nav__list .current-menu-item > a::after,
	.site-nav__list .current_page_item > a::after {
		transform: scaleY(1);
	}

	.site-header__inner {
		justify-content: center;
	}

	/* Förderlogos im Header ausblenden, stattdessen Bar vor Footer zeigen. */
	.site-header .site-funders {
		display: none;
	}

	.site-funders-bar {
		display: block;
	}

	.site-funders {
		justify-content: center;
	}
}

/* ---------------------------------------------------------------------------
   Bewegung reduzieren (WCAG 2.3.3)
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}
	*,
	*::before,
	*::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
	}
}
