/**
 * Eternium CSS framework.
 * License:  MIT
 *
 * Provide custom layout and form element styles ONLY for elements inside the .eternium class.
 * And colorizes elements with a light and dark style.
 * Add 'light' or 'dark' attributes to the <html> tag.
 * It's recommended to use javascript to set this attribute from prefers-color-scheme on page load.
 *
 * TODO: Phase out .grouped in place of .group, and .pad-tiny-small in projects.
 * TODO: Phase out these classes: .btn
 * TODO: Support more elements from https://preview.tabler.io/form-elements.html
 * TODO: flex1, flex2, flex3, etc. instead of expand?  Also fixed width classes?
 *
 * Possible names, haven't checked npm:
 * FlexFlow, RowCols, Energy.css, FlexFusion.cs, FlexBoss, FlexCraft, FlexMatrix.  FlexWarp.  Glide.css
 *
 * Possible names that aren't in npm:
 * divcrafter - div-crafter is also available
 * rex-css - taking a bite out of bad layouts.  But rex-css-framework exists.  Last publish 6 years ago.
 * rectangle-css - rectangle is taken
 * quadrite
 * tungstenite - tungsten is taken
 * carbon12
 * void-?
 * starsteel
 * eternium
 * solarite
 * lumenite
 */


/* ┌─────────────────╮
 * |Variables        |
 * └─────────────────╯*/

/* Light Colors */
:root:not([dark]):is(.eternium, .eternium-forms),
:root:not([dark]) :is(.eternium, .eternium-forms) {
	/* Palette */
	--text: #333;
	--background: white;
	--invert: black;

	--shade1: #e4e8ed;
	--shade2: #cbcfd7;
	--shade3: #b6bac1; /* Unused? */
	--shade4: #aeb3be;

	--primary: #07c;
	--primary2: #08e;

	--invalid: #900;
	--shadow: 0 0 5px #0006;

	/* Elements */
	--primary-text: white;
	--primary-border-focus: black;
	--secondary: var(--shade2);
	--secondary-background-hover: var(--shade4);
	--secondary-border-hover: var(--shade4);
	--input-background: white;
	--input-border: var(--shade2);

	--card-background: white;
	--card-border: var(--border-width) solid transparent; /* same width as visible border on dark mode. */

	/* TODO: get rid of these */
	--border: var(--border-width) solid var(--shade2);
	--border-focus: var(--border-width) solid var(--primary2);

	/* Table */
	--table-header-background: var(--shade1);
	--table-border: 1px solid var(--shade1);
	--table-background: white;
	--table-padding: 4px 8px;
}

/* Dark Colors */
:root[dark]:is(.eternium, .eternium-forms),
:root[dark] :is(.eternium, .eternium-forms) {

	/* Palette */
	--text: #bcc3c8;
	--background: black;
	--invert: white;

	--shade1: #06090c;
	--shade2: #0f1318;
	--shade3: #2a3239;
	--shade4: #3d474f;

	--primary: #048;
	--primary2: #05a;
	--invalid: #900;
	--shadow: 0 0 12px #000f;

	/** Elements */
	--primary-text: white;
	--primary-border-focus: white;
	--secondary: var(--shade3);
	--secondary-background-hover: var(--shade4);
	--secondary-border-hover: var(--shade4);
	--input-background: var(--shade1);
	--input-border: var(--shade3);

	--card-background: var(--shade2);
	--card-border: var(--border);

	--border: var(--border-width) solid var(--shade3);
	--border-focus: var(--border-width) solid var(--primary2);

	/* Table */
	--table-header-background:var(--shade3);
	--table-border: 1px solid var(--shade3);
	--table-background: var(--shade2);
	--table-padding: 4px 8px;
}


:is(.eternium, .eternium-forms) {
	--input-small: 18px;
	--input-normal: 24px;
	--input-big: 32px;
	--input-huge: 44px;

	--border-width: 1px;
	--border-radius: 3px;
	--icon-size: 20px;

	/* Buttons */
	--primary-background: var(--primary);
	--primary-border: var(--border-width) solid var(--primary);

	--primary-background-hover: var(--primary2);
	--primary-border-hover: var(--border-width) solid var(--primary2);

	--secondary-background: var(--secondary);
	--secondary-border: var(--border-width) solid var(--secondary);
}


/* ┌─────────────────╮
 * |Scrollbars       |
 * └─────────────────╯*/
:root[dark]:is(.eternium, .eternium-forms), :root[dark] :is(.eternium, .eternium-forms) {
	/*noinspection CssInvalidPropertyValue*/scrollbar-color: dark;

	::-webkit-scrollbar { background: transparent }
	::-webkit-scrollbar-track,
	::-webkit-scrollbar-corner { background: transparent }
	::-webkit-scrollbar-thumb { background: var(--shade4); border-radius: var(--border-radius) }
}

