/* SPDX-License-Identifier: CC0-1.0 OR 0BSD */

:root {
    --fg-body: black;
    --bg-body: white;
    --bg-alt: #eee;

    --fg-highlight: black;
    --bg-highlight: #eee;

    --bg-changed: antiquewhite;
}

@media (prefers-color-scheme: dark) {
    :root {
        --fg-body: white;
        --bg-body: black;
        --bg-alt: #222;

        --bg-changed: #744;
    }
}

.page-banner {
    font-size: 2em;
    font-weight: bold;
    border-bottom: 2px solid var(--fg-body);
}

nav.table-of-contents {
    border-bottom: 2px solid var(--fg-body);
}

body {
    margin: 3ex auto;
    max-width: calc(min(750px, 90%));
    line-height: 1.3;
    padding-bottom: 15vh;

    color: var(--fg-body);
    background-color: var(--bg-body);
}

.narrow-screen-warning {
    display: none;
}

@media (max-width: 800px) {
    .narrow-screen-warning {
        display: block;
        border: 1px solid var(--fg-body);
        padding: 0 2em;
    }
}

a {
    color: var(--fg-body);
}

a.uri {
    word-break: break-all;
}

span:target {
    text-decoration: underline dotted;
    color: var(--fg-highlight);
    background-color: var(--bg-highlight);
}

pre {
    background-color: var(--bg-alt);
    padding: 0.5em;
    line-height: initial;
    overflow-x: auto;
}

code {
    /* Monospace font size workaround */
    font-family: monospace, monospace;
}

.anchor-link {
    padding-right: 0.25em;
    text-decoration: none;
}

.anchor-link::before {
    content: "⋄";
}

.anchor-link:hover {
    text-decoration: underline;
}

.emulator-disabled {
    white-space: pre-wrap;
    font-family: monospace, monospace;
}

.emulator {
    line-height: initial;
    white-space: pre-wrap;
    font-family: monospace, monospace;

    width: 90vw;
    left: calc(((min(750px, 90vw) - 90vw) / 2));
    position: relative;

    display: grid;
    gap: 1em;
    grid-template-columns: 1fr auto;
    grid-template-rows: calc(17lh + 1em) 2.5em 10lh;
    margin-bottom: 2em;
}

.emulator .emulator-edit {
    grid-column: 1;
    grid-row: 1;
    min-height: 40ex;
    padding: 0.4em;
    resize: none;
    color: var(--fg-body);
    background-color: var(--bg-body);
}

.emulator .emulator-controls {
    grid-column: 1 / 3;
    grid-row: 2;
    display: flex;
    flex-direction: row;
    justify-content: start;
    gap: 0.5em;
}

.emulator .emulator-controls button {
    padding: 0.5em 1em;
}

.emulator .emulator-controls .emulator-checkbox {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    gap: 0.5em;
}

.emulator .emulator-controls .emulator-checkbox label {
    flex-grow: 1;
}

.emulator .emulator-regs-wrapper {
    grid-column: 2;
    grid-row: 1;
    overflow-y: scroll;
    width: fit-content;
}

.emulator .emulator-regs {
    grid-column: 2;
    grid-row: 1;
    background-color: var(--bg-alt);
    padding: 0.5em;
    min-height: 17lh;
}

.emulator .emulator-regs .field-changed {
    background-color: var(--bg-changed);
}

.emulator .emulator-output {
    grid-column: 1 / 3;
    grid-row: 3;
    background-color: var(--bg-alt);
    overflow-y: auto;
    padding: 0.5em;
    word-break: break-all;
}
