/* ==========================================================================
   ThreatCentric theme — design tokens
   ========================================================================== */

:root {
    --bg: #0b0d10;
    --bg-raised: #12161b;
    --bg-inset: #0e1114;
    --border: #232a31;
    --border-soft: #1a2027;

    --text: #e7e9ec;
    --text-muted: #97a1ab;
    --text-faint: #5f6b76;

    --accent: #8b7cf6;
    --accent-dim: #6d5fd1;
    --accent-contrast: #0b0d10;

    --mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;

    --sev-critical: #ef4444;
    --sev-high: #f97316;
    --sev-medium: #eab308;
    --sev-low: #38bdf8;
    --sev-info: #94a3b8;

    --radius-s: 4px;
    --radius-m: 8px;
    --radius-l: 14px;

    --content-width: 1180px;
    --content-width-narrow: 760px;
}

* { box-sizing: border-box; }

html {
    background: var(--bg);
    color-scheme: dark;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.wrap {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 28px;
}

.wrap--narrow { max-width: var(--content-width-narrow); }

/* ==========================================================================
   Header / nav
   ========================================================================== */

.site-header {
    border-bottom: 1px solid var(--border-soft);
    background: rgba(11, 13, 16, 0.85);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 40;
}

.site-header-inner {
    display: flex;
    align-items: center;
    gap: 32px;
    height: 68px;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 600;
    letter-spacing: 0.01em;
    flex-shrink: 0;
}
.site-brand:hover { text-decoration: none; color: var(--text); }
.site-brand-mark {
    font-family: var(--mono);
    color: var(--accent);
    font-weight: 700;
}
.site-brand-logo { height: 38px; width: auto; }

.site-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    gap: 24px;
}

.site-nav-list {
    list-style: none;
    display: flex;
    gap: 22px;
    margin: 0;
    padding: 0;
}

.site-nav-item a {
    color: var(--text-muted);
    font-size: 14.5px;
    font-weight: 500;
}
.site-nav-item a:hover,
.site-nav-item a[aria-current="page"] {
    color: var(--text);
    text-decoration: none;
}

.site-search-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius-m);
    padding: 7px 12px;
    font-size: 13.5px;
    cursor: pointer;
    font-family: var(--sans);
}
.site-search-trigger:hover { border-color: var(--accent-dim); color: var(--text); }

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 34px;
    height: 34px;
    background: none;
    border: none;
    cursor: pointer;
}
.nav-toggle span {
    display: block;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
}

@media (max-width: 760px) {
    .site-nav {
        display: none;
        position: absolute;
        top: 68px; left: 0; right: 0;
        background: var(--bg-raised);
        border-bottom: 1px solid var(--border);
        padding: 20px 28px;
        flex-direction: column;
        align-items: flex-start;
        gap: 18px;
    }
    .site-nav.is-open { display: flex; }
    .site-nav-list { flex-direction: column; gap: 14px; }
    .nav-toggle { display: flex; }
}

/* ==========================================================================
   Hub intro / archive header
   ========================================================================== */

.hub-intro { padding: 56px 0 28px; max-width: 960px; }
.hub-intro-kicker {
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 12.5px;
    color: var(--accent);
    margin: 0 0 10px;
}
.hub-intro-title {
    font-size: 34px;
    line-height: 1.25;
    margin: 0;
    font-weight: 650;
    text-wrap: balance;
}
.hub-intro--archive .hub-intro-title { font-size: 30px; }
.hub-intro-desc { color: var(--text-muted); margin-top: 10px; }

.hub-intro--home {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}
.hub-intro--home .hub-intro-kicker { margin: 14px 0 0; }

/* ==========================================================================
   Author archive header
   ========================================================================== */

.author-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 56px 0 40px;
    max-width: 720px;
}
.author-header-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.author-header-name { font-size: 28px; line-height: 1.25; margin: 0 0 8px; font-weight: 650; }
.author-header-bio { color: var(--text-muted); font-size: 15px; line-height: 1.55; margin: 0 0 10px; }
.author-header-location { color: var(--text-faint); font-size: 13px; margin: 0 0 10px; }
.author-header-social {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    font-family: var(--mono);
    font-size: 12.5px;
}
.author-header-social a { color: var(--accent); }
.author-header-social a:hover { color: var(--accent-dim); }

