@font-face {
    /* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) */
    font-family: "fa-brands";
    src: url('../static/fa-brands-400.woff2');
}

@font-face {
    /* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) */
    font-family: "fa-regular";
    src: url('../static/fa-regular-400.woff2');
}

@font-face {
    /* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) */
    font-family: "fa-solid";
    src: url('../static/fa-solid-900.woff2');
}

@font-face {
  font-family: "Rethink";
  src:      url('../static/RethinkSans-VariableFont_wght.ttf');
            url('../static/RethinkSans-Italic-VariableFont_wght.ttf');
}

@font-face {
    font-family: "NotoSerif";
    src:    url('../static/NotoSerif-Regular.ttf');
            url('../static/NotoSerif-Bold.ttf');
            url('../static/NotoSerif-Italic.ttf');
            url('../static/NotoSerif-Italic.ttf');
}

@font-face {
    font-family: "CourierPrime";
    src:    url('../static/CourierPrime-Regular.ttf');
}

@font-face {
    font-family: "NotoSansMono";
    src:    url('../static/NotoSansMono-Regular.ttf');
}

a:hover {
    text-decoration: underline;
}

.nounderline:hover {
    text-decoration: none;
}

:root {
    --bg-primary: #0f1115;
    --bg-secondary: #161a21;
    --bg-tertiary: #1c212b;
    --text-primary: #e6edf3;
    --text-secondary: #dce0e6;
    --accent: #4f9cff;
    --accent-hover: #9cc8ff;
    --border: #30363d;
    --code-bg: #161b22;
    --syntax-comment: #959077;
    --syntax-keyword: #66d9ef;
    --syntax-literal: #ae81ff;
    --syntax-string: #e6db74;
    --syntax-name: #a6e22e;
    --syntax-operator: #ff4689;
    --syntax-default: #f8f8f2;
}

#theme-toggle:checked + .page-wrapper,
.light-theme .page-wrapper {
    --bg-primary: #ffffff;
    --bg-secondary: #f6f8fa;
    --bg-tertiary: #eff2f5;
    --text-primary: #1f2328;
    --text-secondary: #3a3c42;
    --accent: #0969da;
    --accent-hover: #1f88ff;
    --border: #d0d7de;
    --code-bg: #f6f8fa;
    --syntax-comment: #6a737d;
    --syntax-keyword: #d73a49;
    --syntax-literal: #005cc5;
    --syntax-string: #032f62;
    --syntax-name: #6f42c1;
    --syntax-operator: #d73a49;
    --syntax-default: #24292e;
}

@media (prefers-color-scheme: light) {
    :root:not(.dark-theme) .page-wrapper {
        --bg-primary: #ffffff;
        --bg-secondary: #f6f8fa;
        --bg-tertiary: #eff2f5;
        --text-primary: #1f2328;
        --text-secondary: #3a3c42;
        --accent: #0969da;
        --accent-hover: #1f88ff;
        --border: #d0d7de;
        --code-bg: #f6f8fa;
        --syntax-comment: #6a737d;
        --syntax-keyword: #d73a49;
        --syntax-literal: #005cc5;
        --syntax-string: #032f62;
        --syntax-name: #6f42c1;
        --syntax-operator: #d73a49;
        --syntax-default: #24292e;
    }

    :root:not(.dark-theme) .theme-toggle-label .theme-toggle-icon-dark {
        display: none;
    }

    :root:not(.dark-theme) .theme-toggle-label .theme-toggle-icon-light {
        display: inline-block;
    }
}

.theme-toggle-label {
    cursor: pointer;
    padding: 8px;
    font-size: 1.2em;
    color: var(--text-secondary);
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 10px;
}

.theme-toggle-label:hover {
    color: var(--accent);
}

.theme-toggle-label .theme-toggle-icon-light {
    display: none;
}

.light-theme .theme-toggle-label .theme-toggle-icon-dark {
    display: none;
}

.light-theme .theme-toggle-label .theme-toggle-icon-light {
    display: inline-block;
}

#theme-toggle:checked + .page-wrapper .theme-toggle-label .theme-toggle-icon-dark {
    display: none;
}

#theme-toggle:checked + .page-wrapper .theme-toggle-label .theme-toggle-icon-light {
    display: inline-block;
}

