/*
 * The door's panel, on the first screen of the home page: the panel of the application's sign-in
 * door (backend/resources/css/filament/door.css, .rentops-door-panel) carried over. The same canvas
 * (808 × 868), the headline pair, the glass tab bar whose chosen tab carries a 6 s sweep, three
 * cards and the car. The composition is set in container units (cqw: one hundredth of the panel's
 * width), so it keeps its proportions at every width; text, targets and corners keep their pixels.
 *
 * Phone first. Under 768 px: a taller panel, ONE card laid out in a row, the tabs as icons, every
 * control 44 px. From 768 px: the door's three cards. assets/js/door.js moves it; under
 * prefers-reduced-motion nothing moves by itself.
 */

.ro-door {
	/* The composition on a phone. From 768 px the door's own numbers replace these (below). */
	--ro-porte-titre-haut: 5cqw;
	--ro-porte-titre-debut: 7.92cqw;
	--ro-porte-titre-taille: clamp(20px, 7.3cqw, 60px);
	--ro-porte-titre-ligne: 1.115;
	--ro-porte-barre-haut: 24cqw;
	--ro-porte-barre-debut: 7.92cqw;
	--ro-porte-voiture-bas: -3cqw;
	--ro-porte-voiture-debut: 1cqw;
	--ro-porte-voiture-large: 98cqw;

	position: relative;
	box-sizing: border-box;
	inline-size: 100%;
	aspect-ratio: 3 / 4;
	container-type: size;
	overflow: hidden;
	isolation: isolate;
	border-radius: var(--ro-coin-panneau);
	background: var(--ro-sol-panneau);
	box-shadow: inset 0 0 0 1px var(--trait);
	color: var(--nuit);
}

/* The contour rings, inside the panel: masks of the two files, in the brand's blue. */
.ro-door::before,
.ro-door::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: var(--ro-bleu-500);
	mask-repeat: no-repeat;
	mask-size: cover;
	pointer-events: none;
}

.ro-door::before {
	opacity: 0.26;
	mask-image: url("../img/porte-anneaux-hd.svg");
	mask-position: right top;
}

.ro-door::after {
	opacity: 0.2;
	mask-image: url("../img/porte-anneaux-bg.svg");
	mask-position: left bottom;
}

.ro-door__art {
	position: absolute;
	inset: 0;
}

/* The grain, over the panel's ground and under what stands on it. */
.ro-door__art::before {
	content: "";
	position: absolute;
	inset: 0;
	opacity: 0.12;
	background: var(--ro-grain-fort) 0 0 / 100% 100%;
	pointer-events: none;
}

/* The headline: « Chaque départ, » in Archivo, the line under it in Inter and blue, which changes. */
.ro-door__head {
	position: absolute;
	inset-block-start: var(--ro-porte-titre-haut);
	inset-inline-start: var(--ro-porte-titre-debut);
	max-inline-size: none;
	margin: 0;
	font-family: var(--ro-police-texte);
	font-size: var(--ro-porte-titre-taille);
	line-height: var(--ro-porte-titre-ligne);
	white-space: nowrap;
}

.ro-door__lead {
	color: var(--nuit);
	font-family: var(--ro-police-titre);
	font-stretch: 100%;
	font-weight: 800;
	letter-spacing: -0.02em;
}

/* A line too long for its place is drawn smaller (--fit, from the PHP), never cut or wrapped. */
.ro-door__line {
	display: none;
	color: var(--ro-bleu-600);
	font-size: calc(var(--fit, 1) * 1em);
	font-weight: 400;
	letter-spacing: -0.023em;
}

.ro-door__line.is-on {
	display: inline-block;
	animation: ro-door-rise var(--ro-duree-ligne) var(--ro-courbe) both;
}

/* The bar: white, a fine line, a hair of shadow. Above the cards, which a chosen one lifts toward it. */
.ro-door__bar {
	position: absolute;
	inset-block-start: var(--ro-porte-barre-haut);
	inset-inline-start: var(--ro-porte-barre-debut);
	z-index: 1;
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 4px;
	border: 1px solid var(--trait);
	border-radius: 12px;
	background: var(--papier);
	box-shadow: var(--ro-ombre-barre);
}

.ro-door__tabs {
	display: flex;
	gap: 4px;
}

/*
 * The tabs and the two controls. The parent theme draws every button (a border, a fill on hover and
 * on focus): two classes win over its selectors, state by state. 44 px on a phone.
 */
.ro-door .ro-door__tab,
.ro-door .ro-door__ctl {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	block-size: 44px;
	min-inline-size: 44px;
	margin: 0;
	padding: 0;
	border: 1px solid transparent;
	border-radius: var(--ro-coin-controle);
	background-color: transparent;
	color: var(--ro-gris-600);
	font-family: var(--ro-police-texte);
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 20px;
	white-space: nowrap;
	cursor: pointer;
	transition:
		background-color 200ms,
		color 200ms;
}

