/* ==========================================================================
   xysec Ghost Theme — screen.css
   Security for the AI Era
   ========================================================================== */

/* --- Fonts (self-hosted) --- */
@font-face {
    font-family: 'JetBrains Mono';
    src: url('../fonts/JetBrainsMono-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'JetBrains Mono';
    src: url('../fonts/JetBrainsMono-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('../fonts/Inter-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('../fonts/Inter-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('../fonts/Inter-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* --- Variables --- */
:root {
    --color-bg: #0a0a0a;
    --color-surface: #141414;
    --color-card: #141414;
    --color-elevated: #1a1a1a;
    --color-border: #2a2a2a;
    --color-border-light: #2a2a2a;
    --color-accent: #c75a5a;
    --color-accent-hover: #a04848;
    --color-accent-muted: #3d2020;
    --color-accent-red: #c75a5a;
    --color-accent-red-hover: #a04848;
    --color-accent-red-bg: #3d2020;
    --color-accent-teal: #5ac7c7;
    --color-accent-teal-hover: #489e9e;
    --color-accent-teal-bg: #1a3d3d;
    --color-accent-gold: #d4a84b;
    --color-teal: #5ac7c7;
    --color-teal-hover: #489e9e;
    --color-teal-dark: #1a3d3d;
    --color-text: #ffffff;
    --color-text-dim: #a0a0a0;
    --color-text-body: #a0a0a0;
    --color-text-muted: #666666;
    --color-amber: #d4a84b;
    --font-mono: 'JetBrains Mono', 'IBM Plex Mono', 'Fira Code', ui-monospace, monospace;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --content-width: 1000px;
    --wide-width: 1200px;
}

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

/* --- Base --- */
html {
    font-size: 62.5%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-size: 1.8rem;
    line-height: 1.7;
    color: var(--color-text);
    background: var(--color-bg);
    background-image: linear-gradient(180deg, #0a0a0a 0%, #0d0d0d 50%, #0a0a0a 100%);
    min-height: 100vh;
}

a {
    color: var(--color-teal);
    text-decoration: none;
    transition: color 0.2s, text-decoration 0.2s;
}
a:hover {
    text-decoration: underline;
    color: var(--color-teal-hover);
}

img { max-width: 100%; height: auto; display: block; }

/* --- Layout --- */
.site-main {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 4rem 2rem 8rem;
}

.post-full-width .site-main,
.post-full-width .post-full-content {
    max-width: var(--wide-width);
}

/* --- Header --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
}

.site-header-inner {
    max-width: var(--wide-width);
    margin: 0 auto;
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    text-decoration: none;
}
.site-logo:hover { text-decoration: none; }

.site-logo img {
    height: 28px;
    width: auto;
}

.site-logo-text {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: 0.05em;
    text-transform: lowercase;
}

.site-nav {
    display: flex;
    gap: 2.4rem;
    align-items: center;
}

.nav-link {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--color-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-decoration: none;
    transition: color 0.2s;
}
.nav-link:hover {
    color: var(--color-teal);
    text-decoration: none;
}

/* --- Hero (Homepage) --- */
.site-hero {
    text-align: center;
    padding: 8rem 2rem 5rem;
    position: relative;
    overflow: hidden;
}

.hero-grid-bg {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(90, 199, 199, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(90, 199, 199, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.site-title {
    font-family: var(--font-mono);
    font-size: 4.8rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: 0.02em;
    margin-bottom: 1rem;
}

.site-tagline {
    font-family: var(--font-mono);
    font-size: 1.6rem;
    color: var(--color-teal);
    font-weight: 400;
    margin-bottom: 2rem;
}

.tagline-prefix {
    color: var(--color-text-dim);
}

.hero-terminal {
    margin-top: 1.6rem;
}

/* --- Post Feed --- */
.post-feed {
    display: grid;
    gap: 2.4rem;
}

/* --- Post Card --- */
.post-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.post-card:hover {
    border-color: var(--color-accent);
    border-left: 3px solid var(--color-accent);
    box-shadow: 0 0 24px rgba(199, 90, 90, 0.15);
}

.post-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}
.post-card-link:hover { text-decoration: none; color: inherit; }

.post-card-image-wrap {
    position: relative;
    overflow: hidden;
}

.post-card-image {
    height: 200px;
    background-size: cover;
    background-position: center;
    transition: transform 0.4s ease;
}

.post-card:hover .post-card-image {
    transform: scale(1.03);
}

.scan-lines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
    pointer-events: none;
}

.post-card-content {
    padding: 2.4rem;
}

.post-card-tag {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.8rem;
    display: inline-block;
}

.post-card-title {
    font-family: var(--font-mono);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.3;
    margin-bottom: 0.8rem;
}

.post-card-excerpt {
    font-family: var(--font-sans);
    font-size: 1.5rem;
    color: var(--color-text-dim);
    line-height: 1.6;
    margin-bottom: 1.2rem;
}

.post-card-meta {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    color: var(--color-text-dim);
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.post-card-meta-sep { opacity: 0.5; }

/* --- Post Full --- */
.post-full-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--color-border);
}

.post-full-tag {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    display: inline-block;
    margin-bottom: 1.2rem;
    font-weight: 700;
}

.post-full-title {
    font-family: var(--font-mono);
    font-size: 4rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
    margin-bottom: 1.6rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.post-full-meta {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    color: var(--color-text-muted);
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.post-full-meta-sep { opacity: 0.5; }

.post-full-image {
    margin-bottom: 4rem;
    border-radius: 4px;
    overflow: hidden;
}
.post-full-image img {
    width: 100%;
}
.post-full-image figcaption {
    font-family: var(--font-sans);
    font-size: 1.3rem;
    color: var(--color-text-muted);
    text-align: center;
    padding-top: 1rem;
}

/* --- Selection Color --- */
::selection {
    background: rgba(199, 90, 90, 0.3);
    color: #ffffff;
}

/* --- Post Content --- */
.post-full-content {
    font-family: var(--font-sans);
    font-size: 1.8rem;
    line-height: 1.85;
    color: var(--color-text-body);
    max-width: 750px;
    margin-left: auto;
    margin-right: auto;
}

/* Drop cap */
.post-full-content > p:first-of-type::first-letter {
    font-family: var(--font-mono);
    font-size: 3.5em;
    float: left;
    line-height: 0.85;
    margin-right: 0.12em;
    margin-top: 0.05em;
    margin-bottom: -0.1em;
    color: var(--color-accent);
}
.post-full-content > p:first-of-type + p {
    clear: left;
}

.post-full-content a {
    color: var(--color-teal);
    text-decoration: none;
    transition: color 0.2s, text-decoration-color 0.2s;
}

.post-full-content a:hover {
    color: var(--color-teal-hover);
    text-decoration: underline;
}

.post-full-content h2 {
    font-family: var(--font-mono);
    font-size: 2.8rem;
    font-weight: 700;
    margin-top: 5rem;
    margin-bottom: 1.6rem;
    color: var(--color-text);
    border-left: 3px solid var(--color-accent);
    padding-left: 1rem;
    padding-top: 0.5rem;
}

.post-full-content h3 {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    margin-top: 3.5rem;
    margin-bottom: 1.2rem;
    color: #cccccc;
}

.post-full-content h4 {
    font-family: var(--font-mono);
    font-size: 1.6rem;
    font-weight: 700;
    margin-top: 2.4rem;
    margin-bottom: 1rem;
    color: var(--color-accent-teal);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Lead paragraph */
.post-full-content > p:first-of-type {
    font-size: 1.9rem;
    color: #cccccc;
    line-height: 1.8;
}

.post-full-content p {
    margin-bottom: 2.2rem;
}

.post-full-content ul,
.post-full-content ol {
    margin-bottom: 2rem;
    padding-left: 2.4rem;
}

.post-full-content li {
    margin-bottom: 0.6rem;
}

.post-full-content blockquote,
blockquote {
    border-left: 3px solid var(--color-accent-red);
    padding: 1.5em 2em;
    margin: 2.5em 0;
    background: rgba(199, 90, 90, 0.04);
    font-style: normal;
}
blockquote p {
    font-size: 1.25em;
    line-height: 1.5;
    color: var(--color-text);
    margin: 0;
}
/* Blockquote alt - centered with top/bottom borders */
.post-full-content aside,
.kg-blockquote-alt {
    border-left: none;
    border-top: 2px solid var(--color-accent-teal);
    border-bottom: 2px solid var(--color-accent-teal);
    text-align: center;
    padding: 2.5em 2em;
    margin: 3em 0;
    font-family: var(--font-mono);
    font-size: 1.3em;
    line-height: 1.5;
    color: var(--color-text);
    background: rgba(90,199,199,0.04);
}

.post-full-content code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--color-elevated);
    border: 1px solid var(--color-border);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    color: var(--color-accent-teal);
}

/* Inline stat/sub styling - override browser subscript defaults */
.post-full-content sub {
    vertical-align: baseline;
    font-size: inherit;
    line-height: inherit;
    color: var(--color-teal);
    font-weight: 500;
}

/* Highlight/mark styling */
.post-full-content mark {
    background: transparent;
    color: var(--color-text);
    box-shadow: inset 0 -0.4em 0 rgba(199,90,90,0.25);
}

.post-full-content pre {
    background: var(--color-surface);
    border-left: 3px solid var(--color-teal);
    border-radius: 4px;
    padding: 2rem;
    margin: 2.4rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.post-full-content pre code {
    background: none;
    padding: 0;
    font-size: 1.4rem;
    line-height: 1.6;
    color: var(--color-text);
}

.post-full-content hr {
    border: none;
    height: 1px;
    background: var(--color-border);
    margin: 4rem auto;
    max-width: 200px;
    position: relative;
}

.post-full-content hr::after {
    content: '◆';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--color-bg);
    padding: 0 1rem;
    color: var(--color-border);
    font-size: 1.2rem;
}

.post-full-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2.4rem 0;
    font-size: 1.5rem;
}

.post-full-content thead th {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-teal);
    background: var(--color-surface);
    border-bottom: 2px solid var(--color-accent);
    padding: 1.2rem 1rem;
    text-align: left;
}

.post-full-content tbody td {
    padding: 1.2rem 1rem;
    border-bottom: 1px solid var(--color-border-light);
}

.post-full-content tbody tr:hover {
    background: var(--color-elevated);
}

/* --- Ghost Cards (kg-*) --- */
.kg-width-wide {
    max-width: var(--wide-width);
    margin-left: calc(50% - min(50vw - 2rem, var(--wide-width) / 2));
    width: min(100vw - 4rem, var(--wide-width));
}

.kg-width-full {
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    width: 100vw;
}

.kg-width-full img { width: 100%; }

/* Gallery */
.kg-gallery-container {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin: 2.4rem 0;
}
.kg-gallery-row {
    display: flex;
    gap: 0.6rem;
}
.kg-gallery-image {
    flex: 1;
}
.kg-gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Bookmark */
.kg-bookmark-card {
    margin: 2.4rem 0;
}
.kg-bookmark-container {
    display: flex;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-card);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s;
}
.kg-bookmark-container:hover {
    border-color: var(--color-accent);
    text-decoration: none;
    color: inherit;
}
.kg-bookmark-content {
    flex: 1;
    padding: 2rem;
}
.kg-bookmark-title {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.6rem;
}
.kg-bookmark-description {
    font-size: 1.3rem;
    color: var(--color-text-dim);
    line-height: 1.5;
    margin-bottom: 1rem;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    display: -webkit-box;
    overflow: hidden;
}
.kg-bookmark-metadata {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.2rem;
    color: var(--color-text-dim);
}
.kg-bookmark-icon {
    width: 16px;
    height: 16px;
}
.kg-bookmark-author {
    color: var(--color-text-muted);
}
.kg-bookmark-publisher {
    color: var(--color-text-muted);
}
.kg-bookmark-thumbnail {
    width: 160px;
    flex-shrink: 0;
}
.kg-bookmark-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Callout */
.kg-callout-card {
    background: var(--color-surface);
    border-left: 3px solid var(--color-accent-red);
    border-radius: 0;
    padding: 1.5em 2em;
    margin: 2.4rem 0;
    display: flex;
    gap: 1.2rem;
    align-items: flex-start;
    font-family: var(--font-sans);
}
.kg-callout-emoji {
    font-size: 0;
    line-height: 0;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    overflow: hidden;
    display: none;
}
/* SVG icon pseudo-elements for callout variants */
.kg-callout-card::before {
    content: '';
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin-top: 0.15em;
    opacity: 0.85;
}
/* Red: warning/alert triangle */
.kg-callout-card-red::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%23c75a5a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M12 7.75v5M12 16.25v.01M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3C/svg%3E");
}
/* Blue: info circle */
.kg-callout-card-blue::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' stroke='%235ac7c7' stroke-width='1.5'/%3E%3Cpath stroke='%235ac7c7' stroke-width='1.5' stroke-linecap='round' d='M12 8h.01M12 11v5'/%3E%3C/svg%3E");
}
/* Yellow: chart/analytics */
.kg-callout-card-yellow::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%23d4a84b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M3 3v18h18M7 16l4-4 3 3 4-4'/%3E%3C/svg%3E");
}
/* Grey: document/note */
.kg-callout-card-grey::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%23666666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z'/%3E%3Cpath stroke='%23666666' stroke-width='1.5' d='M14 2v6h6M8 13h8M8 17h8M8 9h2'/%3E%3C/svg%3E");
}
/* White: same as grey */
.kg-callout-card-white::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' viewBox='0 0 24 24'%3E%3Cpath stroke='%23666666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6z'/%3E%3Cpath stroke='%23666666' stroke-width='1.5' d='M14 2v6h6M8 13h8M8 17h8M8 9h2'/%3E%3C/svg%3E");
}
/* Accent: crosshair/target */
.kg-callout-card-accent::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' stroke='%23c75a5a' stroke-width='1.5'/%3E%3Ccircle cx='12' cy='12' r='4' stroke='%23c75a5a' stroke-width='1.5'/%3E%3Cpath stroke='%23c75a5a' stroke-width='1.5' stroke-linecap='round' d='M12 2v4M12 18v4M2 12h4M18 12h4'/%3E%3C/svg%3E");
}
/* Default (no color class): use accent style */
.kg-callout-card:not([class*='-red']):not([class*='-blue']):not([class*='-yellow']):not([class*='-grey']):not([class*='-white']):not([class*='-accent'])::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' stroke='%23c75a5a' stroke-width='1.5'/%3E%3Cpath stroke='%23c75a5a' stroke-width='1.5' stroke-linecap='round' d='M12 8h.01M12 11v5'/%3E%3C/svg%3E");
}
.kg-callout-text {
    font-family: var(--font-sans);
    font-size: 1.5rem;
    line-height: 1.7;
    color: var(--color-text-body);
}
/* Color variants based on Ghost's backgroundColor attribute */
.kg-callout-card-red { border-left-color: var(--color-accent-red); background: rgba(199,90,90,0.06); }
.kg-callout-card-blue { border-left-color: var(--color-accent-teal); background: rgba(90,199,199,0.06); }
.kg-callout-card-yellow { border-left-color: var(--color-accent-gold); background: rgba(212,168,75,0.06); }
.kg-callout-card-grey { border-left-color: var(--color-border); background: var(--color-surface); }
.kg-callout-card-white { border-left-color: var(--color-text-muted); background: var(--color-surface); }
.kg-callout-card-accent { border-left-color: var(--color-accent-red); background: rgba(199,90,90,0.06); }

