/* nosiaht — simple ascii terminal */

:root {
    --bg: #0a0a0a;
    --fg: #c8c8c8;
    --dim: #666;
    --mute: #888;
    --bright: #e8e8e8;
    --accent: #9fdf9f;
    --line: #333;
    --soft: #151515;
    --sev-c: #f08080;
    --sev-h: #e0a060;
    --sev-m: #c8b060;
    --sev-l: #777;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #fafafa;
        --fg: #222;
        --dim: #888;
        --mute: #666;
        --bright: #111;
        --accent: #1a6b1a;
        --line: #ccc;
        --soft: #f0f0f0;
        --sev-c: #b00;
        --sev-h: #b60;
        --sev-m: #860;
        --sev-l: #777;
    }
}

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

html {
    scroll-behavior: smooth;
    /* anchor jumps clear the fixed nav — height is measured into --nav-h */
    scroll-padding-top: var(--nav-h, 3.5rem);
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 14px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--accent);
    color: var(--bg);
}

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

a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

a:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: 2px;
}

/* layout
 * NOTE: do NOT set overflow-x:hidden on html/body — it forces overflow-y
 * to compute to auto and breaks position:sticky for the whole page.
 * Constrain media instead (below).
 */

html {
    max-width: 100%;
}

body {
    max-width: 100%;
}

.wrap {
    --wrap-pad-x: 2rem;
    max-width: min(128ch, 1180px);
    width: 100%;
    margin: 0 auto;
    /* top pad is small: fixed nav space comes from .nav-spacer */
    padding: 0.85rem var(--wrap-pad-x) 4rem;
    box-sizing: border-box;
    min-width: 0;
}

/* never let media blow out the page width */
img,
video,
svg,
canvas,
iframe {
    max-width: 100%;
    height: auto;
}

/* nav — FIXED site chrome (always pinned; works on all pages) */

.nav {
    --nav-pad-y: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    box-sizing: border-box;
    margin: 0;
    /* align content with .wrap column */
    padding: var(--nav-pad-y) max(var(--wrap-pad-x, 2rem), calc((100vw - min(128ch, 1180px)) / 2 + var(--wrap-pad-x, 2rem)));
    border-bottom: 1px solid var(--line);
    color: var(--dim);
    font-size: 0.92rem;
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    backdrop-filter: blur(14px) saturate(1.15);
    -webkit-backdrop-filter: blur(14px) saturate(1.15);
    transition: box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

/* solid fallback if backdrop-filter unsupported / low power */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .nav {
        background: var(--bg);
    }
}

.nav.is-stuck {
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    background: color-mix(in srgb, var(--bg) 97%, transparent);
    border-bottom-color: color-mix(in srgb, var(--line) 80%, var(--accent));
}

@media (prefers-color-scheme: light) {
    .nav.is-stuck {
        box-shadow: 0 8px 22px rgba(18, 20, 26, 0.08);
    }
}

/* reserves space so fixed nav doesn't cover page content */
.nav-spacer {
    width: 100%;
    flex-shrink: 0;
    pointer-events: none;
    height: var(--nav-h, 3.5rem);
}

.nav-brand {
    color: var(--bright);
    font-weight: 700;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.nav-brand:hover {
    color: var(--accent);
    text-decoration: none;
}

.nav-burger {
    display: none;
    appearance: none;
    border: 1px solid var(--line);
    background: var(--soft);
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 6px;
    padding: 0;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    transition: border-color 0.15s, background 0.15s;
}

.nav-burger:hover {
    border-color: var(--accent);
}

.nav-burger:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.nav-burger-bar {
    display: block;
    width: 1.05rem;
    height: 1.5px;
    background: var(--fg);
    border-radius: 1px;
    transition: transform 0.28s ease, opacity 0.2s ease;
}

.nav.is-open .nav-burger-bar:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
}

.nav.is-open .nav-burger-bar:nth-child(2) {
    opacity: 0;
}

.nav.is-open .nav-burger-bar:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.nav-links-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.85rem;
}

.nav a {
    color: var(--mute);
}

.nav a:hover,
.nav a.active {
    color: var(--bright);
    text-decoration: none;
}

.nav a.active {
    color: var(--accent);
}

.nav .sep {
    color: var(--line);
    user-select: none;
}

