/* ============================================================
   Spectral Docs — general.css
   Base content styles: typography, tables, blockquotes, footnotes
   ============================================================ */

:root {
    /* Browser default font-size is 16px, this way 1 rem = 10px */
    font-size: 62.5%;
    color-scheme: var(--color-scheme);
}

html {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    color: var(--fg);
    background-color: var(--bg);
    text-size-adjust: none;
    -webkit-text-size-adjust: none;
}

body {
    margin: 0;
    padding: 0;
    font-size: 1.6rem;
    line-height: 1.6;
    overflow-x: hidden;
}

code {
    font-family: monospace;
    font-size: var(--code-font-size);
    direction: ltr;
}

main {
    overflow-wrap: break-word;
}

.table-wrapper {
    overflow-x: auto;
}

/* Don't change font size in headers */
h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
    font-size: unset;
}

.left { float: left; }
.right { float: right; }
.boring { opacity: 0.6; }
.hide-boring .boring { display: none; }
.hidden { display: none !important; }

h2, h3 { margin-block-start: 2em; }
h4, h5 { margin-block-start: 1.5em; }

.header + .header h3,
.header + .header h4,
.header + .header h5 {
    margin-block-start: 1em;
}

h1:target::before,
h2:target::before,
h3:target::before,
h4:target::before,
h5:target::before,
h6:target::before,
dt:target::before {
    display: inline-block;
    content: "»";
    margin-inline-start: -30px;
    width: 30px;
}

:target {
    scroll-margin-top: calc(var(--menu-bar-height) + 0.5em);
}

/* ---- Page layout ---- */

.page {
    outline: 0;
    padding: 0 var(--page-padding);
    margin-block-start: calc(0px - var(--menu-bar-height));
}
.page-wrapper {
    box-sizing: border-box;
    background-color: var(--bg);
}
html:not(.js) .page-wrapper,
.js:not(.sidebar-resizing) .page-wrapper {
    transition: margin-left 0.3s ease, transform 0.3s ease;
}
[dir=rtl]:not(.js) .page-wrapper,
[dir=rtl].js:not(.sidebar-resizing) .page-wrapper {
    transition: margin-right 0.3s ease, transform 0.3s ease;
}

.content {
    overflow-y: auto;
}
.content main {
    margin-inline-start: auto;
    margin-inline-end: auto;
    max-width: var(--content-max-width);
}
.content img, .content video { max-width: 100%; }
.content .header:link,
.content .header:visited {
    color: var(--fg);
}
.content .header:link,
.content .header:visited:hover {
    text-decoration: none;
}

/* ---- Tables ---- */

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
    font-size: 13px;
}
table thead {
    background: none;
}
table thead tr {
    border: none;
}
table thead th {
    text-align: left;
    background: var(--table-header-bg);
    color: var(--text-secondary);
    padding: 6px 10px;
    border-bottom: 2px solid var(--border-strong);
    font-weight: 600;
}
table thead td {
    font-weight: 700;
    border: none;
}
table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}
table tr:hover {
    background: var(--surface-raised);
}

/* ---- Blockquote ---- */

blockquote {
    margin: 0 0 12px 0;
    padding: 8px 16px;
    color: var(--fg);
    background-color: var(--quote-bg);
    border-left: 3px solid var(--quote-border);
    border-radius: 0 4px 4px 0;
}

.warning {
    margin: 20px;
    padding: 0 20px;
    border-inline-start: 2px solid var(--warning-border);
}

.warning:before {
    position: absolute;
    width: 3rem;
    height: 3rem;
    margin-inline-start: calc(-1.5rem - 21px);
    content: "ⓘ";
    text-align: center;
    background-color: var(--bg);
    color: var(--warning-border);
    font-weight: bold;
    font-size: 2rem;
}

blockquote .warning:before {
    background-color: var(--quote-bg);
}

/* ---- kbd ---- */