@media (max-width: 560px) {
    .author-header { flex-direction: column; align-items: flex-start; gap: 16px; }
}

/* ==========================================================================
   Featured post (homepage hero)
   ========================================================================== */

.featured-post {
    display: block;
    background: var(--bg-raised);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-l);
    overflow: hidden;
    margin-bottom: 40px;
    transition: border-color 0.15s ease;
}
.featured-post:hover { border-color: var(--accent-dim); }
.featured-post-link {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr);
    align-items: stretch;
    color: var(--text);
}
.featured-post-link:hover { text-decoration: none; }
.featured-post-image { overflow: hidden; background: var(--bg-inset); min-height: 220px; }
.featured-post-image img { width: 100%; height: 100%; object-fit: cover; }
.featured-post-body { padding: 26px 30px; display: flex; flex-direction: column; justify-content: center; }
.featured-post-kicker {
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11.5px;
    color: var(--accent);
    margin: 0 0 10px;
}
.featured-post-title {
    font-size: 25px;
    line-height: 1.3;
    margin: 6px 0 10px;
    font-weight: 650;
    text-wrap: balance;
}
.featured-post-excerpt {
    color: var(--text-muted);
    font-size: 14.5px;
    line-height: 1.55;
    margin: 0 0 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.featured-post-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 12px;
    font-size: 12.5px;
    color: var(--text-faint);
    font-family: var(--mono);
}
.featured-post-reading-time { display: inline-flex; align-items: center; gap: 4px; }

@media (max-width: 760px) {
    .featured-post-link { grid-template-columns: 1fr; }
    .featured-post-image { aspect-ratio: 16 / 9; min-height: 0; }
    .featured-post-body { padding: 22px 22px 26px; }
    .featured-post-title { font-size: 23px; }
}

/* ==========================================================================
   Post grid / cards
   ========================================================================== */

.post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    padding-bottom: 60px;
}

@media (max-width: 980px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .post-grid { grid-template-columns: 1fr; } }

.post-card {
    background: var(--bg-raised);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-l);
    overflow: hidden;
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.post-card:hover { border-color: var(--accent-dim); transform: translateY(-2px); }
.post-card-link { color: var(--text); display: block; }
.post-card-link:hover { text-decoration: none; }

.post-card-image { aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-inset); }
.post-card-image img { width: 100%; height: 100%; object-fit: cover; }

.post-card-body { padding: 20px 22px 22px; }

.post-card-title {
    font-size: 19px;
    line-height: 1.35;
    margin: 8px 0 8px;
    font-weight: 620;
}

.post-card-excerpt {
    color: var(--text-muted);
    font-size: 14.5px;
    line-height: 1.55;
    margin: 0 0 14px;
}

.post-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    font-size: 12.5px;
    color: var(--text-faint);
    font-family: var(--mono);
}
.post-card-reading-time { display: inline-flex; align-items: center; gap: 4px; }

/* ==========================================================================
   Tag pills + convention badges (severity / actor / malware / mitre)
   ========================================================================== */

.tag-pills { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.tag-pills--post { margin-bottom: 18px; }

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--mono);
    font-size: 11.5px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 100px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    line-height: 1.6;
}
.tag-pill a { color: inherit; }
.tag-pill a:hover { text-decoration: none; }

/* JS re-classes convention tags (category:value) with these modifiers */
.tag-pill--badge { border-color: transparent; color: var(--accent-contrast); font-weight: 600; }
.tag-pill-cat { opacity: 0.75; margin-right: 1px; }