/* Toggle */
.kg-toggle-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    margin: 2.4rem 0;
    padding: 0;
}
.kg-toggle-heading {
    font-family: var(--font-mono);
    font-size: 1.6rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.6rem 2rem;
    color: var(--color-text);
}
.kg-toggle-heading svg {
    color: var(--color-text-muted);
    flex-shrink: 0;
}
.kg-toggle-content {
    padding: 0 2rem 1.6rem;
    font-size: 1.5rem;
    line-height: 1.7;
    color: var(--color-text-body);
}
.kg-toggle-card[data-kg-toggle-state="close"] .kg-toggle-content {
    display: none;
}

/* Button */
.kg-button-card {
    margin: 2.4rem 0;
    text-align: center;
}
.kg-align-center { text-align: center; }
.kg-align-left { text-align: left; }
.kg-btn {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 1.2rem 2.8rem;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s;
}
.kg-btn:hover { text-decoration: none; }
.kg-btn-accent {
    background: var(--color-accent);
    color: var(--color-bg);
}
.kg-btn-accent:hover {
    background: var(--color-accent-hover);
    color: var(--color-bg);
    box-shadow: 0 0 20px rgba(199, 90, 90, 0.3);
}

/* Header card */
.kg-header-card {
    padding: 6rem 2rem;
    text-align: center;
    margin: 3rem -2rem;
    position: relative;
    overflow: hidden;
}
.kg-header-card h2,
.kg-header-card h3 {
    font-family: var(--font-mono);
    color: var(--color-text);
    margin-bottom: 1rem;
}
.kg-header-card h2 { font-size: 3.2rem; }
.kg-header-card h3 { font-size: 2rem; }
.kg-header-card p {
    font-size: 1.6rem;
    color: var(--color-text-body);
    max-width: 600px;
    margin: 0 auto;
}
.kg-header-card.kg-style-dark { background: var(--color-surface); }
.kg-header-card.kg-style-light { background: var(--color-elevated); }
.kg-header-card.kg-style-accent { background: var(--color-accent-red-bg); }
.kg-header-card.kg-style-image { background-size: cover; background-position: center; }

