/* fork theme: design tokens.
 *
 * Loaded after browser.css / splash.css so these win on equal specificity.
 * Kept in its own file so upstream's :root block stays untouched and a
 * release merge never conflicts on the palette.
 *
 * Colour carries meaning here: one accent for anything interactive, neutral
 * surfaces for chrome, and the semantic hues reserved for status only.
 * Upstream reached for a different hue per control, which is why nothing on
 * the control panel reads as more important than anything else.
 */

:root {
	color-scheme: dark;

	/* surfaces, darkest to lightest */
	--bg-max: #05070a;
	--bg-d3: #0a0d12;
	--bg-d2: #0e1218;
	--bg-d1: #121722;
	--bg: #151b26;
	--bgg: var(--bg);
	--bg-u1: #1a2130;
	--bg-u2: #1f2839;
	--bg-u3: #253044;
	--bg-u4: #2c384f;
	--bg-u5: #35445e;
	--bg-u6: #40516f;

	/* text */
	--fg-max: #f4f7fb;
	--fg2-max: #f4f7fb;
	--fg: #d4dbe6;
	--fg-weak: #8d99ad;

	/* the one accent. everything clickable is some shade of this */
	--a: #5fb3f5;
	--a-hil: #9ed4ff;
	--a-b: #2b7fc4;
	--a-dark: #1b5f99;
	--a-gray: #5a6678;

	/* status. never decorative */
	--ok: #3fb96b;
	--ok-d: #2b8a4e;
	--warn: #e0a33e;
	--err: #e5484d;
	--err-d: #a02328;

	--scroll: var(--a-b);
	--sel-fg: var(--bg-d2);
	--sel-bg: var(--a-hil);

	--tab-alt: var(--fg-weak);
	--row-alt: #1a2130;

	/* buttons: neutral surface, accent text, accent fill when active */
	--btn-fg: var(--a);
	--btn-bg: rgba(95, 179, 245, 0.09);
	--btn-h-fg: var(--bg-d2);
	--btn-h-bg: var(--a-hil);
	--btn-1-fg: var(--bg-d3);
	--btn-1-bg: var(--a);
	--btn-h-bs: var(--btn-bs);
	--btn-h-bb: var(--btn-bb);
	--btn-1-bs: var(--btn-bs);
	--btn-1-bb: var(--btn-bb);
	--btn-1h-fg: var(--bg-d3);
	--btn-1h-bg: var(--a-hil);
	--btn-1h-bs: var(--btn-1-bs);
	--btn-1h-bb: var(--btn-1-bb);

	--chk-fg: var(--a);
	--txt-sh: transparent;
	--txt-bg: var(--bg-d1);

	--op-aa-fg: var(--a);
	--op-aa-bg: var(--bg-d2);
	--op-a-sh: rgba(0, 0, 0, 0.55);

	/* upload pane */
	--u2-btn-b1: var(--bg-u5);
	--u2-sbtn-b1: var(--bg-u5);
	--u2-txt-bg: var(--bg-d1);
	--u2-tab-bg: var(--bg-u1);
	--u2-tab-b1: var(--bg-u4);
	--u2-tab-1-fg: var(--fg-max);
	--u2-tab-1-bg: var(--bg-u3);
	--u2-tab-1-b1: var(--a);
	--u2-tab-1-b2: var(--a-b);
	--u2-tab-1-sh: transparent;
	--u2-b-fg: #fff;
	--u2-b1-bg: var(--a-dark);
	--u2-b2-bg: var(--a-b);
	--u2-inf-bg: var(--a-dark);
	--u2-inf-b1: var(--a);
	--u2-ok-bg: var(--ok-d);
	--u2-ok-b1: var(--ok);
	--u2-err-bg: var(--err-d);
	--u2-err-b1: var(--err);
	--ud-b1: var(--bg-u5);

	--sort-1: var(--a);
	--sort-2: var(--fg-weak);

	/* file sizes: one hue, weight carries the magnitude instead */
	--sz-b: var(--fg-weak);
	--sz-k: var(--fg-weak);
	--sz-m: var(--fg);
	--sz-g: var(--a);
	--sz-t: var(--a-hil);
	--sz-p: var(--a-hil);

	--srv-1: var(--fg-weak);
	--srv-2: var(--fg-weak);
	--srv-3: var(--a);
	--srv-3b: rgba(95, 179, 245, 0.55);

	--tree-bg: var(--bg-d1);

	/* grid view */
	--g-play-bg: var(--a-dark);
	--g-play-b1: var(--a);
	--g-play-b2: var(--a-hil);
	--g-play-sh: transparent;
	--g-sel-fg: var(--bg-d3);
	--g-sel-bg: var(--a-b);
	--g-sel-b1: var(--a);
	--g-sel-sh: transparent;
	--g-fsel-bg: var(--a);
	--g-fsel-b1: var(--a-hil);
	--g-fsel-ts: transparent;
	--g-dfg: var(--a);
	--g-fg: var(--fg);
	--g-bg: var(--bg-u1);
	--g-b1: var(--bg-u3);
	--g-b2: var(--bg-u4);
	--g-g1: var(--bg-u1);
	--g-g2: var(--bg-u3);
	--g-f-bg: var(--bg-u2);
	--g-f-b1: var(--bg-u4);
	--g-f-fg: var(--fg);
	--g-sh: rgba(0, 0, 0, 0.35);

	/* file rows */
	--f-sh1: 0.2;
	--f-sh2: 0.02;
	--f-sh3: 0.12;
	--f-h-b1: var(--bg-u4);
	--f-play-bg: var(--a);
	--f-play-fg: var(--bg-d3);
	--f-sel-sh: var(--a);
	--f-gray: var(--fg-weak);

	--fm-off: var(--fg-weak);
	--mp-sh: var(--bg-d3);
	--mp-b-bg: rgba(0, 0, 0, 0.25);

	--err-fg: #fff;
	--err-bg: var(--err-d);
	--err-b1: var(--err);
	--err-ts: transparent;
}