.tag-pill--severity-critical { background: var(--sev-critical); color: #1a0505; }
.tag-pill--severity-high     { background: var(--sev-high); color: #1a0f02; }
.tag-pill--severity-medium   { background: var(--sev-medium); color: #1a1502; }
.tag-pill--severity-low      { background: var(--sev-low); color: #051620; }
.tag-pill--severity-info,
.tag-pill--severity-unknown  { background: var(--sev-info); color: #0d1114; }

.tag-pill--actor {
    background: transparent;
    border-color: var(--accent-dim);
    color: var(--accent);
}
.tag-pill--malware {
    background: transparent;
    border-color: #d9531e55;
    color: #e77a49;
}
.tag-pill--mitre {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
    font-weight: 600;
}
.tag-pill--mitre a { display: inline-flex; align-items: center; gap: 4px; }

/* ==========================================================================
   Post header / content
   ========================================================================== */

.post-header { padding-top: 48px; }
.post-title { font-size: 40px; line-height: 1.2; margin: 0 0 14px; font-weight: 680; letter-spacing: -0.01em; }
.post-excerpt { font-size: 19px; color: var(--text-muted); margin: 0 0 22px; line-height: 1.55; }

.post-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13.5px;
    color: var(--text-faint);
    padding-bottom: 36px;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 36px;
    font-family: var(--mono);
}
.post-meta-author { display: inline-flex; align-items: center; gap: 10px; color: var(--accent); font-weight: 600; font-size: 16px; }
.post-meta-author:hover { color: var(--accent-dim); text-decoration: none; }
.post-meta-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.post-meta-reading-time { display: inline-flex; align-items: center; gap: 4px; }
.post-meta-sep { opacity: 0.5; }

.post-feature-image { margin: 0 0 40px; }
.post-feature-image img { width: 100%; border-radius: var(--radius-l); border: 1px solid var(--border-soft); }
.post--page .post-feature-image { margin-top: 32px; }

.post-content { font-size: 18px; line-height: 1.75; }
.post-content > * + * { margin-top: 1.4em; }
.post-content h2 { font-size: 27px; margin-top: 2em; font-weight: 650; }
.post-content h3 { font-size: 22px; margin-top: 1.8em; font-weight: 620; }
.post-content p { margin: 0; }
.post-content blockquote {
    margin: 0;
    padding: 4px 0 4px 20px;
    border-left: 3px solid var(--accent);
    color: var(--text-muted);
    font-style: italic;
}
.post-content ul, .post-content ol { padding-left: 1.4em; }
.post-content li + li { margin-top: 0.4em; }
.post-content hr { border: none; border-top: 1px solid var(--border-soft); }
.post-content strong { color: #fff; }
.post-content img { border-radius: var(--radius-m); }
.post-content figcaption { font-size: 13.5px; color: var(--text-faint); text-align: center; margin-top: 10px; }

/* Koenig editor's "wide" and "full bleed" image layout options */
.kg-width-wide {
    width: 1040px;
    max-width: 1040px;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}
.kg-width-full {
    position: relative;
    width: 100vw;
    max-width: 100vw;
    left: 50%;
    margin-left: -50vw;
}
.kg-width-full img { border-radius: 0; }
@media (max-width: 1040px) {
    .kg-width-wide {
        width: 100%;
        max-width: 100%;
        left: 0;
        transform: none;
    }
}

.post-content :not(pre) > code {
    font-family: var(--mono);
    background: var(--bg-inset);
    border: 1px solid var(--border-soft);
    border-radius: 4px;
    padding: 0.1em 0.4em;
    font-size: 0.87em;
    color: #e5c07b;
}

/* ==========================================================================
   Code blocks + syntax highlighting tokens
   ========================================================================== */

.kg-code-card, .post-content pre {
    background: var(--bg-inset);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-m);
    padding: 18px 20px;
    overflow-x: auto;
    position: relative;
}
.post-content pre code {
    font-family: var(--mono);
    font-size: 14.5px;
    line-height: 1.65;
    color: var(--text);
    background: none;
    border: none;
    padding: 0;
}

.code-lang-tag {
    position: absolute;
    top: 10px; right: 14px;
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
}

.tok-comment  { color: var(--text-faint); font-style: italic; }
.tok-string   { color: #9ece6a; }
.tok-keyword  { color: var(--accent); font-weight: 600; }
.tok-number   { color: #e0af68; }
.tok-func     { color: #7dcfff; }
.tok-hash     { color: #e5c07b; }
.tok-variable { color: #f7768e; }
.tok-punct    { color: var(--text-muted); }

/* ==========================================================================
   Tables — generic, IOC, and MITRE ATT&CK
   ========================================================================== */

.kg-table-card { overflow-x: auto; }
.post-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14.5px;
}
.post-content th, .post-content td {
    border: 1px solid var(--border-soft);
    padding: 9px 13px;
    text-align: left;
    vertical-align: top;
}
.post-content th {
    background: var(--bg-raised);
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.post-content tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }

/* Auto-applied by table-enhance.js when a table looks like an IOC or ATT&CK table */
.data-table--ioc td,
.data-table--ioc th:not(:first-child) {
    font-family: var(--mono);
    font-size: 13.5px;
}
.data-table--ioc td:hover { background: rgba(139, 124, 246, 0.06); }

.data-table--mitre td, .data-table--mitre th { font-family: var(--mono); font-size: 13.5px; }
.data-table--mitre .mitre-id-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--accent);
    font-weight: 600;
    white-space: nowrap;
}

.copy-cell {
    position: relative;
    cursor: pointer;
}
.copy-cell:hover::after {
    content: "click to copy";
    position: absolute;
    top: -22px; left: 0;
    font-family: var(--sans);
    font-size: 10.5px;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-faint);
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: 4px;
    white-space: nowrap;
}
.copy-cell.is-copied::after {
    content: "copied!";
    color: var(--accent);
}

/* ==========================================================================
   Callout / bookmark cards (Koenig)
   ========================================================================== */

.kg-callout-card {
    display: flex;
    gap: 12px;
    padding: 16px 18px;
    border-radius: var(--radius-m);
    border: 1px solid var(--border-soft);
    background: var(--bg-raised);
}
.kg-bookmark-card a {
    display: flex;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-m);
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
}
.kg-bookmark-content { padding: 16px 20px; flex: 1; }
.kg-bookmark-title { font-weight: 620; margin-bottom: 6px; }
.kg-bookmark-description { color: var(--text-muted); font-size: 14px; }
.kg-bookmark-metadata { margin-top: 10px; font-size: 12.5px; color: var(--text-faint); }
.kg-bookmark-thumbnail { flex-shrink: 0; width: 180px; }
.kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; }

/* ==========================================================================
   Adjacent post nav
   ========================================================================== */

.post-adjacent {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--border-soft);
}
.post-adjacent-link {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-m);
    color: var(--text);
}
.post-adjacent-link:hover { border-color: var(--accent-dim); text-decoration: none; }
.post-adjacent-link--next { text-align: right; grid-column: 2; }
.post-adjacent-label { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.post-adjacent-title { font-size: 15px; font-weight: 550; }

@media (max-width: 640px) {
    .post-adjacent { grid-template-columns: 1fr; }
    .post-adjacent-link--next { grid-column: 1; text-align: left; }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer { border-top: 1px solid var(--border-soft); margin-top: 60px; padding: 32px 0; }
.site-footer-inner {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: var(--text-faint);
}
.site-footer-nav { display: flex; align-items: center; gap: 16px; }
.site-footer-nav a { color: var(--accent); }
.site-footer-nav a:hover { color: var(--accent-dim); }
.site-footer-nav ul {
    display: flex;
    align-items: center;
    gap: 16px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.site-footer-nav li { margin: 0; padding: 0; }

/* ==========================================================================
   Error page
   ========================================================================== */

.error-page { padding: 100px 28px; text-align: center; }
.error-page-code { font-family: var(--mono); color: var(--accent); font-size: 15px; letter-spacing: 0.08em; }
.error-page-title { font-size: 30px; margin: 8px 0 16px; }
.error-page-message { color: var(--text-muted); }
.error-page-link { display: inline-block; margin-top: 24px; }
