/*
 * Dashboard page (page-dashboard.php)
 *
 * Loaded only on pages using the Dashboard template. Everything is scoped
 * under .dashboard so none of it leaks into the rest of the site.
 */

.dashboard {
	--db-teal: #1d97a8;
	--db-purple: #9d86b8;
	--db-text: #1d1d1b;
	--db-heading: #555;
	--db-page-bg: #f0f0f0;
	--db-card-bg: #f0f0f0;
	--db-illustration-bg: #e2e6df;
	--db-bar-track: #cfcfcf;
	--db-bar-muted: #bdbdbd;
	--db-bar-dark: #666;
	--db-axis: #000000;

	background: var(--db-page-bg);
	color: var(--db-text);
	padding: 48px 0 64px;
}

.dashboard .db-section + .db-section {
	margin-top: 48px;
}

.dashboard .db-section__title {
	color: var(--db-teal);
	font-size: 1.5rem;
	font-weight: 400;
	line-height: 1.3;
	margin: 0 0 12px;
}

/* Panels & cards -------------------------------------------------------- */

.dashboard .db-panel {
	position: relative;
	background: #fff;
	border-top: 3px solid var(--db-teal);
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.dashboard .db-panel__icon {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 22px;
	height: 22px;
	color: #444;
}

.dashboard svg {
	fill: none;
	stroke: currentColor;
	stroke-width: 1.5;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.dashboard .db-panel__icon img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.dashboard .db-card-title {
	color: var(--db-heading);
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	line-height: 1.25;
	text-transform: uppercase;
	margin: 0 0 16px;
	padding-right: 28px; /* room for the panel icon */
	hyphens: manual;
}

/* Macro-economic panel -------------------------------------------------- */

.dashboard .db-macro {
	padding: 18px 18px 20px;
}

.dashboard .db-macro__grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 20px;
	align-items: stretch; /* equal-height cards, bottoms aligned */
	padding-top: 20px;
}

.dashboard .db-macro__card {
	background: var(--db-card-bg);
}

/* Only as tall as its content, sitting on the same bottom line as the others */
.dashboard .db-macro__card--effects {
	align-self: end;
}

.dashboard .db-macro__image {
	aspect-ratio: 3 / 4;
	background: var(--db-illustration-bg);
}

.dashboard .db-macro__image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.dashboard .db-macro__body {
	padding: 16px 12px 20px;
}

/* Thematic cards -------------------------------------------------------- */

.dashboard .db-themes {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 12px;
	align-items: start;
}

.dashboard .db-theme {
	padding: 18px 18px 16px;
}

/* Indicator ------------------------------------------------------------- */

.dashboard .db-indicator + .db-indicator {
	margin-top: 36px;
}

.dashboard .db-indicator__year {
	color: var(--db-teal);
	font-size: 0.75rem;
	line-height: 1.3;
	margin: 0 0 2px;
}

.dashboard .db-indicator__label {
	color: var(--db-text);
	font-size: 0.875rem;
	font-weight: 400;
	line-height: 1.35;
	margin: 0;
}

.dashboard .db-indicator__value {
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.2;
	margin: 4px 0 2px;
}

.dashboard .db-indicator__delta {
	color: var(--db-teal);
	font-size: 0.75rem;
	line-height: 1.3;
	margin: 0;
}

/* Charts ---------------------------------------------------------------- */

.dashboard .db-chart {
	margin-top: 14px;
	color: #555;
	font-size: 0.625rem;
}

.dashboard .db-chart__plot {
	position: relative;
	height: 56px;
	border-bottom: 1.5px solid var(--db-axis);
}

.dashboard .db-chart__axis {
	display: flex;
	justify-content: space-between;
	margin-top: 3px;
	font-weight: 600;
}

/* Line chart: the SVG stretches to the plot; dots are HTML so they stay round */
.dashboard .db-chart__area {
	position: absolute;
	inset: 0 4%;
}

.dashboard .db-chart__area svg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	overflow: visible;
}

