/*
 * The document: a specimen on its sheet, set as the application sets its documents.
 * The only place of the site where Georgia and Courier New appear, and where « timbre » is used.
 */

.ro-document {
	--ro-document-encre: #1a1a1a;
	--ro-document-gris: #595959;
	--ro-document-ligne: #cccccc;
	--ro-document-serif: Georgia, 'Times New Roman', serif;
	--ro-document-mono: 'Courier New', monospace;

	box-sizing: border-box;
	inline-size: 100%;
	padding: var(--espace-24, 24px) var(--espace-16, 16px);
	border-radius: var(--coin-papier, 2px);
	background: var(--papier, #fff);
	box-shadow: var(--ro-ombre-feuille);
	color: var(--ro-document-encre);
	font-family: var(--ro-document-serif);
	font-size: 0.9375rem;
	font-stretch: 100%;
	font-weight: 400;
	line-height: 1.45;
	text-align: start;
	overflow-wrap: anywhere;
	scroll-margin-block-start: calc(var(--ro-hauteur-entete, 3.5rem) + var(--espace-16, 16px));
}

.ro-document *,
.ro-document *::before,
.ro-document *::after {
	box-sizing: border-box;
}

.ro-document p,
.ro-document h2,
.ro-document h3 {
	margin: 0;
	color: inherit;
	font-family: inherit;
	font-stretch: inherit;
	line-height: inherit;
	max-inline-size: none;
}

.ro-document strong {
	font-weight: 700;
}

.ro-document__head {
	display: flex;
	flex-wrap: wrap;
	gap: var(--espace-8, 8px) var(--espace-16, 16px);
	justify-content: space-between;
	align-items: flex-start;
	padding-block-end: var(--espace-12, 12px);
	border-block-end: 2px solid var(--ro-document-encre);
}

.ro-document__agency {
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.2;
}

.ro-document .ro-document__title {
	font-size: 0.9375rem;
	font-weight: 400;
}

.ro-document__ref {
	font-family: var(--ro-document-mono);
	font-size: 1rem;
	font-weight: 700;
}

.ro-document__muted {
	color: var(--ro-document-gris);
}

.ro-document .ro-document__specimen {
	display: inline-block;
	margin-block-start: var(--espace-4, 4px);
	padding: 1px var(--espace-8, 8px);
	border: 1px solid currentColor;
	font-family: var(--ro-document-mono);
	font-weight: 700;
	letter-spacing: 0.08em;
}

.ro-document__part {
	position: relative;
	padding-block-start: var(--espace-16, 16px);
}

.ro-document h3 {
	margin-block-end: var(--espace-8, 8px);
	padding-block-end: 3px;
	border-block-end: 1px solid var(--ro-document-ligne);
	font-size: 0.9375rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.ro-document__grid {
	display: grid;
	gap: var(--espace-4, 4px) var(--espace-24, 24px);
}

.ro-document table {
	inline-size: 100%;
	margin: 0 0 var(--espace-8, 8px);
	border: 0;
	border-collapse: collapse;
	font-size: inherit;
}

.ro-document th,
.ro-document td {
	padding: 5px var(--espace-4, 4px);
	border: 0;
	border-block-end: 1px solid #eeeeee;
	background: none;
	font-weight: 400;
	line-height: inherit;
	text-align: start;
	vertical-align: top;
}

.ro-document thead th {
	border-block-end-color: var(--ro-document-ligne);
	color: var(--ro-document-gris);
}

.ro-document td.ro-document__num {
	font-family: var(--ro-document-mono);
	font-variant-numeric: tabular-nums;
	text-align: end;
	white-space: nowrap;
}

.ro-document .ro-document__row--total > * {
	border-block-start: 2px solid var(--ro-document-encre);
	font-weight: 700;
}

.ro-document .ro-document__row--due > * {
	font-weight: 700;
}

.ro-document__signatures {
	display: grid;
	gap: var(--espace-16, 16px);
	margin-block-start: var(--espace-8, 8px);
}

.ro-document__signature {
	min-block-size: 6.5rem;
	padding: var(--espace-8, 8px);
	border: 1px solid #999999;
}

.ro-document__label {
	color: var(--ro-document-gris);
}

.ro-document .ro-document__signed {
	margin-block-start: var(--espace-16, 16px);
	font-size: 1.0625rem;
	font-style: italic;
}

.ro-document .ro-document__stamp {
	display: inline-block;
	margin-block-start: var(--espace-12, 12px);
	padding: 10px 14px;
	border: 2px dashed var(--timbre, #b45309);
	color: var(--timbre, #b45309);
	font-family: var(--ro-document-mono);
	font-weight: 700;
}

.ro-document__foot {
	margin-block-start: var(--espace-24, 24px);
	padding-block-start: var(--espace-8, 8px);
	border-block-start: 1px solid var(--ro-document-ligne);
	color: var(--ro-document-gris);
	text-align: center;
}

@media (min-width: 577px) {
	.ro-document {
		padding: var(--espace-32, 32px);
	}

	.ro-document__id {
		text-align: end;
	}

	.ro-document__grid,
	.ro-document__signatures {
		grid-template-columns: 1fr 1fr;
	}
}

/*
 * The sequence. The text is in the page and painted from the start; each part lies under a cover
 * of the paper's colour, which is lifted in turn. The class ro-sequence is set on <html>, before
 * the sheet is painted, only for a visitor who will see the sequence (inc/home-hero.php): with
 * reduced motion, or on a second page of the visit, none of these rules applies.
 * Seven parts 150 ms apart and 200 ms each, then the stamp: 1.5 s in all.
 */

@media (prefers-reduced-motion: no-preference) {
	.ro-sequence [data-ro-document-sequence] .ro-document__part::after {
		content: '';
		position: absolute;
		inset: 0 -2px -1px;
		background: var(--papier, #fff);
		pointer-events: none;
		transform-origin: 50% 100%;
	}

	.ro-sequence [data-ro-document-sequence] .ro-document__stamp {
		opacity: 0;
		transform: scale(1.25) rotate(-4deg);
	}

	.ro-sequence [data-ro-document-sequence].ro-document--joue .ro-document__part::after {
		animation: ro-document-decouvre 200ms ease-out both;
		animation-delay: calc(var(--ro-rang, 0) * 150ms);
	}

	.ro-sequence [data-ro-document-sequence].ro-document--joue .ro-document__stamp {
		animation: ro-document-timbre 250ms ease-out 1250ms both;
	}
}

@keyframes ro-document-decouvre {
	to {
		transform: scaleY(0);
	}
}

@keyframes ro-document-timbre {
	to {
		opacity: 1;
		transform: none;
	}
}

/*
 * The fold of a phone (document.js lays it). Under 768 px the sheet shows its first part, a white
 * fade over its foot, and a button opens the rest. The text is in the page whatever the fold: a
 * reader, a search engine and an assistant read all of it. Without JavaScript no fold is laid and
 * the sheet is whole.
 */

.ro-sheet__more {
	display: none;
	justify-content: center;
	max-inline-size: none;
	margin: var(--espace-24, 24px) 0 0;
}

/* Focused from the keyboard, the button scrolls clear of the action bar that stands at the foot of a phone. */
.ro-sheet__more button {
	scroll-margin-block-end: calc(var(--ro-hauteur-barre, 0px) + var(--espace-16, 16px));
}

@media (max-width: 767px) {
	.ro-sheet__more {
		display: flex;
	}

	.ro-sheet.is-folded .ro-document {
		position: relative;
		max-block-size: 70vh;
		overflow: hidden;
	}

	.ro-sheet.is-folded .ro-document::after {
		content: '';
		position: absolute;
		inset-block-end: 0;
		inset-inline: 0;
		block-size: 8rem;
		background: linear-gradient(to bottom, rgb(255 255 255 / 0), var(--papier, #fff) 85%);
		pointer-events: none;
	}
}
