/* === Variables === */
:root {
    --bg-teal: #3b7b77;
    --panel-dark: #232230;
    --panel-highlight: #3b3654;
    --btn-purple: #463d65;
    --text-main: #f4f4f5;
    --text-dim: #a9a9b3;
    --link-color: #8ec3c3;
    --border-light: #ffffff;
}

/* === Reset & Base === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    font-size: 1.1em;
    width: 100%;
    display: flex;
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
}

body {
    background: var(--bg-teal);
    color: var(--text-main);
    font-family: 'Pixel', sans-serif;
}

img {
    max-width: 100%;
    max-height: 100%;
}

/* === Custom Cursors === */
body,
html,
p,
h1,
h2,
h3,
div {
    cursor: url('img/ico/ico_hand_neutral_2x.png'), auto;
}

a,
button,
input[type="button"],
input[type="submit"],
.nav-links a {
    cursor: url('img/ico/ico_hand_neutral_2x.png'), pointer;
}

/* === Scrollbars === */
::-webkit-scrollbar {
    width: 20px;
}

::-webkit-scrollbar-track {
    box-shadow: inset 0 0 5px var(--panel-dark);
    background: var(--panel-highlight);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    border: 2px solid var(--border-light);
    background: var(--btn-purple);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--panel-highlight);
}

/* === Sidebar Navigation === */
.sidebar {
    width: 280px;
    background-color: var(--panel-dark);
    border-right: 2px solid var(--border-light);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    height: 100vh;
}

.sidebar h2 {
    padding: 0 20px;
    font-size: 2rem;
    color: var(--border-light);
    text-align: center;
    border-bottom: 2px dashed var(--btn-purple);
    padding-bottom: 15px;
    margin-bottom: 0;
}

.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-links li {
    margin: 0;
}

.nav-links a {
    display: block;
    padding: 15px 20px;
    color: var(--text-main);
    border: none;
    font-size: 1.4rem;
    transition: background 0.2s;
    cursor: pointer;
    text-decoration: none;
}

.nav-links a:hover {
    background-color: var(--panel-highlight);
}

.nav-links a.active {
    background-color: var(--btn-purple);
    border-left: 5px solid var(--link-color);
}

.nav-links hr {
    margin: 10px 20px;
    border-top: 2px dashed var(--btn-purple);
}

/* === Main Content Area === */
.main-content {
    flex-grow: 1;
    padding: 40px;
    overflow-y: auto;
    height: 100vh;
    box-sizing: border-box;
    text-align: center;
}

/* === Tabs & Animations === */
.tab-content {
    display: none;
    padding: 20px;
    max-width: 900px;
    margin: 0 auto;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Font Faces === */
@font-face {
    font-family: 'Fibberish';
    src: url('fibberish.woff') format('woff'),
        url('fibberish.ttf') format('truetype');
}

@font-face {
    font-family: 'Pixel';
    src: url('pixel_maz.woff') format('woff'),
        url('pixel_maz.ttf') format('truetype');
}

@font-face {
    font-family: 'MesseDuesseldorf';
    src: url('MesseDuesseldorf.woff') format('woff'),
        url('MesseDuesseldorf.ttf') format('truetype');
}

@font-face {
    font-family: 'PixelCode';
    src: url('PixelCode.woff2') format('woff'),
        url('PixelCode.ttf') format('truetype');
}

/* === Typography === */
h1 {
    font-family: 'Fibberish';
    font-size: 2.6em;
    margin: 10px 0;
    text-align: center;
    color: var(--border-light);
}

h2 {
    font-family: 'Fibberish';
    font-size: 1.8em;
    margin: 10px 0;
    color: var(--link-color);
}

h3 {
    font-family: 'Fibberish';
    font-size: 1.4em;
    margin: 10px 0;
    color: var(--link-color);
}

p {
    color: var(--text-main);
    font-family: 'Pixel', sans-serif;
    font-size: 1.8em;
    margin: 10px 0;
}

b {
    font-family: 'MesseDuesseldorf';
    font-size: 0.5em;
    color: var(--link-color);
}

a {
    color: var(--link-color);
    text-decoration: none;
}

a:hover {
    color: var(--border-light);
    text-decoration: underline;
}

code {
    color: var(--text-main);
    font-family: 'PixelCode', sans-serif;
    font-size: 0.8em;
    background: var(--panel-highlight);
    padding: 2px 5px;
    border-radius: 3px;
}

/* === Markdown Parsing Formatting === */
.markdown-body {
    color: var(--text-main);
}

.markdown-body p,
.markdown-body li,
.markdown-body td,
.markdown-body blockquote p {
    font-family: 'PixelCode', monospace !important;
    font-size: 0.8em !important;
    line-height: 1.6;
    margin-bottom: 15px;
}

.markdown-body ul,
.markdown-body ol {
    margin-left: 30px;
    margin-bottom: 20px;
}

/* Headings */
.markdown-body h1 {
    font-family: 'Fibberish', sans-serif;
    font-size: 2.8rem;
    margin-bottom: 20px;
    border-bottom: 2px dashed var(--btn-purple);
    padding-bottom: 10px;
    color: var(--border-light);
}

.markdown-body h2 {
    font-family: 'Fibberish', sans-serif;
    font-size: 2.2rem;
    margin-top: 40px;
    margin-bottom: 15px;
    color: var(--link-color);
    border: none;
}

.markdown-body h3 {
    font-family: 'Fibberish', sans-serif;
    font-size: 1.8rem;
    margin-top: 30px;
    margin-bottom: 10px;
    color: var(--link-color);
    text-align: left;
}

.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    font-family: 'Fibberish', sans-serif;
    font-size: 1.6rem;
    margin-top: 25px;
    margin-bottom: 10px;
    color: var(--border-light);
    text-align: left;
}