/* Image card */
.kg-image-card,
.kg-gallery-card {
    margin: 2.4rem 0;
}
.kg-image-card figcaption,
.kg-gallery-card figcaption {
    font-family: var(--font-sans);
    font-size: 1.3rem;
    color: var(--color-text-muted);
    text-align: center;
    padding-top: 1rem;
}
.kg-image {
    max-width: 100%;
    height: auto;
}

/* Embed card */
.kg-embed-card {
    margin: 2.4rem 0;
}
.kg-embed-card iframe {
    width: 100%;
}
.fluid-width-video-wrapper {
    position: relative;
    overflow: hidden;
    padding-top: 56.25%;
}
.fluid-width-video-wrapper iframe,
.fluid-width-video-wrapper object,
.fluid-width-video-wrapper embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Video / Audio */
.kg-audio-card,
.kg-video-card {
    margin: 2.4rem 0;
    border-radius: 4px;
    overflow: hidden;
}
.kg-audio-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 1.6rem;
}
.kg-video-card video {
    width: 100%;
    display: block;
}

/* Signup card */
.kg-signup-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 4rem 2rem;
    margin: 3rem 0;
    text-align: center;
}
.kg-signup-card h2 {
    font-family: var(--font-mono);
    color: var(--color-text);
    margin-bottom: 1rem;
}
.kg-signup-card p {
    color: var(--color-text-body);
    margin-bottom: 2rem;
}
.kg-signup-card-input {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 1rem 1.4rem;
    font-family: var(--font-mono);
    border-radius: 4px;
}
.kg-signup-card-button {
    background: var(--color-accent-red);
    color: var(--color-bg);
    font-family: var(--font-mono);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 1rem 2rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.kg-signup-card-button:hover {
    background: var(--color-accent-red-hover);
}
.kg-signup-card button,
.kg-signup-card .kg-btn {
    background: var(--color-accent-red);
    color: var(--color-bg);
    font-family: var(--font-mono);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 1.2rem 2.8rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}
.kg-signup-card button:hover,
.kg-signup-card .kg-btn:hover {
    background: var(--color-accent-red-hover);
    box-shadow: 0 0 20px rgba(199, 90, 90, 0.3);
}
.kg-signup-card input {
    background: var(--color-elevated);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 1rem 1.5rem;
    font-family: var(--font-sans);
    font-size: 1.5rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

/* File card */
.kg-file-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    margin: 2.4rem 0;
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 1.6rem;
}
.kg-file-card-container {
    display: flex;
    align-items: center;
    gap: 1.6rem;
    text-decoration: none;
    color: inherit;
    width: 100%;
}
.kg-file-card-container:hover { text-decoration: none; color: inherit; }
.kg-file-card-contents {
    flex: 1;
}
.kg-file-card-title {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.4rem;
}
.kg-file-card-caption {
    font-size: 1.3rem;
    color: var(--color-text-body);
}
.kg-file-card-metadata {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    color: var(--color-text-muted);
    margin-top: 0.4rem;
}
.kg-file-card-icon {
    color: var(--color-accent-teal);
}
.kg-file-card-icon svg {
    color: var(--color-accent-teal);
}

/* Product (NFT) card */
.kg-product-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 2.4rem;
    margin: 2.4rem 0;
}

