/*
 * ATK 2026: Events Manager styling.
 *
 * EM ships its own "pixelbones" stylesheet with many !important rules. We
 * mostly change its CSS variables; where EM forces values with !important we
 * have to answer with a slightly more specific selector (body .em…) and
 * !important as well. No EM plugin files are edited.
 */

/* 1. EM's design tokens → theme tokens
   ------------------------------------------------------------------ */
body .em,
body .em.pixelbones {
	--font-family: var(--wp--preset--font-family--body);
	--font-size: 1rem;
	--line-height: 1.6;
	--text-color-richer: var(--wp--preset--color--foreground);
	--text-color-normal: var(--wp--preset--color--foreground);
	--text-color-softer: var(--wp--preset--color--muted-foreground);
	--accent-color: var(--wp--preset--color--brand-deep);
	--accent-color-hover: var(--wp--preset--color--foreground);
	--border-color: var(--wp--preset--color--border);
	--border-color-softer: var(--wp--preset--color--border);
	--background-color-inputs: var(--wp--preset--color--white);
	--button-primary-color: var(--wp--preset--color--ink);
	--a-color-1: var(--wp--preset--color--foreground);
	--main-bg: transparent;
	--main-h3-color: var(--wp--preset--color--foreground);
	--main-border-color: var(--wp--preset--color--border);
	--default-border: var(--wp--preset--color--primary);
}

/* Headings inside EM output use the display font, but smaller than page headings. */
body .em h2,
body .em h3,
body .em.pixelbones section.em-event-bookings > h2 {
	font-family: var(--wp--preset--font-family--display) !important;
	font-style: italic;
	font-weight: 900 !important;
	text-transform: uppercase;
	letter-spacing: -0.01em;
	color: var(--wp--preset--color--foreground);
}

/* 2. Buttons: lime pills like the rest of the site
   ------------------------------------------------------------------ */
body .em.pixelbones .em-item-actions .button:not([data-nostyle]),
body .em.pixelbones .input .em-booking-submit,
body .em.pixelbones.input input[type=submit].em-booking-submit,
body .em.pixelbones .em-event-bookings-meta a.button.input:not([data-nostyle]) {
	height: auto !important;
	padding: 0.75rem 1.5rem 0.65rem !important;
	border: 1px solid var(--wp--preset--color--foreground) !important;
	border-radius: 9999px !important;
	background-color: transparent !important;
	color: var(--wp--preset--color--foreground) !important;
	font-family: var(--wp--preset--font-family--body) !important;
	font-size: 0.875rem !important;
	font-weight: 600 !important;
	letter-spacing: 0 !important;
	line-height: 1.2 !important;
	text-transform: none !important;
}

/* Primary actions: "Tilmeld dig nu" and the booking submit button. */
body .em.pixelbones .em-item-actions .em-event-book-now.button,
body .em.pixelbones .input .em-booking-submit,
body .em.pixelbones.input input[type=submit].em-booking-submit,
body .em.pixelbones .em-event-bookings-meta a.button.input:not([data-nostyle]) {
	border-color: var(--wp--preset--color--primary) !important;
	background-color: var(--wp--preset--color--primary) !important;
	color: var(--wp--preset--color--ink) !important;
}

body .em.pixelbones .em-item-actions .button:not([data-nostyle]):hover,
body .em.pixelbones .input .em-booking-submit:hover,
body .em.pixelbones .em-event-bookings-meta a.button.input:not([data-nostyle]):hover {
	background-color: var(--wp--preset--color--primary-hover) !important;
	border-color: var(--wp--preset--color--primary-hover) !important;
	color: var(--wp--preset--color--ink) !important;
}

body .em.pixelbones .em-item-actions .em-item-read-more.button:hover {
	background-color: var(--wp--preset--color--foreground) !important;
	border-color: var(--wp--preset--color--foreground) !important;
	color: var(--wp--preset--color--ink-foreground) !important;
}

/* 3. Events list (/medlems-info/events/)
   ------------------------------------------------------------------ */

/* Date tile instead of EM's grey calendar icon. */
body .em.em-list .em-item .em-item-image .em-item-image-placeholder {
	background: var(--wp--preset--color--ink);
	border-radius: 0.5rem;
	opacity: 1;
	max-width: 110px;
}

body .em.em-events-list .em-item-image .em-item-image-placeholder div.date {
	min-width: 0;
	align-content: center;
	grid-template-rows: auto auto;
}