.markdown-body strong,
.markdown-body b {
    font-family: inherit !important;
    font-weight: bold;
    color: var(--link-color);
}

.markdown-body em,
.markdown-body i {
    font-family: inherit !important;
    font-style: italic;
    color: var(--text-dim);
}

/* Inline Code tags */
.markdown-body code {
    font-family: 'PixelCode', monospace !important;
    font-size: 0.8em !important;
    background: var(--panel-highlight);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--panel-dark);
    color: var(--border-light);
    white-space: nowrap;
}

/* Code Blocks */
.markdown-body pre {
    background-color: var(--panel-dark);
    padding: 15px;
    border: 2px solid var(--panel-highlight);
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 20px;
}

.markdown-body pre code {
    background: none;
    padding: 0;
    border: none;
    color: var(--text-main);
    white-space: pre;
}

/* Blockquotes */
.markdown-body blockquote {
    border-left: 4px solid var(--btn-purple);
    background: rgba(0, 0, 0, 0.2);
    margin: 20px 0;
    padding: 15px 20px;
    border-radius: 0 8px 8px 0;
}

.markdown-body blockquote p {
    margin: 0;
    color: var(--text-dim) !important;
    font-style: italic;
}

/* Tables */
.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.markdown-body th,
.markdown-body td {
    border: 2px solid var(--panel-highlight);
    padding: 12px;
    text-align: left;
}

.markdown-body th {
    background-color: var(--panel-dark);
    color: var(--link-color);
    font-family: 'Fibberish', sans-serif;
    font-size: 1.4rem;
}

.markdown-body tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.15);
}

/* === Hotkey Tables & Keyboard Inputs === */
table.hotkey-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-family: 'PixelCode', monospace;
}

table.hotkey-table th,
table.hotkey-table td {
    border: 2px solid var(--panel-highlight);
    padding: 10px;
    text-align: left;
}

table.hotkey-table th {
    background-color: var(--panel-dark);
    color: var(--link-color);
    font-family: 'Pixel', sans-serif;
}

table.hotkey-table tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.2);
}

table.hotkey-table th:nth-child(2),
table.hotkey-table td:nth-child(2) {
    text-align: center;
}

kbd {
    background-color: var(--panel-highlight);
    color: var(--link-color);
    font-family: 'PixelCode', monospace;
    font-size: 1.0rem;
    display: inline-block;
    vertical-align: middle;
    line-height: 1.2;
    margin: 4px 2px;
    padding: 4px 8px;
    border-radius: 0;
    border: 2px solid var(--border-light);
    border-bottom: 4px solid var(--panel-dark);
    box-shadow: 2px 2px 0px rgba(0, 0, 0, 0.6);
    white-space: nowrap;
}

table.hotkey-table b {
    font-family: 'Pixel', sans-serif;
    font-size: 1em;
    color: var(--border-light);
}

table.hotkey-table td {
    vertical-align: middle;
    font-size: 0.9em;
    line-height: 1.6;
}

/* === Elements === */
.info-box,
.smol-box {
    background: var(--panel-highlight);
    color: var(--text-main);
    border: 2px solid var(--border-light);
    padding: 10px;
    text-align: center;
}

.info-box {
    margin: 10px auto;
    border-collapse: collapse;
    border-spacing: 0;
}

