:root {
    font-family: -apple-system, BlinkMacSystemFont, 
        "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", 
        "Fira Sans", "Droid Sans", "Helvetica Neue", 
        sans-serif;
    font-feature-settings: 'liga' 1, 'calt' 1; /* fix for Chrome */
}
body {
    background-color: #1E1E1E;
    color: #DADADA;
}
@supports (font-variation-settings: normal) {
    h1 { font-family: InterVariable, sans-serif; }
    h2 { font-family: InterVariable, sans-serif; }
    h3 { font-family: InterVariable, sans-serif; }
    h4 { font-family: InterVariable, sans-serif; }
    h5 { font-family: InterVariable, sans-serif; }
}
a {
    text-decoration: underline;
    color: #6086ED;
}
a.broken-link {
    color: #6B7EB3;
    text-decoration: underline;
}
a.broken-link:visited {
    color: #6B7EB3;
    text-decoration: underline;
}
a.broken-link:hover {
    color: #B5C6F5;
    text-decoration: underline;
}
strong {
    font-weight: 600;
}
a:visited {
    text-decoration: underline;
    color: #6086ED;
}
a:hover {
    text-decoration: underline;
    color: #87B6F6;
}
span.goto a {
    border-radius: 5px;
    padding: 0.25em;
    text-decoration: none;
    color: #1E1E1E;
    background-color: #6086ed;
    border: 1px solid #6086ed;
}
span.goto a:hover {
    background-color: #1e1e1e;
    color: #6086ed;
}
pre {
    background-color: #242424;
}
img {
    max-width: 100%;
    object-fit: cover;
}
p {
    margin: 0;
    padding: 0;
}
.indent {
    margin-left: 0.5em;
    padding-left: 0.5em;
    border-left: 1px solid #393939;
}
.indent + br {
    display: none;
}
p.indent-1 {
    margin-left: 0.5em;
    padding-left: 0.5em;
    border-left: 1px solid #393939;
}
p.indent-2 {
    margin-left: 1em;
    padding-left: 0.5em;
    border-left: 1px solid #393939;
}
p.indent-3 {
    margin-left: 1.5em;
    padding-left: 0.5em;
    border-left: 1px solid #393939;
}
p.indent-4 {
    margin-left: 2em;
    padding-left: 0.5em;
    border-left: 1px solid #393939;
}
p.indent-5 {
    margin-left: 2.5em;
    padding-left: 0.5em;
    border-left: 1px solid #393939;
}
p.indent-6 {
    margin-left: 3em;
    padding-left: 0.5em;
    border-left: 1px solid #393939;
}
p.top-bar {
    margin-left: 2.75em;
}
span.file-link {
    color: #393939;
}
blockquote {
    padding-left: 1em;
    border-left: 0.1em solid #6086ED;
    margin: 0;
    margin-top: 1em;
    margin-bottom: 1em;
}

.latex-display {
    display: block;
    margin: 1em 0;
    padding: 0.5em;
    text-align: center;
    border-radius: 4px;
    font-family: 'Latin Modern Math', 'STIX Two Math', 'Cambria Math', serif;
    overflow-x: auto;
}
.latex-inline {
    display: inline;
    font-family: 'Latin Modern Math', 'STIX Two Math', 'Cambria Math', serif;
    color: #DADADA;
    padding: 0.1em 0.2em;
    border-radius: 2px;
}
h1 {
    font-family: Inter, sans-serif;
    font-size: 2rem;
    font-weight: 700;
}
h2 {
    font-family: Inter, sans-serif;
    font-size: 1.6rem;
    font-weight: 600;
}
h3 {
    font-family: Inter, sans-serif;
    font-size: 1.37rem;
    font-weight: 600;
}
h4 {
    font-family: Inter, sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
}
h5 {
    font-family: Inter, sans-serif;
    font-size: 1.12rem;
    font-weight: 600;
}
h6 {
    font-size: 1rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

h1.file-title {
    text-align: center;
}

hr {
    margin-bottom: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #363636;
}
td, th {
    text-align: left;
    border: 1px solid #363636;
    padding: 0.4em;
}

article[data-type="md"] {
    max-width: 700px;
    margin: auto;
    padding-left: 0.5em;
    padding-right: 0.5em;
}
div.math-inline {
  display: inline;
}

nav {
    background-color: #1E1E1E;
    padding-top: 0.5em;
}
nav li {
    list-style-type: none;
    padding: 0;
    margin-left: 0.75rem;
    width: 100%
}

li ul {
    margin: 0;
    padding-left: 0.5rem;
    border-left: 1px solid #393939;
    margin-left: 0.3em;
}

input#searchInput {
    width: 90%;
    margin-left: 0.75em;
    margin-right: 0.75em;
    background-color: #2A2A2A;
    border: 1px solid #363636;
    caret-color: #DADADA;
    color: #DADADA;
    border-radius: 5px;
    outline: none;
    padding: 0.5em;
    margin-bottom: 1em;
}
input#searchInput:focus {
    border: 3px solid #555555;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    margin-left: 0.75em;
    margin-bottom: 1em;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #363636;
    transition: 0.3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #DADADA;
    transition: 0.3s;
    border-radius: 50%;
}

