/* ==========================================================================
   INESJ — Layout
   Grid · chapters & backdrops · site header · site footer
   ========================================================================== */

/* 12-column grid ------------------------------------------------------------ */

.grid {
	display: grid;
	grid-template-columns: repeat(12, minmax(0, 1fr));
	column-gap: var(--gutter);
	padding-inline: var(--margin);
}

.grid > * {
	grid-column: 1 / -1;
	min-width: 0;
}

/* Chapters ---------------------------------------------------------------- */

.chapter {
	position: relative;
	overflow: clip;
}

/* Chapters and zones inside them (the viewfinder) paint their own backdrop… */
main [data-backdrop] {
	background-color: var(--bg);
	color: var(--fg);
}

/* …unless JavaScript is running: then the page shares one backdrop colour
   that cross-fades as chapters cross the middle of the screen. */
html.has-backdrops {
	transition:
		--bg var(--dur-backdrop) var(--ease-inout),
		--fg var(--dur-backdrop) var(--ease-inout),
		--accent var(--dur-backdrop) var(--ease-inout);
}

html.has-backdrops body [data-backdrop] {
	--bg: inherit;
	--fg: inherit;
	--accent: inherit;
	background-color: transparent;
}

.chapter__head {
	row-gap: var(--s-6);
	padding-top: var(--chapter-pad);
}

.chapter__intro {
	margin-top: var(--s-2);
}

@media (min-width: 64em) {
	.chapter__intro {
		grid-column: 7 / span 5;
		margin-top: var(--s-4);
	}
}

/* Site header --------------------------------------------------------------- */

.site-header {
	position: fixed;
	inset: 0 0 auto;
	z-index: 50;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--s-5);
	height: var(--header-h);
	padding-inline: var(--margin);
	background-color: var(--bg);
	color: var(--fg);
}

.site-header__logo {
	position: relative;
	z-index: 2;
	font-family: var(--font-mark);
	font-size: 1.375rem;
	font-weight: 800;
	line-height: 1;
	letter-spacing: -0.04em;
	text-decoration: none;
	text-transform: uppercase;
	transition: opacity 500ms var(--ease-out), visibility 0s linear 0s;
}

/* On the opening screen the hero signature is the logo: the header one waits. */
html[data-chapter="home"] .site-header__logo {
	opacity: 0;
	visibility: hidden;
	transition: opacity 300ms var(--ease-out), visibility 0s linear 300ms;
}

.site-nav__list {
	display: flex;
	gap: clamp(14px, 1.7vw, 30px);
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-nav__list a {
	position: relative;
	display: inline-flex;
	align-items: baseline;
	gap: 6px;
	padding-block: 10px;
	font-size: var(--fs-label);
	font-weight: 600;
	letter-spacing: 0.08em;
	line-height: 1;
	text-transform: uppercase;
	text-decoration: none;
	white-space: nowrap;
}

.site-nav__num {
	display: none;
}

/* Active chapter: underline + signal marker. */
.site-nav__list a::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 4px;
	height: 1px;
	background: currentColor;
	transform: scaleX(0);
	transform-origin: left;
	transition: transform var(--dur-ui) var(--ease-out);
}

.site-nav__list a:hover::after,
.site-nav__list a[aria-current]::after {
	transform: none;
}

/* Sky palette: the line drawn under a link on hover is sky blue. */
.palette-sky .site-nav__list a:hover::after {
	background: var(--accent);
}

.site-nav__list a[aria-current]::before {
	content: "";
	position: absolute;
	top: 50%;
	left: -11px;
	width: 5px;
	height: 5px;
	margin-top: -3px;
	border-radius: 30%; /* softened corners, like the photographs */
	background: var(--accent);
}

/* Language switcher (with Polylang): EN FR ES CA after the chapters, set
   apart by a thin rule; the current language at full strength. */
.site-nav {
	display: flex;
	align-items: center;
	gap: clamp(16px, 1.9vw, 32px);
}

.lang-switch {
	display: flex;
	gap: 10px;
	margin: 0;
	padding: 0 0 0 clamp(16px, 1.9vw, 32px);
	border-left: 1px solid color-mix(in srgb, currentColor 30%, transparent);
	list-style: none;
}

