@font-face {
	font-family: 'mspm';
	src: url("./short3.otf?j");
}

o-l {
	text-decoration: overline;
	//text-decoration: underline;
	//text-underline-offset: -0.6em;
}
s-t::after, track::after {
	content: " ";
	white-space: pre-wrap;
	user-select: text;
}
abbr {
	font-variant: small-caps;
	//text-transform: lowercase;
	font-variant-numeric: oldstyle-nums;
}
n-d { /* number-data */
	font-variant: lining-nums tabular-nums;
}
bit-field {
	font-family: monospace;
	word-spacing: -0.5ch;
}
/*bit-field::before {
	content: "[";
	font-family: mspm, serif;
}just type this manually so it's selectable*/

body {
	margin-bottom: 100px;
	font-family: /*georgia,*/ serif;
	font-family: mspm, serif;
	/*font-variant-numeric: oldstyle-nums;*/
	/*text-shadow: white 1px 0px, white -1px 0px, white 0px -1px, white 0px 1px; i wish*/
}
:root {
	image-rendering: crisp-edges;
	background-color: #E4E6E4;
	background-image: url("./tile32.png");
	background-size: 116px;
	background-size: calc(116px * var(--RX,1) / var(--X,1));
	overflow-y: scroll;
	-webkit-text-size-adjust: none;
}
/* body children */
p, dl, .f3-struct, ol, ul {
	//background: #DEE1DEAA;
	max-width: 7in;
	//text-align: justify;
	margin-left: 8px;
}
h1, h2, h3, th {
	font-family: serif;
}
body > h1 {
	background: beige;
	margin: 12px -8px 21px;
	padding: 8px 8px;
	box-shadow: 0 0 5px black;
	color: #E21;
}
body > h1 img + span {
	display: inline-block;
	vertical-align: middle;
}
body > h1 img {
	margin-right: 10px;
	vertical-align: middle;
}
:target {
	text-decoration: underline blue;
}

table {
	//font-family: serif;
	font-variant-numeric: lining-nums tabular-nums;
}

figure {
	//margin: 16px 24px 0px 32px;
	margin: 16px 8px 0px 16px;
}
figure > table.pinout {
	display: inline-table;
	margin-right: 8px;
	margin-bottom: 16px;
	vertical-align: top;
}

table.port {
	table-layout: fixed;
	font-size: 12px;
	border: 1px solid;
	background: beige;
}
.port td {
	border: 1px solid;
}
.port tr>* {
	height: 40px;
	text-align: center;
}
.port th, .port td {
	box-sizing:border-box;
	width: 40px;
	max-width: 40px;
	min-width: 40px;
	//word-wrap: break-word;
	line-height: 1;
	padding: 0.5px;
}
.port .numbers th {
	height: 1em;
	font-family: courier;
}
.port .narrow td {
	
}
.port .gap {
	border: none;
}

table.pinout {
	border: 2px solid transparent;
	border-width: 0px 2px;
	background: beige;
	box-shadow: 0 0 1px #0008;
}
/* pin desc */
.pinout td {
	border: 1px solid;
	padding: 0 4px;
	text-align: left;
}
/* pin number */
.pinout th {
	min-width: 3ch;
	text-align: center;
	font-family: courier;
}
/* pin i/o/pwr designation */
.pinout th + th {
	font-family: unset;
	font-weight: unset;
	padding: 0 3px;
}
.pinout .vcc, .pinout  .gnd {
	border: none;
}

/* pin desc grouping's gap marker */
.cont1.cont1 { border-bottom-style: dashed !important; border-bottom-right-radius: 0; }
.cont2.cont2 { border-top-style: dashed !important; border-top-right-radius: 0; }
/* pin desc grouping */
.pinout td + td {
	border-left: none;
	border-radius: 0 10px 10px 0;
}

.vcc {
	/*border-color: transparent;*/
	background-color: white;
	color: maroon;
}
.gnd {
	background-color: white;
	color: green;
}

.nc {
	background-color: silver;
	color: gray;
}

.portlabel {
	font-size: 2em;
	border: 6px double;
	min-width: 28px;
	padding: 0 2px;
	display: inline-block;
	height: 32px;
	line-height: 32px;
	text-align: center;
	font-family: courier;
	font-weight: normal;
	background: black;
	color: white;
}

