/*
 * Layout and Markdown styles for the rendered docs pages (README, SETUP, ...).
 * Follows GitHub's Markdown styling, with the BOTW palette from the pdoc theme
 * (scripts/pdoc-theme/theme.css, copied next to this file as palette.css).
 */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    background-color: var(--botw-slate-950);
}

body {
    margin: 0;
    color: var(--botw-parchment);
    background-color: var(--botw-slate-950);
    background-image: url("background.webp");
    background-repeat: repeat;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    word-wrap: break-word;
}

a {
    color: var(--botw-sheikah);
    text-decoration: none;
}
a:hover {
    color: var(--botw-sheikah-bright);
    text-decoration: underline;
}

::selection {
    background-color: rgba(90, 209, 230, 0.3);
}

/* ---- Sidebar ---- */

.sidebar {
    background-color: var(--botw-slate-900);
    border-right: 1px solid var(--botw-slate-800);
}
.sidebar-content {
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem 1rem;
}
.sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sidebar a {
    display: block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    color: var(--botw-parchment-dim);
}
.sidebar a:hover {
    color: var(--botw-sheikah-bright);
    background-color: rgba(90, 209, 230, 0.08);
    text-decoration: none;
}
.sidebar .pages > li > a {
    font-weight: 600;
}
.sidebar .pages > li.active > a {
    color: var(--botw-ancient);
    background-color: rgba(245, 167, 66, 0.1);
}
/* table of contents of the current page */
.sidebar .toc {
    margin: 0.25rem 0 0.5rem 0.75rem;
    border-left: 1px solid var(--botw-slate-700);
}
.sidebar .toc a {
    font-size: 0.875rem;
    padding: 0.125rem 0.75rem;
}
.sidebar .api-links {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--botw-slate-700);
}
.sidebar .api-links a {
    color: var(--botw-sheikah);
}

/* Desktop: fixed full-height sidebar, API links pushed to the bottom */
@media (min-width: 770px) {
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 17rem;
        overflow-y: auto;
    }
    .sidebar-content {
        min-height: 100%;
    }
    .sidebar .api-links {
        margin-top: auto;
    }
    main {
        margin-left: 17rem;
    }
}

/* ---- Content ---- */

main {
    min-height: 100vh;
    padding: 2rem 16px;
}
.markdown-body {
    max-width: 980px;
    margin: 0 auto;
    padding: 2rem 2.5rem;
    background-color: var(--botw-slate-950);
    border: 1px solid var(--botw-slate-800);
    border-radius: 6px;
}
@media (max-width: 769px) {
    main {
        padding: 1rem 16px;
    }
    .markdown-body {
        padding: 1.25rem 1rem;
    }
}

.markdown-body > :first-child {
    margin-top: 0 !important;
}
.markdown-body > :last-child {
    margin-bottom: 0 !important;
}

.markdown-body p,
.markdown-body blockquote,
.markdown-body ul,
.markdown-body ol,
.markdown-body dl,
.markdown-body table,
.markdown-body pre,
.markdown-body .codehilite,
.markdown-body .alert {
    margin-top: 0;
    margin-bottom: 16px;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.25;
    color: var(--botw-sheikah);
    scroll-margin-top: 1rem;
}
.markdown-body h1 {
    font-size: 2em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--botw-slate-700);
    color: var(--botw-ancient);
}
.markdown-body h2 {
    font-size: 1.5em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--botw-slate-700);
}
.markdown-body h3 { font-size: 1.25em; }
.markdown-body h4 { font-size: 1em; }
.markdown-body h5 { font-size: 0.875em; }
.markdown-body h6 { font-size: 0.85em; color: var(--botw-stone); }

.markdown-body strong {
    color: var(--botw-triforce);
}

.markdown-body hr {
    height: 0.25em;
    margin: 24px 0;
    padding: 0;
    border: 0;
    background-color: var(--botw-slate-700);
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 2em;
}
.markdown-body li + li {
    margin-top: 0.25em;
}
.markdown-body li > p {
    margin-top: 16px;
}
.markdown-body ul ul,
.markdown-body ul ol,
.markdown-body ol ol,
.markdown-body ol ul {
    margin-top: 0;
    margin-bottom: 0;
}
.markdown-body li:has(> .task-list-item-checkbox) {
    list-style: none;
    margin-left: -1.4em;
}
.markdown-body .task-list-item-checkbox {
    margin: 0 0.3em 0.2em 0;
    vertical-align: middle;
    accent-color: var(--botw-korok);
}