.smol-box {
    flex: 0 1 400px;
    max-width: 100%;
    margin: 0;
    border-radius: 8px;
}

.smol-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    grid-auto-rows: auto;
    gap: 15px;
    grid-auto-flow: dense;
    margin-top: 20px;
}

marquee {
    background-color: var(--panel-dark);
    color: var(--link-color);
    padding: 2px;
    font-size: 1.8em;
    border: 2px solid var(--border-light);
    border-radius: 5px;
}

hr {
    border-top: 2px dashed var(--btn-purple);
    margin: 20px 0;
}

/* === Talk Bubbles === */
.talk-wrapper {
    position: relative;
    display: inline-block;
}

.talk-bubble {
    position: absolute;
    top: 25%;
    transform: translateY(-50%);
    background: var(--panel-dark);
    color: var(--link-color);
    border: 2px solid var(--border-light);
    font-size: 1.2em;
    font-family: 'Pixel', sans-serif;
    padding: 5px;
    border-radius: 5px;
    min-width: 150px;
    max-width: 200px;
    white-space: normal;
    word-wrap: break-word;
    display: none;
    z-index: 10;
}

.talk-wrapper:hover .talk-bubble,
.talk-wrapper:has(:hover) .talk-bubble,
.talk-wrapper:has(:focus-within) .talk-bubble {
    display: block;
}

.talk-wrapper.right .talk-bubble {
    left: 25%;
}

.talk-wrapper.left .talk-bubble {
    right: 25%;
}

.talk-wrapper.top .talk-bubble {
    top: 15%;
    right: 65%;
}

.talk-wrapper.bottom .talk-bubble {
    top: 95%;
}

/* === Responsive === */
@media screen and (max-width: 768px) {
    body {
        flex-direction: column;
        overflow: auto;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 2px solid var(--border-light);
        flex-shrink: 0;
    }

    .main-content {
        width: 100%;
        height: auto;
        padding: 20px;
        overflow-y: visible;
    }

    .nav-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-links a {
        font-size: 1rem;
        padding: 10px;
    }
}

/* === Sub-Navigation === */
.sub-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
    background-color: rgba(0, 0, 0, 0.15);
    border-bottom: 2px dashed var(--btn-purple);
}

.nav-links a.active+.sub-nav {
    display: block;
    animation: fadeIn 0.2s ease-in-out;
}

.sub-nav a {
    font-size: 1.2rem !important;
    padding: 10px 20px 10px 40px !important;
    color: var(--text-dim) !important;
    border-left: 5px solid transparent !important;
}

.sub-nav a:hover {
    color: var(--border-light) !important;
    background-color: var(--panel-highlight);
}

.sub-nav a.sub-nav-h3 {
    padding-left: 60px !important;
    font-size: 1.2rem !important;
}

.sub-nav a.sub-nav-h2::before {
    content: "• ";
    color: var(--btn-purple);
}

.sub-nav a.sub-nav-h3::before {
    content: "- ";
    color: var(--btn-purple);
}

.nav-links a.active+.sub-nav.collapsed {
    display: none;
}

iframe {
    max-width: 100%;
}

/* === Responsive === */
@media screen and (max-width: 768px) {

    html,
    body {
        display: block !important;
        height: auto !important;
        min-height: 100% !important;
        overflow: auto !important;
        overflow-x: hidden !important;
    }

    .sidebar {
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        display: block !important;
        /* Kills the flex-column stretching */
        border-right: none !important;
        border-bottom: 2px solid var(--border-light) !important;
        padding: 10px 0 !important;
    }

    .sidebar h2 {
        font-size: 1.5rem !important;
        padding-bottom: 10px !important;
    }

    .nav-links {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .nav-links::-webkit-scrollbar {
        display: none;
    }

    .nav-links li {
        flex: 0 0 auto !important;
    }

    .nav-links a {
        font-size: 1.1rem !important;
        padding: 10px 15px !important;
        border-left: none !important;
        border-bottom: 3px solid transparent !important;
    }

    .nav-links a.active {
        background-color: var(--panel-highlight) !important;
        border-left: none !important;
        border-bottom: 3px solid var(--link-color) !important;
    }

    .main-content {
        width: 100% !important;
        height: auto !important;
        min-height: 100vh !important;
        padding: 15px !important;
        display: block !important;
        overflow: visible !important;
    }

    table.hotkey-table,
    .markdown-body table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    h1 {
        font-size: 2em;
    }

    h2 {
        font-size: 1.5em;
    }

    p {
        font-size: 1.1em;
    }
}