/* mobile / tablet: hamburger */
@media (max-width: 720px) {
    .nav {
        flex-wrap: wrap;
        align-items: center;
    }

    .nav-brand {
        order: 1;
    }

    .nav-burger {
        display: inline-flex;
        margin-left: auto;
        flex-shrink: 0;
        order: 2;
    }

    .nav-links {
        order: 3;
        width: 100%;
        flex-basis: 100%;
        display: grid;
        grid-template-rows: 0fr;
        transition: grid-template-rows 0.32s ease;
        overflow: hidden;
    }

    .nav.is-open .nav-links {
        grid-template-rows: 1fr;
    }

    .nav-links-inner {
        overflow: hidden;
        min-height: 0;
        max-height: 0;
        opacity: 0;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 0.15rem;
        transition: max-height 0.32s ease, opacity 0.22s ease, padding 0.22s ease;
        padding-top: 0;
        padding-bottom: 0;
    }

    .nav.is-open .nav-links-inner {
        max-height: 20rem;
        opacity: 1;
        padding-top: 0.75rem;
        padding-bottom: 0.15rem;
    }

    .nav-links .sep {
        display: none;
    }

    .nav-links a {
        padding: 0.55rem 0.35rem;
        border-radius: 4px;
        font-size: 0.95rem;
    }

    .nav-links a:hover,
    .nav-links a.active {
        background: color-mix(in srgb, var(--accent) 10%, transparent);
    }

    /* drawer open: full-bleed fixed panel, scroll inside if needed */
    .nav.is-open {
        z-index: 110;
        max-height: min(100vh, 100dvh);
        overflow-x: hidden;
        overflow-y: auto;
        background: var(--bg);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }
}

@media (max-width: 520px) {
    .wrap {
        --wrap-pad-x: 1rem;
    }

    .nav.is-open {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nav-links,
    .nav-burger-bar,
    .nav {
        transition: none !important;
    }
}



/* type */

.prompt {
    color: var(--dim);
    margin-bottom: 0.75rem;
}

.prompt .who {
    color: var(--accent);
}

h1 {
    color: var(--bright);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0;
    margin-bottom: 0.25rem;
}

.role {
    color: var(--dim);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

.bio {
    color: var(--fg);
    margin-bottom: 1.5rem;
}

/* ascii boxes */

.box {
    border: 1px solid var(--line);
    padding: 0.9rem 1rem;
    margin: 1.25rem 0;
    background: var(--soft);
}

.box-title {
    color: var(--accent);
    margin-bottom: 0.65rem;
    font-weight: 700;
}

.box pre,
pre.ascii {
    color: var(--dim);
    font: inherit;
    white-space: pre;
    overflow-x: auto;
    line-height: 1.35;
    margin-bottom: 0.75rem;
    max-width: 100%;
}

/* lists */

.list {
    list-style: none;
}

.list li {
    padding: 0.2rem 0;
    color: var(--fg);
}

.list li::before {
    content: "* ";
    color: var(--dim);
}

.list.num li {
    counter-increment: n;
}

.list.num {
    counter-reset: n;
}

.list.num li::before {
    content: counter(n, decimal-leading-zero) ". ";
    color: var(--dim);
    font-variant-numeric: tabular-nums;
}

/* key-value */

.kv {
    display: grid;
    gap: 0.35rem;
}

.kv-row {
    display: grid;
    grid-template-columns: 10ch 1fr;
    gap: 0.75rem;
}

.kv-k {
    color: var(--dim);
}

.kv-v a {
    color: var(--bright);
}

.kv-v a:hover {
    color: var(--accent);
}

/* tags as plain text */

.tags {
    color: var(--mute);
    word-break: break-word;
}

.tags span::after {
    content: " · ";
    color: var(--line);
}

.tags span:last-child::after {
    content: "";
}

/* section labels */

.sec {
    margin: 1.75rem 0 0.65rem;
    color: var(--accent);
    font-weight: 700;
}

.sec::before {
    content: "// ";
    color: var(--dim);
    font-weight: 400;
}

/* stats line */

.stats {
    color: var(--mute);
    margin: 0.75rem 0 1.25rem;
    font-variant-numeric: tabular-nums;
}

.stats b {
    color: var(--bright);
    font-weight: 700;
}

/* ascii pre (home boxes etc.) */

.ascii {
    white-space: pre;
    font: inherit;
    color: var(--dim);
    line-height: 1.35;
    margin: 0.25rem 0 1rem;
    overflow-x: auto;
}

/* ascii summary box — full content width */

.ascii-box {
    width: 100%;
    margin: 0.75rem 0 1.25rem;
    background: var(--soft);
    border: 1px solid var(--line);
}

.ascii-box-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.ascii-box-row > span {
    padding: 0.45rem 0.75rem;
    border-right: 1px solid var(--line);
    color: var(--fg);
    font-variant-numeric: tabular-nums;
}

.ascii-box-row > span:last-child {
    border-right: none;
}

.ascii-box-head > span {
    color: var(--dim);
    border-bottom: 1px solid var(--line);
    font-size: 0.85rem;
}

/*
 * Pure ASCII CVE table
 * Fixed monospace columns with +---+ borders (not HTML table chrome).
 */
.ascii,
.cve-stats {
    display: block;
    margin: 0.85rem 0 1.1rem;
    padding: 0;
    font: inherit;
    font-variant-numeric: tabular-nums;
    line-height: 1.45;
    color: var(--dim);
    white-space: pre;
    overflow-x: auto;
    max-width: 100%;
    background: transparent;
    border: 0;
}

.ascii-table {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0.25rem 0 1.25rem;
    overflow-x: auto;
    font-variant-numeric: tabular-nums;
    line-height: 1.45;
    color: var(--dim);
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 2px;
    padding: 0.65rem 0.75rem 0.75rem;
}

/* full .wrap content column */
.ascii-table-full {
    width: 100%;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.ascii-table-full .ascii-body {
    width: 100%;
}

.ascii-table-full .ascii-frame,
.ascii-table-full .ascii-header,
.ascii-table-full .ascii-row {
    box-sizing: border-box;
}

.ascii-frame,
.ascii-header,
.ascii-row {
    white-space: pre;
    font: inherit;
    margin: 0;
    min-width: max-content;
}

.ascii-header {
    color: var(--mute);
    font-weight: 700;
}

.ascii-row {
    color: var(--fg);
}

.ascii-row:hover {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--bright);
}

.ascii-row a {
    color: var(--bright);
    font-weight: 700;
    text-decoration: none;
}

.ascii-row a:hover {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ascii-row.is-hidden {
    display: none;
}

.sev {
    font-weight: 700;
    text-transform: none;
}

.sev-c { color: var(--sev-c); }
.sev-h { color: var(--sev-h); }
.sev-m { color: var(--sev-m); }
.sev-l { color: var(--sev-l); }

@media (max-width: 640px) {
    .ascii-table {
        font-size: 0.82rem;
        padding: 0.5rem 0.55rem 0.6rem;
    }
}

/* filter */

.filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: center;
    margin: 0 0 0.75rem;
}

.filter input {
    flex: 1 1 200px;
    min-width: 0;
    background: var(--soft);
    border: 1px solid var(--line);
    color: var(--bright);
    font: inherit;
    padding: 0.4rem 0.6rem;
    outline: none;
}

.filter input:focus {
    border-color: var(--accent);
}

.filter input::placeholder {
    color: var(--dim);
}

#cve-count {
    color: var(--dim);
    font-size: 0.85rem;
}

.is-hidden {
    display: none;
}

/* footer */

.foot {
    margin-top: 2.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
    color: var(--dim);
    font-size: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1rem;
}

.foot a {
    color: var(--mute);
}

.cat {
    cursor: default;
}

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

/* avatar */

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 2px;
    border: 1px solid var(--line);
    object-fit: cover;
    image-rendering: auto;
    display: block;
}