.markdown-body blockquote {
    margin-left: 0;
    margin-right: 0;
    padding: 0 1em;
    color: var(--botw-stone);
    border-left: 0.25em solid var(--botw-slate-700);
}

/* Inline code */
.markdown-body code {
    padding: 0.2em 0.4em;
    font-size: 85%;
    font-family: var(--botw-font-mono);
    color: var(--botw-parchment);
    background-color: var(--botw-slate-850);
    border-radius: 6px;
}

/* Code blocks (.pdoc-code shares the token colors with the pdoc theme) */
.markdown-body pre {
    margin: 0;
    padding: 16px;
    overflow: auto;
    font-size: 85%;
    line-height: 1.45;
    background-color: var(--botw-slate-900);
    border: 1px solid var(--botw-slate-800);
    border-radius: 6px;
}
.markdown-body pre code {
    padding: 0;
    font-size: 100%;
    background-color: transparent;
    border-radius: 0;
    white-space: pre;
}
.markdown-body .codehilite {
    border-radius: 6px;
}

/* Tables */
.markdown-body table {
    display: block;
    width: max-content;
    max-width: 100%;
    overflow: auto;
    border-spacing: 0;
    border-collapse: collapse;
}
.markdown-body th,
.markdown-body td {
    padding: 6px 13px;
    border: 1px solid var(--botw-slate-700);
}
.markdown-body th {
    font-weight: 600;
    background-color: var(--botw-slate-900);
}
.markdown-body tr:nth-child(2n) {
    background-color: var(--botw-slate-900);
}

.markdown-body img {
    max-width: 100%;
}

/* Alerts ("> [!NOTE]" etc.), same colors as the pdoc theme */
.markdown-body .alert {
    padding: 0.5rem 1rem;
    border-left: 4px solid var(--alert-color);
    background-color: var(--botw-slate-900);
    border-radius: 0 6px 6px 0;
}
.markdown-body .alert > em:first-child {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    font-style: normal;
    font-weight: 600;
    color: var(--alert-color);
}
.markdown-body .alert > em:first-child::before {
    content: "";
    width: 1rem;
    height: 1rem;
    background-color: currentColor;
    mask: center / contain no-repeat;
    -webkit-mask: center / contain no-repeat;
}
.markdown-body .alert > :last-child {
    margin-bottom: 0;
}
.markdown-body .alert.note {
    --alert-color: var(--botw-sheikah);
}
.markdown-body .alert.tip {
    --alert-color: var(--botw-korok);
}
.markdown-body .alert.important {
    --alert-color: var(--botw-rupee-purple);
}
.markdown-body .alert.warning {
    --alert-color: var(--botw-ancient);
}
.markdown-body .alert.caution {
    --alert-color: var(--botw-blood-moon);
}
/* icons are set per alert (not through a variable), so the url resolves relative to this file */
.markdown-body .alert.note > em:first-child::before {
    mask-image: url("icons/info-circle-fill.svg");
    -webkit-mask-image: url("icons/info-circle-fill.svg");
}
.markdown-body .alert.tip > em:first-child::before {
    mask-image: url("icons/lightbulb.svg");
    -webkit-mask-image: url("icons/lightbulb.svg");
}
.markdown-body .alert.important > em:first-child::before {
    mask-image: url("icons/exclamation-square-fill.svg");
    -webkit-mask-image: url("icons/exclamation-square-fill.svg");
}
.markdown-body .alert.warning > em:first-child::before {
    mask-image: url("icons/exclamation-triangle-fill.svg");
    -webkit-mask-image: url("icons/exclamation-triangle-fill.svg");
}
.markdown-body .alert.caution > em:first-child::before {
    mask-image: url("icons/exclamation-octagon-fill.svg");
    -webkit-mask-image: url("icons/exclamation-octagon-fill.svg");
}
