/* `--mainSticky` est la hauteur que laisse en haut de la fenêtre ce qui s'y fixe ou s'y colle, et ce qui se colle dans
   `main` s'arrête dessous. Déclaré longueur, il se lit en pixels, `calc()` résolu, au nœud où on le lit : `zone.js` et
   `PlanningDuration.getScreen()` y retrouvent ce que la page compte, la bande du bac à sable comprise. */
@property --mainSticky {
	syntax: '<length>';
	inherits: true;
	initial-value: 0px;
}

@media (min-width: 1100px) and (min-height: 600px) {

	:root {
		--nav-main: 3.5rem;
		--nav-main-sticked: 3.5rem;
		--nav-structure: 0;
		--mainSticky: 0rem;
	}

}

/* Le complément exact de la colonne du bureau. Écrite `(max-width: 1099px), (max-height: 599px)`, la
   condition laisserait une fenêtre de 1099,5 px, sous un zoom, sans aucun des deux gabarits. */
@media not all and (min-width: 1100px) and (min-height: 600px) {

	:root {
		/* La rangée des univers, son retrait de `--space-xxs` en haut et en bas compris
		   (`template-structure.css`). Le téléphone ne l'affiche pas. */
		--structureSections: 4rem;
		--nav-structure: 4rem;
		/* La tête collante de la structure porte la rangée des univers et le fil. */
		--mainSticky: 8rem;
		--nav-main-sticked: 0rem;
		--nav-main: 3rem;
	}

}

h1 {
	font-weight: lighter;
	font-size: 2.5rem;
}

@media screen {

	h1 {
		font-family: 'Bricolage Grotesque', sans-serif;
	}

}

@media not all and (min-width: 576px) {

	h1 {
		font-size: 2rem;
	}

}

@media not all and (min-width: 450px) {

	h1 {
		font-size: 1.75rem;
	}

}

h1 a {
	color: inherit;
	transition: color 0.5s;
}

h1 a:hover {
	text-decoration: none;
	color: var(--primary);
}

h2 {
	font-weight: lighter;
	font-size: 2rem;
}

:where(.util-title) > h2 {
	font-weight: var(--heading-weight, lighter);
}

@media screen {

	h2 {
		font-family: 'Bricolage Grotesque', sans-serif;
	}

}

@media not all and (min-width: 576px) {

	h2 {
		font-size: 1.75rem;
	}

}

@media not all and (min-width: 450px) {

	h2 {
		font-size: 1.5rem;
	}

}

h3 {
	font-family: var(--font-title);
	font-size: 1.4rem;
}

:where(.util-title) > h3 {
	font-weight: var(--heading-weight, normal);
}

h4 {
	font-size: 1.25rem;
}

h5 {
	font-weight: bold;
	font-size: 1rem;
}

h6 {
	font-size: 1rem;
	color: var(--muted);
	font-weight: normal;
	text-transform: uppercase;
	letter-spacing: 3%;
}

@media screen {

	body {
		display: grid;
		grid-template-rows: max-content max-content 1fr max-content;
	}

	@media not all and (min-width: 1100px) and (min-height: 600px) {

		body {
			min-height: 150vh;
		}

	}

	@media (min-width: 1100px) and (min-height: 600px) {

		body {
			min-height: 100vh;
		}

	}

	/* Au téléphone, une page courte remplit la fenêtre sous la barre du haut, pour que le pied ne paraisse
	   qu'en défilant. La largeur seule en décide : une fenêtre de bureau basse garde son pied. `svh` est la
	   fenêtre barre d'adresse dépliée, celle du chargement : `dvh` suivrait son repli et déplacerait le
	   contenu pendant le défilement. */
	@media not all and (min-width: 768px) {

		body > main:has(+ footer > .util-footer) {
			min-height: calc(100svh - var(--nav-main));
		}

	}

}

@media print {

	body {
		background-color: white;
	}

}

.color-harvest {
	color: var(--harvest) !important;
}
.color-order {
	color: var(--order) !important;
}

body[data-template~="panel"] header,
body[data-template~="panel"] main,
body[data-template~="panel"] footer,
body[data-template~="panel"] nav {
	display: none;
}

@media (min-width: 1100px) and (min-height: 600px) {

	body[data-template~="structure"] > header {
		top: var(--nav-main);
	}

	body[data-template~="structure"] > nav {
		position: fixed;
		top: var(--sandbox-band);
	}

}

body[data-template~="structure"] > main > div.container:not(:first-child) {
	margin-top: 0;
}

header h1:only-child {
	margin: 0;
}

@media (min-width: 768px) {

	.util-stick-main {
		position: sticky;
		top: calc(var(--mainSticky) - 1px);
		z-index: 1;
	}

}

body {
	overflow-y: scroll;
}

/* Footer */
footer:empty {
	display: none;
}


.text-secondary a {
	color: inherit;
	text-decoration: underline;
}

.plant-start {
	font-weight: bold;
	display: inline-block;
	white-space: nowrap;
	font-size: 0.9em;
	margin-left: 0.25em;
	background-color: #8881;
	border-radius: 0.5em;
	line-height: 1;
}

