/* The Me page: ink in still water at the top (hero.js) with the greeting
   over it, then Faye's chapters down a spine that fills in the trans flag's
   colours as they're read. */

.me {
	/* The trans flag's blue, pink and white at Everforest's softness. */
	--flag-blue: #8cc8ec;
	--flag-pink: #eea8c0;
	--flag-white: #f1efe6;
	--spine-gap: var(--s6);
	padding: 0 0 var(--s8);
}

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

/* Ink in still water (hero.js) under the greeting: dark water on the dark
   theme, paper on the light one, fading into the page at its foot. */
.me-hero {
	position: relative;
	isolation: isolate;
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-height: clamp(520px, 76vh, 780px);
	background: var(--frame);
	overflow: hidden;
}

.me-hero::after {
	content: "";
	position: absolute;
	inset: auto 0 0;
	z-index: 1;
	height: 28%;
	background: linear-gradient(transparent, var(--bg));
	pointer-events: none;
}

.me-water {
	position: absolute;
	inset: 0;
	z-index: 0;
}

/* On wide screens the panel's bars (util.css) run below the hero, so
   there the water itself fades out at its foot and the bars come in with
   the page, rather than starting at a line where the fade ends. */
@media (min-width: 1200px) {
	.me-hero {
		background: none;
	}

	.me-hero::after {
		content: none;
	}

	.me-water {
		background-color: var(--frame);
		mask-image: linear-gradient(black 72%, transparent);
	}
}

.me-ink {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

/* Without WebGL, a still wash of the three inks, kept off the text as the
   ink is: to its right on wide screens, above it on narrow ones. */
.me-hero.still-ink .me-water {
	background-image:
		radial-gradient(26% 46% at 92% 30%, color-mix(in srgb, var(--flag-blue) 30%, transparent), transparent),
		radial-gradient(24% 40% at 86% 78%, color-mix(in srgb, var(--flag-pink) 28%, transparent), transparent),
		radial-gradient(18% 30% at 78% 52%, color-mix(in srgb, var(--flag-white) 16%, transparent), transparent);
}

.me-hero .me-ink-pause {
	position: absolute;
	top: var(--s4);
	/* In from the edge with the page's margin, so its tooltip clears the
	   panel's scrollbar. */
	right: var(--page-pad);
	z-index: 2;
	color: var(--muted);
	/* A frosted plate of the water's own colour, so the icon holds 3:1
	   whatever ink drifts behind it. */
	background: color-mix(in srgb, var(--frame) 85%, transparent);
	backdrop-filter: blur(12px);
}

.me-hero .me-ink-pause[hidden] {
	display: none;
}

.me-hero .me-ink-pause svg {
	width: 20px;
	height: 20px;
}

.me-hero-text {
	position: relative;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	padding-block: var(--s8);
	/* Lined up with the chapters below: as wide as .me-story with its
	   padding, and never wider than the page. */
	box-sizing: border-box;
	width: 100%;
	max-width: calc(76rem + 2 * var(--page-pad) + var(--spine-gap));
	margin-inline: auto;
	padding-left: calc(var(--page-pad) + var(--spine-gap));
	pointer-events: none;
}

.me-hero-text > * {
	/* Only the text itself takes the pointer, so the water around short
	   lines can still be stirred. */
	width: fit-content;
	max-width: 100%;
	pointer-events: auto;
}

.me-tagline {
	display: flex;
	flex-wrap: wrap;
	gap: var(--s2);
	margin: 0 0 var(--s4);
	font-size: 0.95rem;
	letter-spacing: 0.02em;
}

/* Who she is at a glance, as tags, each with a dot of the flag's blue,
   pink and white in turn: a soft filled surface with no outline and no
   hover, so they read as labels rather than buttons. */
.me-chip {
	--dot: var(--flag-blue);
	display: inline-flex;
	align-items: center;
	gap: var(--s2);
	height: 32px;
	padding: 0 var(--s3);
	border-radius: 8px;
	background: var(--surface);
	color: var(--text);
}

.me-chip::before {
	content: "";
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--dot);
}

.me-chip:nth-child(2) {
	--dot: var(--flag-pink);
}

.me-chip:nth-child(3) {
	--dot: var(--flag-white);
}

.me-hero h1 {
	margin: 0 0 var(--s4);
	font-size: clamp(40px, 7.4vw, 80px);
	line-height: 1.05;
	letter-spacing: -0.025em;
}

/* The greeting's letters move on their own (greeting.js), within words
   that never break, and the name takes the flag's stripes, blue, pink,
   white, pink, blue; on paper, where white can't show, its middle letter
   keeps the text's colour. */
/* The letters lie over the plain copy (greeting.js), in the same cell so
   both wrap alike; the copy's glyphs don't show, but its highlight does
   when selected, beneath every letter. */
.me-hero h1 {
	display: grid;
}

.me-greeting-text,
.me-greeting-letters {
	grid-area: 1 / 1;
}

/* The site's ::selection rule matches every element, the name's span in
   the copy too, so the copy's own elements are named as well. */