.lang-switch a {
	display: inline-block;
	padding-block: 10px;
	font-size: var(--fs-label);
	font-weight: 600;
	letter-spacing: 0.08em;
	line-height: 1;
	text-decoration: none;
	opacity: 0.5;
	transition: opacity var(--dur-ui) var(--ease-out);
}

.lang-switch a:hover,
.lang-switch a:focus-visible,
.lang-switch a[aria-current] {
	opacity: 1;
}

.menu-toggle {
	position: relative;
	z-index: 2;
	display: inline-flex;
	align-items: baseline;
	gap: 8px;
	padding: 12px 0 12px 12px;
}

.menu-toggle[hidden] {
	display: none;
}

.menu-toggle__num:not(:empty)::before {
	content: "(";
}

.menu-toggle__num:not(:empty)::after {
	content: ")";
}

/* Below 1024px: the list becomes a full-screen index behind a Menu button.
   Without JavaScript it stays a horizontally scrollable row. */
@media (max-width: 63.99em) {
	html:not(.js) .site-nav {
		overflow-x: auto;
		scrollbar-width: none;
		margin-right: calc(var(--margin) * -1);
		padding-right: var(--margin);
	}

	html.js .site-nav {
		position: fixed;
		inset: 0;
		z-index: 1;
		display: flex;
		flex-direction: column;
		justify-content: flex-end;
		padding: calc(var(--header-h) + var(--s-6)) var(--margin) var(--s-7);
		background-color: var(--bg);
		color: var(--fg);
		visibility: hidden;
		opacity: 0;
		transition: opacity 260ms var(--ease-out), visibility 0s linear 260ms;
	}

	html.menu-open .site-nav {
		visibility: visible;
		opacity: 1;
		transition: opacity 260ms var(--ease-out);
	}

	html.js .site-nav__list {
		flex-direction: column;
		gap: 0;
	}

	html.js .site-nav__list a {
		gap: 14px;
		padding-block: 2px;
		font-size: clamp(2.75rem, 13vw, 5.5rem);
		font-weight: 800;
		font-stretch: 64%;
		letter-spacing: -0.01em;
		line-height: 0.98;
	}

	html.js .site-nav__num {
		display: inline;
		font-size: var(--fs-label);
		font-weight: 600;
		font-stretch: 100%;
		letter-spacing: 0.08em;
		transform: translateY(-1.6em);
	}

	html.js .site-nav__list a::after {
		bottom: 0.08em;
		height: 2px;
	}

	html.js .site-nav__list a[aria-current]::before {
		left: auto;
		right: -18px;
		width: 9px;
		height: 9px;
	}

	/* In the full-screen index the languages sit under the chapters. */
	html.js .site-nav {
		align-items: stretch;
		gap: 0;
	}

	html.js .lang-switch {
		gap: 18px;
		margin-top: var(--s-6);
		padding: var(--s-4) 0 0;
		border-left: 0;
		border-top: 1px solid color-mix(in srgb, currentColor 30%, transparent);
	}

	html.menu-open {
		overflow: hidden;
	}
}

@media (min-width: 64em) {
	.menu-toggle {
		display: none !important;
	}
}

/* Site footer ------------------------------------------------------------- */

/* A thin banner: half the height it had until 1.6.4 (≈ 41 px instead of 82 on
   a laptop), on one row down to phones. */
.site-footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--s-1) clamp(12px, 2vw, 24px);
	padding: 12px var(--margin) calc(12px + env(safe-area-inset-bottom));
	background-color: var(--c-closing);   /* continues the last chapter */
	color: var(--c-closing-fg);
	border-top: 1px solid color-mix(in srgb, var(--c-closing-fg) 16%, transparent);
}

.site-footer .label {
	font-size: 0.625rem; /* 10 px */
}

.site-footer .motion-toggle {
	margin-block: -5px; /* the 24 px target overlaps the padding, not the height */
}

.site-footer a {
	text-decoration: none;
}

.site-footer a:hover {
	text-decoration: underline;
}

.palette-sky .site-footer a:hover {
	text-decoration-color: var(--c-signal);
}

.site-footer__legal ul {
	display: flex;
	flex-wrap: wrap;
	gap: var(--s-4);
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-footer__credit {
	margin-right: auto;
}