.dashboard .db-chart__area polyline {
	stroke: var(--db-teal);
	vector-effect: non-scaling-stroke;
}

.dashboard .db-chart__dot {
	position: absolute;
	width: 4px;
	height: 4px;
	margin: -2px 0 0 -2px;
	border-radius: 50%;
	background: var(--db-teal);
}

.dashboard .db-chart__goal {
	position: absolute;
	left: 0;
	right: 0;
	border-top: 1px dashed var(--db-purple);
}

.dashboard .db-chart__goal span {
	position: absolute;
	bottom: 1px;
	left: 4%;
	color: var(--db-purple);
	font-size: 0.5625rem;
	line-height: 1;
	white-space: nowrap;
}

/* Vertical bars */
.dashboard .db-chart--bars .db-chart__plot {
	display: flex;
	align-items: flex-end;
	gap: 2px;
	height: 48px;
}

.dashboard .db-chart__bar {
	flex: 1;
	background: var(--db-teal);
}

/* Horizontal bars */
.dashboard .db-chart--hbars {
	display: grid;
	gap: 6px;
}

.dashboard .db-chart--hbars.has-goal {
	padding-bottom: 14px;
}

.dashboard .db-hbar {
	display: flex;
	align-items: center;
	gap: 8px;
}

.dashboard .db-hbar__label {
	flex: 0 0 26px;
}

.dashboard .db-hbar__track {
	position: relative;
	flex: 1;
	height: 12px;
	background: var(--db-bar-track);
}

.dashboard .db-hbar__fill {
	display: block;
	height: 100%;
	background: var(--db-teal);
}

.dashboard .db-hbar__fill--muted {
	background: var(--db-bar-muted);
}

.dashboard .db-hbar__fill--dark {
	background: var(--db-bar-dark);
}

.dashboard .db-hbar__goal {
	position: absolute;
	top: -3px;
	bottom: -3px;
	border-left: 1px dashed var(--db-purple);
}

.dashboard .db-hbar__goal span {
	position: absolute;
	top: 100%;
	left: 0;
	margin-top: 2px;
	transform: translateX(-50%);
	color: var(--db-purple);
	font-size: 0.5625rem;
	white-space: nowrap;
}

/* "Lees de volledige analyse" link ------------------------------------- */

.dashboard .db-more {
	display: flex;
	align-items: center;
	gap: 6px;
	width: fit-content;
	margin: 24px 0 0 auto;
	color: var(--db-text);
	font-size: 0.9375rem;
	text-decoration: none;
}

.dashboard .db-more:hover,
.dashboard .db-more:focus-visible {
	color: var(--db-teal);
	text-decoration: underline;
}

.dashboard .db-more svg {
	width: 16px;
	height: 16px;
	stroke-width: 2;
}

/* Clickable panel ------------------------------------------------------- */

/*
 * The whole panel links to the same URL as its "Lees de volledige analyse"
 * link: that link's ::after is stretched over the panel (links can't be nested).
 * Hovering lifts the panel.
 */
.dashboard .db-panel--link {
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.dashboard .db-panel--link .db-more::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.dashboard .db-panel--link:hover,
.dashboard .db-panel--link:focus-within {
	transform: translateY(-10px);
	box-shadow: 0 16px 32px rgba(0, 0, 0, 0.18), 0 4px 10px rgba(0, 0, 0, 0.12);
}

@media (prefers-reduced-motion: reduce) {
	.dashboard .db-panel--link {
		transition: none;
	}

	.dashboard .db-panel--link:hover,
	.dashboard .db-panel--link:focus-within {
		transform: none;
	}
}

/* Responsive ------------------------------------------------------------ */

@media (max-width: 1024px) {
	.dashboard .db-macro__grid,
	.dashboard .db-themes {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 600px) {
	.dashboard {
		padding: 32px 0 48px;
	}

	.dashboard .db-macro__grid,
	.dashboard .db-themes {
		grid-template-columns: minmax(0, 1fr);
	}

	.dashboard .db-macro__image {
		aspect-ratio: 16 / 9;
	}
}