body .em.em-events-list .em-item-image .em-item-image-placeholder div.date span {
	color: var(--wp--preset--color--ink-foreground);
	font-family: var(--wp--preset--font-family--display);
	font-weight: 900;
	font-style: italic;
	text-transform: uppercase;
	font-size: 1rem;
	line-height: 1.2;
}

body .em.em-events-list .em-item-image .em-item-image-placeholder div.date span.day {
	color: var(--wp--preset--color--primary);
	font-size: 2.75rem;
	line-height: 1;
}

body .em.em-list .em-item .em-item-info {
	border-left-color: var(--wp--preset--color--primary);
}

body .em.em-list .em-item .em-item-info h3.em-item-title {
	font-size: var(--wp--preset--font-size--xx-large) !important;
	line-height: 1.1;
}

body .em.em-list .em-item .em-item-info h3.em-item-title a {
	color: var(--wp--preset--color--foreground);
	text-decoration: none;
}

body .em.em-list .em-item .em-item-info h3.em-item-title a:hover {
	color: var(--wp--preset--color--brand-deep);
}

/* Trainings are free: the "kr0,00" price line in lists is noise.
   (Only in lists: on the single event the same class shows "Tilmeldinger lukket".) */
body .em.em-list .em-item .em-item-meta .em-item-meta-line.em-event-prices {
	display: none;
}

/* EM's search bar button follows the accent colour. */
body .em.pixelbones .em-search-submit {
	border-radius: 9999px !important;
}

/* 4. Compact list on the front page ("Kommende træninger")
   Markup comes from the format inside [events_list]…[/events_list].
   ------------------------------------------------------------------ */
.atk-upcoming .em-events-list {
	display: flex;
	flex-direction: column;
	margin-block: var(--wp--preset--spacing--40) var(--wp--preset--spacing--20);
	border-top: 1px solid var(--wp--preset--color--border);
}

.atk-event {
	display: grid;
	grid-template-columns: 4.5rem 1fr auto;
	align-items: center;
	gap: 1rem;
	padding: 1rem 0.25rem;
	border-bottom: 1px solid var(--wp--preset--color--border);
	color: var(--wp--preset--color--foreground) !important;
	text-decoration: none !important;
	transition: background-color 0.15s ease;
}

.atk-event:hover,
.atk-event:focus-visible {
	/* !important: EM forces a transparent background on every link inside .em. */
	background-color: var(--wp--preset--color--white) !important;
}

.atk-event__date {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 0.5rem 0;
	border-radius: 0.5rem;
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--ink-foreground);
	font-family: var(--wp--preset--font-family--display);
	font-style: italic;
	font-weight: 900;
	line-height: 1;
	text-transform: uppercase;
}

.atk-event__day {
	color: var(--wp--preset--color--primary);
	font-size: 1.75rem;
}

.atk-event__month {
	font-size: 0.8rem;
}

.atk-event__info {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.atk-event__name {
	color: var(--wp--preset--color--foreground);
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--x-large);
	font-weight: 800;
	line-height: 1.2;
}

.atk-event__meta {
	color: var(--wp--preset--color--muted-foreground);
	font-size: var(--wp--preset--font-size--small);
}

/* Weekday from EM (#l) is lowercase in Danish; capitalise the first letter. */
.atk-event__meta::first-letter {
	text-transform: uppercase;
}

.atk-event__arrow {
	color: var(--wp--preset--color--brand-deep);
	font-weight: 600;
	transition: transform 0.15s ease;
}

.atk-event:hover .atk-event__arrow {
	transform: translateX(4px);
}

.atk-upcoming__note {
	color: var(--wp--preset--color--muted-foreground);
}

/* Same list inside a dark section (front page: below the discipline cards). */

/* EM colours everything inside a hovered link with --accent-color-hover (!important),
   so the light-text values have to come from EM's own variables here. */
.is-style-section-ink .em.pixelbones {
	--accent-color: var(--wp--preset--color--ink-foreground);
	--accent-color-hover: var(--wp--preset--color--ink-foreground);
}

.is-style-section-ink .atk-upcoming .em-events-list,
.is-style-section-ink .atk-event {
	border-color: color-mix(in srgb, var(--wp--preset--color--ink-foreground) 15%, transparent);
}

.is-style-section-ink .atk-event {
	color: var(--wp--preset--color--ink-foreground) !important;
}

.is-style-section-ink .atk-event:hover,
.is-style-section-ink .atk-event:focus-visible {
	background-color: color-mix(in srgb, var(--wp--preset--color--ink-foreground) 6%, transparent) !important;
}