.avatar-lg {
    width: 160px;
    height: 160px;
    max-width: 100%;
    border-radius: 6px;
    border: 1px solid var(--line);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

/* contact page layout: photo right of kv rows (below title), top on mobile */
.contact-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1.25rem 2.5rem;
    align-items: start; /* top of photo = top of contact fields */
    margin-top: 0.35rem;
}

.contact-main {
    min-width: 0;
}

.contact-main .kv {
    margin-top: 0;
}

.contact-photo {
    justify-self: end;
    text-align: center;
    max-width: 180px;
    /* keep portrait level with the info list, not the page heading */
    align-self: start;
}

.contact-photo .avatar-lg {
    margin: 0 auto;
}

.contact-name {
    margin-top: 0.75rem;
    color: var(--bright);
    font-weight: 700;
    font-size: 0.92rem;
    letter-spacing: -0.02em;
}

.contact-tag {
    margin-top: 0.2rem;
    color: var(--dim);
    font-size: 0.8rem;
}

@media (max-width: 720px) {
    .contact-layout {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    /* photo first on mobile, then contact info */
    .contact-photo {
        order: -1;
        justify-self: center;
        max-width: 200px;
    }

    .contact-photo .avatar-lg {
        width: 140px;
        height: 140px;
    }
}

@media (max-width: 720px) {
    .wrap {
        --wrap-pad-x: 1.25rem;
        max-width: 100%;
        padding: 0.75rem var(--wrap-pad-x) 3.5rem;
    }

    .prompt {
        font-size: 0.82rem;
        overflow-x: auto;
        white-space: nowrap;
    }
}

@media (max-width: 520px) {
    .wrap {
        --wrap-pad-x: 1rem;
        padding: 0.65rem var(--wrap-pad-x) 3rem;
    }

    .kv-row {
        grid-template-columns: 1fr;
        gap: 0.1rem;
        margin-bottom: 0.45rem;
    }

    .name,
    h1 {
        word-break: break-word;
    }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}
