/* FTD Gated Content
 *
 * Tokens and button geometry are taken from the site's own design — the
 * --ls-* custom properties in BDK-child-theme/src/css/ls-central.css and the
 * .ftd-btn rules in FTD Events — rather than invented here, so the two cards
 * sit on the leasing page as if they had always been part of it.
 *
 * They are redeclared under a --ftdgc- prefix instead of being inherited: this
 * plugin has to render correctly on a page where neither of those stylesheets
 * happens to be enqueued.
 *
 * Selectors are prefixed with #page-container for the same reason FTD Events
 * does it: Divi's per-page CSS is specific enough to win otherwise.
 */

:root {
	--ftdgc-text: #05323c;
	--ftdgc-text-soft: #586365;
	--ftdgc-teal: #084e5e;
	--ftdgc-green: #00c77f;
	--ftdgc-brand-dark: #002b1c;
	--ftdgc-band: #f1f7f7;
	--ftdgc-photo-fallback: #cfe7ee;

	--ftdgc-hairline: rgba(8, 78, 94, 0.12);
	--ftdgc-focus-ring: rgba(0, 199, 127, 0.25);

	--ftdgc-shadow-card: 0 2px 12px rgba(97, 153, 185, 0.12);
	--ftdgc-shadow-card-hi: 0 12px 30px rgba(97, 153, 185, 0.26);
	--ftdgc-shadow-dialog: 0 24px 60px rgba(0, 43, 28, 0.28);

	--ftdgc-font-heading: FTDheading, Helvetica, Arial, sans-serif;
	--ftdgc-font-body: FTDbody, Helvetica, Arial, sans-serif;
	--ftdgc-font-ui: FTDmenu, Helvetica, Arial, sans-serif;
}

#page-container .ftdgc {
	height: 100%;
}

#page-container .ftdgc__state,
#page-container .ftdgc-card {
	height: 100%;
}

#page-container .ftdgc-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: #fff;
	border: 1px solid var(--ftdgc-hairline);
	border-radius: 16px;
	box-shadow: var(--ftdgc-shadow-card);
	transition: box-shadow 200ms ease, transform 200ms ease;
}

#page-container .ftdgc-card--locked:hover {
	box-shadow: var(--ftdgc-shadow-card-hi);
	transform: translateY(-2px);
}

/* The media area is a button so the whole preview is clickable, but it must
 * not inherit any of the theme's button chrome. */
#page-container .ftdgc-card__media {
	position: relative;
	display: block;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: var(--ftdgc-photo-fallback);
	aspect-ratio: 16 / 9;
	cursor: pointer;
	overflow: hidden;
}

#page-container .ftdgc-card__media--static {
	cursor: default;
}

#page-container .ftdgc-card__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

#page-container .ftdgc-card__overlay {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	background: linear-gradient(180deg, rgba(5, 50, 60, 0.1) 0%, rgba(5, 50, 60, 0.55) 100%);
	transition: background-color 200ms ease;
}

#page-container .ftdgc-card__badge {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: var(--ftdgc-text);
	transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

#page-container .ftdgc-card__media:hover .ftdgc-card__badge,
#page-container .ftdgc-card__media:focus-visible .ftdgc-card__badge {
	background: var(--ftdgc-green);
	color: #fff;
	transform: scale(1.06);
}

/* A triangle reads as left-of-centre in a circle even when it is centred.
 * The nudge corrects that, and must not reach the symmetrical file icon. */
#page-container .ftdgc-card__badge--play svg {
	margin-left: 3px;
}

#page-container .ftdgc-card__lock {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 5px 13px;
	border-radius: 13px;
	background: rgba(255, 255, 255, 0.9);
	color: var(--ftdgc-teal);
	font-family: var(--ftdgc-font-ui);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.3px;
}


#page-container .ftdgc-card__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	align-items: flex-start;
	gap: 12px;
	padding: 24px;
}

#page-container .ftdgc-card__title {
	margin: 0;
	padding: 0;
	font-family: var(--ftdgc-font-heading);
	font-size: 22px;
	font-weight: 700;
	line-height: 30px;
	color: var(--ftdgc-text);
}

#page-container .ftdgc-card__teaser {
	margin: 0;
	padding: 0;
	font-family: var(--ftdgc-font-body);
	font-size: 16px;
	line-height: 26px;
	color: var(--ftdgc-text-soft);
}

/* Pushes the button to the bottom so two cards side by side line up even when
 * one has a longer teaser than the other. */