.plant-start-background {
	padding: 0.25em 0.375em;
}

.plant-start-border {
	border: 1px solid #8888;
	padding: 0.25em;
}

/* L'année d'une série pérenne, qui suit la pastille de départ (`CultivationUi::getPerennialSeason()`) sur le
   plan de culture et sur les Récoltes du planning : comme la pastille, elle sort de la feuille des séries.
   « Année » et son numéro ne se séparent pas, la colonne d'une série pouvant être étroite. */
span.series-item-planning-details-cycle {
	margin-left: var(--space-xs);
	color: var(--muted);
	font-size: 0.9rem;
	text-decoration: underline;
	white-space: nowrap;
}

div.logout-external {
	position: fixed;
	bottom: 10px;
	right: 10px;
	max-width: 300px;
	z-index: 100000;
	font-size: 0.875rem;
	padding: 1rem;
	border-radius: var(--radius);
	color: white;
	background-color: #ff1dfd;
}

div.logout-external a {
	color: white;
	text-decoration: underline;
}

/* À droite : le pied du rail, à gauche, porte le lien des paramètres. */
.tab-identity {
	position: fixed;
	bottom: 10px;
	right: 10px;
	max-width: 300px;
	z-index: 100000;
	font-size: 0.875rem;
	padding: var(--space-xs) var(--space-md);
	border-radius: var(--radius);
	color: white;
	background-color: var(--primary);
}

.tab-identity a {
	color: inherit;
	text-decoration: underline;
	margin-left: var(--space-sm);
}

/* Au téléphone, au-dessus de la barre du bas d'une structure, qu'il cachait sinon. */
@media not all and (min-width: 768px) and (min-height: 600px) {

	div.logout-external,
	.tab-identity {
		bottom: calc(var(--nav-structure) + 10px);
	}

}

/* La bande du bac à sable (`RootTemplate::getSandboxBand()`), sur `body[data-sandbox]`. Un jaune et un noir que rien
   d'autre ne porte, pour qu'on ne la prenne pas pour un message de l'écran. `--sandbox-band`, nul ailleurs, est sa
   hauteur : ce qui se fixe ou se colle en haut de la fenêtre descend d'autant (la barre de la colonne plus bas,
   template-base.css, template-structure.css, template-doc.css). Elle passe sous les feuilles (`util-sheet`, 1102) et
   les panneaux (`Lime.getZIndex()`, au-delà), qui la couvrent tant qu'ils sont ouverts. À l'impression, un élément
   fixe se répéterait sur chaque page : elle ne vaut qu'à l'écran. */
:root {
	--sandbox-band: 0rem;
	--sandbox-band-layer: 1101;
	--sandbox-yellow: #ffd400;
	--sandbox-ink: #1a1a1a;
}

@media screen {

	body[data-sandbox] {
		--sandbox-band: 2.5rem;
		padding-top: var(--sandbox-band);
	}

}

@media print {

	.root-sandbox-band {
		display: none;
	}

}

.root-sandbox-band {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: var(--sandbox-band-layer);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-sm);
	height: var(--sandbox-band);
	font-size: 1rem;
	font-weight: 600;
	white-space: nowrap;
	color: var(--sandbox-ink);
	background-color: var(--sandbox-yellow);
	border-bottom: 4px solid transparent;
	border-image: repeating-linear-gradient(-45deg, var(--sandbox-ink) 0 10px, var(--sandbox-yellow) 10px 20px) 4;
}

/* La bande entre dans `--mainSticky` pour tout ce que porte `main`, en deux temps, une variable ne pouvant se lire
   elle-même. Ce qui s'ouvre dans `<body>` hors de `main`, comme un panneau, la couvre et n'a pas à la compter. */
body[data-sandbox] > main {
	--sandbox-main-sticky: var(--mainSticky);
}

body[data-sandbox] > main > * {
	--mainSticky: calc(var(--sandbox-main-sticky) + var(--sandbox-band));
}


.root-nav-wrapper {
	color: var(--primary-on-light, var(--primary));
	justify-content: start;
	height: var(--nav-base-height);
}
.root-nav-wrapper > .container {
	display: flex;
	align-items: center;
	height: 100%;
}

.root-nav-title a {
	display: flex;
	align-items: center;
	font-family: var(--font-title);
	font-size:1.5rem;
	font-weight: 600;
	letter-spacing: 4%;
	color: var(--primary-on-light, var(--primary));

	@media not all and (min-width: 768px) {
		font-size: 1.2rem;
	}

	@media not all and (min-width: 576px) {
		font-size: 1.1rem;
	}

}

.root-nav-title svg {
	width: 1.154rem;
	margin-right: .5rem;
}


.root-nav-actions {
	display: flex;
	flex-grow: 1;
	align-items: center;
}

/* Le grossissement ne compte pas dans la mise en page : le bouton du compte garde la taille que lui
   donnent les initiales. */
a.nav-user > .media-vignette-image {
	transform: scale(1.3);
}