.me-greeting-text,
.me-greeting-text::selection,
.me-greeting-text *::selection {
	color: transparent;
}

.me-greeting-letters {
	pointer-events: none;
	user-select: none;
	--selection-line: none;
}

.me-word {
	display: inline-block;
	white-space: nowrap;
}

.me-letter {
	display: inline-block;
}

.me-name .me-letter:nth-child(1),
.me-name .me-letter:nth-child(5) {
	color: var(--flag-blue);
}

.me-name .me-letter:nth-child(2),
.me-name .me-letter:nth-child(4) {
	color: var(--flag-pink);
}

.me-name .me-letter:nth-child(3) {
	color: var(--flag-white);
}

html[data-theme="light"] .me-name .me-letter:nth-child(3) {
	color: var(--text);
}

.me-hero-body {
	display: contents;
}

.me-lead {
	margin: 0 0 var(--s5);
	max-width: 44ch;
	font-size: clamp(1rem, 1.4vw, 1.12rem);
}

.me-reach {
	display: flex;
	align-items: center;
	gap: var(--s1);
}

.me-email {
	font-size: 1.05rem;
}

.copy-button svg {
	width: 20px;
	height: 20px;
}

/* --- The chapters ----------------------------------------------------- */

.me-story {
	position: relative;
	box-sizing: content-box;
	max-width: 76rem;
	margin-inline: auto;
	padding-top: var(--s7);
	padding-left: calc(var(--page-pad) + var(--spine-gap));
}

/* The spine runs the chapters' length; its fill is clipped to how far the
   reader has got (me.js), so its colours keep their places as it grows. */
.me-spine {
	position: absolute;
	top: calc(var(--s7) + 0.7em);
	bottom: 0;
	left: var(--page-pad);
	width: 2px;
	border-radius: 1px;
	background: var(--hairline);
}

.me-spine-fill {
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: linear-gradient(var(--flag-blue), var(--flag-pink) 25%, var(--flag-white) 50%, var(--flag-pink) 75%, var(--flag-blue));
	clip-path: inset(0 0 calc(100% - var(--progress, 0) * 100%) 0);
}

/* A milestone of her transition on the spine, level with its date (me.js),
   lighting in its stripe's colour, as the timeline's dots run, once the
   fill reaches it. */
.me-milestone {
	--stripe: var(--flag-blue);
	position: absolute;
	left: 50%;
	width: 8px;
	height: 8px;
	border: 2px solid var(--border);
	border-radius: 50%;
	background: var(--bg);
	translate: -50% -50%;
	transition:
		background-color 200ms var(--ease-effects),
		border-color 200ms var(--ease-effects),
		scale var(--mark-duration, 350ms) var(--mark-easing, ease);
}

.me-milestone:nth-of-type(5n + 2),
.me-milestone:nth-of-type(5n + 4) {
	--stripe: var(--flag-pink);
}

.me-milestone:nth-of-type(5n + 3) {
	--stripe: var(--flag-white);
}

.me-milestone.reached {
	border-color: var(--stripe);
	background: var(--stripe);
	scale: 1.2;
}

@media (prefers-reduced-motion: reduce) {
	.me-milestone {
		transition: none;
	}
}

/* On the light page the flag's blue and pink deepen to at least 3:1 on
   the hero's paper, as the greeting's large letters need; its white, which
   paper can't show, stands in as a grey at 3:1 where it only marks things. */
html[data-theme="light"] .me {
	--flag-blue: #2f86b8;
	--flag-pink: #c95aa5;
	--flag-white: #8a9484;
}

.me-chapter {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 13rem) minmax(0, 62ch) minmax(0, 1fr);
	column-gap: var(--s7);
	align-items: start;
	padding-block: var(--s6);
}

.me-chapter h2 {
	position: sticky;
	top: var(--s5);
	margin: 0;
	font-size: clamp(19px, 2.2vw, 24px);
	letter-spacing: 0.01em;
	line-height: 1.3;
}

/* Each chapter's mark on the spine lights once the reader reaches it. */
.me-chapter h2::before {
	content: "";
	position: absolute;
	top: 0.65em;
	/* Centred on the spine: its 2px line's middle is 1px in. */
	left: calc(-1 * var(--spine-gap) - 4px);
	width: 10px;
	height: 10px;
	border: 2px solid var(--border);
	border-radius: 50%;
	background: var(--bg);
	transform: translateY(-50%);
	transition:
		background-color 200ms var(--ease-effects),
		border-color 200ms var(--ease-effects),
		scale var(--mark-duration, 350ms) var(--mark-easing, ease);
}

@media (prefers-reduced-motion: reduce) {
	.me-chapter h2::before {
		transition: none;
	}
}

.me-chapter.reached h2::before {
	border-color: var(--flag-pink);
	background: var(--flag-pink);
	scale: 1.25;
}

.me-chapter-body {
	margin: 0;
}

.me-chapter-body > p {
	margin: 0 0 var(--s4);
}