#page-container .ftdgc-card__body .ftdgc-btn {
	margin-top: auto;
}

#page-container .ftdgc-card__hint {
	margin: 0;
	font-family: var(--ftdgc-font-body);
	font-size: 14px;
	line-height: 21px;
	color: var(--ftdgc-text-soft);
}

#page-container .ftdgc-card__meta {
	margin: 0;
	font-family: var(--ftdgc-font-ui);
	font-size: 13px;
	color: var(--ftdgc-text-soft);
}

#page-container .ftdgc-card__player {
	position: relative;
	aspect-ratio: 16 / 9;
	background: #000;
}

#page-container .ftdgc-card__player iframe,
#page-container .ftdgc-card__player video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* Button — geometry copied from FTD Events so the two plugins agree. */
#page-container .ftdgc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 9px;
	min-height: 48px;
	padding: 0 30px;
	border: none;
	border-radius: 24px;
	background: var(--ftdgc-text);
	color: #fff;
	font-family: var(--ftdgc-font-ui);
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0.3px;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 160ms ease, color 160ms ease;
}

#page-container .ftdgc-btn:hover,
#page-container .ftdgc-btn:focus-visible {
	background: var(--ftdgc-brand-dark);
	color: #fff;
}

#page-container .ftdgc-card--unlocked .ftdgc-btn {
	background: var(--ftdgc-green);
}

#page-container .ftdgc-card--unlocked .ftdgc-btn:hover,
#page-container .ftdgc-card--unlocked .ftdgc-btn:focus-visible {
	background: var(--ftdgc-text);
}

#page-container .ftdgc-card__media:focus-visible,
#page-container .ftdgc-btn:focus-visible {
	outline: 3px solid var(--ftdgc-focus-ring);
	outline-offset: 2px;
}

.ftdgc-dialog {
	width: min(560px, calc(100vw - 32px));
	max-height: calc(100vh - 48px);
	/* dvh følger mobilbrowserens synlige højde, når URL-linjen glider ind og ud. */
	max-height: calc(100dvh - 48px);
	/* Uden denne klippes formularen på lave skærme i stedet for at kunne scrolles. */
	overflow: auto;
	overscroll-behavior: contain;
	padding: 0;
	border: 0;
	border-radius: 18px;
	background: #fff;
	box-shadow: var(--ftdgc-shadow-dialog);
	color: var(--ftdgc-text);
}

.ftdgc-dialog::backdrop {
	background: rgba(5, 50, 60, 0.55);
}

.ftdgc-dialog__inner {
	position: relative;
	padding: 36px 32px 32px;
}

.ftdgc-dialog__close {
	position: absolute;
	top: 14px;
	right: 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--ftdgc-teal);
	cursor: pointer;
	transition: background-color 160ms ease;
}

.ftdgc-dialog__close:hover,
.ftdgc-dialog__close:focus-visible {
	background: var(--ftdgc-band);
}

.ftdgc-dialog__heading {
	margin: 0 0 6px;
	padding: 0;
	font-family: var(--ftdgc-font-heading);
	font-size: 24px;
	font-weight: 700;
	line-height: 32px;
	color: var(--ftdgc-text);
}

.ftdgc-dialog__intro {
	margin: 0 0 22px;
	font-family: var(--ftdgc-font-body);
	font-size: 16px;
	line-height: 26px;
	color: var(--ftdgc-text-soft);
}

/* The site styles Gravity Forms globally in the child theme; the dialog only
 * needs to stop the form from running to the edges. */
.ftdgc-dialog__form .gform_wrapper {
	margin: 0;
}

.ftdgc-granted {
	padding: 8px 0;
	font-family: var(--ftdgc-font-body);
	font-size: 16px;
	line-height: 26px;
	color: var(--ftdgc-text);
}

.ftdgc-granted__text {
	margin: 0;
}

.ftdgc-granted__note {
	margin: 4px 0 0;
	font-family: var(--ftdgc-font-ui);
	font-size: 14px;
	color: var(--ftdgc-text-soft);
}

body.ftdgc-dialog-open {
	overflow: hidden;
}

#page-container .ftdgc-notice {
	padding: 14px 18px;
	border: 1px dashed var(--ftdgc-hairline);
	border-radius: 10px;
	background: var(--ftdgc-band);
	font-family: var(--ftdgc-font-ui);
	font-size: 14px;
	color: var(--ftdgc-teal);
}

/* Small screens — the two-column layout is Divi's; this just keeps the card
 * comfortable once it is on its own. */
