/*--------------------------------------------------
Scroll Thread (js/thread.js)
Edit the color and width here. The color defaults to the
template accent set by data-primary-color on <body>.
---------------------------------------------------*/

.thread-layer {
	--thread-color-fallback: #FFD400;
	--thread-width: 2.2px;
	position: absolute;
	top: 0;
	left: 0;
	/* Above pinned sliders/lists inside the scroll area. The header lives
	   outside the scroll container, so it always stays on top. */
	z-index: 200;
	pointer-events: none;
	overflow: visible;
}

.thread-layer.is-empty {
	display: none;
}

/* Back layer: under the page content, so letters and images cover the
   stretches that pass behind them (woven text, see js/thread.js) */
.thread-layer.thread-back {
	z-index: -1;
}

/* Same, inside one woven text element (js/thread.js makes the element its
   own stacking context, so this sits above the background behind the text) */
.thread-layer.thread-host-back {
	z-index: -1;
}

/* The full path behind a scene drawn in front/back runs: only measured */
.thread-ghost {
	visibility: hidden !important;
}

.thread-path {
	fill: none;
	stroke: var(--thread-color, var(--thread-color-fallback));
	stroke-width: var(--thread-width);
	stroke-linecap: round;
	stroke-linejoin: round;
	vector-effect: non-scaling-stroke;
	visibility: hidden;
}

.thread-origin,
.thread-head {
	fill: var(--thread-color, var(--thread-color-fallback));
	stroke: none;
}

.thread-head {
	opacity: 0;
	filter: drop-shadow(0 0 6px rgba(250, 130, 29, 0.6));
}

.thread-head-ring {
	fill: none;
	stroke: var(--thread-color, var(--thread-color-fallback));
	stroke-width: var(--thread-width);
	opacity: 0;
	transition: opacity 0.3s ease;
}

/* Split / merge points of an orbit scene (data-thread-orbit) */
.thread-junction {
	fill: var(--thread-color, var(--thread-color-fallback));
	stroke: none;
	opacity: 0;
	transition: opacity 0.3s ease;
}

/* Ring around the head only while the page is at rest */
html[data-thread-moving] .thread-head-ring {
	opacity: 0 !important;
}

@media (hover: none), (pointer: coarse) {
	.thread-head {
		filter: none;
	}
}

/*--------------------------------------------------
Brain drawing (in the "We're reynald" row of index.html, opposite the
sentence; js/thread.js draws the line). Modeled on dakshgajjar.com's
"practice" drawing: the drawing box is 5:8; labels fade in and rise 6px when
the line reaches them, and drop back when it retracts. Above 1024px it sits
at the right of the sentence wrapper, level with the sentence; below that it
follows the sentence.
---------------------------------------------------*/

.brain-drawing {
	--brain-w: min(30rem, 28vw);
	position: relative;
	width: var(--brain-w);
	aspect-ratio: 5 / 8;
}

/* The template holds the sentence for 30% of a screen of scroll without
   pushing the content down (js/common.js, wider than 768px), so it settles
   30vh lower than its row: the drawing moves down the same amount to stay
   level with it */
@media only screen and (min-width: 1025px) {
	.brain-intro {
		min-height: calc(30vh + 1.6 * min(30rem, 28vw));
	}

	.brain-intro .brain-drawing {
		position: absolute;
		top: 30vh;
		right: 0;
	}
}

@media only screen and (max-width: 1024px) {
	.brain-intro .brain-drawing {
		--brain-w: min(26rem, 52vw);
		margin: calc(3rem + 30vh) 0 0 auto;
	}
}

/* 768px and below the template pushes the content down itself */
@media only screen and (max-width: 768px) {
	.brain-intro .brain-drawing {
		margin-top: 3rem;
	}
}

.brain-label {
	position: absolute;
	left: 82%;
	font-family: 'Geologica', sans-serif;
	font-size: clamp(0.55rem, 0.85vw, 0.8rem);
	letter-spacing: 0.02em;
	line-height: 1.2;
	white-space: nowrap;
	color: #fff;
	opacity: 0;
	transform: translateY(calc(6px - 50%));
	transition: opacity 0.42s ease, transform 0.42s cubic-bezier(0.16, 1, 0.3, 1);
}

.brain-label[data-thread-reached] {
	opacity: 1;
	transform: translateY(-50%);
}

.brain-intent { top: 28%; left: 90%; }
.brain-interaction { top: 67.8%; }
.brain-system { top: 81.8%; }

/* Phones: the drawing is centred under the sentence */
@media only screen and (max-width: 767px) {
	.brain-intro .brain-drawing {
		--brain-w: min(24rem, 78vw);
		margin: 2.5rem auto 0;
	}

	.brain-label {
		left: 84%;
		font-size: 0.52rem;
	}

	.brain-intent { left: 90%; }
}

/* Without the line (no JS) the labels just show */
[data-thread-brain]:not([data-thread-progress]) .brain-label {
	opacity: 1;
	transform: translateY(-50%);
}

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