.page-wrapper {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s, color 0.3s;
}

img {
    background: #ffffff;
}

body {
    font-family: 'Rethink', Verdana, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

.articlecontent {
    max-width: 800px;
    width: 90%;
    margin: 40px auto;
}

.entry-content {
    font-family: NotoSerif, serif;
    font-size: 1.1em;
}

.highlight.code-block {
    font-size: 0.95em;
    font-family: "Noto Mono", monospace;
    background: var(--code-bg);
    color: var(--syntax-default);
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    border: 1px solid var(--border);
    margin: 20px 0;
}

.inline-code {
    background: var(--bg-secondary);
    color: var(--syntax-keyword);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: CourierPrime, monospace;
    font-size: 0.9em;
}

.article-img {
    max-height: 40vh;
    display: block;
    margin: 2em auto;
    border-radius: 8px;
}

.highlight .c { color: var(--syntax-comment) } /* Comment */
.highlight .err { color: #ed007e; background-color: #1e0010 } /* Error */
.highlight .esc { color: var(--syntax-default) } /* Escape */
.highlight .g { color: var(--syntax-default) } /* Generic */
.highlight .k { color: var(--syntax-keyword) } /* Keyword */
.highlight .l { color: var(--syntax-literal) } /* Literal */
.highlight .n { color: var(--syntax-default) } /* Name */
.highlight .o { color: var(--syntax-operator) } /* Operator */
.highlight .x { color: var(--syntax-default) } /* Other */
.highlight .p { color: var(--syntax-default) } /* Punctuation */
.highlight .ch { color: var(--syntax-comment) } /* Comment.Hashbang */
.highlight .cm { color: var(--syntax-comment) } /* Comment.Multiline */
.highlight .cp { color: var(--syntax-comment) } /* Comment.Preproc */
.highlight .cpf { color: var(--syntax-comment) } /* Comment.PreprocFile */
.highlight .c1 { color: var(--syntax-comment) } /* Comment.Single */
.highlight .cs { color: var(--syntax-comment) } /* Comment.Special */
.highlight .gd { color: var(--syntax-operator) } /* Generic.Deleted */
.highlight .ge { color: var(--syntax-default); font-style: italic } /* Generic.Emph */
.highlight .ges { color: var(--syntax-default); font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: var(--syntax-default) } /* Generic.Error */
.highlight .gh { color: var(--syntax-default) } /* Generic.Heading */
.highlight .gi { color: var(--syntax-name) } /* Generic.Inserted */
.highlight .go { color: var(--syntax-keyword) } /* Generic.Output */
.highlight .gp { color: var(--syntax-operator); font-weight: bold } /* Generic.Prompt */
.highlight .gs { color: var(--syntax-default); font-weight: bold } /* Generic.Strong */
.highlight .gu { color: var(--syntax-comment) } /* Generic.Subheading */
.highlight .gt { color: var(--syntax-default) } /* Generic.Traceback */
.highlight .kc { color: var(--syntax-keyword) } /* Keyword.Constant */
.highlight .kd { color: var(--syntax-keyword) } /* Keyword.Declaration */
.highlight .kn { color: var(--syntax-operator) } /* Keyword.Namespace */
.highlight .kp { color: var(--syntax-keyword) } /* Keyword.Pseudo */
.highlight .kr { color: var(--syntax-keyword) } /* Keyword.Reserved */
.highlight .kt { color: var(--syntax-keyword) } /* Keyword.Type */
.highlight .ld { color: var(--syntax-string) } /* Literal.Date */
.highlight .m { color: var(--syntax-literal) } /* Literal.Number */
.highlight .s { color: var(--syntax-string) } /* Literal.String */
.highlight .na { color: var(--syntax-name) } /* Name.Attribute */
.highlight .nb { color: var(--syntax-default) } /* Name.Builtin */
.highlight .nc { color: var(--syntax-name) } /* Name.Class */
.highlight .no { color: var(--syntax-keyword) } /* Name.Constant */
.highlight .nd { color: var(--syntax-name) } /* Name.Decorator */
.highlight .ni { color: var(--syntax-default) } /* Name.Entity */
.highlight .ne { color: var(--syntax-name) } /* Name.Exception */
.highlight .nf { color: var(--syntax-name) } /* Name.Function */
.highlight .nl { color: var(--syntax-default) } /* Name.Label */
.highlight .nn { color: var(--syntax-default) } /* Name.Namespace */
.highlight .nx { color: var(--syntax-name) } /* Name.Other */
.highlight .py { color: var(--syntax-default) } /* Name.Property */
.highlight .nt { color: var(--syntax-operator) } /* Name.Tag */
.highlight .nv { color: var(--syntax-default) } /* Name.Variable */
.highlight .ow { color: var(--syntax-operator) } /* Operator.Word */
.highlight .pm { color: var(--syntax-default) } /* Punctuation.Marker */
.highlight .w { color: var(--syntax-default) } /* Text.Whitespace */
.highlight .mb { color: var(--syntax-literal) } /* Literal.Number.Bin */
.highlight .mf { color: var(--syntax-literal) } /* Literal.Number.Float */
.highlight .mh { color: var(--syntax-literal) } /* Literal.Number.Hex */
.highlight .mi { color: var(--syntax-literal) } /* Literal.Number.Integer */
.highlight .mo { color: var(--syntax-literal) } /* Literal.Number.Oct */
.highlight .sa { color: var(--syntax-string) } /* Literal.String.Affix */
.highlight .sb { color: var(--syntax-string) } /* Literal.String.Backtick */
.highlight .sc { color: var(--syntax-string) } /* Literal.String.Char */
.highlight .dl { color: var(--syntax-string) } /* Literal.String.Delimiter */
.highlight .sd { color: var(--syntax-string) } /* Literal.String.Doc */
.highlight .s2 { color: var(--syntax-string) } /* Literal.String.Double */
.highlight .se { color: var(--syntax-literal) } /* Literal.String.Escape */
.highlight .sh { color: var(--syntax-string) } /* Literal.String.Heredoc */
.highlight .si { color: var(--syntax-string) } /* Literal.String.Interpol */
.highlight .sx { color: var(--syntax-string) } /* Literal.String.Other */
.highlight .sr { color: var(--syntax-string) } /* Literal.String.Regex */
.highlight .s1 { color: var(--syntax-string) } /* Literal.String.Single */
.highlight .ss { color: var(--syntax-string) } /* Literal.String.Symbol */
.highlight .bp { color: var(--syntax-default) } /* Name.Builtin.Pseudo */
.highlight .fm { color: var(--syntax-name) } /* Name.Function.Magic */
.highlight .vc { color: var(--syntax-default) } /* Name.Variable.Class */
.highlight .vg { color: var(--syntax-default) } /* Name.Variable.Global */
.highlight .vi { color: var(--syntax-default) } /* Name.Variable.Instance */
.highlight .vm { color: var(--syntax-default) } /* Name.Variable.Magic */
.highlight .il { color: var(--syntax-literal) } /* Literal.Number.Integer.Long */

/* ---------- Header ---------- */
header {
    padding: 5px 20px;
    margin-top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--border);
    background-color: var(--bg-secondary);
}

.pagehdr {
    background-color: var(--bg-secondary);
}

header a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s;
}