.is-style-section-ink .atk-event__date {
	background: color-mix(in srgb, var(--wp--preset--color--ink-foreground) 10%, transparent);
}

.is-style-section-ink .atk-event__name {
	color: var(--wp--preset--color--ink-foreground);
}

.is-style-section-ink .atk-event__meta,
.is-style-section-ink .atk-upcoming__note {
	color: color-mix(in srgb, var(--wp--preset--color--ink-foreground) 65%, transparent);
}

.is-style-section-ink .atk-event__arrow {
	color: var(--wp--preset--color--primary);
}

/* 5. Single event (templates/single-event.html)
   ------------------------------------------------------------------ */

/* The title is already shown in the dark band above, so hide EM's own <h1>. */
.atk-event-single .em-item-header > h1 {
	display: none;
}

.atk-event-single .em-item-meta h3,
.atk-location-single .em-item-meta h3 {
	font-size: var(--wp--preset--font-size--x-large) !important;
	color: var(--wp--preset--color--brand-deep) !important;
}

/* Layout from EM's single event format (option dbem_single_event_format, copy in
   content/em/single-event-format.html). Same split as the training pages: text 2/3,
   "Tid & sted" 1/3 with rows separated by thin lines. Phones: facts first. */
.atk-ev {
	display: grid;
	grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
	gap: var(--wp--preset--spacing--60);
	align-items: start;
}

@media (max-width: 781px) {
	.atk-ev {
		grid-template-columns: minmax(0, 1fr);
		gap: var(--wp--preset--spacing--50);
	}

	.atk-ev__aside {
		order: -1;
	}
}

/* EM gives every <p> a 2.5rem bottom margin; spacing here comes from the rows instead. */
body .em.pixelbones .atk-ev p {
	margin: 0 !important;
}

.atk-ev__notes {
	font-size: var(--wp--preset--font-size--large);
}

body .em.pixelbones .atk-ev .atk-ev__notes > * + * {
	margin-top: 1em !important;
}

/* Same look as the "Overlinje" paragraph style. */
.atk-ev__eyebrow {
	color: var(--wp--preset--color--brand-deep);
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 700;
	letter-spacing: 0.3em;
	line-height: 1.4;
	text-transform: uppercase;
}

body .em.pixelbones .atk-ev__attendees {
	margin-top: var(--wp--preset--spacing--50) !important;
}

body .em.pixelbones .atk-ev .atk-ev__attendees .atk-ev__eyebrow {
	margin-bottom: 1rem !important;
}

body .em.pixelbones .atk-ev__date {
	margin: var(--wp--preset--spacing--20) 0 0 !important;
	font-size: var(--wp--preset--font-size--xx-large) !important;
	line-height: 1.1 !important;
}

.atk-ev__facts {
	margin-top: var(--wp--preset--spacing--40);
}

body .em.pixelbones .atk-ev__fact {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.25rem;
	margin: 0 !important;
	padding: var(--wp--preset--spacing--30) 0 !important;
	border-top: 1px solid var(--wp--preset--color--border);
}

.atk-ev__fact:last-child {
	border-bottom: 1px solid var(--wp--preset--color--border);
}

.atk-ev__label {
	color: var(--wp--preset--color--muted-foreground);
	font-size: var(--wp--preset--font-size--small);
}

.atk-ev__value {
	font-size: var(--wp--preset--font-size--x-large);
	font-weight: 800;
	line-height: 1.3;
}

body .em.pixelbones .atk-ev__value a {
	color: var(--wp--preset--color--foreground) !important;
	text-decoration: none;
}

body .em.pixelbones .atk-ev__value a:hover {
	color: var(--wp--preset--color--brand-deep) !important;
}

.atk-ev__muted {
	color: var(--wp--preset--color--muted-foreground);
}

body .em.pixelbones .atk-ev__muted a {
	color: var(--wp--preset--color--brand-deep) !important;
	font-weight: 600;
	text-decoration: none;
}

/* "Tilføj til kalender": small text link instead of EM's boxed dropdown button. */
body .em.pixelbones .atk-ev .em-event-add-to-calendar {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	width: auto !important;
	height: auto !important;
	margin: 0.5rem 0 0 !important;
	padding: 0 !important;
	border: 0 !important;
	background: none !important;
	color: var(--wp--preset--color--brand-deep) !important;
	font-family: var(--wp--preset--font-family--body) !important;
	font-size: var(--wp--preset--font-size--small) !important;
	font-weight: 600 !important;
	letter-spacing: 0 !important;
	line-height: 1.4 !important;
	text-transform: none !important;
	cursor: pointer;
}