/* Form validation. Hide fields used by validate.js */
:is(.eternium, .eternium-forms) {

	/* ┌─────────────────╮
	 * |Normalize        |
	 * └─────────────────╯*/
	body { background: var(--background); color: var(--text) }
	:is(button, input, optgroup, select, textarea) { font-family: inherit; font-size: 100% }

	/**
	 * Prevent `sub` and `sup` elements from affecting the line height in all browsers. */
	sub, sup {line-height: 0 }

	dialog { z-index: 1000;
		&::backdrop { background: #0008 }
	}

	/* ┌─────────────────╮
	 * |Misc             |
	 * └─────────────────╯*/

	/* Form Validation */
	:is(.invalid) { border-color: var(--invalid) !important; outline-color: var(--invalid) !important }

	/* Hide validation messages by default. */
	:is(
		[data-pattern], [data-min], [data-max], [data-minlength], [data-maxlength], [data-required], [data-step], [data-type],
		[data-validate]:not(input, .input, select, .select, textarea), [data-validate2], [data-validate3], [data-validate4]) {
		color: var(--invalid); display: none
	}

	/* Misc */
	.little { font-size: 80%;  line-height: 1.1 }
	:is(.muted,.faint) { opacity: .66; } /* faint is deprecated */



	:focus-visible { outline: none } /* Remove browser's default outline */
	a:focus-visible:not(.noOutline) { outline: var(--border-focus) }
	hr { border: none; border-bottom: var(--border) }
	.noselect { user-select: none }

	/* Icon */
	.icon { font-size: var(--icon-size);
		min-width: var(--icon-size); max-width: var(--icon-size); min-height: var(--icon-size); max-height: var(--icon-size);
		&:not([disabled]) { cursor: pointer;
			&.selected { color: var(--primary2)	}
		}
	}

	/* Placeholder + Contenteditable placeholder */
	::placeholder { color: inherit; opacity: .6 }
	[placeholder]:empty {
		&:before { content: attr(placeholder); opacity: .6; white-space: nowrap; cursor: text }
		&:is(:focus,.focus):before { content: '' }
	}

	/* menu-item */
	/* A combination of:  class="row pad-h-small pad-v-micro gap-small button center-v" */
	.menu-item {
		display: flex; align-items: center; padding: 4px 8px; gap: 8px; color: var(--text);
		user-select: none; cursor: pointer;
	}
	.menu-item:hover { background: var(--primary-background); color: var(--primary-text) }

	/* Card
	 * Must appear before row/col so those can override the display to be flex. */
	.card { box-sizing: border-box; background: var(--card-background); box-shadow: var(--shadow);
		&:not(.square) { border-radius: var(--border-radius) }
		&:not(.flat) { border: var(--card-border) }
	}


	/* ┌─────────────────╮
	 * |Input+Btn Height |
	 * └─────────────────╯*/
	/* Height */
	:is(
		input:not([type=checkbox],[type=file],[type=hidden],[type=image],[type=radio],[type=range]),
		.input:not([contenteditable]), select, button, .button, .btn) { /** TODO: .btn is deprecated */
		box-sizing: border-box; padding-top: 0; padding-bottom: 0;
		min-height: var(--input-normal)
	}

	:is(textarea, [contenteditable].input) {
		box-sizing: border-box;
		min-height: var(--input-normal);
		padding-top: calc((var(--input-normal) - 1lh) / 2 - var(--border-width)) /* Make text line up vertically with inputs.  Top half of the diff between input height and text height*/
	}

	/* ┌─────────────────╮
	 * |Input            |
	 * └─────────────────╯*/
	:is(.input, select, textarea,
		input:not([type=checkbox],[type=file],[type=hidden],[type=image],[type=radio],[type=range],[type=button],[type=reset],[type=submit])) {
		min-width: 0; color: var(--text);
		&:not(.square, .flat) { border-radius: var(--border-radius); }
		&:not(.flat) {
			background: var(--input-background);
			border: var(--border-width) solid var(--input-border); vertical-align: top; padding-left: var(--tiny); padding-right: var(--tiny);
		}
	}

	/* Input focus */
	:is(
		input:not([type=checkbox],[type=file],[type=hidden],[type=image],[type=radio],[type=range],[type=button],[type=reset],[type=submit]),
		.input, select, textarea):not(.flat,.noOutline):is(:focus-within,.focus) {
		outline: var(--border-focus); outline-offset: -1px; z-index: 2 /* z-index lets it the border be on top when inside .group */
	}
	input[type=file]:not(.noOutline):is(:focus-within, .focus) { outline: var(--border-focus) } /* Can't style file, but at least make the focus look similar. */

	/* Input focus:invalid */
	:is(
		input:not([type=checkbox],[type=hidden],[type=image],[type=radio],[type=range],[type=button],[type=reset],[type=submit]),
		.input, select, textarea):not(.flat):is(:focus-within,.focus):invalid {
		outline-color: red
	}


	/* ┌─────────────────╮
	 * |Alerts           |
	 * └─────────────────╯*/
	.infoAlert { background: #cdf; color: #347; padding: 8px 16px }
	.successAlert { background: #cfd; color: #374; padding: 8px 16px }
	.warningAlert { background: #fec; color: #863; padding: 8px 16px }
	.errorAlert { background: #fcc; color: #833; padding: 8px 16px }


	/* ┌─────────────────╮
	 * |Buttons          |
	 * └─────────────────╯*/
	:is(.button, .btn, button, input:is([type=button],[type=submit],[type=reset])) {
		& {
			box-sizing: border-box; user-select: none; text-align: center; color: var(--text); display: inline-flex; align-items: center }
		&:not([disabled]) {
			cursor: pointer }
		&:not(.square, .flat) {
			border-radius: var(--border-radius) }
		&:not(.flat) {
			padding-left: var(--normal); padding-right: var(--normal); line-height: normal;
			border: var(--secondary-border); background: var(--secondary-background) }

		/* Button Hover/Focus */
		&:not([disabled],.flat):is(:hover,.hover,.selected) {
			background: var(--secondary-background-hover); border: var(--border-width) solid var(--secondary-border-hover);
			color: var(--invert)}
		&:not(.noOutline):is(:focus-visible,.focus) { outline: var(--border-focus); outline-offset: -1px; z-index: 2 }
		&:is([disabled]) { cursor: default; opacity: .5 }

		/* Button Primary */
		&.primary {
			&:not(.flat) { background: var(--primary-background); border: var(--primary-border) }
			&:not(.flat) { color: var(--primary-text) }
			&:is(:active,:hover,.active,.hover,.selected):not([disabled]) {
				background: var(--primary-background-hover); border: var(--primary-border-hover); color: var(--primary-text) }
			&:not(.noOutline):is(:focus-visible,.focus){
				outline: var(--border-width) solid var(--primary-border-focus); outline-offset: -1px; z-index: 2 }
			}
		a:is(.button, .btn, .button:hover, .btn:hover) { text-decoration: none }

		/* ┌─────────────────╮
		 * |Button Status    |
		 * └─────────────────╯*/
		/* TODO: Let inputs have status also. */
		&:is(.loading,.error,.complete) { position: relative;
			&:after { position: relative;	margin-right: -16px; top: 1px; left: 1px; }
			&.primary:after { filter: invert(100%) }
		}

		&.loading:after {
			content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path style="transform-origin: center" fill="currentColor" d="M13 2v2c4.39.54 7.5 4.53 6.96 8.92A8.014 8.014 0 0 1 13 19.88v2c5.5-.6 9.45-5.54 8.85-11.03C21.33 6.19 17.66 2.5 13 2m-2 0c-1.96.18-3.81.95-5.33 2.2L7.1 5.74c1.12-.9 2.47-1.48 3.9-1.68V2M4.26 5.67A9.81 9.81 0 0 0 2.05 11h2c.19-1.42.75-2.77 1.64-3.9L4.26 5.67M2.06 13c.2 1.96.97 3.81 2.21 5.33l1.42-1.43A8.002 8.002 0 0 1 4.06 13h-2m5 5.37l-1.39 1.37A9.994 9.994 0 0 0 11 22v-2a8.002 8.002 0 0 1-3.9-1.63h-.04Z"><animateTransform attributeName="transform" type="rotate" from="0 0 0" to="360 0 0" dur="2s" repeatCount="indefinite" /></path></svg>');
		}
		&.complete:after {
			content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path fill="currentColor" d="M13 2.03v2.02c4.39.54 7.5 4.53 6.96 8.92c-.46 3.64-3.32 6.53-6.96 6.96v2c5.5-.55 9.5-5.43 8.95-10.93c-.45-4.75-4.22-8.5-8.95-8.97m-2 .03c-1.95.19-3.81.94-5.33 2.2L7.1 5.74c1.12-.9 2.47-1.48 3.9-1.68v-2M4.26 5.67A9.885 9.885 0 0 0 2.05 11h2c.19-1.42.75-2.77 1.64-3.9L4.26 5.67M15.5 8.5l-4.88 4.88l-2.12-2.12l-1.06 1.06l3.18 3.18l5.94-5.94L15.5 8.5M2.06 13c.2 1.96.97 3.81 2.21 5.33l1.42-1.43A8.002 8.002 0 0 1 4.06 13h-2m5.04 5.37l-1.43 1.37A9.994 9.994 0 0 0 11 22v-2a8.002 8.002 0 0 1-3.9-1.63Z"/></svg>');
		}
		&.error:after {
			content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path fill="currentColor" d="M13 2v2c4.39.54 7.5 4.53 6.96 8.92A8.014 8.014 0 0 1 13 19.88v2c5.5-.6 9.45-5.54 8.85-11.03C21.33 6.19 17.66 2.5 13 2m-2 0c-1.96.18-3.81.95-5.33 2.2L7.1 5.74c1.12-.9 2.47-1.48 3.9-1.68v-2M4.26 5.67A9.81 9.81 0 0 0 2.05 11h2c.19-1.42.75-2.77 1.64-3.9L4.26 5.67M2.06 13c.2 1.96.97 3.81 2.21 5.33l1.42-1.43A8.002 8.002 0 0 1 4.06 13h-2m5 5.37l-1.39 1.37A9.994 9.994 0 0 0 11 22v-2a8.002 8.002 0 0 1-3.9-1.63h-.04M13 13V7h-2v6h2m0 4v-2h-2v2h2Z"/></svg>');
		}

		/* ┌─────────────────╮
		 * |Button Sizes     |
		 * └─────────────────╯*/

		/* Small buttons. */
		/* We calculate how much vertical padding space is left after using line height and border: */
		&.small {
			min-height: var(--input-small); padding: calc((var(--input-small) - 1lh) / 2 - var(--border-width)) calc(var(--input-small) / 2)
		}

		/* Big buttons . */
		&.big:not(.wt) {
			height: var(--input-big); padding: calc((var(--input-big) - 1lh) / 2 - var(--border-width)) calc(var(--input-big))
		}

		/* Huge buttons */
		&.huge:not(.wt) {
			height: var(--input-huge); padding: calc((var(--input-huge) - 1lh) / 2 - var(--border-width)) calc(var(--input-huge))
		}
	}

	/* ┌─────────────────╮
	 * |Input Sizes      |
	 * └─────────────────╯*/
	:is(button, .button, .btn, input, select).small {
		height: var(--input-small); /* Needed for <select> to get it to shrink its height. */
	}

	:is(input:not([type=checkbox],[type=file],[type=hidden],[type=image],[type=radio],[type=range],[type=button],[type=reset],[type=submit]),
		.input, select, textarea) {

		&.small {  min-height: var(--input-small); padding: calc((var(--input-small) - 1lh) / 2 - var(--border-width)) calc(var(--input-small) / 4) }
		&.big { min-height: var(--input-big); padding: calc((var(--input-big) - 1lh) / 2 - var(--border-width)) calc(var(--input-big) / 3) }
		&.huge { min-height: var(--input-huge); padding: calc((var(--input-huge) - 1lh) / 2 - var(--border-width)) calc(var(--input-huge) / 3) }
	}


	/* ┌─────────────────╮
	 * |Flat             |
	 * └─────────────────╯*/
	/* Flat Buttons + Inputs have no bg, border, or padding.  Good for toolbars. */
	:is(input:not([type=checkbox],[type=file],[type=hidden],[type=image],[type=radio],[type=range]),
		.input, select, textarea, button, .button, .btn).flat {
		border: var(--border-width) solid transparent; background: transparent;
	}
	:is(input:not([type=checkbox],[type=file],[type=hidden],[type=image],[type=radio],[type=range],[type=button],[type=reset],[type=submit]),
		.input, select, textarea, button, .button, .btn).flat:is(:focus-visible,.focus) {
		outline: var(--border-focus)
	}

	:is(button, .button, .btn, [type=button],[type=reset],[type=submit]):not([disabled]).flat:is(.selected, :hover) {
		border: var(--border-width) solid var(--secondary-background-hover); background: var(--secondary-background-hover);
		color: var(--invert)
	}
	.input:focus-within :focus-within { outline: none !important }

	/* ┌─────────────────╮
	 * |Grouped          |
	 * └─────────────────╯*/
	/* Grouped inputs + buttons share borders */
	.group > :is(:not(:first-child), .group-left),
	.group > :is(:not(:first-child), .group-left) :is(input, .input, select, textarea, button, .btn),
	.group > input[type=checkbox]:is(.normal,.big,.huge):is(:not(:first-child), .group-left):before,
	.group > :is(:not(:first-child), .group-left) input[type=checkbox]:is(.normal,.big,.huge):before {
		margin-left: -1px; border-top-left-radius: 0 !important; border-bottom-left-radius: 0 !important;
	}
	.group > :is(:not(:last-child), .group-right),
	.group > :is(:not(:last-child), .group-right) :is(input, .input, select, textarea, button, .btn),
	.group > input[type=checkbox]:is(.normal,.big,.huge):is(:not(:last-child), .group-right):before,
	.group > :is(:not(:last-child), .group-right) input[type=checkbox]:is(.normal,.big,.huge):before {
		border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important;
	}

	/* ┌─────────────────╮
	 * |Checkboxes       |
	 * └─────────────────╯*/
	/* Allow us to customize the border on checkboxes when they're invalid. */
	[type=checkbox] { 
		appearance:none; outline: none; content: none; margin: 0; vertical-align: text-top;
		&:before { content: "✓"; box-sizing: border-box;
			align-items: center; justify-content: center; color: transparent; background: var(--input-background);
			display: inline-flex; width: .9rem; height: .9rem; font: bold .75rem Arial; line-height: 0;}
		&:not(.flat,.square):before { border-radius: var(--border-radius) }
		&:not(.flat):before { border: var(--border-width) solid var(--input-border) }
		&:not(.noOutline):is(:focus-visible,.focus):before { outline: var(--border-focus); outline-offset: -1px; z-index: 2; position: relative } /* relative needed for z-index to work */
	
		/* Checkbox gets primary style when checked. */
		&:checked:before { color: white; background: var(--primary-background) }
		&:checked:is(:focus-visible,.focus):before { outline: var(--border-width) solid var(--primary-border-focus) }
	
		/* Various sizes of checkboxes */
		&.small:before {
			width: var(--input-small);
			height: var(--input-small);
			font-size: calc(var(--input-small) * .75) }
		&.normal:before {
			width: var(--input-normal);
			height: var(--input-normal);
			font-size: calc(var(--input-normal) * .75) }
		&.big:before {
			width: var(--input-big);
			height: var(--input-big);
			font-size: calc(var(--input-big) * .75) }
		&.huge:before {
			width: var(--input-huge);
			height: var(--input-huge);
			font-size: calc(var(--input-huge) * .75) }
	}	

	/* ┌─────────────────╮
	 * |Data table       |
	 * └─────────────────╯*/
	/* One border around the whole table, and then right and bottom borders on each cell that's not the last in the row/column. */
	.data-table { 
		border-collapse: collapse; background: var(--table-background); border: var(--table-border); font-size: inherit;
		
		:is(thead,.thead,tfoot,.tfoot) { background: var(--table-header-background) }
		:is(th,.th) { padding: var(--table-padding); border-bottom: var(--table-border);
			text-align: left; user-select: none; font-weight: 500; white-space: nowrap }
		:is(thead,.thead) :is(th,.th) { vertical-align: bottom } /* column headers */
		:is(tbody,.tbody,tfoot,.tfoot) :is(th,.th) { vertical-align: top } /* row headers, footer */

		:is(td,.td) { padding: var(--table-padding) }
		:is(th,.th,td,.td):not(:last-child) { border-right: var(--table-border) }
		:is(tr,.tr):not(:last-child) :is(td,.td) { border-bottom: var(--table-border) }
	}

	/* ┌─────────────────╮
	 * |Experimental     |
	 * └─────────────────╯*/
	/* These may change in the future. */

	/* drop-menu */
	/* A menu with expandable sub-items. */
	.drop-menu ul {
		list-style: none; margin: 0; padding: 0;
		&:not(:hover) ul { transition: visibility 0s; transition-delay: .6s }
		&:hover > ul:not(:hover) { transition: visibility 0s; transition-delay: 0s; display: none }
		a { display: block }
		li { position: relative }
		ul { visibility: hidden; position: absolute; top: 100%; left: 0; z-index: 1 }
		ul ul { top: 0; left: 100% }
		li:hover > ul { visibility: visible; transition-delay: 0s }
	}
}











/* ┌─────────────────╮
 * |Grid             |
 * └─────────────────╯*/
:is(.eternium, .eternium-layout) {

	/* Dimensions */
	--micro: .125rem;
	--tiny: .25rem;
	--small: .5rem;
	--normal: 1rem;
	--big: 1.5rem;
	--huge: 3rem;
	
	/* Rows and column layout.  These can occor on the same element with :is(.eternium, .eternium-forms)
	 * Unlike bootstrap, a col class will stack each of its children into a column,
	 * and having a col class for each item in a row isn't necessary.*/
	.row { display: flex; align-items: start }  /* align-items: start prevents stretching to available height */
	.col { display: flex; flex-direction: column; align-items: start }

	/* Gaps */
	.gap-micro { gap: var(--micro) }
	.gap-tiny { gap: var(--tiny) }
	.gap-small { gap: var(--small) }
	.gap { gap: var(--normal) }
	.gap-big { gap: var(--big) }
	.gap-huge { gap: var(--huge) }



	/* Pad */
	/* We need :not(#wt) to override the css weight of input pad-left and pad-right above.*/
	:not(#wt).pad-micro { padding: var(--micro) }
	:not(#wt).pad-tiny { padding: var(--tiny) }
	:not(#wt).pad-small { padding: var(--small) }
	:not(#wt).pad { padding: var(--normal) }
	:not(#wt).pad-big { padding: var(--big) }
	:not(#wt).pad-huge { padding: var(--huge) }

	:not(#wt).pad-h-tiny { padding-left: var(--tiny); padding-right: var(--tiny) }
	:not(#wt).pad-h-small { padding-left: var(--small); padding-right: var(--small) }
	:not(#wt).pad-h { padding-left: var(--normal); padding-right: var(--normal) }
	:not(#wt).pad-h-big { padding-left: var(--big); padding-right: var(--big) }
	:not(#wt).pad-h-huge { padding-left: var(--huge); padding-right: var(--huge) }

	:not(#wt).pad-v-tiny { padding-top: var(--tiny); padding-bottom: var(--tiny) }
	:not(#wt).pad-v-small { padding-top: var(--small); padding-bottom: var(--small) }
	:not(#wt).pad-v { padding-top: var(--normal); padding-bottom: var(--normal) }
	:not(#wt).pad-v-big { padding-top: var(--big); padding-bottom: var(--big) }
	:not(#wt).pad-v-huge { padding-top: var(--huge); padding-bottom: var(--huge) }

	/* Alignment */
	.row:is(.center, .center-h) { justify-content: center }
	.col:is(.center, .center-h) { align-items: center }

	.row:is(.center, .center-v) { align-items: center }
	.col:is(.center, .center-v) { justify-content: center }

	.row.left { justify-content: start }
	.col.left { align-items: start }

	.row.right { justify-content: end }
	.col.right { align-items: end }

	.row.top { align-items: start }
	.col.top { justify-content: start }

	.row.bottom { align-items: end }
	.col.bottom { justify-content: end }

	:is(.row,.col).stretch { align-items: stretch }
	:is(.row,.col).stretch > * { flex: 1 }

	.row.stretch-h > * { flex: 1 }
	.row.stretch-v { align-items: stretch }

	.col.stretch-h { align-items: stretch }
	.col.stretch-v  > * { flex: 1 }

	/* Spacing */
	.space-between { justify-content: space-between }
	.space-around { justify-content: space-around }
	.space-evenly { justify-content: space-evenly }

	/* Wrap */
	.wrap { flex-wrap: wrap }
	.nowrap { flex-wrap: nowrap; white-space: nowrap }

	/* Labels */
	.label { font-size :85%; font-weight: bold; user-select: none }


	/* ┌─────────────────╮
	 * |Dimensions       |
	 * └─────────────────╯*/

	/* Fixed */
	.rem1 { width: clamp(1rem, 1rem, 1rem) }
	.rem2 { width: clamp(2rem, 2rem, 2rem) }
	.rem3 { width: clamp(3rem, 3rem, 3rem) }
	.rem4 { width: clamp(4rem, 4rem, 4rem) }
	.rem5 { width: clamp(5rem, 5rem, 5rem) }
	.rem6 { width: clamp(6rem, 6rem, 6rem) }
	.rem7 { width: clamp(7rem, 7rem, 7rem) }
	.rem8 { width: clamp(8rem, 8rem, 8rem) }
	.rem9 { width: clamp(9rem, 9rem, 9rem) }
	.rem10 { width: clamp(10rem, 10rem, 10rem) }
	.rem11 { width: clamp(11rem, 11rem, 11rem) }
	.rem12 { width: clamp(12rem, 12rem, 12rem) }
	.rem13 { width: clamp(13rem, 13rem, 13rem) }
	.rem14 { width: clamp(14rem, 14rem, 14rem) }
	.rem15 { width: clamp(15rem, 15rem, 15rem) }
	.rem16 { width: clamp(16rem, 16rem, 16rem) }

	/* Percents in thirds, fourths, and tenths. */
	.pc10 { width: 10% }
	.pc20 { width: 20% }
	.pc25 { width: 25% }
	.pc30 { width: 25% }
	.pc33 { width: 33.333% }
	.pc40 { width: 40% }
	.pc50 { width: 50% }
	.pc60 { width: 60% }
	.pc66 { width: 66.666% }
	.pc70 { width: 70% }
	.pc75 { width: 70% }
	.pc80 { width: 80% }
	.pc90 { width: 90% }
	.pc100 { width: 100% }

	/* Flex */
	:is(.expand, .flex1) { flex: 1 }
	.flex2 { flex: 2 }
	.flex3 { flex: 3 }
	.flex4 { flex: 4 }
	.flex5 { flex: 5 }
	.flex6 { flex: 6 }
	.flex7 { flex: 7 }
	.flex8 { flex: 8 }
	.flex9 { flex: 9 }
	.flex10 { flex: 10 }
	.flex11 { flex: 11 }
	.flex12 { flex: 12 }
}


/* ┌─────────────────╮
 * |Grid Mobile      |
 * └─────────────────╯*/
@media (width < 768px) {

	:is(.eternium, .eternium-layout) {


		/* Row/Col */
		.row-mobile { display: flex; flex-direction: row; align-items: start; justify-content: start }
		.col-mobile { display: flex; flex-direction: column; align-items: start; justify-content: start }

		/* Gaps */
		.gap-tiny-mobile { gap: var(--micro) }
		.gap-small-mobile { gap: var(--small) }
		.gap-mobile { gap: var(--normal) }
		.gap-big-mobile { gap: var(--big) }
		.gap-huge-mobile { gap: var(--huge) }

		/* Pad */
		:not(#wt).pad-tiny-mobile { padding: var(--micro) }
		:not(#wt).pad-small-mobile { padding: var(--small) }
		:not(#wt).pad-mobile { padding: var(--normal) }
		:not(#wt).pad-big-mobile { padding: var(--big) }
		:not(#wt).pad-huge-mobile { padding: var(--huge) }

		:not(#wt).pad-h-tiny-mobile { padding-left: var(--tiny); padding-right: var(--tiny) }
		:not(#wt).pad-h-small-mobile { padding-left: var(--small); padding-right: var(--small) }
		:not(#wt).pad-h-mobile { padding-left: var(--normal); padding-right: var(--normal) }
		:not(#wt).pad-h-big-mobile { padding-left: var(--big); padding-right: var(--big) }
		:not(#wt).pad-h-huge-mobile { padding-left: var(--huge); padding-right: var(--huge) }

		:not(#wt).pad-v-tiny-mobile { padding-top: var(--tiny); padding-bottom: var(--tiny) }
		:not(#wt).pad-v-small-mobile { padding-top: var(--small); padding-bottom: var(--small) }
		:not(#wt).pad-v-mobile { padding-top: var(--normal); padding-bottom: var(--normal) }
		:not(#wt).pad-v-big-mobile { padding-top: var(--big); padding-bottom: var(--big) }
		:not(#wt).pad-v-huge-mobile { padding-top: var(--huge); padding-bottom: var(--huge) }

		/* Alignment */
		.row-mobile:is(.center-mobile, .center-h-mobile) { justify-content: center }
		.col-mobile:is(.center-mobile, .center-h-mobile) { align-items: center }

		.row-mobile:is(.center-mobile, .center-v-mobile) { align-items: center }
		.col-mobile:is(.center-mobile, .center-v-mobile) { justify-content: center }

		.row-mobile.left-mobile { justify-content: start }
		.col-mobile.left-mobile { align-items: start }

		.row-mobile.right-mobile { justify-content: end }
		.col-mobile.right-mobile { align-items: end }

		.row-mobile.top-mobile { align-items: start }
		.col-mobile.top-mobile { justify-content: start }

		.row-mobile.bottom-mobile { align-items: end }
		.col-mobile.bottom-mobile { justify-content: end }

		:is(.row-mobile,.col-mobile).stretch-mobile { align-items: stretch }
		:is(.row-mobile,.col-mobile).stretch-mobile > * { flex: 1 }

		.row-mobile.stretch-h-mobile > * { flex: 1 }
		.row-mobile.stretch-v-mobile { align-items: stretch }

		.col-mobile.stretch-h-mobile { align-items: stretch }
		.col-mobile.stretch-v-mobile > * { flex: 1 }

		/* Spacing */
		/* We use :not(.wt) so this can override .col.center w/ a selector weight of 3 above. */
		.space-between-mobile:not(.wt) { justify-content: space-between }
		.space-around-mobile:not(.wt) { justify-content: space-around }
		.space-evenly-mobile:not(.wt) { justify-content: space-evenly }

		/* Wrap */
		.wrap-mobile { flex-wrap: wrap }
		.nowrap-mobile { flex-wrap: nowrap; white-space: nowrap }




		/* ┌─────────────────╮
		 * |Dimensions       |
		 * └─────────────────╯*/

		/* Fixed */
		.rem1-mobile { width: clamp(1rem, 1rem, 1rem) }
		.rem2-mobile { width: clamp(2rem, 2rem, 2rem) }
		.rem3-mobile { width: clamp(3rem, 3rem, 3rem) }
		.rem4-mobile { width: clamp(4rem, 4rem, 4rem) }
		.rem5-mobile { width: clamp(5rem, 5rem, 5rem) }
		.rem6-mobile { width: clamp(6rem, 6rem, 6rem) }
		.rem7-mobile { width: clamp(7rem, 7rem, 7rem) }
		.rem8-mobile { width: clamp(8rem, 8rem, 8rem) }
		.rem9-mobile { width: clamp(9rem, 9rem, 9rem) }
		.rem10-mobile { width: clamp(10rem, 10rem, 10rem) }
		.rem11-mobile { width: clamp(11rem, 11rem, 11rem) }
		.rem12-mobile { width: clamp(12rem, 12rem, 12rem) }
		.rem13-mobile { width: clamp(13rem, 13rem, 13rem) }
		.rem14-mobile { width: clamp(14rem, 14rem, 14rem) }
		.rem15-mobile { width: clamp(15rem, 15rem, 15rem) }
		.rem16-mobile { width: clamp(16rem, 16rem, 16rem) }


		/* Percents in thirds, fourths, and tenths. */
		.pc10-mobile { width: 10% }
		.pc20-mobile { width: 20% }
		.pc25-mobile { width: 25% }
		.pc30-mobile { width: 25% }
		.pc33-mobile { width: 33.333% }
		.pc40-mobile { width: 40% }
		.pc50-mobile { width: 50% }
		.pc60-mobile { width: 60% }
		.pc66-mobile { width: 66.666% }
		.pc70-mobile { width: 70% }
		.pc75-mobile { width: 70% }
		.pc80-mobile { width: 80% }
		.pc90-mobile { width: 90% }
		.pc100-mobile { width: 100% }

		/* Flex */
		.flex1-mobile { flex: 1 }
		.flex2-mobile { flex: 2 }
		.flex3-mobile { flex: 3 }
		.flex4-mobile { flex: 4 }
		.flex5-mobile { flex: 5 }
		.flex6-mobile { flex: 6 }
		.flex7-mobile { flex: 7 }
		.flex8-mobile { flex: 8 }
		.flex9-mobile { flex: 9 }
		.flex10-mobile { flex: 10 }
		.flex11-mobile { flex: 11 }
		.flex12-mobile { flex: 12 }
	}
}

/* ┌─────────────────╮
 * |Grid Tablet      |
 * └─────────────────╯*/
@media (768px <= width < 992px) {

	:is(.eternium, .eternium-layout) {

		/* Row/Col */
		.row-tablet { display: flex; flex-direction: row; align-items: start; justify-content: start }
		.col-tablet { display: flex; flex-direction: column; align-items: start; justify-content: start }

		/* Gaps */
		.gap-tiny-tablet { gap: var(--micro) }
		.gap-small-tablet { gap: var(--small) }
		.gap-tablet { gap: var(--normal) }
		.gap-big-tablet { gap: var(--big) }
		.gap-huge-tablet { gap: var(--huge) }

		/* Pad */
		:not(#wt).pad-tiny-tablet { padding: var(--micro) }
		:not(#wt).pad-small-tablet { padding: var(--small) }
		:not(#wt).pad-tablet { padding: var(--normal) }
		:not(#wt).pad-big-tablet { padding: var(--big) }
		:not(#wt).pad-huge-tablet { padding: var(--huge) }

		:not(#wt).pad-h-tiny-tablet { padding-left: var(--tiny); padding-right: var(--tiny) }
		:not(#wt).pad-h-small-tablet { padding-left: var(--small); padding-right: var(--small) }
		:not(#wt).pad-h-tablet { padding-left: var(--normal); padding-right: var(--normal) }
		:not(#wt).pad-h-big-tablet { padding-left: var(--big); padding-right: var(--big) }
		:not(#wt).pad-h-huge-tablet { padding-left: var(--huge); padding-right: var(--huge) }

		:not(#wt).pad-v-tiny-tablet { padding-top: var(--tiny); padding-bottom: var(--tiny) }
		:not(#wt).pad-v-small-tablet { padding-top: var(--small); padding-bottom: var(--small) }
		:not(#wt).pad-v-tablet { padding-top: var(--normal); padding-bottom: var(--normal) }
		:not(#wt).pad-v-big-tablet { padding-top: var(--big); padding-bottom: var(--big) }
		:not(#wt).pad-v-huge-tablet { padding-top: var(--huge); padding-bottom: var(--huge) }

		/* Alignment */
		.row-tablet:is(.center-tablet, .center-h-tablet) { justify-content: center }
		.col-tablet:is(.center-tablet, .center-h-tablet) { align-items: center }

		.row-tablet:is(.center-tablet, .center-v-tablet) { align-items: center }
		.col-tablet:is(.center-tablet, .center-v-tablet) { justify-content: center }

		.row-tablet.left-tablet { justify-content: start }
		.col-tablet.left-tablet { align-items: start }

		.row-tablet.right-tablet { justify-content: end }
		.col-tablet.right-tablet { align-items: end }

		.row-tablet.top-tablet { align-items: start }
		.col-tablet.top-tablet { justify-content: start }

		.row-tablet.bottom-tablet { align-items: end }
		.col-tablet.bottom-tablet { justify-content: end }

		:is(.row-tablet,.col-tablet).stretch-tablet { align-items: stretch }
		:is(.row-tablet,.col-tablet).stretch-tablet > * { flex: 1 }

		.row-tablet.stretch-h-tablet > * { flex: 1 }
		.row-tablet.stretch-v-tablet { align-items: stretch }

		.col-tablet.stretch-h-tablet { align-items: stretch }
		.col-tablet.stretch-v-tablet > * { flex: 1 }

		/* Spacing */
		/* We use :not(.wt) so this can override .col.center w/ a selector weight of 3 above. */
		.space-between-tablet:not(.wt) { justify-content: space-between }
		.space-around-tablet:not(.wt) { justify-content: space-around }
		.space-evenly-tablet:not(.wt) { justify-content: space-evenly }

		/* Wrap */
		.wrap-tablet { flex-wrap: wrap }
		.nowrap-tablet { flex-wrap: nowrap; white-space: nowrap }


		/* ┌─────────────────╮
		 * |Dimensions       |
		 * └─────────────────╯*/

		/* Fixed */
		.rem1-tablet { width: clamp(1rem, 1rem, 1rem) }
		.rem2-tablet { width: clamp(2rem, 2rem, 2rem) }
		.rem3-tablet { width: clamp(3rem, 3rem, 3rem) }
		.rem4-tablet { width: clamp(4rem, 4rem, 4rem) }
		.rem5-tablet { width: clamp(5rem, 5rem, 5rem) }
		.rem6-tablet { width: clamp(6rem, 6rem, 6rem) }
		.rem7-tablet { width: clamp(7rem, 7rem, 7rem) }
		.rem8-tablet { width: clamp(8rem, 8rem, 8rem) }
		.rem9-tablet { width: clamp(9rem, 9rem, 9rem) }
		.rem10-tablet { width: clamp(10rem, 10rem, 10rem) }
		.rem11-tablet { width: clamp(11rem, 11rem, 11rem) }
		.rem12-tablet { width: clamp(12rem, 12rem, 12rem) }
		.rem13-tablet { width: clamp(13rem, 13rem, 13rem) }
		.rem14-tablet { width: clamp(14rem, 14rem, 14rem) }
		.rem15-tablet { width: clamp(15rem, 15rem, 15rem) }
		.rem16-tablet { width: clamp(16rem, 16rem, 16rem) }

		/* Percents in thirds, fourths, and tenths. */
		.pc10-tablet { width: 10% }
		.pc20-tablet { width: 20% }
		.pc25-tablet { width: 25% }
		.pc30-tablet { width: 25% }
		.pc33-tablet { width: 33.333% }
		.pc40-tablet { width: 40% }
		.pc50-tablet { width: 50% }
		.pc60-tablet { width: 60% }
		.pc66-tablet { width: 66.666% }
		.pc70-tablet { width: 70% }
		.pc75-tablet { width: 70% }
		.pc80-tablet { width: 80% }
		.pc90-tablet { width: 90% }
		.pc100-tablet { width: 100% }

		/* Flex */
		.flex1-tablet { flex: 1 }
		.flex2-tablet { flex: 2 }
		.flex3-tablet { flex: 3 }
		.flex4-tablet { flex: 4 }
		.flex5-tablet { flex: 5 }
		.flex6-tablet { flex: 6 }
		.flex7-tablet { flex: 7 }
		.flex8-tablet { flex: 8 }
		.flex9-tablet { flex: 9 }
		.flex10-tablet { flex: 10 }
		.flex11-tablet { flex: 11 }
		.flex12-tablet { flex: 12 }
	}	
}

/* ┌─────────────────╮
 * |Grid Desktop+    |
 * └─────────────────╯*/
@media (992px <= width) {

	:is(.eternium, .eternium-layout) {

		/* Row/Col */
		.row-desktop { display: flex; flex-direction: row; align-items: start; justify-content: start }
		.col-desktop { display: flex; flex-direction: column; align-items: start; justify-content: start }
	
		/* Gaps */
		.gap-tiny-desktop { gap: var(--micro) }
		.gap-small-desktop { gap: var(--small) }
		.gap-desktop { gap: var(--normal) }
		.gap-big-desktop { gap: var(--big) }
		.gap-huge-desktop { gap: var(--huge) }
	
		/* Pad */
		:not(#wt).pad-tiny-desktop { padding: var(--micro) }
		:not(#wt).pad-small-desktop { padding: var(--small) }
		:not(#wt).pad-desktop { padding: var(--normal) }
		:not(#wt).pad-big-desktop { padding: var(--big) }
		:not(#wt).pad-huge-desktop { padding: var(--huge) }
	
		:not(#wt).pad-h-tiny-desktop { padding-left: var(--tiny); padding-right: var(--tiny) }
		:not(#wt).pad-h-small-desktop { padding-left: var(--small); padding-right: var(--small) }
		:not(#wt).pad-h-desktop { padding-left: var(--normal); padding-right: var(--normal) }
		:not(#wt).pad-h-big-desktop { padding-left: var(--big); padding-right: var(--big) }
		:not(#wt).pad-h-huge-desktop { padding-left: var(--huge); padding-right: var(--huge) }
	
		:not(#wt).pad-v-tiny-desktop { padding-top: var(--tiny); padding-bottom: var(--tiny) }
		:not(#wt).pad-v-small-desktop { padding-top: var(--small); padding-bottom: var(--small) }
		:not(#wt).pad-v-desktop { padding-top: var(--normal); padding-bottom: var(--normal) }
		:not(#wt).pad-v-big-desktop { padding-top: var(--big); padding-bottom: var(--big) }
		:not(#wt).pad-v-huge-desktop { padding-top: var(--huge); padding-bottom: var(--huge) }
	
		/* Alignment */
		.row-desktop:is(.center-desktop, .center-h-desktop) { justify-content: center }
		.col-desktop:is(.center-desktop, .center-h-desktop) { align-items: center }
	
		.row-desktop:is(.center-desktop, .center-v-desktop) { align-items: center }
		.col-desktop:is(.center-desktop, .center-v-desktop) { justify-content: center }
	
		.row-desktop.left-desktop { justify-content: start }
		.col-desktop.left-desktop { align-items: start }
	
		.row-desktop.right-desktop { justify-content: end }
		.col-desktop.right-desktop { align-items: end }
	
		.row-desktop.top-desktop { align-items: start }
		.col-desktop.top-desktop { justify-content: start }
	
		.row-desktop.bottom-desktop { align-items: end }
		.col-desktop.bottom-desktop { justify-content: end }
	
		:is(.row-desktop,.col-desktop).stretch-desktop { align-items: stretch }
		:is(.row-desktop,.col-desktop).stretch-desktop > * { flex: 1 }
	
		.row-desktop.stretch-h-desktop > * { flex: 1 }
		.row-desktop.stretch-v-desktop { align-items: stretch }
	
		.col-desktop.stretch-h-desktop { align-items: stretch }
		.col-desktop.stretch-v-desktop > * { flex: 1 }
	
		/* Spacing */
		/* We use .sel-weight so this can override .col.center w/ a selector weight of 3 above. */
		.space-between-desktop:not(.wt) { justify-content: space-between }
		.space-around-desktop:not(.wt) { justify-content: space-around }
		.space-evenly-desktop:not(.wt) { justify-content: space-evenly }
	
		/* Wrap */
		.wrap-desktop { flex-wrap: wrap }
		.nowrap-desktop { flex-wrap: nowrap; white-space: nowrap }


		/* ┌─────────────────╮
		 * |Dimensions       |
		 * └─────────────────╯*/

		/* Fixed */
		.rem1-desktop { width: clamp(1rem, 1rem, 1rem) }
		.rem2-desktop { width: clamp(2rem, 2rem, 2rem) }
		.rem3-desktop { width: clamp(3rem, 3rem, 3rem) }
		.rem4-desktop { width: clamp(4rem, 4rem, 4rem) }
		.rem5-desktop { width: clamp(5rem, 5rem, 5rem) }
		.rem6-desktop { width: clamp(6rem, 6rem, 6rem) }
		.rem7-desktop { width: clamp(7rem, 7rem, 7rem) }
		.rem8-desktop { width: clamp(8rem, 8rem, 8rem) }
		.rem9-desktop { width: clamp(9rem, 9rem, 9rem) }
		.rem10-desktop { width: clamp(10rem, 10rem, 10rem) }
		.rem11-desktop { width: clamp(11rem, 11rem, 11rem) }
		.rem12-desktop { width: clamp(12rem, 12rem, 12rem) }
		.rem13-desktop { width: clamp(13rem, 13rem, 13rem) }
		.rem14-desktop { width: clamp(14rem, 14rem, 14rem) }
		.rem15-desktop { width: clamp(15rem, 15rem, 15rem) }
		.rem16-desktop { width: clamp(16rem, 16rem, 16rem) }

		/* Percents in thirds, fourths, and tenths. */
		.pc10-desktop { width: 10% }
		.pc20-desktop { width: 20% }
		.pc25-desktop { width: 25% }
		.pc30-desktop { width: 25% }
		.pc33-desktop { width: 33.333% }
		.pc40-desktop { width: 40% }
		.pc50-desktop { width: 50% }
		.pc60-desktop { width: 60% }
		.pc66-desktop { width: 66.666% }
		.pc70-desktop { width: 70% }
		.pc75-desktop { width: 70% }
		.pc80-desktop { width: 80% }
		.pc90-desktop { width: 90% }
		.pc100-desktop { width: 100% }

		/* Flex */
		.flex1-desktop { flex: 1 }
		.flex2-desktop { flex: 2 }
		.flex3-desktop { flex: 3 }
		.flex4-desktop { flex: 4 }
		.flex5-desktop { flex: 5 }
		.flex6-desktop { flex: 6 }
		.flex7-desktop { flex: 7 }
		.flex8-desktop { flex: 8 }
		.flex9-desktop { flex: 9 }
		.flex10-desktop { flex: 10 }
		.flex11-desktop { flex: 11 }
		.flex12-desktop { flex: 12 }
	}
}

/* ┌─────────────────╮
 * |Grid Misc        |
 * └─────────────────╯*/
:is(.eternium, .eternium-layout) .col hr { width: 100% }

/* Show only for specific sizes. */
/* TODO: Use this method for other -desktop and -mobile styles above?  Having that will override the default style only for that size. */
@media (width < 768px) {
	:is(.tablet, .desktop):not(.mobile) { display: none !important }
}
@media (768px <= width < 992px) {
	:is(.mobile, .desktop):not(.tablet) { display: none !important }
}
@media (992px <= width) {
	:is(.mobile, .tablet):not(.desktop) { display: none !important }
}


/* ┌─────────────────╮
 * |Deprecated       |
 * └─────────────────╯*/
/* These are deprecated, use pad-h and pad-v */
:is(.eternium, .eternium-forms) .pad-tiny-small, :is(.eternium, .eternium-forms).pad-tiny-small { padding: var(--tiny) var(--small) }
:is(.eternium, .eternium-forms) .pad-small-normal, :is(.eternium, .eternium-forms).pad-small-normal { padding: var(--small) var(--normal) }

:is(.eternium, .eternium-forms) :is(small, :is(a,b,i,s,p,u,span,div,ul,ol,li,.label):not([contenteditable]).small) {
	font-size: 80%; opacity: .65; line-height: 1.1 } /* .small is deprecated for .little and .muted */