@media (max-width: 767px) {
	#page-container .ftdgc-card__body {
		padding: 20px;
		gap: 10px;
	}

	#page-container .ftdgc-card__title {
		font-size: 20px;
		line-height: 28px;
	}

	.ftdgc-dialog__inner {
		padding: 30px 20px 24px;
	}
}

@media (prefers-reduced-motion: reduce) {
	#page-container .ftdgc-card,
	#page-container .ftdgc-card__badge,
	#page-container .ftdgc-btn {
		transition: none;
	}

	#page-container .ftdgc-card--locked:hover {
		transform: none;
	}
}
/* ---------------------------------------------------------------------------
 * Divi-hjaelpeklasser
 *
 * Divi floats its columns, so two cards side by side are only as tall as their
 * own content and the buttons end up at different heights. Put ftdgc-row on the
 * Divi row and ftdgc-col on each column to make that one row a flex row; the
 * card's own height:100% then does the rest.
 * ------------------------------------------------------------------------ */

/* Rækken og kolonnen finder sig selv.
 *
 * :has() udpeger netop de Divi-rækker og -kolonner, der indeholder et gated
 * kort, så redaktøren bare kan indsætte shortcoden og være færdig. Reglerne
 * står for sig selv og ikke i samme selector-liste som klasserne nedenfor:
 * en browser uden :has() kasserer hele listen, hvis blot én selector er
 * ukendt, og så ville fallback'en ryge med.
 * ------------------------------------------------------------------------ */

#page-container .et_pb_row:has(.ftdgc) {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
}

#page-container .et_pb_column:has(.ftdgc) {
	display: flex;
}

#page-container .et_pb_column:has(.ftdgc) > .et_pb_module {
	width: 100%;
	margin-bottom: 0;
}

@media (max-width: 980px) {
	#page-container .et_pb_row:has(.ftdgc) {
		display: block;
	}

	#page-container .et_pb_column:has(.ftdgc) > .et_pb_module {
		margin-bottom: 30px;
	}
}

/* Fallback: de oprindelige klasser, for ældre browsere og for sider der
 * allerede bruger dem. */

#page-container .et_pb_row.ftdgc-row {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
}

#page-container .ftdgc-col {
	display: flex;
}

#page-container .ftdgc-col > .et_pb_module {
	width: 100%;
	margin-bottom: 0;
}

@media (max-width: 980px) {
	#page-container .et_pb_row.ftdgc-row {
		display: block;
	}

	#page-container .ftdgc-col > .et_pb_module {
		margin-bottom: 30px;
	}
}

/* ---------------------------------------------------------------------------
 * Formularens labels
 *
 * Child temaet skjuler .gfield_label globalt og viser dem kun igen paa
 * kontaktformularen (#gform_1) via en show-label-klasse. Vores dialog arver
 * skjulningen og ville staa med to blanke felter, saa labels vises igen her —
 * scoped til dialogen, saa resten af sitet er uberoert.
 *
 * Placeholders alene ville ikke vaere nok: de forsvinder i det oejeblik man
 * begynder at skrive, og saa kan man ikke laengere se hvad feltet er.
 * ------------------------------------------------------------------------ */

.ftdgc-dialog .gform_wrapper .gfield_label {
	display: block;
	margin: 0 0 6px;
	font-family: var(--ftdgc-font-ui);
	font-size: 14px;
	font-weight: 700;
	line-height: 20px;
	color: var(--ftdgc-text);
}

/* Stjernen for paakraevede felter skjules af samme regel i temaet. */
.ftdgc-dialog .gform_wrapper .gfield_label span,
.ftdgc-dialog .gform_wrapper .gfield_required {
	display: inline;
	color: var(--ftdgc-teal);
}

/* Samtykkefeltets label er overfloedig — teksten staar ved selve afkrydsningen. */
.ftdgc-dialog .gform_wrapper .gfield--type-consent > .gfield_label {
	display: none;
}

.ftdgc-dialog .gform_wrapper .gform_fields {
	row-gap: 18px;
}

.ftdgc-dialog .gform_wrapper .gfield_consent_label,
.ftdgc-dialog .gform_wrapper .gfield--type-consent label {
	font-family: var(--ftdgc-font-body);
	font-size: 15px;
	line-height: 23px;
	color: var(--ftdgc-text-soft);
}

.ftdgc-dialog .gform_wrapper .gfield_description.validation_message {
	font-family: var(--ftdgc-font-body);
	font-size: 14px;
}
