/* ===========================================================================
   MOSS SCIENCE — "The oldest green on land"
   Cinematic scroll-editorial. Dark chapters, vector graphics, minimal copy.

   Everything here is scoped under .ms- so it cannot leak into the shop CSS.
   Motion is opt-in: elements start in their revealed state and only get an
   entrance if the browser reports motion is welcome (see the last block).
   =========================================================================== */

.ms {
	--ms-ink: #f3f7ed;
	--ms-ink-dim: #a9b99b;
	--ms-accent: #acdc79;
	--ms-accent-deep: #86cb3c;
	--ms-night: #0a1207;
	--ms-night-2: #14200d;
	--ms-day: #fafdf7;
	--ms-day-ink: #181d27;
	--ms-day-ink-dim: #535862;

	background: var(--ms-night);
	color: var(--ms-ink);
	font-family: "Outfit", "Century Gothic", system-ui, sans-serif;
	overflow-x: hidden;
}

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


/* ---------------------------------------------------------------- shared - */

.ms-wrap {
	width: 100%;
	max-width: 1180px;
	margin: 0 auto;
	padding: 0 32px;
}

.ms-eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 22px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .2em;
	text-transform: uppercase;
	color: var(--ms-accent);
}

.ms-eyebrow::before {
	content: "";
	width: 30px;
	height: 1px;
	background: currentColor;
	opacity: .6;
}

.ms-h {
	margin: 0;
	font-weight: 300;
	font-size: clamp(2rem, 4.6vw, 3.6rem);
	line-height: 1.08;
	letter-spacing: -.03em;
	color: var(--ms-ink);
}

.ms-h em {
	font-style: normal;
	color: var(--ms-accent);
}

.ms-lead {
	margin: 22px 0 0;
	max-width: 30ch;
	font-weight: 300;
	font-size: clamp(1rem, 1.5vw, 1.2rem);
	line-height: 1.65;
	color: var(--ms-ink-dim);
}

/* The oversized number that carries each chapter. */
.ms-figure {
	display: block;
	font-weight: 200;
	font-size: clamp(3.4rem, 11vw, 9rem);
	line-height: .9;
	letter-spacing: -.05em;
	color: var(--ms-accent);
	font-variant-numeric: tabular-nums;
}

.ms-figure small {
	display: inline-block;
	margin-left: .12em;
	font-size: .26em;
	font-weight: 400;
	letter-spacing: .04em;
	color: var(--ms-ink-dim);
	vertical-align: super;
}


/* ------------------------------------------------------------------ hero - */

.ms-hero {
	position: relative;
	min-height: 100svh;
	display: grid;
	place-items: center;
	text-align: center;
	overflow: hidden;
	background:
		radial-gradient(120% 80% at 50% 108%, rgba(134, 203, 60, .30) 0%, rgba(134, 203, 60, 0) 62%),
		radial-gradient(90% 60% at 50% -10%, #1d2f13 0%, rgba(10, 18, 7, 0) 70%),
		var(--ms-night);
}

/* Slow-drifting spore field. Purely decorative. */
.ms-hero__spores {
	position: absolute;
	inset: -10%;
	pointer-events: none;
}

.ms-spore {
	position: absolute;
	top: var(--y);
	left: var(--x);
	width: var(--s);
	height: var(--s);
	border-radius: 50%;
	background: var(--ms-accent);
	opacity: 0;
	filter: blur(.4px);
}

.ms-hero__inner {
	position: relative;
	z-index: 2;
	padding: 0 24px;
}

.ms-hero__title {
	margin: 0;
	font-weight: 200;
	font-size: clamp(3.6rem, 15vw, 12rem);
	line-height: .86;
	letter-spacing: -.06em;
	color: var(--ms-ink);
}

.ms-hero__sub {
	margin: 26px auto 0;
	max-width: 34ch;
	font-weight: 300;
	font-size: clamp(1.05rem, 2vw, 1.4rem);
	line-height: 1.55;
	color: var(--ms-ink-dim);
}

.ms-hero__rule {
	width: 1px;
	height: 74px;
	margin: 44px auto 0;
	background: linear-gradient(180deg, var(--ms-accent), rgba(172, 220, 121, 0));
	transform-origin: top;
}

.ms-hero__cue {
	position: absolute;
	left: 50%;
	bottom: 34px;
	transform: translateX(-50%);
	font-size: 11px;
	font-weight: 500;
	letter-spacing: .24em;
	text-transform: uppercase;
	color: var(--ms-ink-dim);
	z-index: 2;
}


/* --------------------------------------------------------------- chapter - */

.ms-chapter {
	position: relative;
	padding: clamp(88px, 13vh, 150px) 0;
	border-top: 1px solid rgba(172, 220, 121, .12);
}

.ms-chapter--day {
	background: var(--ms-day);
	color: var(--ms-day-ink);
	border-top-color: #e9eaeb;
}

.ms-chapter--day .ms-h {
	color: var(--ms-day-ink);
}

.ms-chapter--day .ms-h em,
.ms-chapter--day .ms-figure {
	color: #4f7a21;
}

.ms-chapter--day .ms-lead,
.ms-chapter--day .ms-figure small {
	color: var(--ms-day-ink-dim);
}

.ms-chapter--day .ms-eyebrow {
	color: #669f2a;
}

.ms-chapter__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: clamp(40px, 6vw, 90px);
	align-items: center;
}

