/*
 *	style.css | Finn Le Var
 */

*
{
	margin:		0;
	padding:	0;
	box-sizing:	border-box;
}

/* monogram extended, a pixel font, self hosted so the page makes no outside requests
   it is drawn on a 16px grid so every size here is a multiple of 16 to stay crisp */
@font-face
{
	font-family:	"Monogram";
	src:			url(../../fonts/monogram-extended.ttf) format("truetype");
	font-display:	swap;
}

html, body
{
	min-height:	100%;
}

body
{
	background-color:	black;
	color:				#8c8c8c;
	font-family:		"Monogram", monospace;
	font-size:			32px;
	line-height:		1.125;
	-webkit-font-smoothing:	none;
}

/*
 *	background
 */

/* sits behind everything and never scrolls */
#bg
{
	position:	fixed;
	inset:		0;
	z-index:	-1;
}

.layer
{
	position:			absolute;
	inset:				0;
	image-rendering:	pixelated;
}

/* each layer drifts twice as fast as the one behind it, so we get parallax */
.bg01 { background-image: url(../../img/bg01.png); animation: drift_y 120s infinite linear, sway_x 60s infinite ease-in-out; }
.bg02 { background-image: url(../../img/bg02.png); animation: drift_y 60s infinite linear, sway_x 30s infinite ease-in-out; }
.bg03 { background-image: url(../../img/bg03.png); animation: drift_y 30s infinite linear, sway_x 15s infinite ease-in-out; }

/* darkens the edges so the text in the middle stays readable */
.vignette
{
	background: radial-gradient(circle, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 1) 100%);
}

/* scrolls exactly two tiles so the loop has no seam */
@keyframes drift_y
{
	0%		{ background-position-y: 1024px;	}
	100%	{ background-position-y: -1024px;	}
}

@keyframes sway_x
{
	0%		{ background-position-x: 0px;	}
	50%		{ background-position-x: 50px;	}
	100%	{ background-position-x: 0px;	}
}

/* just in case someone has motion turned off */
@media (prefers-reduced-motion: reduce)
{
	.layer { animation: none; }
}

/*
 *	content
 */

/* the name column and how far a groups links step in, the children get the column minus the step
   so every description starts at the same x */
:root
{
	--name:	192px;
	--step:	32px;
}

/* one block as wide as its longest row, centred both ways, svh so the ios bars dont push it off */
main
{
	width:			fit-content;
	max-width:		100%;
	min-height:		100vh;
	min-height:		100svh;
	margin:			0 auto;
	padding:		48px 32px;
	display:		flex;
	flex-direction:	column;
	justify-content:center;
	gap:			32px;
	text-shadow:	0 0 8px black, 0 0 16px black;
}

h1
{
	font-size:		32px;
	font-weight:	normal;
	color:			#d2738a;
}

ul
{
	list-style:	none;
}

/* the gated rows, safety in case a li ever gets a display */
[hidden]	{ display: none; }

/* one row per link, name then description, no boxes, the type does the work. the gap is the same at both
   levels so the descriptions still line up, rounded to a whole pixel where round() is in, plain 5vw where not */
a, .row
{
	position:			relative;
	display:			grid;
	grid-template-columns:	var(--col, var(--name)) 1fr;
	column-gap:			max(16px, 5vw);
	column-gap:			round(max(16px, 5vw), 1px);
	align-items:		baseline;
	text-decoration:	none;
	color:				inherit;
}

/* only once dragging is on, logged in, so everyone else keeps the normal long press and selection */
.editable a, .editable .row
{
	user-select:		none;
	-webkit-user-select:	none;
	-webkit-touch-callout:	none;
}

.name	{ color: #e8e8e8; }

/* a group header is a label not a link, so its name sits dimmer than the links under it */
.row .name	{ color: #5c5c5c; }
.row .desc	{ color: #5c5c5c; }

/* a third of a line either side of a group, enough to read as one block without stretching the list */
.group
{
	margin:	12px 0;
}

.group ul
{
	padding-left:	var(--step);
	--col:			calc(var(--name) - var(--step));
}

/* the marker lives in the gutter left of the name, absolute so showing it shifts nothing */
a::before
{
	content:	">";
	position:	absolute;
	left:		-32px;
	color:		#d2738a;
	visibility:	hidden;
}

a:hover .name, a:focus-visible .name	{ color: #d2738a; }
a:hover::before, a:focus-visible::before	{ visibility: visible; }

/* the marker and the pink are the focus ring */
a:focus-visible
{
	outline:	none;
}

/*
 *	reordering
 */

/* the row being dragged stays where it is and fills pink, square to match the pixels. the shadows push the
   fill out past the text either side without moving anything */
.dragging
{
	background-color:	#d2738a;
	box-shadow:			-8px 0 0 #d2738a, 8px 0 0 #d2738a;
	text-shadow:		none;
}

nav .dragging .name, nav .dragging .desc	{ color: black; }
a.dragging::before							{ visibility: hidden; }

/* while dragging the rows under the pointer stay quiet, the slot line is the only thing that should light up */
.sorting, .sorting a	{ cursor: grabbing; }
.sorting a:hover:not(.dragging) .name		{ color: #e8e8e8; }
.sorting a:hover::before					{ visibility: hidden; }

/* the drop slot, 8px dashes as a gradient so they land on whole pixels, a dashed border wont */
#slot
{
	position:		absolute;
	height:			2px;
	background:		repeating-linear-gradient(90deg, #d2738a 0 8px, transparent 8px 16px);
	pointer-events:	none;
}

/* the label that follows the pointer, the name and a dim line saying where it goes */
#ghost
{
	position:			fixed;
	left:				0;
	top:				0;
	z-index:			10;
	padding:			4px 12px 6px;
	background-color:	#141414;
	border:				2px solid #2e2e2e;
	white-space:		nowrap;
	pointer-events:		none;
}

#ghost .name	{ display: block; }
#ghost .hint	{ display: block; font-size: 16px; color: #6c6c6c; }

/* sits under the list, only shown once the order isnt the default */
#reset
{
	align-self:			flex-start;
	font:				inherit;
	font-size:			16px;
	color:				#5c5c5c;
	background:			none;
	border:				none;
	border-radius:		0;
	-webkit-appearance:	none;
	appearance:			none;
	cursor:				pointer;
}

#reset:hover, #reset:focus-visible
{
	color:		#d2738a;
	outline:	none;
}

/* phone, a 16px gutter, the description drops to 16px so it still fits on the name line. the name column is
   112 not 128 like d to make room for the gap, lua docs still just fits the 96 the children get */
@media (max-width: 800px)
{
	:root
	{
		--name:	112px;
		--step:	16px;
	}

	main
	{
		width:		auto;
		padding:	48px 16px;
	}

	.desc		{ font-size: 16px; }
	a::before	{ left: -16px; }
}