/* --- Tag / Author Headers --- */
.tag-header,
.author-header {
    text-align: center;
    padding: 4rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--color-border);
}

.tag-title,
.author-name {
    font-family: var(--font-mono);
    font-size: 3.2rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.8rem;
}

.tag-description,
.author-bio {
    font-size: 1.6rem;
    color: var(--color-text-dim);
    max-width: 600px;
    margin: 0 auto;
}

.author-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 1.6rem;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    padding: 4rem 0 2rem;
    font-family: var(--font-mono);
    font-size: 1.3rem;
}

.pagination-info {
    color: var(--color-text-dim);
}

.pagination-prev,
.pagination-next {
    color: var(--color-teal);
    text-decoration: none;
}
.pagination-prev:hover,
.pagination-next:hover {
    text-decoration: underline;
}

/* --- Error Page --- */
.error-page {
    text-align: center;
    padding: 8rem 2rem;
}

.error-code {
    font-family: var(--font-mono);
    font-size: 10rem;
    font-weight: 700;
    color: var(--color-accent);
    line-height: 1;
    margin-bottom: 1rem;
    text-shadow: 0 0 30px rgba(199, 90, 90, 0.3);
}

.error-message {
    font-family: var(--font-mono);
    font-size: 1.8rem;
    color: var(--color-text-dim);
    margin-bottom: 1rem;
}