body .em.pixelbones .atk-ev .em-event-add-to-calendar .em-icon {
	display: none;
}

body .em.pixelbones .atk-ev .em-event-add-to-calendar::after {
	content: "↓";
}

body .em.pixelbones .atk-ev .em-event-add-to-calendar:hover {
	color: var(--wp--preset--color--foreground) !important;
}

/* Attendee names: compact, comma-free pill list. */
body .em.pixelbones ul.event-attendees {
	display: flex;
	flex-wrap: wrap;
	gap: 0.375rem;
	margin: 0 0 0.75rem !important;
	padding: 0 !important;
	list-style: none !important;
}

body .em.pixelbones ul.event-attendees li {
	margin: 0 !important;
	padding: 0.15rem 0.6rem 0.05rem;
	border-radius: 9999px;
	background: var(--wp--preset--color--secondary);
	font-size: var(--wp--preset--font-size--small);
}

/* Booking form in the "Tilmelding" row: one click, so only EM's submit button is shown.
   The comment field, section titles and ticket list are hidden (free single ticket);
   the price summary is off via option dbem_bookings_summary_free = 0. */
body .em.pixelbones .atk-ev__book .em-event-booking-form,
body .em.pixelbones .atk-ev__book .em-booking-form,
body .em.pixelbones .atk-ev__book .em-booking-form section,
body .em.pixelbones .atk-ev__book .em-booking-section {
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	background: none !important;
}

body .em.pixelbones .atk-ev__book .em-booking-section-title,
body .em.pixelbones .atk-ev__book .em-booking-form-section-details,
body .em.pixelbones .atk-ev__book .em-booking-form-section-summary {
	display: none !important;
}

body .em.pixelbones .atk-ev__book {
	margin-top: 1rem;
}

body .em.pixelbones .atk-ev__book .em-booking-submit {
	width: auto !important;
	padding: 0.875rem 1.75rem 0.75rem !important;
	font-size: 1rem !important;
}

/* A single free ticket has no visible fields; hide its empty "Billetter" section. */
body .em.em-event-booking-form .em-booking-form-section-tickets:has(.em-tickets-single) {
	display: none;
}

/* Login button for guests; markup lives in EM's single event format
   (option dbem_single_event_format, {not_logged_in} block). */
body .em.pixelbones .atk-login-prompt {
	margin-top: 1rem;
}

body .em.pixelbones .atk-login-prompt a {
	display: inline-block;
	padding: 0.875rem 1.75rem 0.75rem !important;
	border-radius: 9999px !important;
	background: var(--wp--preset--color--primary) !important;
	color: var(--wp--preset--color--ink) !important;
	font-weight: 600 !important;
	text-decoration: none !important;
}

body .em.pixelbones .atk-login-prompt a:hover {
	background: var(--wp--preset--color--primary-hover) !important;
}

.em-event-booking-form p.em-booking-form-details {
	font-weight: 500;
}

/* 6. "Mine tilmeldinger" table
   ------------------------------------------------------------------ */
body .em.em-my-bookings table,
body .em-my-bookings table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--wp--preset--font-size--small);
}

body .em-my-bookings th,
body .em-my-bookings td {
	padding: 0.6rem 0.5rem;
	border-bottom: 1px solid var(--wp--preset--color--border);
	text-align: left;
	vertical-align: top;
}

/* "Frameld": EM puts it in a "Handlinger" dropdown, which is overkill for one action.
   Hide the dropdown button and show the link itself (EM only moves it into a popup
   when the button is clicked). Same look as "Frameld" on the event page. */
body .em.pixelbones.em-my-bookings .em-tooltip-ddm {
	display: none !important;
}

body .em.pixelbones.em-my-bookings .em-my-bookings-actions-content {
	display: block !important;
	position: static !important;
	width: auto !important;
	height: auto !important;
	overflow: visible !important;
	clip: auto !important;
	clip-path: none !important;
	opacity: 1 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	background: none !important;
	box-shadow: none !important;
}

