@font-face {
	font-family: "Jost";
	src: url("fonts/jost-latin.woff2") format("woff2");
	font-weight: 200 500;
	font-style: normal;
	font-display: swap;
}

:root {
	--bg: #05060a;
	--ink: #e9edf7;
	--accent: #adc0ff;
	--on-accent: #080b18;
	--deep: #0a0e1f;
	--ease: cubic-bezier(0.2, 0.8, 0.2, 1);
	--ease-soft: cubic-bezier(0.45, 0, 0.15, 1);
	/* The horizon of the field, kept equal to HZ in field.js. */
	--hz: 46vh;
	--gutter: clamp(24px, 7vw, 120px);
}

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

html,
body {
	height: 100%;
	margin: 0;
	overflow: hidden;
	background: var(--bg);
	color: var(--ink);
}

body {
	font-family: "Jost", "Segoe UI", system-ui, sans-serif;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

#field {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
}

.vignette {
	position: fixed;
	inset: 0;
	pointer-events: none;
	background: radial-gradient(120% 95% at 50% 58%, transparent 52%, rgba(0, 0, 0, 0.6) 100%);
}

/* The logo and the two ways in sit on the sky, just above the horizon. */
.hero {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: var(--hz);
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	align-items: flex-start;
	padding: 0 var(--gutter) clamp(30px, 6.5vh, 70px);
}

/* The logo is written by hand, so it is put on the page by hand: one piece at a time, left to right. */
.logo {
	margin: 0 0 clamp(26px, 4.8vh, 48px);
	line-height: 0;
}

.logo-svg {
	display: block;
	width: clamp(300px, 62vw, 980px);
	max-width: 100%;
	height: auto;
	overflow: visible;
}

.g {
	fill: var(--ink);
	animation:
		wipe var(--w) cubic-bezier(0.3, 0.55, 0.3, 1) var(--d) both,
		cool 1.2s var(--ease-soft) calc(var(--d) + var(--w) - 0.12s) backwards,
		gleam var(--period) linear var(--gl) infinite;
}

.g.dot {
	fill: var(--accent);
	animation: wipe var(--w) cubic-bezier(0.3, 0.55, 0.3, 1) var(--d) both;
}

/* the ink front is a hard edge that is still hot: periwinkle first, then it cools to white */
@keyframes wipe {
	from {
		clip-path: inset(-12% 100% -12% -3%);
	}
	to {
		clip-path: inset(-12% -3% -12% -3%);
	}
}

@keyframes cool {
	from {
		fill: var(--accent);
	}
}

/* every so often the light that rides the sea runs through the letters */
@keyframes gleam {
	0%,
	100% {
		fill: var(--ink);
	}
	5% {
		fill: var(--accent);
	}
	13% {
		fill: var(--ink);
	}
}

@keyframes settle {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

.actions {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
}

/* The centred version, for comparing: open index.html?layout=center (or index-centered.html). The left aligned one is the default. */
.center .hero {
	align-items: center;
	text-align: center;
}

.center .logo-svg {
	width: clamp(300px, 66vw, 1040px);
}

.center .actions {
	justify-content: center;
}

/*
 * The buttons. At rest each is one flat colour. On hover the tide comes in from below: a body of the other colour with a
 * flowing wave on top of it, and the label is cut by the water line, so the text is dark below the surface and light above it.
 * The copy of the label lives inside the tide and is moved the opposite way, so it never moves relative to the button.
 */
.btn {
	--wave: 14px;
	position: relative;
	isolation: isolate;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: var(--bh, 50px);
	padding: 0 28px;
	overflow: hidden;
	font-size: 1.0625rem;
	font-weight: 400;
	letter-spacing: 0.09em;
	text-decoration: none;
	border: 1px solid var(--accent);
	border-radius: 3px;
	opacity: 0;
	animation: settle 1.2s var(--ease) var(--at, 1.9s) forwards;
	transition: transform 0.18s ease;
	-webkit-tap-highlight-color: transparent;
}

/* a button that is not live yet: it still reacts, it just does not go anywhere */
.btn-soon {
	cursor: default;
}

.btn-soon:active {
	transform: none;
}

.btn:nth-child(2) {
	--at: 2.1s;
}

.btn:active {
	transform: scale(0.97);
}

.btn-in {
	display: inline-flex;
	align-items: center;
	gap: 11px;
	white-space: nowrap;
}

.btn-in svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
	flex: none;
}