.error-description {
    font-size: 1.6rem;
    color: var(--color-text-dim);
    margin-bottom: 2rem;
}

.error-link {
    font-family: var(--font-mono);
    color: var(--color-teal);
    font-size: 1.4rem;
}

/* --- Terminal Aesthetic Components --- */
.terminal-header {
    display: inline-flex;
    gap: 0.8rem;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    letter-spacing: 0.08em;
    margin-bottom: 1.2rem;
}

.terminal-module {
    color: var(--color-text-dim);
}

.terminal-status {
    color: var(--color-amber);
}

.terminal-status-active {
    color: var(--color-teal);
}

/* Blinking cursor */
.blink-cursor {
    animation: blink 1s step-end infinite;
    color: var(--color-teal);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* --- Reading Progress Bar --- */
.reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-accent);
    z-index: 200;
    transition: width 0.1s linear;
    box-shadow: 0 0 6px rgba(199, 90, 90, 0.4);
}

/* --- CTA Section --- */
.cta-section {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    margin: 6rem 0 2rem;
    padding: 4rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.cta-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(90, 199, 199, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(90, 199, 199, 0.03) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
}

.cta-inner {
    position: relative;
    z-index: 1;
}

.cta-title {
    font-family: var(--font-mono);
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 1rem;
}

.cta-text {
    font-family: var(--font-sans);
    font-size: 1.5rem;
    color: var(--color-text-dim);
    max-width: 500px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

.cta-button {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: var(--color-accent);
    color: var(--color-bg);
    border: none;
    padding: 1.2rem 3rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}

.cta-button:hover {
    background: var(--color-accent-hover);
    box-shadow: 0 0 20px rgba(199, 90, 90, 0.3);
}

.cta-button .blink-cursor {
    color: var(--color-bg);
}

.cta-post {
    margin-top: 4rem;
}

/* --- Author Card (Post) --- */
.author-card {
    margin: 4rem 0;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    padding: 2.4rem;
}

.author-card-inner {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.author-card-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid var(--color-border);
}

.author-card-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-elevated);
    font-family: var(--font-mono);
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--color-teal);
}

