/**
 * Metropolis Events – frontend styles.
 *
 * Designet arver sitets typografi (font: inherit) og bruger CSS-variabler,
 * så farver, mellemrum og radius let kan finjusteres uden at rette i templates.
 */

.me-events {
	/* Justerbare designtokens. */
	--me-gap: 24px;
	--me-card-gap: 20px;
	--me-radius: 10px;
	--me-card-bg: #ffffff;
	--me-card-border: #e6e6e6;
	--me-text: inherit;
	--me-muted: #6b6b6b;
	--me-accent: #111111;
	--me-badge-bg: #f1f1f1;
	--me-badge-text: #222222;
	--me-hover-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
	--me-transition: 160ms ease;
	--me-min-card: 280px;

	font-family: inherit;
	color: var(--me-text);
	box-sizing: border-box;
}

.me-events *,
.me-events *::before,
.me-events *::after {
	box-sizing: border-box;
}

/* ---------- Filterbar ---------- */
.me-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 12px;
	margin: 0 0 var(--me-gap);
}

.me-filters__label {
	font-weight: 600;
	margin-right: 4px;
}

.me-filters__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.me-filter {
	display: inline-block;
	padding: 6px 14px;
	border: 1px solid var(--me-card-border);
	border-radius: 999px;
	font-size: 0.9rem;
	line-height: 1.2;
	text-decoration: none;
	color: inherit;
	background: #fff;
	cursor: pointer;
	transition: background var(--me-transition), color var(--me-transition), border-color var(--me-transition);
}

.me-filter:hover,
.me-filter:focus-visible {
	border-color: var(--me-accent);
}

.me-filter.is-active {
	background: var(--me-accent);
	color: #fff;
	border-color: var(--me-accent);
}

/* ---------- Listevisning ---------- */
.me-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(var(--me-min-card), 1fr));
	gap: var(--me-card-gap);
}

.me-card {
	display: flex;
	background: var(--me-card-bg);
	border: 1px solid var(--me-card-border);
	border-radius: 0;
	overflow: hidden;
	transition: transform var(--me-transition), box-shadow var(--me-transition);
}

.me-card__link {
	display: flex;
	flex-direction: column;
	text-decoration: none;
	color: inherit;
	width: 100%;
	height: 100%;
}

.me-card__media {
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: #f4f4f4;
}

.me-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform var(--me-transition);
}

.me-card__body {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 16px 18px 18px;
	flex: 1 1 auto;
}

.me-card__date {
	margin: 0;
	font-size: 0.82rem;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--me-muted);
}

.me-card__title {
	margin: 0;
	font-size: 1.15rem;
	line-height: 1.25;
	font-family: inherit;
}

.me-card__cats {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.me-badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 0.75rem;
	line-height: 1.3;
	background: var(--me-badge-bg);
	color: var(--me-badge-text);
}

.me-badge.is-subtle {
	border: 1px solid currentColor;
}

.me-card__excerpt {
	margin: 0;
	color: var(--me-muted);
	font-size: 0.92rem;
	line-height: 1.5;
}

.me-card__more {
	margin-top: auto;
	padding-top: 4px;
	font-weight: 600;
	font-size: 0.9rem;
	color: var(--me-accent);
}

/* Konsistent hover – tekst er altid synlig uden hover (ingen Safari hover-fejl). */
.me-card:hover,
.me-card:focus-within {
	transform: translateY(-3px);
	box-shadow: var(--me-hover-shadow);
	border-color: var(--me-accent);
}

.me-card:hover .me-card__media img {
	transform: scale(1.04);
}

.me-card__link:focus-visible {
	outline: 2px solid var(--me-accent);
	outline-offset: 2px;
}

/* Skjult kort ved JS-filtrering. */
.me-card[hidden],
.me-month__event[hidden] {
	display: none !important;
}

/* ---------- Tom tilstand ---------- */
.me-empty {
	margin: 0;
	padding: 24px 0;
	color: var(--me-muted);
	font-size: 1rem;
}

/* ---------- Månedsvisning ---------- */
.me-month__nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 16px;
}

.me-month__title {
	margin: 0;
	font-size: 1.35rem;
	text-transform: capitalize;
	font-family: inherit;
}

.me-month__prev,
.me-month__next {
	text-decoration: none;
	color: inherit;
	padding: 6px 12px;
	border: 1px solid var(--me-card-border);
	border-radius: 8px;
	transition: border-color var(--me-transition);
}

.me-month__prev:hover,
.me-month__next:hover {
	border-color: var(--me-accent);
}

.me-month__weekdays {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	gap: 6px;
	margin-bottom: 6px;
}

