:root {
    --bg: #0a0a15;
    --panel: #111122;
    --accent: #51b1ff;
    --text: #ffffff;
    --muted: #a2a2a2;
    --muted-border: #222242;
    --radius: 3px;
    --ansi-black: #45475a;
    --ansi-red: #f38ba8;
    --ansi-green: #a6e3a1;
    --ansi-yellow: #f9e2af;
    --ansi-blue: #89b4fa;
    --ansi-magenta: #f5c2e7;
    --ansi-cyan: #94e2d5;
    --ansi-white: #bac2de;
    --error-bg: #370f0f;
    --error-border: #aa3b3b;
    --warning-bg: #2b2213;
    --warning-border: #aa823b;
    --note-bg: #0c0e2b;
    --note-border: #294bae;
    color-scheme: dark;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: min(2vw, 1rem);
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: "JetBrains Mono", monospace;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

select {
    outline: none;
}

main {
    margin-top: 4rem;
}

img {
    pointer-events: none;
    user-select: none;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

header {
    position: fixed;
    width: 100%;
    top: 0;
    display: flex;
    z-index: 1000;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 3rem;
    border-bottom: 1px solid var(--muted-border);
    background-color: var(--panel);
}

footer {
    background-color: #000000;
    padding: 2rem 3rem;
    margin-top: auto;
}

footer p {
    margin: 0;
}

nav {
    display: flex;
    gap: 1.5rem;
}

pre {
    margin: 1rem 0;
    overflow-x: auto;
}

pre,
.lines,
.editor {
    padding: 0.75rem 1rem;
}

code {
    padding: 0.2rem;
}

pre,
code,
button,
select,
textarea,
.lines {
    font: inherit;
    color: inherit;
    line-height: inherit;
}

h1,
h2,
h3 {
    margin-top: 2rem;
    margin-bottom: 1.25rem;
    line-height: 1.25;
}

p {
    margin-bottom: 1rem;
}

ul,
ol {
    margin-left: 1rem;
    margin-bottom: 1rem;
}

li {
    margin-bottom: 0.5rem;
}

li::marker {
    color: var(--muted);
}

table {
    width: 100%;
}

th,
td {
    padding: 0.5rem;
}

tbody {
    background-color: var(--bg);
}

hr {
    border-color: var(--muted-border);
    margin: 2rem 0;
}

.nav-link {
    color: var(--text);
}

.hero {
    padding-top: 13rem;
    padding-bottom: 10rem;
}

.logo,
.tagline,
.hero-buttons {
    padding: 1.5rem 6rem;
}

.logo {
    width: 30rem;
}

.tagline {
    font-weight: 500;
    font-size: 1.5rem;
    width: 75%;
    text-wrap: balance;
}

.principles {
    padding: 3rem 6rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 4rem;
}

.principles-left {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.code-snippet-wrapper {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--muted-border);
    background-color: var(--bg);
    border-radius: var(--radius);
}

.code-snippet {
    font-size: 1.5rem;
    padding: 2rem;
    background-color: transparent;
    border: none;
    border-bottom: 1px solid var(--muted-border);
    margin: 0;
}

.run-in-playground {
    text-align: center;
    padding: 0.5rem;
}

.accent {
    color: var(--accent);
    font-weight: 700;
}

.button {
    font-weight: 300;
    border-radius: var(--radius);
    padding: 0.5rem 1.5rem;
    display: inline-flex;
    align-items: center;
}

.button-primary {
    background-color: var(--accent);
    color: var(--bg);
}

.button-secondary {
    color: var(--accent);
    border: 2px solid var(--accent);
}

.hero-buttons {
    display: flex;
    gap: 1rem;
}

.icon {
    vertical-align: middle;
    width: 1.25rem;
}

.puzzle {
    position: absolute;
    right: 6rem;
    top: 21rem;
    width: 10rem;
}

.panel,
.toc,
code,
pre,
button,
select,
table {
    border: 1px solid var(--muted-border);
    background-color: var(--panel);
    border-radius: var(--radius);
}

.bg-panel {
    border-top: 1px solid var(--muted-border);
    border-bottom: 1px solid var(--muted-border);
    background-color: var(--panel);
}

.muted {
    color: var(--muted);
}

.content-wrapper {
    display: flex;
    justify-content: start;
    gap: 6rem;
}

.toc {
    position: sticky;
    top: 4rem;
    margin-left: 1rem;
    margin-bottom: 1rem;
    max-height: calc(100vh - 5rem);
    min-height: calc(100vh - 10rem);
    overflow: auto;
    padding: 1rem;
    padding-right: 2rem;
    min-width: 18rem;
}

.content {
    width: 50%;
    padding: 1rem;
    margin-right: 6rem;
    line-height: 1.6;
}

.content h1 > a:first-child::before,
.content h2 > a:first-child::before,
.content h3 > a:first-child::before,
.content h4 > a:first-child::before,
.content h5 > a:first-child::before,
.content h6 > a:first-child::before {
    content: "# ";
}

.playground-wrapper {
    margin: 1rem;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: calc(100vh - 8rem);
}

.share-wrapper {
    position: relative;
}

.share-button {
    height: 100%;
}

.share-menu {
    background-color: var(--bg);
    position: absolute;
    margin-top: 0.5rem;
    right: 0;
    width: 32rem;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.2s;
    align-items: center;
    z-index: 100;
}

.share-menu-title-bar {
    background-color: var(--panel);
    width: 100%;
    border-bottom: 1px solid var(--muted-border);
    display: flex;
    justify-content: right;
}

.share-menu-close {
    background-color: transparent;
    border: none;
}

.share-menu-close-icon {
    width: 16px;
}

.share-menu-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    justify-content: center;
}

.snippet-qr {
    border: 2px solid #ffffff;
}

.toolbar {
    display: flex;
    justify-content: space-between;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    gap: 1rem;
}

.toolbar button,
.toolbar select {
    padding: 0 1rem;
}

.editor-wrapper,
.output-wrapper {
    flex-grow: 1;
}

.editor-wrapper {
    height: 30%;
    display: flex;
}

.output-wrapper {
    height: 30%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 2rem;
    overflow: auto;
}

.output-wrapper p {
    white-space: pre;
    margin: 0;
}

.lines {
    text-align: right;
    user-select: none;
    padding-left: 2rem;
    color: var(--muted);
    white-space: pre;
    overflow: hidden;
}

.editor {
    width: 100%;
    display: grid;
}

.editor-textarea,
.editor-pre {
    grid-column-start: 1;
    grid-row-start: 1;
    margin: 0;
    padding: 0;
    border: none;
}

.editor-textarea {
    width: 100%;
    outline: none;
    background-color: var(--panel);
    border: none;
    overflow: auto;
    resize: none;
    white-space: pre;
    max-height: calc(100vh - 12rem);
    color: transparent;
    background-color: transparent;
    z-index: 1;
    caret-color: var(--text);
}

.error-container {
    position: absolute;
    bottom: 5rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 30rem;
}

.lines,
.editor-textarea,
.editor-pre,
.output-wrapper p,
.toolbar button,
.toolbar select {
    font-size: 1.25rem;
}

.toc ul,
.toc ol {
    margin-top: 0.5rem;
}

.toc li {
    list-style-type: none;
}

.error,
.warning,
.note {
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
}

.error::before,
.warning::before,
.note::before {
    display: block;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.error {
    background-color: var(--error-bg);
    border: 1px solid var(--error-border);
    animation: fade-in 0.3s ease-out;
}

.error.fade-out {
    animation: fade-out 0.3s ease-out forwards;
}

.warning {
    background-color: var(--warning-bg);
    border: 1px solid var(--warning-border);
}

.note {
    background-color: var(--note-bg);
    border: 1px solid var(--note-border);
}

.error::before {
    content: "ERROR!";
}

.warning::before {
    content: "WARNING!";
}

.note::before {
    content: "NOTE!";
}

.loading {
    width: 1.75rem;
    margin-top: 0.5rem;
    animation: spin 1s linear infinite;
    display: none;
}

.code-block {
    position: relative;
}

.copy-button {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
    background-color: var(--bg);
    font-size: 0;
    opacity: 0;
    transition: opacity 0.2s;
}

.code-block:hover .copy-button {
    opacity: 0.6;
}

.code-block:hover .copy-button:hover {
    opacity: 1;
}

.copy-icon {
    width: 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes fade-in {
    0% {
        opacity: 0;
        transform: translateX(-2rem);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fade-out {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-6rem);
    }
}

@media (max-width: 950px) {
    .toc {
        display: none;
    }

    .content {
        width: 100%;
        margin-right: 0;
    }
}

.Repeat {
    color: #cba6f7;
}

.Function {
    color: #89b4fa;
}

.Structure {
    color: #f9e2af;
}

.Number {
    color: #fab387;
}

.Type {
    color: #f9e2af;
}

.Keyword {
    color: #cba6f7;
}

.Constant {
    color: #fab387;
}

.PreProc {
    color: #f5c2e7;
}

.Include {
    color: #cba6f7;
}

.Statement {
    color: #cba6f7;
}

.Boolean {
    color: #fab387;
}

.Comment {
    font-style: italic;
    color: #9399b2;
}

.Delimiter {
    color: #9399b2;
}

.Operator {
    color: #89dceb;
}

.Identifier {
    color: #f2cdcd;
}

.Special {
    color: #f5c2e7;
}

.Character {
    color: #94e2d5;
}

.String {
    color: #a6e3a1;
}

.Conditional {
    font-style: italic;
    color: #cba6f7;
}