input#toggleByText:checked + .slider {
    background-color: #6086ED;
}

input#toggleByText:checked + .slider:before {
    transform: translateX(26px);
}

.slider:hover {
    background-color: #4A4A4A;
}

input#toggleByText:checked + .slider:hover {
    background-color: #87B6F6;
}
input#toggleByText:checked + .slider {
    background-color: #6086ED;
}

input#toggleByText:checked + .slider:before {
    transform: translateX(26px);
}

.slider:hover {
    background-color: #4A4A4A;
}

input#toggleByText:checked + .slider:hover {
    background-color: #87B6F6;
}

ul#articles {
    list-style-type: none;
    padding: 0;
    margin: 0;
    overflow-y: auto; 
    overflow-x: hidden;
    max-height: 85vh;
}
ul#articles li a {
    margin-top: -1px;
    color: #DADADA;
    text-decoration: none;
    font-size: 18px;
    display: block;
    border-radius: 10px;
    padding: 5px;
    padding-left: 0.75em;
    padding-right: 0.75em;
    margin-bottom: 4px;
    margin-right: 1em;
}
ul#articles li a:hover {
    background-color: #2F3852;
}
sub.content-preview mark {
    background-color: #72662D;
    color: #DADADA;
}
div.content-snippet {
    background-color: #1E1E1E;
    border-radius: 10px;
    padding: 5px;
    padding-left: 0.75em;
    padding-right: 0.75em;
    padding-bottom: 0.75em;
    margin-top: 1em;
}
div#navbar {
    border: 0;
    padding: 2ch;
    background-color: #242424;
    color: #DADADA;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    border-radius: 1ch;
    max-width: 50vw;
    max-height: 90vh;
    margin: 0 auto;
    left: 0;
    right: auto;
    overflow-x: hidden;
}

div#searchbar {
    border: 0;
    padding: 2ch;
    background-color: #242424;
    color: #DADADA;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    border-radius: 1ch;
    max-width: 50vw;
    margin: 2.5em 0;
    left: 100px;
    overflow: hidden;
    top: -1.5em;
}

div#table-of-contents {
    border: 0;
    padding: 2ch;
    background-color: #242424;
    color: #DADADA;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    border-radius: 1ch;
    max-width: 50vw;
    max-height: 90vh;
    margin: 2.5em 0;
    left: auto;
    right: 0;
}

div#table-of-contents a {
    display: block;
    color: #DADADA;
    text-decoration: none;
    padding: 0.25em 0.5em;
    border-radius: 5px;
}

div#table-of-contents a:hover {
    background-color: #363636;
}

div#navbar li.parent {
    margin-top: 0.3em;
    margin-bottom: 0.3em;
}

div#navbar ul.child {
    margin-top: 0.3em;
}

div#navbar a {
    display: block;
    color: #DADADA;
    text-decoration: none;
    padding: 0.15em 0.5em;
    border-radius: 5px;
}

div#navbar a:hover {
    background-color: #363636;
}

div#navbar #checkbox {
    color: #DADADA;
    text-decoration: none;
    padding: 0.25em 0.5em;
    border-radius: 5px;
}

div#navbar #checkbox:hover {
    background-color: #363636;
}

div.transclude-link {
    text-align: right;
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    padding-left: 1em;
}

div.transclsec {
    width: 100%;
}

span.transcl-bar {
    display: flex;
    justify-content: space-between;
}

#navbar:popover-open {
    animation: fadeIn 150ms ease-in-out;
}
div#navbar::backdrop {
    background-color: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(6px);
}

button {
    border-radius: 5px;
    background-color: #6086ED;
    border: 1px solid #6086ed;
}

button:hover {
    border: 1px solid #6086ed;
    background-color: #1e1e1e;
}

svg.lucide {
    height: 2em;
    width: 2em;
}
svg.lucide:hover {
    stroke: #6086ed;
}
.external-link-icon svg.lucide {
    height: 0.75em;
    width: 0.75em;
    color: #DADADA;
}
.external-link-icon svg.lucide:hover {
    stroke: currentColor;
}

nav {
    position: -webkit-sticky; /* Safari */
    position: sticky;
    top: 0;
    display: flex;
    justify-content: space-between;
}
span.anchor {
    height: 30px;
    margin-top: -30px;
    position: absolute;
}

input[type='checkbox'].nav-checkbox:not(:checked) + label + ul {
        display: none;
        visibility:hidden;
}
input[type="checkbox"].nav-checkbox {
    appearance: none;
    transform-origin: center;
    margin: 0;
    font: inherit;
    width: 1.15em;
    height: 1.15em;
    border: 0;
    border-radius: 0.15em;
    color: #363636;
    bottom: 0.1em;
    position: relative;
}
input[type="checkbox"].nav-checkbox::before {
    content: ">";
}
input[type="checkbox"].nav-checkbox:checked {
    transform: rotate(90deg);
    bottom: auto;
    top: 0.4em;
}
footer {
    background-color: #242424;
    font-size: 1em;
    border: 1px solid #2F3852;
    margin-top: 1em;
    margin-left: 1em;
    margin-right: 1em;
    padding: 1em;
    padding-bottom: 1em;
    border-radius: 1em;
}

