:root {
    --accent: #ff6b35;
    --accent-dark: #e85d04;
    --accent-muted: rgba(255, 107, 53, 0.14);
    --accent-soft: rgba(255, 107, 53, 0.42);
    --accent-glow: rgba(255, 107, 53, 0.16);
    --background: #050505;
    --background-alt: #0a0a0a;
    --surface: rgba(20, 20, 20, 0.76);
    --surface-soft: rgba(255, 255, 255, 0.035);
    --surface-strong: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 107, 53, 0.2);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #fafafa;
    --text-muted: #a1a1aa;
    --text-soft: #d4d4d8;
    --code-bg: #111111;
    --content-width: min(1480px, 92vw);
    --reading-width: min(760px, 92vw);
    --radius: 10px;
}

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

html {
    color: var(--text);
    background: var(--background);
    font-family: var(--gh-font-body, "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
    min-width: 100%;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    width: 100%;
    min-width: 100%;
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 0%, var(--accent-glow), transparent 30rem),
        linear-gradient(135deg, var(--background), var(--background-alt));
    color: var(--text);
    overflow-x: clip;
    text-rendering: optimizeLegibility;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: linear-gradient(to bottom, black, transparent 72%);
}

::selection {
    color: #1a0a00;
    background: var(--accent);
}

a {
    color: inherit;
    text-decoration: none;
}

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

img,
svg {
    display: block;
    max-width: 100%;
}

button,
input,
textarea,
select {
    font: inherit;
}

.site-shell {
    position: relative;
    z-index: 1;
    width: 100%;
    min-width: 100%;
    min-height: 100vh;
    overflow-x: clip;
}

.content-width {
    width: var(--content-width);
    max-width: calc(100% - 2rem);
    margin-inline: auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(5, 5, 5, 0.76);
    backdrop-filter: blur(18px);
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: var(--content-width);
    max-width: calc(100% - 2rem);
    min-height: 72px;
    margin-inline: auto;
}