.btn-main {
	color: var(--on-accent);
	background: var(--accent);
	--water: var(--deep);
	--water-ink: var(--ink);
}

.btn-icon {
	width: var(--bh, 50px);
	padding: 0;
}

.btn-icon .btn-in svg {
	width: 23px;
	height: 23px;
}

/* line icons (the person) are drawn with a stroke, not filled */
.btn-in svg.ico-line {
	fill: none;
	stroke: currentColor;
	stroke-width: 1.5;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.btn-side {
	color: var(--ink);
	background: transparent;
	border-color: rgba(173, 192, 255, 0.4);
	--water: var(--accent);
	--water-ink: var(--on-accent);
}

.btn-profile {
	--bh: 42px;
	--wave: 12px;
	position: fixed;
	top: clamp(18px, 3.6vh, 34px);
	right: clamp(20px, 3.2vw, 44px);
	z-index: 5;
	border-radius: 50%;
	border-color: rgba(173, 192, 255, 0.26);
}

.btn-profile .btn-in svg {
	width: 21px;
	height: 21px;
}

.tide {
	position: absolute;
	left: -1px;
	right: -1px;
	top: -1px;
	height: calc(100% + 2px + var(--wave));
	z-index: 2;
	overflow: hidden;
	pointer-events: none;
	transform: translateY(100%);
	transition: transform 0.9s var(--ease);
}

.tide::before,
.tide::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	height: var(--wave);
	background: var(--water);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 14' preserveAspectRatio='none'%3E%3Cpath d='M0 7C20 0 40 0 60 7S100 14 120 7V14H0Z'/%3E%3C/svg%3E") 0 0 / 120px 100% repeat-x;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 14' preserveAspectRatio='none'%3E%3Cpath d='M0 7C20 0 40 0 60 7S100 14 120 7V14H0Z'/%3E%3C/svg%3E") 0 0 / 120px 100% repeat-x;
	animation: flow 2.6s linear infinite;
	animation-play-state: paused;
}

/* a second, fainter swell moving the other way and a little out of step */
.tide::after {
	opacity: 0.45;
	-webkit-mask-position: 60px 0;
	mask-position: 60px 0;
	animation: flow-back 3.8s linear infinite;
	animation-play-state: paused;
}

.tide-body {
	position: absolute;
	left: 0;
	right: 0;
	top: calc(var(--wave) - 1px);
	bottom: 0;
	background: var(--water);
}

.tide-label {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding-bottom: var(--wave);
	color: var(--water-ink);
	transform: translateY(-100%);
	transition: transform 0.9s var(--ease);
}

@keyframes flow {
	to {
		-webkit-mask-position: -120px 0;
		mask-position: -120px 0;
	}
}

@keyframes flow-back {
	from {
		-webkit-mask-position: 60px 0;
		mask-position: 60px 0;
	}
	to {
		-webkit-mask-position: 180px 0;
		mask-position: 180px 0;
	}
}

.btn:hover .tide,
.btn:focus-visible .tide {
	transform: translateY(calc(-1 * var(--wave)));
}

.btn:hover .tide-label,
.btn:focus-visible .tide-label {
	transform: translateY(var(--wave));
}

.btn:hover .tide::before,
.btn:hover .tide::after,
.btn:focus-visible .tide::before,
.btn:focus-visible .tide::after {
	animation-play-state: running;
}

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

@media (max-width: 560px) {
	.btn {
		--bh: 48px;
	}

	.btn-main {
		padding: 0 24px;
	}

	.btn-profile {
		--bh: 40px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.g,
	.g.dot {
		animation: none;
		clip-path: none;
	}

	.btn {
		animation: none;
		opacity: 1;
	}

	.tide,
	.tide-label {
		transition: none;
	}

	.tide::before,
	.tide::after {
		animation: none;
	}
}