.ms-chapter--flip .ms-chapter__art {
	order: -1;
}

.ms-chapter__no {
	position: absolute;
	top: clamp(30px, 5vh, 56px);
	right: 32px;
	font-size: 12px;
	font-weight: 500;
	letter-spacing: .22em;
	color: rgba(172, 220, 121, .45);
}

.ms-chapter--day .ms-chapter__no {
	color: rgba(102, 159, 42, .45);
}

.ms-chapter__art {
	position: relative;
	display: grid;
	place-items: center;
	min-height: 320px;
}

.ms-chapter__art svg {
	width: 100%;
	height: auto;
	max-width: 460px;
	overflow: visible;
}


/* --------------------------------------------------- 01 · deep time bar - */

.ms-time {
	width: 100%;
	max-width: 460px;
}

.ms-time__track {
	position: relative;
	height: 3px;
	background: rgba(172, 220, 121, .16);
	border-radius: 2px;
}

.ms-time__fill {
	position: absolute;
	inset: 0 auto 0 0;
	width: 100%;
	background: linear-gradient(90deg, var(--ms-accent), var(--ms-accent-deep));
	border-radius: 2px;
	transform-origin: left;
}

.ms-time__marks {
	display: flex;
	justify-content: space-between;
	margin-top: 18px;
}

.ms-time__mark {
	position: relative;
	padding-top: 16px;
	font-size: 12px;
	font-weight: 400;
	letter-spacing: .04em;
	color: var(--ms-ink-dim);
	text-align: center;
	flex: 1;
}

.ms-time__mark::before {
	content: "";
	position: absolute;
	top: -14px;
	left: 50%;
	width: 1px;
	height: 12px;
	background: rgba(172, 220, 121, .3);
}

.ms-time__mark:first-child { text-align: left; }
.ms-time__mark:first-child::before { left: 0; }
.ms-time__mark:last-child { text-align: right; }
.ms-time__mark:last-child::before { left: auto; right: 0; }

.ms-time__mark strong {
	display: block;
	font-weight: 500;
	font-size: 14px;
	color: var(--ms-ink);
}

.ms-time__mark--now strong { color: var(--ms-accent); }


/* ----------------------------------------------- 02 · anatomy line-draw - */

.ms-draw path,
.ms-draw line,
.ms-draw circle,
.ms-draw ellipse {
	stroke-dasharray: var(--len, 600);
	stroke-dashoffset: 0;
}

.ms-anno {
	font-size: 12px;
	font-weight: 500;
	letter-spacing: .12em;
	text-transform: uppercase;
	fill: var(--ms-ink-dim);
	opacity: 1;
}