.author-card-info {
    flex: 1;
}

.author-card-name {
    font-family: var(--font-mono);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
}

.author-card-name a {
    color: var(--color-text);
}

.author-card-name a:hover {
    color: var(--color-teal);
    text-decoration: none;
}

.author-card-bio {
    font-size: 1.5rem;
    color: var(--color-text-dim);
    line-height: 1.6;
    margin-bottom: 0.6rem;
}

.author-card-location {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    color: var(--color-text-dim);
}

/* --- Footer --- */
.site-footer {
    border-top: 1px solid var(--color-border);
    padding: 4rem 2rem;
    margin-top: 2rem;
}

.site-footer-inner {
    max-width: var(--wide-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-family: var(--font-mono);
    font-size: 1.2rem;
    color: var(--color-text-dim);
    gap: 4rem;
}

.footer-brand {
    flex: 1;
}

.footer-logo {
    font-family: var(--font-mono);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--color-text);
    display: block;
    margin-bottom: 0.8rem;
}

.footer-tagline {
    font-family: var(--font-sans);
    font-size: 1.3rem;
    color: var(--color-text-dim);
    line-height: 1.6;
    margin-bottom: 1.2rem;
    max-width: 400px;
}

.footer-pillars {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    font-size: 1.1rem;
    color: var(--color-text-dim);
}

.footer-pillar-defend {
    color: var(--color-accent);
}

.footer-pillar-secure {
    color: var(--color-teal);
}

.footer-pillar-govern {
    color: var(--color-amber);
}

.footer-pillar-sep {
    opacity: 0.4;
}

.footer-links {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1.6rem;
}

.footer-social {
    display: flex;
    gap: 1.2rem;
    align-items: center;
}

.footer-social-link {
    color: var(--color-text-dim);
    text-decoration: none;
    font-size: 1.3rem;
    transition: color 0.2s;
    display: flex;
    align-items: center;
}

.footer-social-link:hover {
    color: var(--color-teal);
    text-decoration: none;
}

.footer-social-link svg {
    width: 14px;
    height: 14px;
}

.footer-meta {
    display: flex;
    gap: 1.6rem;
    align-items: center;
    font-size: 1.1rem;
}

.footer-powered {
    color: var(--color-text-dim);
    text-decoration: none;
}

.footer-powered:hover {
    color: var(--color-teal);
    text-decoration: none;
}

/* --- Ghost Portal Dark Mode Overrides --- */
.gh-portal-popup-wrapper {
    background: rgba(10, 10, 10, 0.9) !important;
}

/* --- Full Width Post Variant --- */
.post-full-width .post-full-content,
.full-width-content {
    max-width: var(--wide-width);
    margin: 0 auto;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .site-title { font-size: 3.2rem; }
    .post-full-title { font-size: 2.8rem; }
    .post-full-content { font-size: 1.6rem; }
    .post-full-content h2 { font-size: 2.2rem; }
    .post-full-content h3 { font-size: 1.8rem; }
    .post-card-image { height: 150px; }
    .post-card-content { padding: 1.6rem; }
    .post-card-title { font-size: 1.8rem; }
    .site-header-inner { padding: 1.2rem 1.6rem; }
    .site-nav { gap: 1.6rem; }
    .nav-link { font-size: 1.1rem; }
    .site-footer-inner { flex-direction: column; gap: 2rem; align-items: flex-start; }
    .footer-links { align-items: flex-start; }
    .author-card-inner { flex-direction: column; align-items: center; text-align: center; }
    .author-card-info .terminal-header { justify-content: center; }
    .kg-bookmark-container { flex-direction: column; }
    .kg-bookmark-thumbnail { width: 100%; height: 160px; }
}