/* light theme */
html.y {
	color-scheme: light;

	--bg-max: #fff;
	--bg-d3: #fff;
	--bg-d2: #fff;
	--bg-d1: #fff;
	--bg: #f4f6f9;
	--bgg: var(--bg);
	--bg-u1: #fff;
	--bg-u2: #edf1f6;
	--bg-u3: #e3e9f1;
	--bg-u4: #d5dde8;
	--bg-u5: #c3cedd;
	--bg-u6: #aebdd0;

	--fg-max: #0b1017;
	--fg2-max: #0b1017;
	--fg: #1c2430;
	--fg-weak: #5b6675;

	--a: #0b6bc4;
	--a-hil: #0a5ba6;
	--a-b: #8cb8e0;
	--a-dark: #084d8c;
	--a-gray: #7b8695;

	--ok: #1f8f4a;
	--ok-d: #166b37;
	--warn: #9a6b0f;
	--err: #c5282d;
	--err-d: #9c1f23;

	--sel-fg: #fff;
	--sel-bg: var(--a);

	--row-alt: #edf1f6;
	--tree-bg: #edf1f6;

	--btn-bg: rgba(11, 107, 196, 0.08);
	--btn-h-fg: #fff;
	--btn-h-bg: var(--a);
	--btn-1-fg: #fff;
	--btn-1-bg: var(--a);
	--btn-1h-fg: #fff;
	--btn-1h-bg: var(--a-hil);

	--txt-sh: transparent;
	--txt-bg: #fff;

	--op-aa-bg: #fff;
	--op-a-sh: rgba(20, 30, 45, 0.16);

	--u2-tab-bg: #edf1f6;
	--u2-tab-1-fg: var(--fg-max);
	--u2-tab-1-bg: #fff;
	--u2-txt-bg: #fff;

	--sz-b: var(--fg-weak);
	--sz-k: var(--fg-weak);
	--sz-m: var(--fg);
	--sz-g: var(--a);
	--sz-t: var(--a);
	--sz-p: var(--a);

	--g-sel-fg: #fff;
	--g-bg: #fff;
	--g-f-bg: #edf1f6;
	--g-sh: rgba(20, 30, 45, 0.12);

	--f-sh1: 0.06;
	--f-sh2: 0.01;
	--f-sh3: 0.04;

	--mp-sh: var(--bg-u5);
	--mp-b-bg: rgba(20, 30, 45, 0.06);

	--err-fg: #fff;
}

/* ---- op bar ----------------------------------------------------------
 * Upstream renders each mode as a bare pictogram. The name of each mode
 * already existed as a hover tooltip, which a touch user can never reach,
 * so nothing about this bar was discoverable. Each control now shows its
 * name, and opening one explains in a sentence what it does.
 */