body .em.pixelbones .atk-cancel-link,
body .em.pixelbones.em-my-bookings .em-bookings-cancel {
	display: inline-block;
	padding: 0.5rem 1.1rem 0.4rem !important;
	border: 1px solid var(--wp--preset--color--border) !important;
	border-radius: 9999px !important;
	background: var(--wp--preset--color--white) !important;
	color: var(--wp--preset--color--foreground) !important;
	font-size: var(--wp--preset--font-size--small) !important;
	font-weight: 600 !important;
	line-height: 1.4 !important;
	text-decoration: none !important;
	white-space: nowrap;
}

body .em.pixelbones .atk-cancel-link:hover,
body .em.pixelbones.em-my-bookings .em-bookings-cancel:hover {
	border-color: var(--wp--preset--color--bike) !important;
	color: var(--wp--preset--color--bike) !important;
}

body .em.pixelbones .atk-ev__cancel {
	margin-top: 0.75rem;
}

/* "Mit overblik": EM prints the page numbers above and below the table; keep only the bottom ones. */
body .em.pixelbones.em-my-bookings > .tablenav:first-child {
	display: none;
}

body .em.pixelbones.em-my-bookings .table-wrap + * .em-pagination,
body .em.pixelbones.em-my-bookings > .tablenav:last-of-type .em-pagination {
	margin-top: var(--wp--preset--spacing--30);
}

/* Pagination: EM keeps it on one line and, when it doesn't fit, collapses the extra
   page numbers into "…" (its own JS adds .overflowing). Only made smaller and in theme colours. */
body .em.pixelbones .em-pagination {
	--color: var(--wp--preset--color--muted-foreground);
	--color-hover: var(--wp--preset--color--foreground);
	margin-bottom: var(--wp--preset--spacing--20);
}

body .em.pixelbones .em-pagination .page-numbers,
body .em.pixelbones .em-pagination .page-numbers:hover {
	min-width: 2rem;
	height: 2.25rem;
	padding: 0.4rem 0;
	font-size: 1rem !important;
	font-weight: 600;
}

body .em.pixelbones .em-pagination .page-numbers.current {
	color: var(--wp--preset--color--brand-deep) !important;
	font-size: 1.125rem !important;
	text-decoration: 2px solid underline;
}

/* Phones: each booking becomes a two-line row instead of a five-column table:
   event name on top, "date · status" under it, the "Handlinger" button on the right.
   The header row and the "Pladser" column (always 1) are dropped. */
@media (max-width: 599px) {
	body .em.pixelbones.em-my-bookings table,
	body .em.pixelbones.em-my-bookings table tbody {
		display: block;
		table-layout: auto;
	}

	body .em.pixelbones.em-my-bookings table thead {
		display: none !important;
	}

	body .em.pixelbones.em-my-bookings table tr {
		display: grid;
		grid-template-columns: auto 1fr auto;
		grid-template-areas:
			"event event action"
			"date status action";
		align-items: center;
		column-gap: 0.5rem;
		padding: 0.75rem 0;
		border-bottom: 1px solid var(--wp--preset--color--border);
	}

	body .em.pixelbones.em-my-bookings table td {
		display: block;
		padding: 0 !important;
		border: 0 !important;
	}

	body .em.pixelbones.em-my-bookings table td:nth-child(1) {
		grid-area: event;
		font-size: 1rem;
		font-weight: 700;
	}

	body .em.pixelbones.em-my-bookings table td:nth-child(2) {
		grid-area: date;
		color: var(--wp--preset--color--muted-foreground);
	}

	body .em.pixelbones.em-my-bookings table td:nth-child(3) {
		display: none !important;
	}

	body .em.pixelbones.em-my-bookings table td:nth-child(4) {
		grid-area: status;
		color: var(--wp--preset--color--muted-foreground);
	}

	body .em.pixelbones.em-my-bookings table td:nth-child(4)::before {
		content: "· ";
	}

	body .em.pixelbones.em-my-bookings table td:nth-child(5) {
		grid-area: action;
	}
}

/* 7. Phones
   ------------------------------------------------------------------ */
@media (max-width: 599px) {
	.atk-event {
		grid-template-columns: 3.75rem 1fr;
	}

	.atk-event__arrow {
		display: none;
	}

	body .em.em-list .em-item .em-item-info {
		padding-left: 1rem;
	}
}

/* Events Manager wraps its pages ("Mit overblik") in <div id="em-wrapper">, so a wide
   block inside the page is no longer a direct child of the constrained content and
   stays narrow. Let the wrapper take the wide width when it holds a wide block. */
.is-layout-constrained > #em-wrapper:has(> .alignwide) {
	max-width: var(--wp--style--global--wide-size) !important;
}