kbd {
    display: inline-block;
    padding: 2px 6px;
    background: var(--border-color);
    border: 1px solid var(--scrollbar);
    border-radius: 3px;
    font-size: 12px;
    color: var(--text-secondary);
    font-family: inherit;
    line-height: normal;
    vertical-align: baseline;
}

/* ---- Misc ---- */

sup {
    line-height: 0;
}

.chapter li.part-title {
    color: var(--sidebar-fg);
    margin: 5px 0px;
    font-weight: bold;
}

.result-no-output {
    font-style: italic;
}

.fa-svg svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
    margin-bottom: -0.1em;
}

/* ---- Tooltips ---- */

.tooltiptext {
    position: absolute;
    visibility: hidden;
    color: #fff;
    background-color: var(--border-color);
    transform: translateX(-50%);
    left: -8px;
    top: -35px;
    font-size: 0.8em;
    text-align: center;
    border-radius: 6px;
    padding: 5px 8px;
    margin: 5px;
    z-index: 1000;
}
.tooltipped .tooltiptext {
    visibility: visible;
}

/* ---- Footnotes ---- */

.footnote-definition {
    font-size: 0.9em;
}
.footnote-definition ul,
.footnote-definition ol {
    padding-left: 20px;
}
.footnote-definition > li {
    position: relative;
}
.footnote-definition > li:target {
    scroll-margin-top: 50vh;
}
.footnote-reference:target {
    scroll-margin-top: 50vh;
}
.footnote-definition > li:target::before {
    border: 2px solid var(--footnote-highlight);
    border-radius: 6px;
    position: absolute;
    top: -8px;
    right: -8px;
    bottom: -8px;
    left: -32px;
    pointer-events: none;
    content: "";
}
@media not (prefers-reduced-motion) {
    .footnote-reference:target  {
        animation: fn-highlight 0.8s;
        border-radius: 2px;
    }

    @keyframes fn-highlight {
        from {
            background-color: var(--footnote-highlight);
        }
    }
}

/* ---- Definition lists ---- */

dt {
    font-weight: bold;
    margin-top: 0.5em;
    margin-bottom: 0.1em;
}

dl, dt {
    counter-reset: dd-counter;
}

dd:has(+ dd), dd + dd {
    counter-increment: dd-counter;
    display: flex;
    align-items: flex-start;
}

dd:has(+ dd)::before, dd + dd::before  {
    content: counter(dd-counter) ". ";
    font-weight: 600;
    display: inline-block;
    margin-right: 0.5em;
}

dd > p {
    margin-top: 0;
}

/* ---- Blockquote tags (note, tip, warning, caution) ---- */

.blockquote-tag p:last-child {
    margin-bottom: 2px;
}

.blockquote-tag {
    padding: 2px 0px 2px 20px;
    border-inline-start-style: solid;
    border-inline-start-width: 4px;
    background-color: inherit;
    border-block-start: none;
    border-block-end: none;
}

.blockquote-tag-title svg {
    fill: currentColor;
    margin-right: 8px;
}

.blockquote-tag-note { border-inline-start-color: var(--blockquote-note-color); }
.blockquote-tag-tip { border-inline-start-color: var(--blockquote-tip-color); }
.blockquote-tag-important { border-inline-start-color: var(--blockquote-important-color); }
.blockquote-tag-warning { border-inline-start-color: var(--blockquote-warning-color); }
.blockquote-tag-caution { border-inline-start-color: var(--blockquote-caution-color); }

.blockquote-tag-note .blockquote-tag-title { color: var(--blockquote-note-color); }
.blockquote-tag-tip .blockquote-tag-title { color: var(--blockquote-tip-color); }
.blockquote-tag-important .blockquote-tag-title { color: var(--blockquote-important-color); }
.blockquote-tag-warning .blockquote-tag-title { color: var(--blockquote-warning-color); }
.blockquote-tag-caution .blockquote-tag-title { color: var(--blockquote-caution-color); }

.blockquote-tag-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    margin: 2px 0 8px 0;
}

.blockquote-tag-title .fa-svg {
    fill: currentColor;
    margin-right: 8px;
}
