#content * {
    box-sizing: border-box;
}

#content *,
#content *::before,
#content *::after {
  box-sizing: inherit;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: "M PLUS 2", Helvetica, Arial, Verdana, sans-serif;
    font-size: 1em;
}

a {
    cursor: pointer;
}

h1 {
    font-family: "SotN Header", "Courier New", Courier, monospace;
    font-size: 2.5em;
}

main {
    display: grid;
    grid-template: "sidebar content" / 1fr 3fr;
}

hr {
    width: 100%;
    height: 1px;
    margin: 2em 0;
    background-color: #69696930;
    border: 0;
}

#sidebar {
    grid-area: sidebar;
    position: sticky;
    background-color: #1A1A1A;
    color: #E5E5E5;
    overflow-y: scroll;
    height: calc(100vh - 50px);
    padding: 50px 50px 0 50px;
    max-width: 400px;
    min-width: min-content;
    top: 0;
}

#sidebar ul {
    width: 100%;
    min-width: max-content;
}

#links {
    padding-inline-start: 0;
    list-style-type: none;
}

#links li {
    line-height: 2rem;
    transition: margin .25s;
}

#links li::before {
    display: inline-block;
    vertical-align: sub;
    margin: 0 .5em 0 -1.5em;
    transition: margin .25s;
}

#links li:hover {
    margin: 0 0 0 1em;
}

#links li:hover::before {
    margin: 0 1.5em 0 -2.5em;
}

#links li:not(:hover)::before {
    content: "";
    height: 16px;
    width: 16px;
}

#links li:hover::before, #links:not(:hover) li.selected::before {
    content: url("/img/items/119.png");
    height: 16px;
    width: 16px;
}

#links a {
    display: inline-block;
    color: inherit;
    text-decoration: none;
    width: 100%;
    height: 100%;
}

#logo {
    margin: 0 0 65px 0;
    user-select: none;
}

#content {
    grid-area: content;
    padding: 50px 50px 2em 50px;
}

#content h1:first-of-type {
    margin-top: 0;
}

code {
    background: #E0E0E0;
    font-size: 1rem;
}

/* ------------------------------------------------------------------------------------------------------------------------------------------------------ */

#content summary::marker,
#content summary::-webkit-details-marker {
    display: none;
}

#content summary {
    cursor: pointer;
    list-style: none;
    user-select: none;
    padding: 3px 0;
}

div > details > summary::before,
details > details > summary::before {
    font-family: "icons";
    content: "\2B";
    display: inline-block;
    width: 1.5em;
}

div > details[open] > summary::before,
details > details[open] > summary::before {
    content: "\F068";
}

#content summary > h2,
#content summary > h3 {
    display: inline-block;
}

#content > details > details {
    margin-left: 3em;
}

/* ------------------------------------------------------------------------------------------------------------------------------------------------------ */

.treeview {
    font-family: Menlo, Consolas, "Lucida Console", "Courier New", Courier, monospace;
    font-size: .9em;
    max-width: max-content;
}

.treeview ul {
    padding-left: 4px;
}

.treeview li {
    position: relative;
    list-style: none;
    padding: 3px 0 3px 15px;
    cursor: default;
}

.treeview li::after {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 1px;
    height: 100%;
    content: "";
    background-color: #666;
}

.treeview li::before {
    position: absolute;
    top: 12px;
    left: 0;
    width: 10px;
    height: 1px;
    margin: auto;
    content: "";
    background-color: #666;
}

.treeview li:last-child::after {
    height: 12px;
}

.treeview li:has(details)::before {
    top: 15px;
}

.treeview li:has(details):last-child::after {
    height: 15px;
}

.treeview details {
    padding: 3px 0;
}

.treeview summary {
    cursor: pointer;
    list-style: none;
    user-select: none;
    padding: 3px 0;
}

.treeview details > summary::before {
    font-family: "icons";
    display: inline-block;
    width: 1.5em;
    color: #0080FF;
}