.me-chapter-body > :last-child {
	margin-bottom: 0;
}

/* Hidden until they rise in (me.js), only when that will happen. */
.me-story.revealing .me-chapter:not(.shown) :is(h2, .me-chapter-body > *, .me-journey) {
	opacity: 0;
}

/* Things she loves: a name, then a few sentences. */
.me-loves > div {
	display: grid;
	grid-template-columns: 9rem minmax(0, 1fr);
	column-gap: var(--s5);
	padding-block: var(--s4);
	border-top: 1px solid var(--hairline);
}

.me-loves > div:first-child {
	padding-top: 0;
	border-top: 0;
}

.me-loves dt {
	color: var(--muted);
}

.me-loves dd {
	margin: 0;
}

/* Her transition so far: a date, then what happened, each marked in the
   flag's stripes in turn. */
.me-timeline {
	padding: 0;
	list-style: none;
}

.me-timeline > li {
	display: grid;
	/* Room for the longest a date can be, "28 September 2026". */
	grid-template-columns: 11.5rem minmax(0, 1fr);
	column-gap: var(--s5);
	padding-block: var(--s4);
	border-top: 1px solid var(--hairline);
}

.me-timeline > li:first-child {
	padding-top: 0;
	border-top: 0;
}

.me-timeline time {
	display: flex;
	align-items: baseline;
	gap: var(--s2);
	color: var(--muted);
}

.me-timeline time::before {
	content: "";
	flex: none;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--stripe, var(--flag-blue));
	translate: 0 -1px;
}

.me-timeline > li:nth-child(5n + 2),
.me-timeline > li:nth-child(5n + 4) {
	--stripe: var(--flag-pink);
}

.me-timeline > li:nth-child(5n + 3) {
	--stripe: var(--flag-white);
}

.me-timeline p {
	margin: 0;
}

/* The way to Norway, beside the chapter where there's room. */
.me-journey {
	grid-column: 3;
	grid-row: 1;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--s5);
	margin: 0;
}

.me-journey-map {
	flex: none;
	width: 240px;
	height: 240px;
	overflow: visible;
}

.me-journey-ring,
.me-journey-meridian {
	fill: none;
	stroke: var(--muted);
	stroke-width: 1;
}

.me-journey-meridian {
	stroke: var(--border);
}

.me-journey-pole {
	fill: var(--muted);
}

.me-journey-from {
	stop-color: var(--flag-blue);
}

.me-journey-to {
	stop-color: var(--flag-pink);
}

/* The distance as it's read out; a selection copies the visible one. */
.me-journey-distance [data-distance-spoken] {
	user-select: none;
	--selection-line: none;
}

.me-journey-label {
	font-size: 12px;
	fill: var(--muted);
	/* A halo of the page's colour, so the rings and meridians don't cross
	   the letters. */
	stroke: var(--bg);
	stroke-width: 4px;
	stroke-linejoin: round;
	paint-order: stroke;
}

.me-journey-route {
	fill: none;
	stroke: url(#me-journey-shade);
	stroke-width: 2.5;
	stroke-linecap: round;
	stroke-dasharray: 1;
}

.me-journey-here {
	fill: var(--flag-blue);
}

.me-journey-there {
	fill: var(--flag-pink);
	transform-box: fill-box;
	transform-origin: center;
}

.me-journey-facts {
	display: grid;
	gap: var(--s2);
	color: var(--muted);
}

.me-journey-facts time {
	margin-left: 0.5ch;
	color: var(--text);
}

@media (max-width: 1279px) {
	.me-chapter {
		grid-template-columns: minmax(0, 13rem) minmax(0, 62ch);
	}

	.me-journey {
		grid-column: 2;
		grid-row: auto;
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		gap: var(--s5) var(--s6);
		margin-top: var(--s6);
	}
}

@media (max-width: 899px) {
	.me-hero {
		min-height: clamp(560px, 88vh, 720px);
	}

	.me-hero.still-ink .me-water {
		background:
			radial-gradient(50% 16% at 80% 0%, color-mix(in srgb, var(--flag-blue) 30%, transparent), transparent),
			radial-gradient(34% 12% at 30% 0%, color-mix(in srgb, var(--flag-pink) 28%, transparent), transparent),
			radial-gradient(30% 10% at 100% 8%, color-mix(in srgb, var(--flag-white) 16%, transparent), transparent);
	}

	.me-chapter {
		grid-template-columns: minmax(0, 1fr);
		row-gap: var(--s4);
	}

	.me-chapter h2 {
		position: relative;
		top: 0;
	}

	.me-journey {
		grid-column: 1;
	}
}

/* Below 600px a label or date beside its text would leave the text too
   narrow, so it goes above. */
@media (max-width: 599px) {
	:is(.me-loves > div, .me-timeline > li) {
		grid-template-columns: minmax(0, 1fr);
		row-gap: var(--s1);
	}
}

@media (max-width: 480px) {
	.me {
		--spine-gap: var(--s5);
	}
}