#ops {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: .15em;
	padding: .35em .5em;
	white-space: normal;
}

#ops a {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	gap: .2em;
	min-width: 4.6em;
	padding: .45em .5em .4em;
	font-size: 1em;
	line-height: 1.15;
	text-shadow: none;
	border-radius: .3em;
	border-bottom: .2em solid transparent;
}

#ops a .oi {
	font-size: 1.3em;
	line-height: 1.1;
}

#ops a .ol {
	font-size: .75em;
	color: var(--fg-weak);
	letter-spacing: .01em;
}

#ops a:hover {
	background: var(--btn-bg);
}

#ops a:hover .ol {
	color: var(--fg);
}

#ops a.act {
	border-radius: .3em .3em 0 0;
	border-bottom: .2em solid var(--a);
}

#ops a.act .ol {
	color: inherit;
}

#ops a:focus-visible {
	outline: 2px solid var(--a-hil);
	outline-offset: 1px;
}

/* the progress donut replaces the icon span, so it needs the sizing that
 * upstream put on the whole button */
#ops a .oi svg {
	width: 1.5em;
	height: 1.5em;
	margin: 0;
	display: block;
}

#opdesc {
	display: none;
}

#opdesc.act {
	display: block;
	max-width: 52em;
	margin: 0 .7em .5em;
	padding: .6em .8em;
	background: var(--bg-u1);
	border-left: .2em solid var(--a);
	border-radius: 0 .3em .3em 0;
	color: var(--fg);
	font-size: .92em;
	line-height: 1.5;
	white-space: normal;
}

/* ---- upload pane -----------------------------------------------------
 * Same problem as the op bar: the toggles were bare pictograms and the
 * status cards read "ok / ng / bz / que". Both now say what they are.
 */

#u2conf .c label {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	gap: .15em;
	width: 4.8em;
	padding: .4em .15em;
	line-height: 1.15;
	border-radius: .3em;
}

#u2conf .c label .ui {
	font-size: 1.25em;
	line-height: 1.1;
}

#u2conf .c label .ub {
	font-size: .68em;
	color: var(--fg-weak);
	/* wrap to a second line rather than widening the table cell */
	white-space: normal;
	text-align: center;
	hyphens: auto;
}

#u2conf .c label:hover .ub,
#u2conf .c input:checked + label .ub {
	color: var(--fg);
}

#u2cards a {
	white-space: nowrap;
}

/* #u2conf is a table whose toggle cells carry rowspan, so the two cells
 * without one are exactly the "parallel uploads" caption and its stepper.
 * Widening the toggles to fit labels made both of them wrap. */
#u2conf td.c:not([rowspan]) {
	white-space: nowrap;
}

#u2btn_cw {
	min-width: 13em;
}

/* ---- footer nav ------------------------------------------------------
 * These four links sit in an <h2>, so folder navigation rendered larger
 * than the filenames above it. They are navigation, not a heading.
 */

#wfp {
	font-size: 1em;
	font-weight: 400;
	margin: 1em 0 .4em;
	padding: .5em 0 0;
	border-top: 1px solid var(--bg-u3);
}

#wfp a {
	padding: .3em .6em;
	border-radius: .25em;
}

#wfp a:hover {
	background: var(--btn-bg);
}

/* view / play / zip in the Actions column */
#files td:first-child a {
	font-size: .85em;
	padding: .1em .45em;
	border-radius: .25em;
	background: var(--btn-bg);
}

#files td:first-child a:hover {
	background: var(--btn-h-bg);
	color: var(--btn-h-fg);
}

#repl {
	opacity: .35;
}

#repl:hover {
	opacity: 1;
}

/* The grid and player toggles are direct children of #wtoggle, so they miss
 * the small-label rules that #wfm / #wzip1 / #wnp children get. Their icons
 * are meant to stay large; only the new captions need shrinking. */
#wtgrid,
#wtico {
	display: inline-block;
	text-align: center;
	line-height: 1;
	vertical-align: middle;
}

#wtgrid span,
#wtico span {
	display: block;
	/* rem, not em: these two sit at different inherited sizes, so a relative
	 * value rendered them 10px and 12px next to the existing 15px zip label */
	font-size: .9rem;
	line-height: 1.2;
	margin-top: .3em;
	font-weight: 400;
}
