/**
 * DP Gasspeicher Live
 * Optimierte Frontend-Styles für KPI-Karten, Diagramm und Quellenhinweis.
 */

.dp-gas {
	container-type: inline-size;
	container-name: gas-widget;

	width: 100%;
	max-width: 100%;
	box-sizing: border-box;

	margin: 2.5rem 0;
	padding: clamp(1.1rem, 3cqi, 2.25rem);

	border-radius: 14px;
	background: #ffffff;
	box-shadow: 0 12px 32px rgba(24, 39, 52, 0.08);

	color: #233f51;
	overflow: hidden;
}

.dp-gas *,
.dp-gas *::before,
.dp-gas *::after {
	box-sizing: border-box;
}

.dp-gas__header {
	margin: 0 0 clamp(1rem, 2cqi, 1.4rem);
}

.dp-gas__eyebrow {
	margin: 0 0 0.45rem;

	font-size: clamp(0.68rem, 1.5cqi, 0.8rem);
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0.07em;
	text-transform: uppercase;

	color: inherit;
	opacity: 0.65;
}

.dp-gas__title {
	margin: 0;
	max-width: 24ch;

	font-size: clamp(1.45rem, 4cqi, 2rem);
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: -0.02em;

	color: inherit;
	text-wrap: balance;
	overflow-wrap: break-word;
}

.dp-gas__warning {
	margin: 0 0 1.25rem;
	padding: 0.85rem 1rem;

	border: 1px solid #efd59c;
	border-radius: 8px;
	background: #fff8e8;

	font-size: clamp(0.85rem, 1.7cqi, 0.95rem);
	line-height: 1.5;
	color: #6f4c00;
}

/**
 * Responsives KPI-Raster.
 *
 * Das Raster entscheidet selbstständig, wie viele Karten nebeneinander
 * passen. Bei mittleren Breiten entsteht in der Regel ein 2 × 2-Raster.
 */
.dp-gas__metrics {
	display: grid;
	grid-template-columns: repeat(
		auto-fit,
		minmax(min(100%, 220px), 1fr)
	);
	gap: 0.85rem;

	width: 100%;
	margin: 0 0 1.5rem;
}

.dp-gas__metric {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: 0.7rem;

	width: 100%;
	min-width: 0;
	min-height: 128px;
	padding: 1rem;

	border: 1px solid transparent;
	border-radius: 10px;
	background: #f2f3f5;
}

.dp-gas__metric--main {
	background: #f2f3f5;
}

.dp-gas__metric-label {
	display: block;
	margin: 0;

	font-size: clamp(0.72rem, 1.45cqi, 0.86rem);
	font-weight: 400;
	line-height: 1.3;

	color: inherit;
	opacity: 0.72;

	overflow-wrap: break-word;
	word-break: normal;
	hyphens: auto;
}

.dp-gas__metric-value {
	display: block;

	width: 100%;
	max-width: 100%;
	min-width: 0;
	margin-top: auto;

	font-size: clamp(2.15rem, 6cqi, 3.2rem);
	font-weight: 700;
	line-height: 1;
	letter-spacing: -0.035em;

	color: inherit;
	white-space: nowrap;
	overflow: visible;
	font-variant-numeric: tabular-nums;
}

.dp-gas__metric-value--small {
	font-size: clamp(1.05rem, 2.8cqi, 1.35rem);
	line-height: 1.18;
	letter-spacing: -0.015em;

	white-space: normal;
	overflow-wrap: normal;
	word-break: normal;
	hyphens: none;
}

.dp-gas__metric-detail {
	display: block;
	margin-top: auto;

	font-size: clamp(0.68rem, 1.3cqi, 0.78rem);
	font-weight: 400;
	line-height: 1.3;

	color: inherit;
	opacity: 0.72;
}

.dp-gas__change--positive {
	color: #24743c;
}

.dp-gas__change--negative {
	color: #b32828;
}

.dp-gas__change--neutral {
	color: inherit;
}

.dp-gas__summary {
	margin: 0 0 clamp(1.25rem, 2.5cqi, 1.5rem);

	font-size: clamp(0.92rem, 1.8cqi, 1rem);
	line-height: 1.65;
	color: inherit;
}

.dp-gas__summary strong {
	font-weight: 700;
	color: inherit;
}

.dp-gas__chart-wrapper {
	position: relative;

	width: 100%;
	height: clamp(300px, 65cqi, 440px);
	min-height: 300px;
	margin: 0;

	overflow: hidden;
}

.dp-gas__chart {
	display: block;

	width: 100% !important;
	max-width: 100%;
	height: 100% !important;
}

.dp-gas__source {
	margin: 1rem 0 0;

	font-size: clamp(0.7rem, 1.35cqi, 0.8rem);
	line-height: 1.5;

	color: inherit;
	opacity: 0.72;
}

.dp-gas__source a {
	color: inherit;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}