header a:hover {
    color: var(--accent);
}

.hdr-left {
    display: flex;
    align-items: center;
}

header .logo {
    font-size: 21px;
    font-weight: bold;
    color: var(--text-secondary);
    font-family: 'Rethink', Verdana, sans-serif;
}

header nav a {
    color: var(--text-secondary);
    text-decoration: none;
    margin-left: 20px;
    font-weight: 500;
    font-size: 0.95em;
}

header nav a:hover {
    color: var(--text-primary);
    text-decoration: none;
}

/* ---------- Main ---------- */
.page-body {
    display: flex;
    align-items: stretch;
    flex: 1;
}

main {
    font-family: 'Rethink', Verdana, sans-serif;
    padding: 20px;
    text-align: left;
    flex: 1;
    min-width: 0;
    margin-bottom: 10px;
}

main h1 {
    font-size: 32px;
    color: var(--text-primary);
    margin-bottom: 24px;
}

main p {
    font-size: 18px;
    margin: 16px 0;
}

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

main a:hover {
    text-decoration: underline;
}

.fa-brands {
    font-style: normal;
    font-variant: normal;
    font-family: fa-brands, sans-serif;
}

.fa-regular {
    font-style: normal;
    font-variant: normal;
    font-family: fa-regular, sans-serif;
}