.treeview.filesystem details > summary::before {
    content: "\F07B";
}


.treeview.filesystem details[open] > summary::before {
    content: "\F07C";
}

.treeview details > summary[data-type=sprite]::before {
    content: "\F03E";
}

.treeview details > summary[data-type=sprite-part]::before {
    content: "\F302";
    color: #FF80FF;
}

.treeview details > summary[data-type=sprite-frame]::before {
    content: "\F5FD";
    color: #333;
}

.treeview summary::marker,
.treeview summary::-webkit-details-marker {
    display: none;
}

/* ------------------------------------------------------------------------------------------------------------------------------------------------------ */

.highlight {
    background-color: #FFFF0080;
}

.map-header-table {
    display: grid;
    grid-template-columns: 1fr 1fr 4fr;
    grid-gap: 20px;
    margin-top: 3rem;
}

.code-box {
    font-family: Menlo, Consolas, "Lucida Console", "Courier New", Courier, monospace;
    border-radius: 4px;
    background-color: #282923;
    color: #F8F8F2;
    padding: 1em 1em 1em 3.5em;
    counter-reset: line-number;
    list-style-type: none;
}

.code-box li {
    counter-increment: line-number;
    position: relative;
    white-space: pre;
    line-height: 1.5rem;
    border-left: 1px solid #474842;
    padding-left: 1rem;
}

.code-box li::before {
    content: counter(line-number);
    padding: 0 1em;
    position: absolute;
    left: -3.5em;
    color: #90918B;
}

/* Yellow */
.code-box .str {
    color: #E7DB74;
}

/* Blue */
.code-box .type {
    color: #67D8EF;
    font-style: italic;
}

/* Purple */
.code-box .val {
    color: #AC80FF;
}

/* Green */
.code-box .def {
    color: #A6E22C;
}

/* Grey */
.code-box .comment {
    color: #74705D;
}

/* Pink */
.code-box .keyword {
    color: #F92472;
}

/* Orange */
.code-box .arg {
    color: #FD9621;
}

/* ------------------------------------------------------------------------------------------------------------------------------------------------------ */

figure {
    margin: 2em;
}

figure img,
figure video {
    display: block;
    margin: 0 auto;
    border-radius: 0.5em;
    max-width: 512px;
}

figure figcaption {
    text-align: center;
    padding-top: 10px;
}

fieldset {
    width: min-content;
}

fieldset .square::before {
    font-family: "icons";
    content: "\F45C";
    display: inline-block;
    width: 1.5em;
    color: #0080FF;
}

/* ------------------------------------------------------------------------------------------------------------------------------------------------------ */

table {
    border-spacing: 0;
    border-collapse: collapse;
    border: 3px solid #DEDEDE;
    margin-bottom: 2em;
}

table td,
table th {
    border: 1px solid #DEDEDE;
    padding: 4px 8px;
}

/* ------------------------------------------------------------------------------------------------------------------------------------------------------ */

#sprite-full {
    position: relative;
    width: 200px;
    height: 100px;
}

#sprite-full img {
    position: absolute;
}

#sprite-full img.warg0 {
    left: calc(100px + -49px);
    top: calc(50px + -19px);
}
#sprite-full img.warg1 {
    left: calc(100px + -33px);
    top: calc(50px + -27px);
}
#sprite-full img.warg2 {
    left: calc(100px + 36px);
    top: calc(50px + -9px);
}
#sprite-full img.warg3 {
    left: calc(100px + 13px);
    top: calc(50px + -15px);
}
#sprite-full img.warg4 {
    left: calc(100px + -16px);
    top: calc(50px + -7px);
}
#sprite-full img.warg5 {
    left: calc(100px + -29px);
    top: calc(50px + -25px);
}
#sprite-full img.warg6 {
    left: calc(100px + -29px);
    top: calc(50px + 9px);
}
