body {
    display: grid;
    place-items: center;
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    margin: 0;
    padding: 0;
}
article {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: auto auto;
    margin-top: 10px;
    padding: 0 10px;
}
nav {
    text-align: center;
    margin-top: 20px;
}
header {
    background: #002b36;
    color: #e9e5d2;
    width: 100%;
    line-height: 22px;
    padding: 10px;
    border-bottom: 5px solid #268bd2;
    display: grid;
    grid-template-columns: auto auto;
    box-sizing: border-box;
}
header h1 {
    margin: 0;
    padding: 0 0 0 10px;
    font-size: 20px;
}
header ul {
    list-style: none;
    margin: 0;
    padding: 0 10px 0 0;
    text-align: right;
}
header li {
    display: inline-block;
    padding: 0 0 0 10px;
    white-space: pre;
}
header li:nth-child(2) a, header li:nth-child(2) a:visited, header li:nth-child(2) a:hover {color: #268bd2;}
header li:nth-child(3) a, header li:nth-child(3) a:visited, header li:nth-child(3) a:hover {color: #d33682;}
header li:nth-child(4) a, header li:nth-child(4) a:visited, header li:nth-child(4) a:hover {color: #dc322f;}
.teensy {
    padding: 0px;
    position: relative;
}
table {
    font-family: ui-monospace,
    Menlo, Monaco,
    "Cascadia Mono", "Segoe UI Mono",
    "Roboto Mono",
    "Oxygen Mono",
    "Ubuntu Monospace",
    "Source Code Pro",
    "Fira Mono",
    "Droid Sans Mono",
    "Courier New", monospace;
}
.labels.left, .labels.right {
    top: 8px;
    height: fit-content;
    display: grid;
    position: relative;
}
.labels.left {
    direction: rtl;
}
.labels tr {
    line-height: 20px;
    color: #333333;
    font-size: 0;
}

/* USB Port Labels */
.labels.below {
    grid-column: 2;
    grid-row: 2;
    margin: 0 auto;
}
.labels.below td {
    width: 25px;
    line-height: 25px;;
    height: auto;
    border: none;
    padding: 0;
    writing-mode: vertical-lr;
    vertical-align: top;
    min-width: 25px;
    display: inline-block;
}

/* Upside-down View */
.australian-view .labels.left, .australian-view .labels.right {
    transform: scale(1, -1);
}
.australian-view .labels.left tr, .australian-view .labels.right tr {
    transform: scale(1, -1);
}
.australian-view .labels.below {
    grid-row: 1;
}
.australian-view .labels.left, .australian-view .labels.right, .australian-view .teensy {
    grid-row: 2;
}
.labels thead {display:none;}

td, th {
    height: 20px;
    text-align: left;
    overflow: hidden;
    color: #222;
    font-size: 12px;
    cursor: default;
    white-space: nowrap;
    position: relative;
    border-width:0 4px 0 4px;
    border-style: solid;
    padding: 0 5px;
}

.labels tbody tr th {
    text-align: center;
    float: right;
    background-color: #CCCCCC;
    width: 20px;
    height: 20px;
    font-size: 11px;
    border: 0;
    padding: 0;
}

.labels.left td:nth-child(2), .labels.right td:nth-child(2) {
    min-width: 50px; /* min width for the Dn labels */
}
.labels sup {
    font-size: 6px;
    vertical-align: bottom;
    position: relative;
    top: -4px;
}
.extra table {
    grid-column: 2;
}
.extra td {
    border: none;
    background-color: #9e9d9b22;
    padding: 5px;
}
.extra tr:nth-child(odd) td {
    background-color: #9e9d9b33;
}
.extra th {
    border: none;
    background-color: transparent;
}
.extra .power_pins td {
    background-color: #dc322f22;
}
.extra .power_pins tr:nth-child(odd) td {
    background-color: #dc322f33;
}
.extra .tpads td {
    background-color: #85990022;
}
.extra .tpads tr:nth-child(odd) td {
    background-color: #85990033;
}

/* Hide advanced labels by default */
.labels .advanced {visibility: hidden;}
.labels .hidden, .extra.advanced, .below.advanced {display: none;}
.filter li.advanced {display: none;}

.gpio   {background-color: #85990033;border-color: #859900;}
.ground {background-color: #002b3633;border-color: #002b36;}
.power  {background-color: #dc322f33;border-color: #dc322f;}
.adc    {background-color: #d8d80f33;border-color: #d8d80f;}
.can   {background-color: #2aa19833;border-color: #2aa198;}
.system {background-color: #df8f8e33;border-color: #df8f8e;}
.i2c    {background-color: #268bd233;border-color: #268bd2;}
.spi    {background-color: #d3368233;border-color: #d33682;}
.uart   {background-color: #6c71c433;border-color: #6c71c4;}
.pwm    {background-color: #33333333;border-color: #333333;}
.empty  {background-color: #00000000;border-color: #00000000;}


.labels.left td {border-width:0 0 0 4px;}
.labels.right td {border-width:0 4px 0 0;}

.labels tr:hover:before  {background-color: #eeeeee;}
.labels tr:hover .gpio   {background-color: #9fb80366;}
.labels tr:hover .ground {background-color: #01435366;}
.labels tr:hover .power  {background-color: #f13a3766;}
.labels tr:hover .adc    {background-color: #d8d80f66;}
.labels tr:hover .can   {background-color: #39d1c466;}
.labels tr:hover .system {background-color: #fab4b266;}
.labels tr:hover .i2c    {background-color: #3ba6f166;}
.labels tr:hover .spi    {background-color: #f34f9f66;}
.labels tr:hover .uart   {background-color: #8d91e666;}
.labels tr:hover .pwm    {background-color: #44444466;}

.filter {
    list-style: none;
    margin: 0;
    padding: 0;
}
.filter li {
    display: inline;
}
.filter label {
    display: inline-block;
    color: #002b36;
    padding: 0px 10px 0px 10px;
    line-height: 30px;
    user-select: none;
    margin-bottom: 5px;
}
.interfaces label {
    border-width:0 0px 0 30px;
    border-style: solid;
}
.filter input {
    margin: 0 10px 0 0;
}
.filter.interfaces label {
    color: #222;
}
.filter.interfaces {
    margin-bottom: 20px;
}
.nojs ul {display: none;}

/* Support for flipping board over to view from the bottom... */

/* Top-up View */
.underside {
    display: none;
}

/* Aussie View */
.australian-view .teensy {
    rotate: 180deg;
    position: relative;
}

.australian-view {
    direction: rtl;
}
.australian-view .labels.left {
    direction: ltr;
    top: 0px;
}
.australian-view .labels.right {
    top: 0px;
}
.australian-view .labels.left td {border-width:0 4px 0 0;}
.australian-view .labels.right td {border-width:0 0 0 4px;}
.underside-view.australian-view .labels.left td {border-width:0 0 0 4px;}
.underside-view.australian-view .labels.right td {border-width:0 4px 0 0;}
.underside-view.australian-view {
    direction: ltr;
}
.underside-view.australian-view .labels.left {
    direction: rtl;
}

/* Bottom-up View */
.underside-view .teensy {
    display: none;
}
.underside-view .underside {
    display: block;
}
.underside-view {
    direction: rtl;
}
.underside-view .labels.left {
    direction: ltr;
}
.underside-view .labels.left td {border-width:0 4px 0 0;}
.underside-view .labels.right td {border-width:0 0 0 4px;}

/* Footer */
footer {
    display: grid;
    align-items: center;
    margin: 20px 0;
}
footer p {
    padding: 5px 10px;
    margin: 0;
    text-align: center;
}
footer a.selected {
    text-decoration: none;
}
footer.print {display: none;}


@media (prefers-color-scheme: dark) {
    body {
        background-color: #000000;
    }
    header {
        background: #111111;
        color: #666666;
        border-bottom-color: #222222;
    }
    .filter label,
    footer p,
    nav p {
        color: #666666;
    }
    footer a.selected {
        color: #666666;
    }
    footer a, footer a:visited {
        color: #1d6ca5;
    }
    footer a:hover {
        color: #3ba6f1;
    }
    .labels.left tbody tr th,
    .labels.right tbody tr th {
        background-color: #002b36;
        color: #e9e5d2;
    }
    .labels tbody tr:hover th {background-color: #013441;}
    td, th, .filter.interfaces label {
        color: #e9e5d2;
    }
}

@media print {
    footer, header ul, #nav {display: none;}
    footer.print {
        display: block;
        border-top: 5px solid #268bd2;
    }
    #pinout {margin-top: 40px;}
    header {
        background: transparent;
        color: #666666;
    }
}
