/**
 * Embeds for other websites (Embed\Embed): a ski center's status and the ski centers map.
 *
 * Both fill the partner's iframe (usually 400px high, any width): the center's boxes and the map share its
 * height, lists scroll inside their box.
 */

html,
body.xiono-embed-page {
	height: 100%;
	margin: 0;
}

body.xiono-embed-page {
	overflow-x: hidden;
	background: var(--wp--preset--color--grey-lighter, #f8f7f8);
	color: var(--wp--preset--color--black, #282828);
	font-family: var(--wp--preset--font-family--inter, "Helvetica Neue", Arial, sans-serif);
	-webkit-font-smoothing: antialiased;
}

.xiono-embed *,
.xiono-embed *::before,
.xiono-embed *::after {
	box-sizing: border-box;
}

.xiono-embed .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	border: 0;
	white-space: nowrap;
}

.xiono-embed__powered {
	margin: 0;
	color: var(--wp--preset--color--grey-dark, #6d6d6d);
	font-size: 12px;
	line-height: 1.4;
}

.xiono-embed__powered a {
	color: var(--wp--preset--color--fuchsia-dark, #8c1972);
	text-decoration: none;
}

.xiono-embed__powered a:hover,
.xiono-embed__powered a:focus-visible {
	text-decoration: underline;
}

/* ------------------------------------------------------------------ Ski center */

.xiono-embed--center {
	display: flex;
	flex-direction: column;
	height: 100vh;
	min-height: 300px;
}

.xiono-embed__bar {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 14px;
	border-bottom: 3px solid var(--wp--preset--color--fuchsia, #af1f8e);
	background: #fff;
}

.xiono-embed__name {
	overflow: hidden;
	color: var(--wp--preset--color--fuchsia-dark, #8c1972);
	font-size: 17px;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.xiono-embed__name:hover,
.xiono-embed__name:focus-visible {
	text-decoration: underline;
}

.xiono-embed__logo {
	flex: none;
}

.xiono-embed__logo img {
	display: block;
	width: auto;
	height: 30px;
}

.xiono-embed__body {
	flex: 1;
	min-height: 0;
	padding: 12px;
}

/* Doubled classes: beat the block's own grid and its "narrower boxes" width. */
.xiono-embed .xiono-center-status.xiono-center-status {
	grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); /* Conditions need the room; lifts are short rows. */
	gap: 12px;
	max-width: none;
	height: 100%;
}

.xiono-embed .xiono-box.xiono-box {
	height: 100%;
	min-height: 0;
	padding: 14px;
	border-radius: 12px;
	box-shadow: 0 2px 12px rgba(82, 65, 109, 0.15);
}

.xiono-embed .xiono-box--conditions {
	overflow-y: auto;
	scrollbar-width: thin;
}

.xiono-embed .xiono-box__title {
	margin-bottom: 10px;
	font-size: 17px;
}

.xiono-embed .xiono-box__item {
	min-height: 40px;
	padding: 6px 0;
}

.xiono-embed--center .xiono-embed__powered {
	flex: none;
	padding: 0 14px 8px;
	text-align: right;
}

/* Next 3 days under the boxes: only when the iframe has room (the usual 400px leaves none for the boxes). */
.xiono-embed--center > .xiono-forecast3 {
	flex: none;
	margin: -2px 12px 10px;
	box-shadow: 0 2px 12px rgba(82, 65, 109, 0.15);
	background: #fff;
}

.xiono-embed--center > .xiono-forecast3 .xiono-forecast3__day {
	background: var(--wp--preset--color--grey-lighter, #f8f7f8);
}

@media (min-width: 560px) and (max-height: 519px) {

	.xiono-embed--center > .xiono-forecast3 {
		display: none;
	}
}

/* Narrow iframes: boxes stacked, the page scrolls inside the iframe. */
@media (max-width: 559px) {

	.xiono-embed--center {
		height: auto;
		min-height: 100vh;
	}

	.xiono-embed .xiono-center-status.xiono-center-status {
		grid-template-columns: minmax(0, 1fr);
		height: auto;
	}

	.xiono-embed .xiono-box.xiono-box {
		height: auto;
	}

	.xiono-embed .xiono-box--lifts.xiono-box--lifts {
		max-height: 320px;
	}
}

/* ------------------------------------------------------------------ Map */

.xiono-embed--map {
	position: relative;
	height: 100vh;
	min-height: 300px;
	overflow: hidden;
}

/* The map fills the iframe; card (and list, when there's room) float over it. */
.xiono-embed .xiono-map {
	--h: max(300px, 100vh);
	--panels: 0px;
	--xiono-header-h: 0px;
	--cw: max(100cqw, calc(var(--h) * var(--ratio)));
	height: 100%;
}

.xiono-embed .xiono-map__stage {
	height: var(--h);
}

.xiono-embed .xiono-map__panels.xiono-map__panels {
	position: absolute;
	top: 12px;
	right: 12px;
	bottom: 12px;
	z-index: 3;
	grid-template-columns: minmax(0, 380px);
	align-items: start;
	width: min(380px, calc(100% - 24px));
	padding: 0;
	pointer-events: none;
}

/* Narrow: the card under the "Powered by" badge. */
@media (max-width: 899px) {

	.xiono-embed .xiono-map__panels.xiono-map__panels {
		top: 56px;
	}
}

.xiono-embed .xiono-map__card,
.xiono-embed .xiono-map__list {
	max-height: 100%;
	border-width: 4px;
	border-radius: 14px;
	pointer-events: auto;
}

.xiono-embed .xiono-map__list {
	display: none;
}

.xiono-embed--map .xiono-embed__powered {
	position: absolute;
	top: 12px;
	left: 12px;
	z-index: 4;
	padding: 6px 12px;
	border-radius: 49px;
	background: #fff;
	box-shadow: 0 0 7px rgba(0, 0, 0, 0.25);
}

/* Wide iframes: the list too, as on the homepage; pins stay clear of it. */
@media (min-width: 900px) {

	.xiono-embed .xiono-map {
		--panels: 296px; /* 260 list + 12 margin + 24 room. */
		--cw: max(100cqw, calc(var(--h) * var(--ratio)), calc((var(--panels) + 40px) / (1 - var(--pin-max))));
	}

	/* Flex, not the block's grid: its "card closed" grid rules don't apply here. */
	.xiono-embed .xiono-map__panels.xiono-map__panels {
		display: flex;
		align-items: flex-start;
		gap: 12px;
		width: auto;
	}

	.xiono-embed .xiono-map__card {
		width: 380px;
	}

	.xiono-embed .xiono-map__list {
		display: flex;
		flex: none;
		width: 260px;
		height: 100%;
	}

	.xiono-embed .xiono-map__list-title {
		padding: 10px;
		font-size: 16px;
	}
}

/* Phones: the portrait preview, covering the iframe (the block's own rule sizes it to its width). */
@media (max-width: 781px) {

	.xiono-embed .xiono-map__stage {
		aspect-ratio: auto;
	}

	.xiono-embed .xiono-map__canvas {
		inset: auto;
		top: 50%;
		left: 50%;
		width: max(100%, calc(var(--h) * 800 / 960));
		height: auto;
		aspect-ratio: 800 / 960;
		transform: translate(-50%, -50%);
	}
}