.dp-gas__source a:hover,
.dp-gas__source a:focus {
	opacity: 1;
}

.dp-gas--error {
	border-color: #e7b8b8;
	background: #fff5f5;
	color: #8a2020;
}

.dp-gas--error p {
	margin: 0;
}

/**
 * Mittlere Widget-Breiten.
 */
@container gas-widget (max-width: 850px) {
	.dp-gas__metric {
		min-height: 118px;
	}

	.dp-gas__metric-value {
		font-size: clamp(2.05rem, 7.5cqi, 3rem);
	}

	.dp-gas__metric-value--small {
		font-size: clamp(1rem, 3.8cqi, 1.3rem);
	}

	.dp-gas__title {
		max-width: 28ch;
	}

	.dp-gas__chart-wrapper {
		height: clamp(320px, 72cqi, 420px);
	}
}

/**
 * Kleine Tablet- und große Smartphone-Breiten.
 */
@container gas-widget (max-width: 620px) {
	.dp-gas {
		padding: clamp(1rem, 4cqi, 1.35rem);
		border-radius: 12px;
	}

	.dp-gas__metrics {
		gap: 0.75rem;
	}

	.dp-gas__metric {
		min-height: 108px;
		padding: 0.85rem;
	}

	.dp-gas__metric-value {
		font-size: clamp(1.95rem, 8.5cqi, 2.7rem);
	}

	.dp-gas__metric-value--small {
		font-size: clamp(0.98rem, 4.5cqi, 1.22rem);
	}

	.dp-gas__metric-label {
		font-size: clamp(0.72rem, 2.6cqi, 0.82rem);
	}

	.dp-gas__metric-detail {
		font-size: clamp(0.66rem, 2.3cqi, 0.76rem);
	}

	.dp-gas__summary {
		font-size: clamp(0.9rem, 2.9cqi, 0.98rem);
		line-height: 1.6;
	}

	.dp-gas__chart-wrapper {
		height: clamp(300px, 82cqi, 380px);
	}
}

/**
 * Sehr schmale Widget-Breiten.
 *
 * Die KPI-Karten werden untereinander dargestellt.
 */
@container gas-widget (max-width: 420px) {
	.dp-gas {
		padding: 1rem;
		border-radius: 10px;
	}

	.dp-gas__header {
		margin-bottom: 1rem;
	}

	.dp-gas__eyebrow {
		font-size: 0.68rem;
		letter-spacing: 0.055em;
	}

	.dp-gas__title {
		max-width: none;
		font-size: clamp(1.3rem, 7cqi, 1.65rem);
		line-height: 1.2;
	}

	.dp-gas__metrics {
		grid-template-columns: 1fr;
		gap: 0.7rem;
	}

	.dp-gas__metric {
		min-height: auto;
		padding: 0.9rem;
	}

	.dp-gas__metric-value {
		font-size: clamp(2.3rem, 14cqi, 3.2rem);
	}

	.dp-gas__metric-value--small {
		font-size: clamp(1.05rem, 6cqi, 1.3rem);
	}

	.dp-gas__metric-label {
		font-size: 0.78rem;
	}

	.dp-gas__metric-detail {
		font-size: 0.72rem;
	}

	.dp-gas__summary {
		font-size: 0.92rem;
		line-height: 1.58;
	}

	.dp-gas__chart-wrapper {
		height: 310px;
		min-height: 310px;
	}

	.dp-gas__source {
		font-size: 0.72rem;
	}
}

/**
 * Fallback für Browser ohne Container Queries.
 */
@supports not (container-type: inline-size) {
	.dp-gas__metrics {
		grid-template-columns: repeat(
			auto-fit,
			minmax(min(100%, 220px), 1fr)
		);
	}

	.dp-gas__metric-value {
		font-size: clamp(2.15rem, 5vw, 3.2rem);
	}

	.dp-gas__metric-value--small {
		font-size: clamp(1.05rem, 2.2vw, 1.35rem);
	}

	@media (max-width: 520px) {
		.dp-gas {
			padding: 1rem;
		}

		.dp-gas__metrics {
			grid-template-columns: 1fr;
		}

		.dp-gas__metric {
			min-height: auto;
		}

		.dp-gas__chart-wrapper {
			height: 310px;
		}
	}
}

/**
 * Druckansicht.
 */
@media print {
	.dp-gas {
		box-shadow: none;
		border-color: #bfc7cc;
		break-inside: avoid;
	}

	.dp-gas__chart-wrapper {
		height: 340px;
	}

	.dp-gas__source a {
		text-decoration: none;
	}
}

/**
 * Nutzer mit reduzierter Bewegung.
 */
@media (prefers-reduced-motion: reduce) {
	.dp-gas *,
	.dp-gas *::before,
	.dp-gas *::after {
		scroll-behavior: auto !important;
		transition: none !important;
		animation: none !important;
	}
}