.fa-solid {
    font-style: normal;
    font-variant: normal;
    font-family: fa-solid, sans-serif;
}

.fa-envelope::before {
    content: "\f0e0";
}

.fa-github::before {
    content: "\f09b";
}

.fa-linkedin::before {
    content: "\f08c";
}

.fa-orcid::before {
    content: "\f8d2";
}

.fa-google-scholar::before {
    content: "\e63b";
}

.fa-file-lines::before {
    content: "\f15c";
}

.fa-bullhorn::before {
    content: "\f0a1";
}

.fa-bug::before {
    content: "\f188";
}

.fa-display::before {
    content: "\e163";
}

.fa-code::before {
    content: "\f121";
}

.fa-bars::before {
    content: "\f0c9";
}

.fa-xmark::before {
    content: "\f00d";
}

.fa-code::before {
    content: "\f121";
}

/* ---------- Side Panel ---------- */
/* Visually hidden, but still focusable so the panel can be toggled by keyboard. */
.sidebar-toggle-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
}

.sidepanel {
    flex: 0 0 clamp(260px, 24vw, 340px);
    box-sizing: border-box;
    position: relative;
    padding: 36px 20px 0 20px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border);
}

.sidepanel__inner {
    position: sticky;
    top: 28px;
}

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

/* :not(.nounderline) keeps the .nounderline utility winning the cascade here. */
.sidepanel a:not(.nounderline):hover {
    text-decoration: underline;
}

.sidepanel__name {
    font-size: 28px;
    line-height: 1.2;
    margin: 0 0 12px 0;
    color: var(--text-primary);
    font-weight: bold;
}

.sidepanel__tag {
    margin: 0 0 16px 0;
    color: var(--text-secondary);
    font-size: 18px;
}

.sidepanel__desc {
    margin: 0 0 24px 0;
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
}

.sidepanel__contact {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

.sidepanel__contact a {
    display: inline-flex;
    padding: 8px 6px;
    font-size: 1.6em;
    color: var(--text-secondary);
    transition: color 0.2s, transform 0.2s;
}

.sidepanel__contact a:hover {
    color: var(--accent);
    transform: translateY(-2px);
}

/* The close button and the backdrop only exist while the panel is a drawer. */
.sidepanel__close,
.sidebar-scrim {
    display: none;
}

.sidebar-toggle-label {
    display: none;
    cursor: pointer;
    align-items: center;
    padding: 6px 10px 6px 0;
    font-size: 1.3em;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.sidebar-toggle-label:hover {
    color: var(--accent);
}

.sidebar-toggle-icon-close {
    display: none;
}

#sidebar-toggle:checked ~ .page-wrapper .sidebar-toggle-icon-open {
    display: none;
}

#sidebar-toggle:checked ~ .page-wrapper .sidebar-toggle-icon-close {
    display: inline-block;
}

#sidebar-toggle:focus-visible ~ .page-wrapper .sidebar-toggle-label {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---------- Publications ---------- */
.publications {
    margin: 40px auto;
    width: 100%;
    max-width: 1000px;
    box-sizing: border-box;
}
.publications h2 {
    margin-bottom: 32px;
    color: var(--text-primary);
    font-size: 28px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}
.pub-list {
    list-style: none;
    padding-left: 0;
}
.pub-item {
    margin-bottom: 0;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.pub-item:last-child {
    border-bottom: none;
}
.pub-title a {
    color: var(--accent);
    font-size: 1.25em;
    font-weight: 600;
}
.pub-title a:hover {
    color: var(--accent-hover);
}
.pub-meta {
    color: var(--text-secondary);
    font-size: 1em;
    margin-top: 0px;
}
.pub-equal-note {
    margin-top: 0px;
    margin-bottom: 0px;
    font-size: 0.8em;
    font-style: italic;
    color: var(--text-secondary);
}
.pub-cve {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.cve-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.88em;
    color: var(--text-secondary);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0px 6px;
    margin: 4px 4px 0 0;
}
.cve-badge a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: inherit;
    text-decoration: none;
}
.cve-badge a:hover {
    color: inherit;
    text-decoration: underline;
}
.cve-badge .pub-github-icon {
    color: inherit;
    transition: none;
    margin: 0;
    font-size: 1em;
}
.cve-badge .pub-github-icon:hover {
    color: inherit;
}