@media (max-width: 480px) {
    .site-title { font-size: 2.4rem; }
    .post-full-title { font-size: 2.4rem; }
    .site-hero { padding: 4rem 0 2rem; }
}

/* --- Post Feed Grid (2-column) --- */
.post-feed { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2.4rem; }
@media (max-width: 768px) { .post-feed { grid-template-columns: 1fr; } }

/* --- TOC Sidebar --- */
.post-layout { display: flex; max-width: 1400px; margin: 0 auto; padding: 0 2rem; gap: 4rem; }
.toc-sidebar { width: 220px; flex-shrink: 0; display: none; }
.toc-sticky { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; padding: 1rem 0; }
.toc-header { font-family: var(--font-mono); font-size: 1.1rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--color-text-muted); margin-bottom: 1.2rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--color-border); }
.toc-list { list-style: none; padding: 0; margin: 0; }
.toc-list-item { margin-bottom: 0.3rem; }
.toc-link { font-family: var(--font-sans); font-size: 1.2rem; color: var(--color-text-muted); text-decoration: none; display: block; padding: 0.3rem 0 0.3rem 1rem; border-left: 2px solid transparent; transition: color 0.2s, border-color 0.2s; line-height: 1.4; }
.toc-link:hover { color: var(--color-text-body); text-decoration: none; }
.is-active-link { color: var(--color-accent-red) !important; border-left-color: var(--color-accent-red) !important; }
.toc-list .toc-list .toc-link { font-size: 1.1rem; padding-left: 2rem; }
.toc-list .toc-list .is-active-link { color: var(--color-accent-teal) !important; border-left-color: var(--color-accent-teal) !important; }
@media (min-width: 1300px) { .toc-sidebar { display: block; } }
@media (max-width: 1299px) { .post-layout { display: block; max-width: var(--content-width); margin: 0 auto; } }
.toc-sticky::-webkit-scrollbar { width: 3px; }
.toc-sticky::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }

/* --- Search Button --- */
.nav-search-btn { background: none; border: none; color: var(--color-text-muted); cursor: pointer; padding: 0.4rem; transition: color 0.2s; display: flex; align-items: center; }
.nav-search-btn:hover { color: var(--color-accent-teal); }

/* --- Share Buttons --- */
.post-share { display: flex; align-items: center; gap: 1rem; padding: 2rem 0; margin: 3rem 0; border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); }
.post-share-label { font-family: var(--font-mono); font-size: 1.2rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.1em; }
.post-share-btn { font-family: var(--font-mono); font-size: 1.2rem; color: var(--color-text-muted); text-decoration: none; display: flex; align-items: center; gap: 0.4rem; padding: 0.5rem 1rem; border: 1px solid var(--color-border); border-radius: 4px; transition: all 0.2s; background: none; cursor: pointer; }
.post-share-btn:hover { color: var(--color-accent-teal); border-color: var(--color-accent-teal); text-decoration: none; }
.post-share-btn svg { width: 14px; height: 14px; }

/* --- Featured Hero --- */
.featured-hero { position: relative; border: 1px solid var(--color-border); border-radius: 6px; overflow: hidden; margin-bottom: 4rem; background: var(--color-surface); }
.featured-hero-image { height: 300px; background-size: cover; background-position: center; }
.featured-hero-content { padding: 3rem; }
.featured-hero-badge { font-family: var(--font-mono); font-size: 1rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--color-accent-red); margin-bottom: 0.8rem; display: inline-block; }
.featured-hero-tag { font-family: var(--font-mono); font-size: 1rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--color-accent-teal); margin-left: 1rem; }
.featured-hero-title { font-family: var(--font-mono); font-size: 3rem; font-weight: 700; margin-bottom: 1rem; line-height: 1.2; }
.featured-hero-title a { color: var(--color-text); text-decoration: none; }
.featured-hero-title a:hover { color: var(--color-accent-teal); text-decoration: none; }
.featured-hero-excerpt { font-family: var(--font-sans); font-size: 1.6rem; color: var(--color-text-body); line-height: 1.6; margin-bottom: 1.2rem; }
.featured-hero-meta { font-family: var(--font-mono); font-size: 1.2rem; color: var(--color-text-muted); display: flex; gap: 0.6rem; }
.featured-hero-sep { opacity: 0.5; }

