/* Comite Saint-Michel. Design tokens taken from the Squarespace source site,
   see docs/design-system.md. */

@font-face {
	font-family: "Marcellus";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/marcellus-400.woff2") format("woff2");
}

@font-face {
	font-family: "PT Serif";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/pt-serif-400.woff2") format("woff2");
}

@font-face {
	font-family: "PT Serif";
	font-style: italic;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/pt-serif-400-italic.woff2") format("woff2");
}

@font-face {
	font-family: "PT Serif";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("../fonts/pt-serif-700.woff2") format("woff2");
}

:root {
	--csm-accent: #338452;
	--csm-dark: #1d231c;
	--csm-white: #ffffff;
	--csm-text: #000000;

	--csm-font-heading: "Marcellus", Georgia, serif;
	--csm-font-body: "PT Serif", Georgia, serif;

	--csm-h1: 4.24rem;
	--csm-h2: 2.94rem;
	--csm-h3: 2.31rem;
	--csm-body: 1.43rem;

	--csm-wrap: 1310px;
	--csm-gutter: 2rem;
	--csm-header-height: 199px;
}

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

body.csm {
	margin: 0;
	background: var(--csm-white);
	color: var(--csm-text);
	font-family: var(--csm-font-body);
	font-size: var(--csm-body);
	line-height: 1.5;
}

h1,
h2,
h3,
h4 {
	margin: 0 0 0.5em;
	font-family: var(--csm-font-heading);
	font-weight: 400;
	line-height: 1.12;
}

h1 { font-size: var(--csm-h1); line-height: 1.4; }
h2 { font-size: var(--csm-h2); }
h3 { font-size: var(--csm-h3); }

p { margin: 0 0 1em; }

a { color: inherit; }

img {
	max-width: 100%;
	height: auto;
}

.csm-wrap {
	width: 100%;
	max-width: var(--csm-wrap);
	margin-inline: auto;
	padding-inline: var(--csm-gutter);
}

.csm-skip {
	position: absolute;
	left: -9999px;
}

.csm-skip:focus {
	left: 1rem;
	top: 1rem;
	z-index: 10;
	background: var(--csm-white);
	padding: 0.5rem 1rem;
}

/* Header */

.csm-header {
	background: var(--csm-white);
}

.csm-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 2rem;
	min-height: var(--csm-header-height);
}

.csm-brand img {
	display: block;
	width: 485px;
	max-width: 60vw;
}

.csm-nav ul {
	display: flex;
	flex-wrap: wrap;
	gap: 1.75rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.csm-nav a {
	font-size: 1rem;
	text-decoration: none;
}

.csm-nav a:hover,
.csm-nav .current > a {
	color: var(--csm-accent);
}

/* Sections */

.csm-section {
	padding-block: 5rem;
}

.csm-section--accent {
	background: var(--csm-accent);
	color: var(--csm-white);
}

.csm-section--dark {
	background: var(--csm-dark);
	color: var(--csm-white);
}

.csm-section--flush {
	padding-block: 0;
}

.csm-split {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4rem;
	align-items: center;
}

.csm-center {
	text-align: center;
}

/* Hero */

.csm-hero {
	position: relative;
	display: grid;
	place-items: center;
	min-height: 700px;
	padding: 4rem var(--csm-gutter);
	overflow: hidden;
	color: var(--csm-white);
	text-align: center;
}

.csm-hero__image {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* The photo is a soft upscale. The veil hides its artefacts and keeps the
   white title readable on the bright roofs. */

.csm-hero::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.45));
}

.csm-hero h1,
.csm-hero h2 {
	position: relative;
	z-index: 2;
	margin: 0;
	color: var(--csm-white);
	text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
}

/* Marquee band */

.csm-marquee {
	overflow: hidden;
	padding-block: 1.5rem;
	white-space: nowrap;
}