.ms-anno--x { fill: #d4756b; }

.ms-chapter--day .ms-anno { fill: var(--ms-day-ink-dim); }


/* ------------------------------------------------------ 03 · water swell - */

.ms-swell__cushion { transform-origin: 50% 78%; }

.ms-drop { opacity: 1; }


/* ----------------------------------------------------- 04 · spore burst - */

.ms-burst {
	position: relative;
	display: grid;
	place-items: center;
	width: 100%;
	aspect-ratio: 1;
	max-width: 380px;
}

.ms-burst__dot {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 5px;
	height: 5px;
	margin: -2.5px 0 0 -2.5px;
	border-radius: 50%;
	background: var(--ms-accent);
	opacity: .55;
	transform: rotate(var(--a)) translateX(var(--r));
}

.ms-burst__core {
	position: relative;
	z-index: 2;
	width: 46px;
	height: 74px;
	border-radius: 50% 50% 46% 46%;
	background: linear-gradient(160deg, #4f7a21, #2b4212);
	box-shadow: 0 0 0 1px rgba(172, 220, 121, .35), 0 0 60px rgba(134, 203, 60, .28);
}


/* ------------------------------------------------------- 05 · extremes - */

.ms-scale {
	width: 100%;
	max-width: 440px;
}

.ms-scale__bar {
	position: relative;
	height: 8px;
	border-radius: 999px;
	background: linear-gradient(90deg, #3b6ea8 0%, #7d9bb5 26%, #d8dfd2 44%, #acdc79 58%, #e2a93f 82%, #c2542f 100%);
	transform-origin: left;
}

.ms-scale__pin {
	position: absolute;
	top: -6px;
	left: var(--p);
	width: 2px;
	height: 20px;
	background: var(--ms-ink);
	border-radius: 2px;
	transform: translateX(-1px);
}

.ms-scale__legend {
	display: flex;
	justify-content: space-between;
	margin-top: 26px;
	gap: 16px;
}

.ms-scale__item {
	flex: 1;
	text-align: center;
}

.ms-scale__item b {
	display: block;
	font-weight: 400;
	font-size: clamp(1.15rem, 2.4vw, 1.7rem);
	letter-spacing: -.02em;
	color: var(--ms-accent);
	font-variant-numeric: tabular-nums;
}

.ms-scale__item span {
	display: block;
	margin-top: 6px;
	font-size: 12px;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--ms-ink-dim);
}


/* ------------------------------------------------------- 06 · counters - */

.ms-stats {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: clamp(24px, 4vw, 56px);
	width: 100%;
	max-width: 100%;
}

.ms-stat b {
	display: block;
	font-weight: 200;
	font-size: clamp(2.2rem, 5.4vw, 4rem);
	line-height: 1;
	letter-spacing: -.04em;
	color: #4f7a21;
	font-variant-numeric: tabular-nums;
}

.ms-stat span {
	display: block;
	margin-top: 12px;
	font-size: 13px;
	line-height: 1.5;
	font-weight: 400;
	color: var(--ms-day-ink-dim);
}

/* A range ("1 800–2 800 m") is wider than a plain count — shrink it so it
   stays on one line and the three captions keep a common baseline. */
.ms-stat--sm b {
	font-size: clamp(1.5rem, 3.4vw, 2.5rem);
	white-space: nowrap;
}

/* Three-lineage split used inside chapter 06. */
.ms-lineage {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 1px;
	margin-top: 46px;
	background: #e9eaeb;
	border: 1px solid #e9eaeb;
	border-radius: 14px;
	overflow: hidden;
}

.ms-lineage__cell {
	background: var(--ms-day);
	padding: 26px 22px;
}

.ms-lineage__cell b {
	display: block;
	font-weight: 500;
	font-size: 15px;
	color: var(--ms-day-ink);
}

.ms-lineage__cell i {
	display: block;
	margin-top: 4px;
	font-style: italic;
	font-size: 13px;
	color: #669f2a;
}

.ms-lineage__cell span {
	display: block;
	margin-top: 10px;
	font-size: 13px;
	line-height: 1.55;
	color: var(--ms-day-ink-dim);
}


/* ------------------------------------------------------------ 07 · peat - */

.ms-peat__water { transform-origin: 50% 100%; }


/* ------------------------------------------------------------ 08 · uses - */

.ms-uses {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 1px;
	margin-top: 56px;
	background: rgba(172, 220, 121, .14);
	border: 1px solid rgba(172, 220, 121, .14);
	border-radius: 14px;
	overflow: hidden;
}

.ms-use {
	background: var(--ms-night-2);
	padding: 30px 24px;
}

.ms-use svg {
	width: 30px;
	height: 30px;
	color: var(--ms-accent);
	margin-bottom: 18px;
}

.ms-use b {
	display: block;
	font-weight: 500;
	font-size: 15px;
	color: var(--ms-ink);
}

.ms-use span {
	display: block;
	margin-top: 8px;
	font-size: 13px;
	line-height: 1.55;
	color: var(--ms-ink-dim);
}


/* -------------------------------------------------------- 09 · red list - */

/* Wrapper so the bars and their caption share one left edge — .ms-chapter__art
   centres its children, which otherwise pushed the narrower caption inwards. */
.ms-bars-block {
	width: 100%;
	max-width: 460px;
}

.ms-bars {
	display: grid;
	gap: 30px;
}

.ms-bar__top {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	margin-bottom: 10px;
	font-size: 14px;
	color: var(--ms-ink-dim);
}

.ms-bar__top b {
	font-weight: 400;
	font-size: 20px;
	color: var(--ms-ink);
	font-variant-numeric: tabular-nums;
}

.ms-bar__track {
	height: 10px;
	border-radius: 999px;
	background: rgba(172, 220, 121, .22);
	box-shadow: inset 0 0 0 1px rgba(172, 220, 121, .16);
	overflow: hidden;
}

.ms-bar__fill {
	/* a <span> is inline by default, and width/transform do not apply to
	   non-replaced inline boxes — without this the fill never renders */
	display: block;
	height: 100%;
	width: var(--w);
	border-radius: 999px;
	background: linear-gradient(90deg, var(--ms-accent-deep), #e2a93f);
	transform-origin: left;
}


/* ----------------------------------------------------------- close / cta - */

.ms-close {
	position: relative;
	padding: clamp(100px, 16vh, 180px) 0;
	text-align: center;
	background:
		radial-gradient(80% 100% at 50% 0%, rgba(134, 203, 60, .18) 0%, rgba(10, 18, 7, 0) 70%),
		var(--ms-night);
	border-top: 1px solid rgba(172, 220, 121, .12);
}

.ms-close .ms-h {
	max-width: 16ch;
	margin: 0 auto;
}

.ms-close .ms-lead {
	margin-left: auto;
	margin-right: auto;
	max-width: 46ch;
}

.ms-cta {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	margin-top: 44px;
	padding: 17px 34px;
	border-radius: 999px;
	background: var(--ms-accent);
	color: #14200d;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: .01em;
	text-decoration: none;
	transition: transform .25s cubic-bezier(.2, .8, .3, 1.2), box-shadow .25s ease, background .25s ease;
}

.ms-cta:hover {
	transform: translateY(-2px);
	background: #c2e79a;
	box-shadow: 0 12px 34px rgba(134, 203, 60, .3);
}

.ms-cta__arrow { transition: transform .25s ease; }
.ms-cta:hover .ms-cta__arrow { transform: translateX(4px); }

.ms-source {
	margin: 56px auto 0;
	max-width: 52ch;
	font-size: 12px;
	line-height: 1.7;
	color: rgba(169, 185, 155, .7);
}

.ms-source a {
	color: rgba(172, 220, 121, .85);
	text-decoration: underline;
	text-underline-offset: 2px;
}


/* ----------------------------------------------------------- responsive - */

@media (max-width: 900px) {
	.ms-chapter__grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 48px;
	}

	.ms-chapter--flip .ms-chapter__art { order: 0; }
	.ms-chapter__art { min-height: 0; order: 2; }
	.ms-uses { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.ms-lineage { grid-template-columns: minmax(0, 1fr); }
	.ms-lead { max-width: none; }
}

@media (max-width: 560px) {
	.ms-wrap { padding: 0 20px; }
	.ms-stats { grid-template-columns: minmax(0, 1fr); gap: 30px; }
	.ms-uses { grid-template-columns: minmax(0, 1fr); }
	.ms-scale__legend { flex-direction: column; gap: 22px; }
	.ms-chapter__no { right: 20px; }
	.ms-time__mark { font-size: 11px; }
}


/* ===========================================================================
   MOTION
   Nothing above hides content. The rules below set the "before" state and the
   entrance, and they only apply when the visitor has not asked for less
   motion. .ms-js is added by the script, so a no-JS visitor keeps the page in
   its final, fully readable state too.
   =========================================================================== */

@media (prefers-reduced-motion: no-preference) {

	.ms-js .ms-rv {
		opacity: 0;
		transform: translateY(26px);
		filter: blur(6px);
		transition:
			opacity .9s cubic-bezier(.22, .68, .3, 1) var(--d, 0s),
			transform .9s cubic-bezier(.22, .68, .3, 1) var(--d, 0s),
			filter .9s cubic-bezier(.22, .68, .3, 1) var(--d, 0s);
	}

	.ms-js .ms-rv.is-in {
		opacity: 1;
		transform: none;
		filter: none;
	}

	/* hero ------------------------------------------------------------- */
	.ms-js .ms-spore {
		animation: ms-drift var(--dur) linear var(--delay) infinite;
	}

	@keyframes ms-drift {
		0%   { opacity: 0; transform: translate3d(0, 20px, 0) scale(.6); }
		18%  { opacity: .55; }
		78%  { opacity: .4; }
		100% { opacity: 0; transform: translate3d(var(--dx), -180px, 0) scale(1.15); }
	}

	.ms-js .ms-hero__rule {
		transform: scaleY(0);
		transition: transform 1.2s cubic-bezier(.22, .68, .3, 1) .5s;
	}

	.ms-js .ms-hero.is-in .ms-hero__rule { transform: scaleY(1); }

	.ms-js .ms-hero__cue { animation: ms-cue 2.6s ease-in-out infinite; }

	@keyframes ms-cue {
		0%, 100% { opacity: .35; transform: translate(-50%, 0); }
		50%      { opacity: .9;  transform: translate(-50%, 6px); }
	}

	/* 01 deep time ------------------------------------------------------ */
	.ms-js .ms-time__fill {
		transform: scaleX(0);
		transition: transform 1.6s cubic-bezier(.22, .68, .3, 1) .15s;
	}

	.ms-js .is-in .ms-time__fill { transform: scaleX(1); }

	/* 02 anatomy line-draw ---------------------------------------------- */
	.ms-js .ms-draw path,
	.ms-js .ms-draw line,
	.ms-js .ms-draw circle,
	.ms-js .ms-draw ellipse {
		stroke-dashoffset: var(--len, 600);
		transition: stroke-dashoffset 1.5s cubic-bezier(.3, .7, .3, 1) var(--d, 0s);
	}

	.ms-js .is-in .ms-draw path,
	.ms-js .is-in .ms-draw line,
	.ms-js .is-in .ms-draw circle,
	.ms-js .is-in .ms-draw ellipse {
		stroke-dashoffset: 0;
	}

	.ms-js .ms-anno {
		opacity: 0;
		transition: opacity .7s ease var(--d, 0s);
	}

	.ms-js .is-in .ms-anno { opacity: 1; }

	/* 03 water swell ---------------------------------------------------- */
	.ms-js .ms-swell__cushion {
		transform: scale(.82) translateY(6px);
		transition: transform 1.5s cubic-bezier(.22, .68, .3, 1) .55s;
	}

	.ms-js .is-in .ms-swell__cushion { transform: scale(1) translateY(0); }

	.ms-js .ms-drop { animation: none; opacity: 0; }
	.ms-js .is-in .ms-drop { animation: ms-fall 2.6s ease-in var(--d, 0s) infinite; }

	@keyframes ms-fall {
		0%       { opacity: 0; transform: translateY(-26px) scaleY(.8); }
		12%      { opacity: 1; }
		52%, 100% { opacity: 0; transform: translateY(46px) scaleY(1.15); }
	}

	/* 04 spore burst ---------------------------------------------------- */
	.ms-js .ms-burst__dot {
		transform: rotate(var(--a)) translateX(0);
		opacity: 0;
		transition:
			transform 2s cubic-bezier(.16, .8, .3, 1) var(--d, 0s),
			opacity 2s ease var(--d, 0s);
	}

	.ms-js .is-in .ms-burst__dot {
		transform: rotate(var(--a)) translateX(var(--r));
		opacity: .55;
	}

	.ms-js .ms-burst__core {
		transform: scale(.7);
		transition: transform 1s cubic-bezier(.2, .8, .3, 1.3);
	}

	.ms-js .is-in .ms-burst__core { transform: scale(1); }

	/* 05 extremes ------------------------------------------------------- */
	.ms-js .ms-scale__bar {
		transform: scaleX(0);
		transition: transform 1.4s cubic-bezier(.22, .68, .3, 1);
	}

	.ms-js .is-in .ms-scale__bar { transform: scaleX(1); }

	.ms-js .ms-scale__pin {
		opacity: 0;
		transform: translateX(-1px) translateY(-8px);
		transition: opacity .6s ease var(--d, 0s), transform .6s cubic-bezier(.2, .8, .3, 1.4) var(--d, 0s);
	}

	.ms-js .is-in .ms-scale__pin {
		opacity: 1;
		transform: translateX(-1px) translateY(0);
	}

	/* 07 peat ----------------------------------------------------------- */
	.ms-js .ms-peat__water {
		transform: scaleY(0);
		transition: transform 1.8s cubic-bezier(.22, .68, .3, 1) .3s;
	}

	.ms-js .is-in .ms-peat__water { transform: scaleY(1); }

	/* 09 red list ------------------------------------------------------- */
	.ms-js .ms-bar__fill {
		transform: scaleX(0);
		transition: transform 1.3s cubic-bezier(.22, .68, .3, 1) var(--d, 0s);
	}

	.ms-js .is-in .ms-bar__fill { transform: scaleX(1); }
}