/* --- Related Posts --- */
.related-posts { margin: 4rem 0; padding-top: 3rem; border-top: 1px solid var(--color-border); }
.related-posts-title { font-family: var(--font-mono); font-size: 1.6rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 2rem; }
.related-posts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
.related-post-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 4px; overflow: hidden; text-decoration: none; transition: border-color 0.2s; }
.related-post-card:hover { border-color: var(--color-accent-teal); text-decoration: none; }
.related-post-image { height: 120px; background-size: cover; background-position: center; }
.related-post-content { padding: 1.2rem; }
.related-post-content h4 { font-family: var(--font-mono); font-size: 1.4rem; color: var(--color-text); margin-bottom: 0.4rem; line-height: 1.3; }
.related-post-meta { font-family: var(--font-mono); font-size: 1.1rem; color: var(--color-text-muted); }
@media (max-width: 768px) { .related-posts-grid { grid-template-columns: 1fr; } }

/* --- Tag Filter --- */
.tag-filter { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 3rem; padding-bottom: 2rem; border-bottom: 1px solid var(--color-border); }
.tag-pill { font-family: var(--font-mono); font-size: 1.1rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-muted); text-decoration: none; padding: 0.4rem 1.2rem; border: 1px solid var(--color-border); border-radius: 20px; transition: all 0.2s; }
.tag-pill:hover { color: var(--color-accent-teal); border-color: var(--color-accent-teal); text-decoration: none; }
.tag-pill-active { color: var(--color-accent-red); border-color: var(--color-accent-red); }

/* --- Scroll to Top --- */
.scroll-top { position: fixed; bottom: 2rem; right: 2rem; width: 40px; height: 40px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 50%; color: var(--color-text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0; transform: translateY(10px); transition: all 0.3s; z-index: 50; }
.scroll-top.visible { opacity: 1; transform: translateY(0); }
.scroll-top:hover { color: var(--color-accent-teal); border-color: var(--color-accent-teal); }

/* --- Hero Subscribe --- */
.hero-subscribe { margin-top: 2rem; }
.hero-subscribe-form { display: flex; gap: 0.8rem; justify-content: center; max-width: 440px; margin: 0 auto; }
.hero-subscribe-input { flex: 1; background: var(--color-surface); border: 1px solid var(--color-border); color: var(--color-text); padding: 0.8rem 1.2rem; font-family: var(--font-mono); font-size: 1.3rem; border-radius: 4px; }
.hero-subscribe-input::placeholder { color: var(--color-text-muted); }
.hero-subscribe-input:focus { outline: none; border-color: var(--color-accent-teal); }
.hero-subscribe-btn { background: var(--color-accent-red); color: var(--color-bg); font-family: var(--font-mono); font-size: 1.3rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.8rem 2rem; border: none; border-radius: 4px; cursor: pointer; transition: background 0.2s; }
.hero-subscribe-btn:hover { background: var(--color-accent-red-hover); }
.hero-subscribe-note { font-family: var(--font-sans); font-size: 1.2rem; color: var(--color-text-muted); margin-top: 0.8rem; }

/* Subscribe form states */
.hero-subscribe-form .btn-loading { display: none; }
.hero-subscribe-form .hero-subscribe-success { display: none; }

.hero-subscribe-form.loading .btn-text { display: none; }
.hero-subscribe-form.loading .btn-loading { display: inline; }
.hero-subscribe-form.loading .hero-subscribe-btn { opacity: 0.7; pointer-events: none; }

.hero-subscribe-form.success .hero-subscribe-input,
.hero-subscribe-form.success .hero-subscribe-btn { display: none; }
.hero-subscribe-form.success .hero-subscribe-success { display: flex; align-items: center; gap: 0.6rem; font-family: var(--font-mono); font-size: 1.3rem; color: var(--color-accent-teal); padding: 0.8rem 0; }
.hero-subscribe-form.success .success-icon { font-size: 1.6rem; }
.hero-subscribe-form.success + .hero-subscribe-note { display: none; }

.hero-subscribe-form.error .hero-subscribe-input { border-color: var(--color-accent-red); }
.hero-subscribe-form.error::after { content: "Something went wrong. Try again."; display: block; font-family: var(--font-mono); font-size: 1.1rem; color: var(--color-accent-red); margin-top: 0.6rem; width: 100%; text-align: center; }

/* --- Feed Header --- */
.feed-header { margin-bottom: 2rem; }
.feed-title { font-family: var(--font-mono); font-size: 1.4rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--color-text-muted); }