.site-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    font-family: var(--gh-font-heading, "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

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

.site-logo span::before {
    content: ">";
    margin-right: 0.45rem;
    color: var(--accent);
}

.site-navigation {
    display: flex;
    align-items: center;
    gap: 1.1rem;
}

.site-navigation ul,
.footer-nav ul {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0;
    margin: 0;
    list-style: none;
}

.site-navigation a,
.search-button {
    color: var(--text-muted);
    font-family: var(--gh-font-heading, "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 0.86rem;
    font-weight: 500;
}

.site-navigation a:hover,
.site-navigation .nav-current a {
    color: var(--text);
}

.search-button {
    padding: 0.48rem 0.75rem;
    color: var(--accent);
    cursor: pointer;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 999px;
}

.search-button:hover {
    background: var(--accent-muted);
}

.nav-toggle {
    display: none;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
}

.nav-toggle span {
    width: 17px;
    height: 2px;
    margin: 4px auto;
    background: var(--text);
    border-radius: 999px;
}

.site-main {
    width: 100%;
    padding: 4rem 0 5rem;
}

.hero,
.archive-header {
    padding: 4rem 0 2.6rem;
}

.eyebrow {
    margin: 0 0 0.65rem;
    color: var(--accent);
    font-family: var(--gh-font-heading, "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero h1,
.archive-header h1,
.post-header h1 {
    max-width: 12ch;
    margin: 0;
    font-family: var(--gh-font-heading, "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: clamp(2.3rem, 6vw, 4.2rem);
    line-height: 1.02;
    letter-spacing: -0.04em;
}

.hero p,
.archive-header p {
    max-width: 60ch;
    margin: 1.1rem 0 0;
    color: var(--text-muted);
    font-size: clamp(1rem, 2vw, 1.18rem);
    line-height: 1.75;
}

.hero-tags,
.author-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1.35rem;
}

.hero-tags a,
.author-links a,
.author-links span {
    padding: 0.45rem 0.72rem;
    color: var(--text-soft);
    font-family: var(--gh-font-heading, "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 0.82rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-soft);
}

.hero-tags a:hover {
    color: var(--accent);
    border-color: var(--accent-soft);
    background: var(--accent-muted);
}

.post-feed {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.post-card {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    padding: 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.post-card:hover {
    transform: translateY(-2px);
    border-color: var(--border);
    background: rgba(24, 24, 24, 0.84);
}

.post-card:hover h2 {
    color: var(--accent);
}

.post-card-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

.post-card-image,
.post-card-body {
    position: relative;
}

.post-card-image {
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: var(--code-bg);
}

.post-card-image img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.post-card h2 {
    margin: 0.6rem 0 0;
    font-family: var(--gh-font-heading, "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: clamp(1.15rem, 2vw, 1.45rem);
    line-height: 1.25;
}

.post-card p {
    max-width: 68ch;
    margin: 0.65rem 0 0;
    color: var(--text-muted);
    line-height: 1.7;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.9rem;
    align-items: center;
    color: var(--text-muted);
    font-family: var(--gh-font-heading, "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 0.78rem;
}

.post-meta a {
    position: relative;
    z-index: 2;
    color: var(--accent);
}

.pagination {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    color: var(--text-muted);
    font-family: var(--gh-font-heading, "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 0.85rem;
}

.pagination div:last-child {
    text-align: right;
}

.post-template {
    width: var(--content-width);
    max-width: 100%;
}

.post-header {
    max-width: var(--reading-width);
    padding: 2.3rem 0 2rem;
    margin-inline: auto;
    text-align: center;
}

.post-header .post-meta {
    justify-content: center;
}

.post-header h1 {
    max-width: 15ch;
    margin: 0.85rem auto 0;
    font-size: clamp(2.1rem, 5vw, 3.7rem);
}

.post-excerpt {
    max-width: 62ch;
    margin: 1.1rem auto 0;
    color: var(--text-muted);
    font-size: 1.12rem;
    line-height: 1.75;
}

.post-image {
    margin: 2rem 0 0;
}

.post-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
}

.post-image figcaption,
.post-content figcaption {
    margin-top: 0.6rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
}

.post-content {
    width: 100%;
    max-width: var(--reading-width);
    margin-inline: auto;
    color: var(--text-soft);
    font-size: 1.03rem;
    line-height: 1.85;
}

.post-content > * {
    margin-block: 0 1.35rem;
}

.post-content h2,
.post-content h3,
.post-content h4 {
    margin-top: 2.4rem;
    color: var(--text);
    font-family: var(--gh-font-heading, "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, monospace);
    line-height: 1.25;
}

.post-content h2 {
    font-size: 1.8rem;
}

.post-content h3 {
    font-size: 1.35rem;
}

.post-content p,
.post-content li {
    color: var(--text-soft);
}

.post-content a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: rgba(255, 107, 53, 0.35);
    text-underline-offset: 0.22em;
}

.post-content ul,
.post-content ol {
    padding-left: 1.25rem;
}

.post-content li + li {
    margin-top: 0.35rem;
}

.post-content blockquote {
    margin-inline: 0;
    padding: 0.05rem 0 0.05rem 1rem;
    color: var(--text);
    border-left: 3px solid var(--accent);
}

.post-content hr {
    height: 1px;
    margin: 2.3rem 0;
    border: 0;
    background: rgba(255, 255, 255, 0.1);
}

.post-content :not(pre) > code,
.post-card code {
    padding: 0.13em 0.38em;
    color: #ffb86b;
    font-family: var(--gh-font-heading, "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 0.9em;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
}

.post-content pre {
    overflow-x: auto;
    padding: 1rem;
    color: #f8f8f2;
    background: var(--code-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
}

.post-content pre code {
    padding: 0;
    color: inherit;
    font-family: var(--gh-font-heading, "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 0.9rem;
    background: transparent;
    border: 0;
}

.kg-card {
    margin: 1.8rem 0;
    max-width: 100%;
}

.kg-card,
.kg-html-card {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

.kg-width-wide,
.kg-width-full {
    width: min(980px, calc(100vw - 2rem));
    max-width: none;
    margin-left: 50%;
    transform: translateX(-50%);
}

.kg-image,
.kg-gallery-image img {
    width: auto !important;
    max-width: 100% !important;
    height: auto;
    margin-inline: auto;
    border-radius: var(--radius);
}

.kg-image-card,
.kg-gallery-card {
    overflow: hidden;
}

.kg-bookmark-card,
.kg-callout-card,
.kg-toggle-card,
.kg-product-card-container,
.kg-file-card-container {
    color: var(--text);
    background: var(--surface) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: var(--radius) !important;
    box-shadow: none !important;
}

.kg-file-card-container {
    align-items: center;
}

.kg-file-card-contents,
.kg-file-card-title,
.kg-file-card-caption,
.kg-file-card-metadata,
.kg-file-card-filename,
.kg-file-card-filesize {
    color: var(--text-soft) !important;
}

.kg-file-card-title,
.kg-file-card-filename {
    color: var(--text) !important;
    font-weight: 700;
}

.kg-file-card-caption,
.kg-file-card-metadata,
.kg-file-card-filesize {
    color: var(--text-muted) !important;
}

.kg-file-card-icon,
.kg-file-card-icon svg,
.kg-file-card-container svg {
    color: var(--accent) !important;
    fill: none;
    stroke: currentColor;
}

.kg-file-card-container:hover {
    border-color: var(--accent-soft) !important;
    background: rgba(24, 24, 24, 0.86) !important;
}

.kg-button-card {
    display: flex;
    justify-content: flex-start;
}

.kg-button-card.kg-align-center {
    justify-content: center;
}

.kg-button-card.kg-align-right {
    justify-content: flex-end;
}

.kg-button-card a.kg-btn,
.kg-button-card .kg-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.72rem 1rem !important;
    color: var(--accent) !important;
    font-family: var(--gh-font-heading, "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none !important;
    background: var(--accent-muted) !important;
    border: 1px solid var(--accent-soft) !important;
    border-radius: 999px !important;
    box-shadow: none !important;
}

.kg-button-card a.kg-btn:hover,
.kg-button-card .kg-btn:hover {
    color: var(--text) !important;
    background: rgba(255, 107, 53, 0.22) !important;
    border-color: var(--accent) !important;
}

.kg-bookmark-description,
.kg-bookmark-metadata,
.kg-toggle-content,
.kg-product-card-description {
    color: var(--text-muted) !important;
}

.post-content table {
    display: table;
    width: 100%;
    max-width: 100%;
    margin: 1.6rem 0;
    color: var(--text-soft);
    background: transparent !important;
    border: 0;
    border-collapse: collapse;
    box-shadow: none !important;
}

.post-content thead,
.post-content tbody,
.post-content tr {
    background: transparent !important;
}

.post-content th,
.post-content td {
    padding: 0.72rem 0.85rem;
    vertical-align: top;
    background: transparent !important;
    border: 1px solid var(--border-strong);
}

.post-content th {
    color: var(--text);
    font-family: var(--gh-font-heading, "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 0.82rem;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.post-content .kg-html-card {
    overflow-x: auto;
}

.post-footer {
    display: grid;
    gap: 1.4rem;
    max-width: var(--reading-width);
    padding: 2rem 0 0;
    margin: 2rem auto 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.post-comments {
    width: 100%;
    max-width: var(--reading-width);
    margin: 2.5rem auto 0;
}

.post-comments > * {
    max-width: 100%;
}

.author-box {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.author-box img,
.author-header img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid var(--border);
}

.author-box span {
    display: block;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.author-box a {
    font-weight: 700;
}

.post-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.post-nav a {
    min-height: 100%;
    padding: 0.9rem;
    color: var(--text-soft);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.site-footer {
    width: 100%;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.site-footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: var(--content-width);
    max-width: calc(100% - 2rem);
    min-height: 86px;
    margin-inline: auto;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.site-footer p {
    margin: 0;
}

@media (min-width: 760px) {
    .post-feed {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 2200px) {
    .post-feed {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .site-header-inner {
        min-height: 64px;
    }

    .nav-toggle {
        display: block;
    }

    .site-navigation {
        position: absolute;
        top: 64px;
        right: 4vw;
        left: 4vw;
        display: none;
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: var(--radius);
        background: rgba(10, 10, 10, 0.96);
    }

    .site-navigation.is-open {
        display: flex;
    }

    .site-navigation ul,
    .footer-nav ul {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-button {
        width: 100%;
        text-align: left;
    }

    .site-main {
        padding-top: 2rem;
    }

    .hero,
    .archive-header {
        padding-top: 2.4rem;
    }

    .pagination {
        grid-template-columns: 1fr;
    }

    .pagination div:last-child {
        text-align: left;
    }

    .post-nav {
        grid-template-columns: 1fr;
    }

    .post-content {
        font-size: 1rem;
    }
}