.memory-map  {
	table-layout: fixed;
	line-height: 1;
	background: #CCC8;
	text-align: center;
}
.memory-map, .memory-map tr>* {
	border: 1px solid;
	border-collapse: collapse;
}
.memory-map th {
	font-family: monospace;
	background: beige;
	padding: 4px 1px;
}
.memory-map td {
}
.memory-map .mem-cutoff {
	border-style: dashed none dashed solid;
}
.memory-map .space {
	border: none !important;
	background: none !important;
}
.memory-map td[data-mirrors] {
	background-image: linear-gradient(to right, #8C8 calc(100% / var(--m)), #FFF 0);
	/background: repeating-linear-gradient(to right, white, #DEF calc(100% / var(--m)));
}
.memory-map td[data-registers] {
	background-image: linear-gradient(45deg, #8C8 5px, #FFF 0);
	background-origin: border-box;
}
.memory-map dl {
	margin: 0;
	display: grid;
	grid: auto-flow / max-content 1fr;
	margin-left: 3px;
}
.memory-map dt {
	margin: 0;
	grid-column: 1;
}
.memory-map dt::after {
	content: ' = ';
	white-space: pre;
}
.memory-map dd {
	margin: 0;
	grid-column: 2;
	text-align: left;
}
.struct td {
	padding: 1px 1px;
	vertical-align: top;
}
.struct td > b {
	font-size: 18px;
	font-weight: normal;
	text-decoration: underline;
	display: inline-block;
	margin-bottom: 2px;
}

/* "normal" tables */
.table {
	background: #CCC8;
	border-collapse: unset;
	border-spacing: 2px;
	/padding: 3px;
	border: none;
	/box-shadow: 0 0 1px #0008;
}
.table th {
	background: beige;
	padding: 2px 0.25em;
}
.table td {
	padding: 1px 0.25em;
	background: beige;
	border: none;
	/border: 1px solid #8888;
	/border-style: solid none none solid;
}
.table tr:first-child {
}
.table tr:first-child > th {
	border-radius: 5.5px 5.5px 0 0;
	border-bottom: none;
}
.table tr:not(:first-child) > th {
	border-radius: 5.5px 0 0 5.5px;
	border-right: none;
	background: beige;
	font-weight: normal;
	/font-style: italic;
	font-family: mspm, serif;
}
.table tr:first-child > th:first-child {
}

/* nicer sub/sup */
@supports (font-variant-position: sub) {
	sub, sup {
		font-size: unset;
		vertical-align: unset;
	}
	sub { font-variant-position: sub; }
	sup { font-variant-position: super; }
}
@supports not (font-variant-position: sub) {
	sub, sup {
		font-size: 81.25%;
		line-height: 0;
		position: relative;
		vertical-align: baseline;
	}
	sub { bottom: -0.25em; }
	sup { top: -0.5em; /* todo: check this */ }
}

/* todo markers */
todo {
	background-image: repeating-linear-gradient(135deg, white 0 5px, #FF8 0 10px);
	border: 1px solid black;
	border-radius: 4px;
	padding: 0 2px;
	white-space: pre-wrap;
}
todo::before {
	content: "TODO: ";
}

.sitemap {
	font-size: 1.25em;
}

var {
	/* hack until we get a proper italic font */
	font-style: italic;
	display: inline-block;
	margin-left: -0.0625em;
	margin-right: 0.0625em;
}


dl.bits > dt, table.bits td {
	font-family: mspm, times new roman;
	color: blue;
	text-shadow: 1px 0 white;
}
dl.bits.address > dt, table.bits.address td {
	font-family: mspm, times new roman;
	color: #080;
	text-shadow: 1px 0 white;
}
.f3-struct {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	margin-bottom: 1em;
	padding: 8px 8px 8px 16px;
	background: beige;
	box-shadow: 0 0 1px #0008;
}
.f3-struct h1 {
	margin: 0;
	font-size: 1.5em;
	margin-bottom: 0.5em;
	margin-left: -0.25em;
	margin-right: -8px;
	font-family: unset;
	
	display: block;
	/*align-self: stretch;*/
	margin-left: -16px;
	margin-top: -8px;
	padding: 4px 8px;
	background: #420;
	color: white;
	border: 6px double;
	/*font-family: serif;*/
}
.f3-struct h2 {
	font-size: 1.2em;
	margin: 0;
	font-family: unset;
}
.f3-struct dl dl {
	margin-left: 0;
	margin-top: 0;
	margin-bottom: 0;
}
.f3-struct dl dl dt {
	font-size: unset;
}
.f3-struct dl:not(:last-child) {
	margin-bottom: 0.25em; /*hack*/
}

dl {
	font-variant: tabular-nums;
	display: grid;
	grid: auto-flow / max-content 1fr;
}
dt {
	grid-column: 1 / 2;	
	justify-self: right;
}
dt::after {
	content: " ↦ ";
	white-space: pre;
}
dd {
	margin-left: 0;
	grid-column: 2 / 3;
}

dl[compact] {
	display: flex;
	flex-wrap: wrap;
}
dl[compact] > dd {
	margin: 0;
}
dl[compact] > dd:not(:last-child) {
	margin-right: 1em;
}
dl[compact] > dt {
	margin-right: 0em;
}
dl[compact] > dt::after {
	padding: 0 2px;
	content: "=";
}



dl.bits {
	display: grid;
	grid: auto-flow / max-content 1fr;
	margin-left: 1em;
	margin-top: 0.25em;
	margin-bottom: 0em;
}
dl.bits > * {
	align-self: baseline;
}
dl.bits > dt {
	font-size: 18px;
	margin-right: 6px;
	justify-self: right;
	grid-column: 1 / 2;
	margin-bottom: 2px;
}
dl.bits > dt {
	display: flex;
	justify-self: stretch;
	//text-shadow: 0.5px 0.5px 1px #4688;
}
dl.bits > dt::after {
	text-shadow: none;
	color: #468;
	content: ":";
}
dl.bits > dt::before {
	content: " ";
	flex: 1;
	white-space: pre;
	margin-right: 2px;
	margin-left: 2px;
	border-bottom: 1px dotted #468;
	height: 11px;
}
dl.bits > dd {
	margin: 0;
	grid-column: 2 / 3;
}

.mathbox {
	border: 1px solid;
	background: white;
	padding: 3px;
	margin: 3px;
	display: inline-block;
}
/* bitfield table */
table.bits {
	table-layout: fixed;
	border-spacing: 0;
	border: 2px groove;
	counter-reset: bnum 16;
	background: white;
}
table.bits tr>* {
	width: 18px;
	max-width: 18px;
	text-align: center;
}
table.bits th {
	font-family: courier, monospace;
	font-size: 9.5px;
	padding: 0;
	font-weight: normal;
	border-right: 1px inset;
	-webkit-text-fill-color: #bbb;
}
table.bits th.f {
	-webkit-text-fill-color: black;
	color: black;
}
table.bits th.x {
	-webkit-text-fill-color: white;
	color: black;
}
table.bits td {
	padding: 1px 0;
	border-top: 1px solid #DDD;
	padding-top: 0;
	color: blue;
}
table.bits th.div { border-right: 1px outset; }
table.bits th.div + th { border-left: 1px outset; }
table.bits tr>:last-child { border-right: none; }
table.bits tr>:first-child { border-left: none; }
table.bits td:nth-child(2n) { background: linear-gradient(to top, white, #DDD); }
table.bits td:nth-child(2n+1) { background: linear-gradient(to bottom, white, #DDD); }
table.bits td:nth-child(n) {
	background: linear-gradient(to right, white, #DDD);
	background: linear-gradient(to right, white, #DDD calc((8px + 100%) / 2));
	background: linear-gradient(110deg, white, #E7E7E7 calc(8px + 20%) calc(100% - 8px - 15%), #ccc);
}
table.bits td.space { background: linear-gradient(to bottom right, white, #DDD); }
table.bits td.x {
	font-variant: tabular-nums;
	background: #e3e3e3;
	text-shadow: none;
	color: black;
}
table.bits.address th {
	background-color: #efe; /* todo: ugly */
}