.footnotes {
    font-size: smaller;
}
.fn {
    position: relative;
    display: inline-block;
    border-bottom: 1px dotted black;
}
.fn .fn-tooltip {
    max-height: 360px;
    overflow: auto;
    font-size: smaller;
}
.fn .fn-tooltip {
    visibility: hidden;
    width: 300px;
    top: 100%;
    left: 50%;
    margin-left: 5px;
    margin-top: 5px;
    background-color: #1E1E1E;
    color: #DADADA;
    border-radius: 6px;
    border-color: #363636;
    border-style: solid;
    border-width: 2px;
    padding: 1em;
    position: absolute;
    z-index: 1;
}
.fn:hover .fn-tooltip {
    visibility: visible;
}
.fn-link {
    text-decoration: none;
}
.fn-link:hover {
    text-decoration: none;
}


.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
}

.card {
    border: 1px solid #363636;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    cursor: pointer;  /* Shows it's clickable */
}

.card:hover {
    border-color: #3F3F3F;
}

.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.card-link:hover {
    text-decoration: none;
    color: inherit;
}

.card-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background-color: #242424;
}

.card-image img {
    width: 100%;
    height: 100%;
}

.card-content {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    margin: 0 0 10px 0;
    font-size: 1.2em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #333;
}

.card-title a {
    text-decoration: none;
    color: #333;
}

.card-title:hover {
    color: #007bff;
}

.card-property {
    margin: 8px 0;
    font-size: 0.9em;
}

.property-label {
    font-weight: bold;
    margin-right: 8px;
}

.property-value {
    color: #666;
}

.base-tabs-container {
    width: 100%;
    margin: 20px 0;
}

.base-tab-headers {
    display: flex;
    border-bottom: 2px solid #363636;
    background-color: #242424;
    margin-bottom: 0;
    border-radius: 8px 8px 0 0;
}

.base-tab-header {
    background-color: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 14px 20px;
    transition: all 0.3s ease;
    font-size: 16px;
    border-bottom: 3px solid transparent;
    color: #DADADA;
    font-family: Inter, sans-serif;
    font-weight: 500;
    border-radius: 8px 8px 0 0;
}

.base-tab-header:hover {
    background-color: #363636;
    color: #DADADA;
}

.base-tab-header.active {
    background-color: #1E1E1E;
    border-bottom: 3px solid #6086ED;
    color: #6086ED;
    font-weight: 600;
}

.base-tab-contents {
    border: 1px solid #363636;
    border-top: none;
    background-color: #1E1E1E;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}

.base-tab-content {
    display: none;
    padding: 20px;
    animation: fadeIn 0.3s ease-in;
    color: #DADADA;
}

.base-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Ensure tables display properly in tabs with dark theme */
.base-tab-content table {
    margin: 0;
}

.base-tab-content th {
    background-color: #242424;
    font-weight: 600;
}

.base-tab-content .cards-container {
    gap: 1rem;
    padding: 0;
}

.base-tab-content .property-label {
    font-weight: 600;
    margin-right: 8px;
    color: #DADADA;
}

/* Info/error messages in tabs */
.base-tab-content .info,
.base-tab-content .error {
    padding: 1em;
    border-radius: 5px;
    margin: 1em 0;
}

.base-tab-content .info {
    background-color: #242424;
    border: 1px solid #363636;
    color: #DADADA;
}

.base-tab-content .error {
    background-color: #2A1E1E;
    border: 1px solid #6B3636;
    color: #FF8A8A;
}




@media screen and (max-width: 768px) {
    svg#tocicon {
        height: 2rem;
        width: 2rem;
    }
    svg#navicon {
        height: 2rem;
        width: 2rem;
    }
    svg#searchicon {
        height: 2rem;
        width: 2rem;
    }
    div#navbar {
        max-width: 100vw;
        max-height: 85vh;
        margin: 0 auto;
        top: 10vh;
    }
    div#searchbar {
        max-width: 90vw;
        max-height: 85vh;
        margin: 0 auto;
        top: 10vh;
        left: auto;
        right: auto;
    }
    ul#articles {
        max-height: 80vh;
    }
    div#table-of-contents {
        max-width: 100vw;
        max-height: 85vh;
        margin: 0 auto;
        top: 10vh;
    }
    article[data-type="md"] {
        width: 90%;
        margin: auto;
        padding-left: 0.25em;
        padding-right: 0.25em;
    }
    footer {
        margin-top: 4em;
    }
    .base-tab-header {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .base-tab-content {
        padding: 15px;
    }
    
    .base-tab-content .cards-container {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

/* Mobile fallback for popover (iOS Safari compatibility) */
@supports not (selector(:popover-open)) {
    [popover] {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 9999;
        display: none;
        background: #242424;
        border: 1px solid #363636;
        border-radius: 8px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    }
    
    [popover].show {
        display: block;
    }
    
    /* Backdrop fallback */
    .popover-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        display: none;
    }
    
    .popover-backdrop.show {
        display: block;
    }
}