.me-month__weekday {
	font-size: 0.78rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--me-muted);
	text-align: left;
	padding: 0 4px;
}

.me-month__days {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	grid-auto-rows: 1fr;
	gap: 6px;
}

.me-month__day {
	min-width: 0;
	min-height: 96px;
	border: 1px solid var(--me-card-border);
	border-radius: 8px;
	padding: 6px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	background: #fff;
}

.me-month__day.is-empty {
	background: transparent;
	border: none;
}

.me-month__day.is-noevents {
	background: #fafafa;
}

.me-month__day.is-today {
	border-color: var(--me-accent);
	box-shadow: inset 0 0 0 1px var(--me-accent);
}

.me-month__daynum {
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--me-muted);
}

.me-month__event {
	display: block;
	min-width: 0;
	max-width: 100%;
	font-size: 0.8rem;
	line-height: 1.25;
	padding: 3px 6px;
	border-radius: 5px;
	text-decoration: none;
	color: inherit;
	background: var(--me-badge-bg);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	transition: filter var(--me-transition);
}

.me-month__event:hover,
.me-month__event:focus-visible {
	filter: brightness(0.94);
}

/* ---------- Modal / popup ---------- */
.me-modal {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.me-modal[hidden] {
	display: none;
}

.me-modal__backdrop {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	cursor: pointer;
}

.me-modal__dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 560px;
	max-height: calc(100vh - 40px);
	overflow: auto;
	background: var(--me-card-bg, #fff);
	border-radius: var(--me-radius, 10px);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
	font-family: inherit;
	color: inherit;
	-webkit-overflow-scrolling: touch;
	animation: me-modal-in 160ms ease;
}

@keyframes me-modal-in {
	from { opacity: 0; transform: translateY(12px); }
	to { opacity: 1; transform: translateY(0); }
}

.me-modal__close {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 38px;
	height: 38px;
	border: none;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.85);
	color: #111;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background var(--me-transition, 160ms ease);
}

.me-modal__close:hover,
.me-modal__close:focus-visible {
	background: #fff;
}

.me-modal__media {
	margin: 0;
	background: #f4f4f4;
}

.me-modal__media[hidden] {
	display: none;
}

.me-modal__media img {
	display: block;
	width: 100%;
	height: auto;
	max-height: 320px;
	object-fit: cover;
}

.me-modal__body {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 22px 24px 26px;
}

.me-modal__date {
	margin: 0;
	font-size: 0.85rem;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--me-muted, #6b6b6b);
}

.me-modal__date[hidden],
.me-modal__content[hidden] {
	display: none;
}

.me-modal__title {
	margin: 0;
	font-size: 1.5rem;
	line-height: 1.2;
	font-family: inherit;
}

.me-modal__content {
	margin: 0;
	font-size: 1rem;
	line-height: 1.6;
	color: var(--me-text, inherit);
}

.me-modal__content > *:first-child {
	margin-top: 0;
}

.me-modal__content > *:last-child {
	margin-bottom: 0;
}

.me-modal__content img {
	max-width: 100%;
	height: auto;
}

.me-modal__content a {
	color: var(--me-accent, #111);
}

/* Skjult beholder med events fulde indhold (bruges kun af modalen). */
.me-modal-data {
	display: none !important;
}

.me-modal__more {
	align-self: flex-start;
	margin-top: 4px;
	display: inline-block;
	padding: 10px 20px;
	background: var(--me-accent, #111);
	color: #fff;
	text-decoration: none;
	border-radius: 0;
	font-weight: 600;
	font-size: 0.95rem;
	transition: filter var(--me-transition, 160ms ease);
}

.me-modal__more:hover,
.me-modal__more:focus-visible {
	filter: brightness(1.15);
}

body.me-modal-open {
	overflow: hidden;
}

/* ---------- Responsivt ---------- */
@media (max-width: 640px) {
	.me-list {
		grid-template-columns: 1fr;
	}

	.me-modal {
		padding: 0;
		align-items: flex-end;
	}

	.me-modal__dialog {
		max-width: 100%;
		max-height: 92vh;
		border-radius: 16px 16px 0 0;
	}

	.me-month__days,
	.me-month__weekdays {
		gap: 3px;
	}

	.me-month__day {
		min-height: 64px;
		padding: 4px;
	}

	.me-month__event {
		font-size: 0.7rem;
	}

	.me-month__weekday {
		font-size: 0.65rem;
		text-align: center;
	}
}

@media (prefers-reduced-motion: reduce) {
	.me-card,
	.me-card__media img,
	.me-filter,
	.me-month__event,
	.me-modal__more,
	.me-modal__close {
		transition: none;
	}

	.me-modal__dialog {
		animation: none;
	}
}