.ro-door .ro-door__tab {
	gap: 8px;
}

.ro-door .ro-door__tab:hover:not(.is-on),
.ro-door .ro-door__ctl:hover {
	background-color: rgb(91 100 120 / 0.1);
	color: var(--ro-gris-600);
}

/* The chosen tab: glass on the blue, its solid icon popping in. */
.ro-door .ro-door__tab.is-on {
	background: var(--ro-verre-bleu);
	box-shadow: var(--ro-ombre-verre-bleu);
	color: var(--papier);
}

/* The theme's focus rule removes every shadow: the chosen tab keeps its glass. */
.ro-door .ro-door__tab.is-on:focus-visible {
	box-shadow: var(--ro-ombre-verre-bleu);
}

.ro-door__icon {
	position: relative;
	display: inline-flex;
	color: var(--ro-gris-500);
}

.ro-door__icon svg {
	display: block;
	inline-size: 20px;
	block-size: 20px;
}

.ro-door__icon--on {
	display: none;
}

.ro-door__tab.is-on .ro-door__icon--off {
	display: none;
}

.ro-door__tab.is-on .ro-door__icon--on {
	display: inline-flex;
	color: var(--papier);
	filter: drop-shadow(0 1px 1px rgb(0 20 80 / 0.45));
	animation: ro-door-pop 520ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Icons only on a phone: the button's aria-label carries the name. */
.ro-door__tab-label {
	position: relative;
	display: none;
}

/* The chosen tab's timeline: a soft lighter sweep across it in 6 s; its end moves to the next slide. */
.ro-door__sweep {
	position: absolute;
	inset: 0;
	border-radius: 9px;
	background: rgb(255 255 255 / 0.13);
	mask-image: linear-gradient(90deg, #000 78%, transparent);
	transform-origin: left center;
	transform: scaleX(0);
	animation: ro-door-sweep var(--ro-duree-balayage) linear forwards;
	pointer-events: none;
}

/* A hand on the panel (a pointer over it, the focus inside it) or « pause » holds the sweep. */
.ro-door:focus-within .ro-door__sweep,
.ro-door.is-paused .ro-door__sweep {
	animation-play-state: paused;
}

@media (hover: hover) {
	.ro-door:hover .ro-door__sweep {
		animation-play-state: paused;
	}
}

.ro-door__sep {
	inline-size: 1px;
	block-size: 22px;
	margin-inline: 4px;
	background: var(--trait);
}

.ro-door__ctl svg {
	display: block;
	inline-size: 18px;
	block-size: 18px;
}

.ro-door__glyph {
	display: inline-flex;
}

.ro-door__glyph svg {
	inline-size: 16px;
	block-size: 16px;
}

.ro-door__glyph--play,
.ro-door.is-paused .ro-door__glyph--pause {
	display: none;
}

.ro-door.is-paused .ro-door__glyph--play {
	display: inline-flex;
}

/* A card: tile, label, value, caption. On a phone only the chosen one shows, in a row. */
.ro-door__card {
	position: absolute;
	inset-block-start: 45cqw;
	inset-inline-start: 7.92cqw;
	display: none;
	box-sizing: border-box;
	inline-size: 60cqw;
	align-items: center;
	gap: 14px;
	padding: 16px 18px;
	border: 1px solid var(--ro-bleu-100);
	border-radius: var(--ro-coin-carte);
	background: var(--ro-sol-carte);
	box-shadow: var(--ro-ombre-carte);
	color: var(--nuit);
	transition:
		transform var(--ro-duree-carte) var(--ro-courbe),
		box-shadow var(--ro-duree-carte);
}

.ro-door__card.is-on {
	display: flex;
	border-color: var(--ro-bleu-600);
	background: var(--ro-sol-carte-active);
	box-shadow: var(--ro-ombre-carte-active);
	color: var(--papier);
	animation: ro-door-rise var(--ro-duree-carte) var(--ro-courbe) both;
}

.ro-door__tile {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	inline-size: 36px;
	block-size: 36px;
	border-radius: var(--ro-coin-controle);
	background: var(--ro-bleu-50);
	color: var(--ro-bleu-600);
}

.ro-door__tile svg {
	display: block;
	inline-size: 18px;
	block-size: 18px;
}

.ro-door__card.is-on .ro-door__tile {
	background: rgb(255 255 255 / 0.16);
	color: var(--papier);
}

.ro-door__card-text {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-inline-size: 0;
}

.ro-door__card-label {
	color: var(--ro-gris-600);
	font-size: 13px;
	font-weight: 600;
	line-height: 18px;
}

/* The value is a figure of the specimen rental, in Archivo like the headline. */
.ro-door__card-value {
	font-family: var(--ro-police-titre);
	font-size: calc(var(--fit, 1) * clamp(18px, 3.713cqw, 30px));
	font-stretch: 100%;
	font-weight: 800;
	letter-spacing: -0.5px;
	line-height: 1.13;
	white-space: nowrap;
}

.ro-door__card-caption {
	color: var(--ro-gris-600);
	font-size: 12px;
	line-height: 16px;
}

.ro-door__card.is-on .ro-door__card-label,
.ro-door__card.is-on .ro-door__card-caption {
	color: var(--ro-bleu-100);
}

/* The car stands in front of the cards, as in the door. */
.ro-door__car {
	position: absolute;
	inset-block-end: var(--ro-porte-voiture-bas);
	inset-inline-start: var(--ro-porte-voiture-debut);
	inline-size: var(--ro-porte-voiture-large);
	max-inline-size: none;
	block-size: auto;
}

/*
 * A wider phone has the room: the card, 108 px of text and padding, takes a smaller share of a
 * panel 430 px wide or more, which is then less tall (a narrow one needs the 3 / 4 above).
 */
@media (min-width: 460px) and (max-width: 767px) {
	.ro-door {
		aspect-ratio: 5 / 6;
	}
}

/*
 * From 768 px: the door's own composition, in its numbers (its desktop block): the three cards at
 * their places, the labels back in the tabs, the tabs 36 px (44 px for a finger, below). The panel
 * keeps the door's canvas, 808 × 868, and is never wider than 42 rem: one column up to 1024 px
 * would otherwise make it taller than a screen. The site's panel is 672 px wide at most, not 808:
 * the card text, 12 to 30 px, keeps its pixels and reaches lower, so the car stands 4 units lower
 * than in the door (-5cqw for -1.07cqw) and the captions stay clear of its roof.
 */
@media (min-width: 768px) {
	.ro-door {
		--ro-porte-titre-haut: 5.94cqw;
		--ro-porte-titre-debut: 7.92cqw;
		--ro-porte-titre-taille: clamp(32px, 6.44cqw, 60px);
		--ro-porte-titre-ligne: 1.115;
		--ro-porte-barre-haut: 22.28cqw;
		--ro-porte-barre-debut: 7.92cqw;
		--ro-porte-carte-haut: 29.7cqw;
		--ro-porte-carte-large: 24.26cqw;
		--ro-porte-carte-haute: 44.55cqw;
		--ro-porte-carte1-haut: 33.17cqw;
		--ro-porte-carte1-haute: 40.59cqw;
		--ro-porte-carte0-x: 11.88cqw;
		--ro-porte-carte1-x: 37.87cqw;
		--ro-porte-carte2-x: 63.86cqw;
		--ro-porte-voiture-bas: -5cqw;
		--ro-porte-voiture-debut: 5.32cqw;
		--ro-porte-voiture-large: 100.25cqw;
		--ro-porte-carte-marge: 20px;
		--ro-porte-carte-ecart: 16px;
		--ro-porte-carte-coin: var(--ro-coin-carte);
		--ro-porte-pastille: 36px;
		--ro-porte-pastille-coin: var(--ro-coin-controle);
		--ro-porte-valeur: clamp(18px, 3.713cqw, 30px);

		max-inline-size: 42rem;
		aspect-ratio: 808 / 868;
	}

	.ro-door .ro-door__tab,
	.ro-door .ro-door__ctl {
		block-size: 36px;
	}

	.ro-door .ro-door__tab {
		padding: 0 14px 0 12px;
	}

	.ro-door .ro-door__ctl {
		inline-size: 36px;
		min-inline-size: 0;
	}

	.ro-door__icon svg,
	.ro-door__glyph svg {
		inline-size: 16px;
		block-size: 16px;
	}

	.ro-door__tab-label {
		display: inline;
	}

	.ro-door__card {
		inset-block-start: var(--ro-porte-carte-haut);
		inline-size: var(--ro-porte-carte-large);
		block-size: var(--ro-porte-carte-haute);
		display: flex;
		flex-direction: column;
		align-items: stretch;
		gap: var(--ro-porte-carte-ecart);
		padding: var(--ro-porte-carte-marge);
		border-radius: var(--ro-porte-carte-coin);
	}

	/* The chosen card is lifted (its transition); the phone's rise does not apply here. */
	.ro-door__card.is-on {
		transform: translateY(-10px);
		animation: none;
	}

	.ro-door__card-0 {
		inset-inline-start: var(--ro-porte-carte0-x);
	}

	.ro-door__card-1 {
		inset-block-start: var(--ro-porte-carte1-haut);
		block-size: var(--ro-porte-carte1-haute);
		inset-inline-start: var(--ro-porte-carte1-x);
	}

	.ro-door__card-2 {
		inset-inline-start: var(--ro-porte-carte2-x);
	}

	.ro-door__tile {
		inline-size: var(--ro-porte-pastille);
		block-size: var(--ro-porte-pastille);
		border-radius: var(--ro-porte-pastille-coin);
	}

	.ro-door__card-value {
		font-size: calc(var(--fit, 1) * var(--ro-porte-valeur));
	}
}

/*
 * A pointer: the tabs and the controls look 36 px, as in the door, and are 44 px to reach. The
 * extension is a transparent layer that stays inside the bar's 4 px of padding.
 */
@media (min-width: 768px) and (pointer: fine) {
	.ro-door .ro-door__tab::after,
	.ro-door .ro-door__ctl::after {
		content: "";
		position: absolute;
		inset: -4px;
	}
}

/* A finger: the tabs and the controls are 44 px, at every width. */
@media (min-width: 768px) and (pointer: coarse) {
	.ro-door .ro-door__tab,
	.ro-door .ro-door__ctl {
		block-size: 44px;
	}

	.ro-door .ro-door__ctl {
		inline-size: 44px;
	}
}

/*
 * From 1025 px the panel shares the row with the text and is 542 to 672 px wide: narrower than the
 * canvas the door's desktop numbers were drawn on (808 px), while the bar, the tabs and the card
 * text keep their pixels. Below 1248 px the door's own tablet numbers (its 1024 to 1279 px block:
 * a lower bar, smaller cards, a larger car) take over, on a panel a little taller than the canvas.
 */
@media (min-width: 1025px) and (max-width: 1247px) {
	.ro-door {
		--ro-porte-titre-haut: 6.23cqw;
		--ro-porte-titre-debut: 7.48cqw;
		--ro-porte-titre-taille: clamp(32px, 6.85cqw, 60px);
		--ro-porte-titre-ligne: 1.136;
		--ro-porte-barre-haut: 24.92cqw;
		--ro-porte-barre-debut: 7.48cqw;
		--ro-porte-carte-haut: 35.2cqw;
		--ro-porte-carte-large: 24.92cqw;
		--ro-porte-carte-haute: 46.73cqw;
		--ro-porte-carte1-haut: 38.94cqw;
		--ro-porte-carte1-haute: 42.99cqw;
		--ro-porte-carte0-x: 8.72cqw;
		--ro-porte-carte1-x: 35.83cqw;
		--ro-porte-carte2-x: 62.93cqw;
		--ro-porte-voiture-bas: -2.28cqw;
		--ro-porte-voiture-debut: 1.56cqw;
		--ro-porte-voiture-large: 109cqw;
		--ro-porte-carte-marge: 17px;
		--ro-porte-carte-ecart: 14px;
		--ro-porte-carte-coin: 19px;
		--ro-porte-pastille: 31px;
		--ro-porte-pastille-coin: 9px;
		--ro-porte-valeur: clamp(18px, 4.05cqw, 26px);

		aspect-ratio: 4 / 5;
	}
}

/* Right to left: the contour lines, the sweep and the arrow turn with the reading; the car does not. */
[dir="rtl"] .ro-door::before,
[dir="rtl"] .ro-door::after {
	transform: scaleX(-1);
}

[dir="rtl"] .ro-door__sweep {
	transform-origin: right center;
	mask-image: linear-gradient(270deg, #000 78%, transparent);
}

[dir="rtl"] .ro-door__next svg {
	transform: scaleX(-1);
}

@media (min-width: 768px) {
	/* The car is not mirrored (its plate would read backwards): the middle card rises, as in the door. */
	[dir="rtl"] .ro-door__card-1 {
		inset-block-start: calc(var(--ro-porte-carte1-haut) - 2cqw);
	}
}

@keyframes ro-door-sweep {
	to {
		transform: scaleX(1);
	}
}

@keyframes ro-door-pop {
	from {
		opacity: 0;
		transform: scale(0.6) rotate(-12deg);
	}
}

@keyframes ro-door-rise {
	from {
		opacity: 0;
		transform: translateY(14px);
	}
}

/* Reduced motion: nothing runs. The sweep never plays, so nothing advances by itself; the tabs still work. */
@media (prefers-reduced-motion: reduce) {
	.ro-door__sweep,
	.ro-door__line.is-on,
	.ro-door__tab.is-on .ro-door__icon--on,
	.ro-door__card.is-on {
		animation: none;
	}

	.ro-door__card,
	.ro-door .ro-door__tab,
	.ro-door .ro-door__ctl {
		transition: none;
	}
}