.csm-marquee__track {
	display: inline-flex;
	gap: 2rem;
	font-family: var(--csm-font-heading);
	font-size: var(--csm-h1);
	animation: csm-scroll 28s linear infinite;
}

@keyframes csm-scroll {
	from { transform: translateX(0); }
	to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
	.csm-marquee__track { animation: none; }
}

/* Image row */

.csm-row {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 1rem;
}

.csm-row img {
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

.csm-credit {
	margin-top: 1rem;
	font-size: 0.9rem;
	font-style: italic;
	text-align: right;
}

/* Buttons */

.csm-button {
	display: inline-block;
	border: 1px solid transparent;
	border-radius: 300px;
	padding: 1.2rem 2rem;
	background: var(--csm-accent);
	color: var(--csm-white);
	font-family: var(--csm-font-body);
	font-size: 1rem;
	line-height: 1;
	text-decoration: none;
	transition: opacity 0.2s ease;
}

.csm-button:hover {
	opacity: 0.85;
}

.csm-button--invert {
	background: var(--csm-white);
	color: var(--csm-accent);
}

.csm-button--outline {
	background: transparent;
	border-color: currentColor;
	color: var(--csm-accent);
}

/* Footer */

.csm-footer {
	background: var(--csm-dark);
	color: var(--csm-white);
	padding-block: 2.5rem;
}

.csm-footer__grid {
	display: grid;
	grid-template-columns: 1.6fr 1fr 1fr 1fr;
	gap: 3rem;
}

.csm-footer__about p:not(.csm-footer__brand) {
	max-width: 32rem;
	font-size: 1rem;
	opacity: 0.85;
}

.csm-footer__col h2 {
	margin-bottom: 1rem;
	color: var(--csm-white);
	font-family: var(--csm-font-body);
	font-size: 0.85rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.csm-footer__col ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.csm-footer__col li {
	margin-bottom: 0.5rem;
	font-size: 1rem;
}

.csm-footer__col a {
	text-decoration: none;
}

.csm-footer__col a:hover,
.csm-footer__col a:focus-visible {
	text-decoration: underline;
}

.csm-footer__col p {
	font-size: 1rem;
}

.csm-footer__bottom {
	margin-top: 3rem;
	padding-top: 1.5rem;
	border-top: 1px solid rgba(255, 255, 255, 0.15);
}

@media (max-width: 900px) {
	.csm-footer__grid {
		grid-template-columns: 1fr;
		gap: 2rem;
	}
}

.csm-footer__brand {
	margin: 0;
	font-family: var(--csm-font-heading);
	font-size: var(--csm-h3);
}

.csm-footer a {
	color: var(--csm-white);
}

/* Responsive */

@media (max-width: 900px) {
	:root {
		--csm-h1: 2.6rem;
		--csm-h2: 2rem;
		--csm-h3: 1.6rem;
		--csm-body: 1.125rem;
		--csm-header-height: auto;
	}

	.csm-header__inner {
		flex-direction: column;
		align-items: flex-start;
		padding-block: 1.5rem;
	}

	.csm-brand img { max-width: 100%; }

	.csm-split { grid-template-columns: 1fr; gap: 2rem; }

	.csm-row { grid-template-columns: repeat(2, 1fr); }


	.csm-section { padding-block: 3rem; }
}

/* Section separated by a rule, as on the source contact block. */

.csm-section--rule .csm-wrap {
	border-top: 1px solid #d8d8d8;
	padding-top: 4rem;
}

.csm-nav ul ul {
	display: none;
}

.csm-split--wide {
	align-items: start;
	margin-bottom: 3rem;
}

.csm-split__action {
	justify-self: end;
	margin: 0;
}

/* Accordion. Native details and summary, no JavaScript. The source shows a
   green Marcellus title, thin rules and a plus sign that turns into a minus. */

.csm-accordion {
	border-top: 1px solid #d8d8d8;
}

.csm-accordion details {
	border-bottom: 1px solid #d8d8d8;
}

.csm-accordion summary {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 2rem;
	padding: 1.35rem 0;
	color: var(--csm-accent);
	font-family: var(--csm-font-heading);
	font-size: 1.65rem;
	line-height: 1.25;
	cursor: pointer;
	list-style: none;
}

.csm-accordion summary::-webkit-details-marker {
	display: none;
}

.csm-accordion summary::after {
	content: "+";
	flex: 0 0 auto;
	font-size: 1.5rem;
	line-height: 1;
}

.csm-accordion details[open] > summary::after {
	content: "\2212";
}

.csm-accordion details > *:not(summary) {
	font-size: 1.1rem;
}

.csm-accordion details > *:last-child {
	margin-bottom: 1.5rem;
}

.csm-section--accent .csm-accordion,
.csm-section--accent .csm-accordion details {
	border-color: rgba(255, 255, 255, 0.35);
}

.csm-section--accent .csm-accordion summary {
	color: var(--csm-white);
}

/* Two column block: heading on the left, accordion on the right. */

.csm-split--top {
	align-items: start;
}

.csm-split--top h2 {
	position: sticky;
	top: 2rem;
	margin: 0;
}

/* Carousel. Scroll snapping, no library. */

.csm-carousel {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(0, 60%);
	gap: 1rem;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: thin;
	padding-bottom: 1rem;
}

.csm-carousel > figure {
	margin: 0;
	scroll-snap-align: center;
}

.csm-carousel img {
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

@media (min-width: 900px) {
	.csm-carousel {
		grid-auto-columns: minmax(0, 42%);
	}
}

/* Section themes usable straight from article HTML. */

.csm-section--light {
	background: var(--csm-white);
}

.csm-section--accent h2,
.csm-section--accent h3,
.csm-section--dark h2,
.csm-section--dark h3 {
	color: var(--csm-white);
}

.csm-section--accent a,
.csm-section--dark a {
	color: var(--csm-white);
}

/* The green block ends on a downward curve on the source site. */

.csm-section--curve {
	padding-bottom: 7rem;
	border-bottom-left-radius: 50% 90px;
	border-bottom-right-radius: 50% 90px;
}

/* Headings inside articles follow the source colours: green by default, black
   on the chronology blocks and on the history page. */

.csm-section h1,
.csm-section h2,
.csm-section h3 {
	color: var(--csm-text);
}

/* The project pages use green headings, the home page and the chronology
   blocks keep them black. */

.csm-section--white h1,
.csm-section--white h2,
.csm-section--white h3 {
	color: var(--csm-accent);
}

.csm-section--plain {
	background: var(--csm-white);
}

.csm-section--white h3,
.csm-section--light h3 {
	font-size: 1.65rem;
}

/* Headings on coloured backgrounds win over the default green. Declared last so
   the cascade does not turn them green on green. */

.csm-section--accent h1,
.csm-section--accent h2,
.csm-section--accent h3,
.csm-section--dark h1,
.csm-section--dark h2,
.csm-section--dark h3 {
	color: var(--csm-white);
}

/* Contact block. Pill inputs, matching the source form. */

.csm-form {
	display: grid;
	gap: 1.25rem;
	align-content: start;
}

.csm-field label {
	display: block;
	margin-bottom: 0.4rem;
	font-size: 1rem;
}

.csm-hint {
	color: #6e6e6e;
	font-size: 0.85rem;
}

.csm-form input,
.csm-form textarea {
	width: 100%;
	border: 1px solid var(--csm-text);
	border-radius: 300px;
	padding: 0.85rem 1.25rem;
	background: transparent;
	color: inherit;
	font-family: var(--csm-font-body);
	font-size: 1rem;
}

.csm-form textarea {
	border-radius: 24px;
	resize: vertical;
}

.csm-form input:focus,
.csm-form textarea:focus {
	outline: 2px solid var(--csm-accent);
	outline-offset: 2px;
}

.csm-form button {
	justify-self: start;
	border: 0;
	cursor: pointer;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.csm-contact .csm-split--top h2 {
	position: static;
}

/* Buttons keep their own colours on coloured backgrounds. Declared after the
   generic link rule so the pill stays readable. */

.csm-section--accent .csm-button--invert,
.csm-section--dark .csm-button--invert {
	color: var(--csm-accent);
}

.csm-nav ul {
	flex-wrap: nowrap;
	gap: 1.35rem;
}

.csm-nav a {
	white-space: nowrap;
}

@media (max-width: 1200px) {
	.csm-nav ul {
		flex-wrap: wrap;
		gap: 1rem;
	}
}

/* Text for assistive technologies only. */

.csm-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Heading levels follow the document outline, these classes keep the size the
   source design gives to the visual rank. */

.csm-h2 {
	font-size: var(--csm-h2);
	line-height: 1.12;
}

.csm-h3 {
	font-size: 1.65rem;
	line-height: 1.12;
}

.csm-h4 {
	font-size: 1em;
	line-height: 1.12;
}

/* Marquee pause control, WCAG 2.2.2. */

.csm-marquee {
	position: relative;
}

.csm-marquee.is-paused .csm-marquee__track {
	animation-play-state: paused;
}

.csm-marquee__toggle {
	position: absolute;
	right: var(--csm-gutter);
	top: 50%;
	transform: translateY(-50%);
	border: 1px solid var(--csm-text);
	border-radius: 300px;
	padding: 0.4rem 0.9rem;
	background: var(--csm-white);
	color: var(--csm-text);
	font-family: var(--csm-font-body);
	font-size: 0.85rem;
	cursor: pointer;
}

.csm-marquee__toggle:focus-visible {
	outline: 2px solid var(--csm-accent);
	outline-offset: 2px;
}

/* Honeypot field, out of sight and out of the tab order. */

.csm-trap {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Error and offline pages. */

.csm-error {
	min-height: 50vh;
}

.csm-error__code {
	margin-bottom: 0.5rem;
	color: var(--csm-accent);
	font-family: var(--csm-font-heading);
	font-size: 1.2rem;
}

/* Blog grid and post page. */

.csm-blog__grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 3rem;
}

.csm-card {
	text-align: center;
}

.csm-card .item-image {
	margin: 0 0 1.5rem;
}

.csm-card .item-image img {
	width: 100%;
	aspect-ratio: 3 / 2;
	object-fit: cover;
}

.csm-card__meta {
	margin-bottom: 0.75rem;
	font-size: 1rem;
}

.csm-card__meta span + time::before {
	content: " \2022  ";
}

.csm-card__title {
	font-size: var(--csm-h3);
}

.csm-card__title a {
	text-decoration: none;
}

.csm-card__title a:hover {
	color: var(--csm-accent);
}

.csm-card__more a,
.csm-post__back a {
	color: var(--csm-accent);
	font-size: 1rem;
}

.csm-post .csm-card__meta {
	text-align: left;
}

.csm-post h1 {
	color: var(--csm-text);
}

.csm-post__body {
	max-width: 62rem;
}

.csm-post__body img {
	display: block;
	margin: 2rem 0;
}

.csm-post__body h2 {
	margin-top: 2rem;
	font-size: 1.65rem;
}

.csm-post__body a {
	color: var(--csm-accent);
}

.csm-video {
	margin: 0 0 2rem;
	aspect-ratio: 16 / 9;
}

.csm-video iframe {
	width: 100%;
	height: 100%;
	border: 0;
}

.csm-blog__pagination ul {
	display: flex;
	justify-content: center;
	gap: 1rem;
	margin: 3rem 0 0;
	padding: 0;
	list-style: none;
}

@media (max-width: 900px) {
	.csm-blog__grid {
		grid-template-columns: 1fr;
	}
}

/* About page: text on the left, illustration on the right, as on the source. */

.csm-split--about {
	grid-template-columns: 3fr 2fr;
	gap: 4rem;
}

.csm-about__image {
	width: 100%;
	max-width: 500px;
	justify-self: center;
}

@media (max-width: 900px) {
	.csm-split--about {
		grid-template-columns: 1fr;
	}
}

/* Footer credit, discreet. */

.csm-footer__credit {
	margin: 0;
	font-size: 0.85rem;
	opacity: 0.6;
}

.csm-footer__credit a {
	text-decoration: underline;
}

/* Motion. Everything below is decorative: hover feedback, a slow drift on the
   hero, and a soft rise of each section as it scrolls into view. The reveal
   uses scroll driven animations, browsers without them show the page as is.
   prefers-reduced-motion turns all of it off at the end of this block. */

html {
	scroll-behavior: smooth;
}

:focus-visible {
	outline: 3px solid var(--csm-accent);
	outline-offset: 3px;
}

.csm-nav a {
	position: relative;
	padding-bottom: 0.2rem;
	transition: color 0.25s;
}

.csm-nav a::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 1px;
	background: var(--csm-accent);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.csm-nav a:hover::after,
.csm-nav a:focus-visible::after,
.csm-nav .current > a::after {
	transform: scaleX(1);
}

.csm-button {
	position: relative;
	overflow: hidden;
	transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.csm-button::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%);
	transform: translateX(-120%);
	transition: transform 0.6s;
}

.csm-button:hover,
.csm-button:focus-visible {
	transform: translateY(-2px);
	box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.45);
	opacity: 1;
}

.csm-button:hover::after {
	transform: translateX(120%);
}

.csm-row img,
.csm-carousel img,
.csm-card .item-image img {
	transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s;
}

.csm-row img:hover,
.csm-carousel figure:hover img,
.csm-card:hover .item-image img {
	transform: scale(1.03);
	box-shadow: 0 18px 36px -20px rgba(0, 0, 0, 0.5);
}

.csm-card {
	transition: transform 0.3s;
}

.csm-card:hover {
	transform: translateY(-4px);
}

.csm-accordion summary::after {
	transition: transform 0.25s;
}

.csm-accordion details[open] > summary::after {
	transform: rotate(180deg);
}

.csm-hero__image {
	animation: csm-drift 24s ease-in-out infinite alternate;
}

.csm-hero h1 {
	animation: csm-rise 1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes csm-drift {
	from { transform: scale(1); }
	to { transform: scale(1.06); }
}

@keyframes csm-rise {
	from { opacity: 0; transform: translateY(1.5rem); }
	to { opacity: 1; transform: none; }
}

@supports (animation-timeline: view()) {
	.csm-section > .csm-wrap,
	.csm-card,
	.csm-row img,
	.csm-contact .csm-split > * {
		animation: csm-rise linear both;
		animation-timeline: view();
		animation-range: entry 0% entry 35%;
	}
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	.csm-hero__image,
	.csm-hero h1,
	.csm-section > .csm-wrap,
	.csm-card,
	.csm-row img,
	.csm-contact .csm-split > * {
		animation: none;
	}

	.csm-button,
	.csm-button::after,
	.csm-nav a::after,
	.csm-row img,
	.csm-carousel img,
	.csm-card,
	.csm-card .item-image img {
		transition: none;
	}
}

/* Accordion panels slide in when opened. */

.csm-accordion details[open] > *:not(summary) {
	animation: csm-rise 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@media (prefers-reduced-motion: reduce) {
	.csm-accordion details[open] > *:not(summary) {
		animation: none;
	}
}

/* Legal pages, plain reading column. */

.csm-legal {
	max-width: 56rem;
}

.csm-legal h2 {
	margin-top: 2rem;
	font-size: 1.65rem;
}