/* ---------- Footer ---------- */
footer {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
    align-items: center;
    padding: 24px 32px;
    border-top: 1px solid var(--border);
    margin-top: 0;
}

footer p {
    margin: 0;
}

footer a {
    color: var(--text-secondary);
    text-decoration: none;
    margin: 0 5px;
}

footer a:hover {
    color: var(--text-primary);
}

.pub-year-heading {
    color: var(--text-primary);
    margin: 28px 0 4px 0;
    font-size: 1.5em;
    font-weight: 700;
}

.article-item {
    margin-bottom: 32px;
    padding: 24px;
    background-color: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}

.article-item:hover {
    border-color: var(--accent);
}

.article-item h2 {
    margin: 0 0 12px 0;
    font-size: 1.5em;
}

.article-item .summary {
    color: var(--text-primary);
    margin-bottom: 16px;
}

.article-item .btn-more {
    color: var(--accent);
    font-weight: 600;
}

.article-item .btn-more:hover {
    text-decoration: underline;
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

/* Below this width the side panel becomes a drawer toggled from the header. */
@media (max-width: 900px) {
    .sidebar-toggle-label {
        display: inline-flex;
    }

    .sidepanel {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1000;
        flex: none;
        width: min(330px, 84vw);
        padding: 56px 24px 32px 24px;
        overflow-y: auto;
        box-shadow: 0 0 24px rgba(0, 0, 0, 0.35);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    #sidebar-toggle:checked ~ .page-wrapper .sidepanel {
        transform: translateX(0);
    }

    .sidepanel__inner {
        position: static;
    }

    .sidepanel__close {
        display: inline-flex;
        position: absolute;
        top: 10px;
        right: 12px;
        padding: 6px;
        font-size: 1.4em;
        line-height: 1;
        cursor: pointer;
        color: var(--text-secondary);
        transition: color 0.2s;
    }

    .sidepanel__close:hover {
        color: var(--accent);
    }

    .sidebar-scrim {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 999;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s ease;
    }

    #sidebar-toggle:checked ~ .page-wrapper .sidebar-scrim {
        opacity: 1;
        visibility: visible;
    }

    body:has(#sidebar-toggle:checked) {
        overflow: hidden;
    }
}

@media (max-width: 768px) {
    header {
        padding: 4px 12px;
        font-size: .8em;
    }

    header .logo {
        font-size: 1em;
    }

    header nav a {
        font-weight: 600;
        font-size: .9em;
        margin-left: 10px;
    }

    main h1 {
        font-size: 20px;
    }

    main p {
        font-size: 15px;
    }

    .sidepanel__name {
        font-size: 28px;
    }

    .sidepanel__desc {
        font-size: 15px;
    }

    .sidepanel__contact a {
        padding: 6px 5px;
        font-size: 1.5em;
    }

    .publications {
        width: 100%;
    }

    .pub-item {
        padding: 8px 0;
    }

    .pub-title a {
        font-size: 1.1em;
    }

    .pub-meta {
        font-size: 0.95em;
    }

    footer {
        flex-direction: column;
        text-align: center;
        padding: 24px 16px;
    }

    footer p {
        margin: 8px 0;
    }

    .articlecontent {
        width: 95%;
        margin: 20px auto;
    }
}

.well {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 12px;
    font-size: 0.9em;
    color: var(--text-secondary);
}

h1 .errorcode{
    font-size: 36px;
}

.papericon {
    padding: 0 5px 0 0;
}

.pub-github-icon {
    padding: 2px 0;
    margin: 0 6px;
    font-size: 1.1em;
    color: var(--text-secondary);
    transition: color 0.2s;
    vertical-align: middle;
}

.pub-github-icon:hover {
    color: var(--accent);
}

/* Table styles */
.article-entry-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-family: 'Rethink', Verdana, sans-serif;
    font-size: 0.95em;
}

.article-entry-content th, 
.article-entry-content td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.article-entry-content thead th {
    border-bottom: 2px solid var(--border);
    color: var(--text-primary);
}

.article-entry-content tr:last-child td {
    border-bottom: none;
}

