:root {
    color-scheme: dark;
    --night: #09110f;
    --forest-deep: #0e1c18;
    --forest: #152a23;
    --spruce: #214037;
    --storm: #435766;
    --rain: #647c8b;
    --mist: #9babb3;
    --fog: #c1cccf;
    --text: #d8e0df;
    --text-soft: #abb9b7;
    --text-muted: #7f8e8a;
    --border: #293b37;
    --fern: #5f846f;
    --moss: #83a08b;
    --cold-light: #a8ccd5;
    --code-bg: #07100d;
    --code-border: #1d332b;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    --shell-site: 1180px;
    --shell-feed: 980px;
    --shell-reading: 760px;
    --shell-wide: 1120px;
    --space-page: clamp(1.25rem, 4vw, 2.5rem);
}

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

html {
    background: var(--night);
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 78% 3%, rgba(82, 104, 121, 0.12), transparent 28rem),
        linear-gradient(180deg, #0a1311 0, var(--night) 36rem);
    color: var(--text-soft);
    font-family: var(--gh-font-body, var(--font-sans));
    font-size: 17px;
    line-height: 1.7;
    text-rendering: optimizeLegibility;
}

::selection {
    background: var(--fern);
    color: #f1f5f4;
}

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

img {
    height: auto;
}

a {
    color: var(--cold-light);
    text-decoration-color: rgba(168, 204, 213, 0.42);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.22em;
}

a:hover {
    color: var(--fog);
    text-decoration-color: currentColor;
}

:focus-visible {
    outline: 2px solid var(--cold-light);
    outline-offset: 4px;
    border-radius: 2px;
}

.skip-link {
    position: fixed;
    z-index: 100;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.65rem 0.9rem;
    transform: translateY(-180%);
    background: var(--fog);
    color: var(--night);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.skip-link:focus {
    transform: translateY(0);
}

.shell {
    width: calc(100% - (var(--space-page) * 2));
    margin-inline: auto;
}

.shell--site {
    max-width: var(--shell-site);
}

.shell--feed {
    max-width: var(--shell-feed);
}

.shell--reading {
    max-width: var(--shell-reading);
}

.shell--wide {
    max-width: var(--shell-wide);
}

.site-header {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border-bottom: 1px solid rgba(82, 120, 101, 0.22);
    background: linear-gradient(110deg, #0a1411 12%, #10201b 58%, #101c1b 100%);
}

.site-header::after {
    position: absolute;
    z-index: -1;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(9, 17, 15, 0.98) 0%, rgba(9, 17, 15, 0.72) 58%, rgba(9, 17, 15, 0.42) 100%),
        linear-gradient(180deg, transparent 40%, rgba(9, 17, 15, 0.7));
    content: "";
}

.site-header__atmosphere {
    position: absolute;
    z-index: -2;
    inset: 0;
    background-image: url("../images/header-rain.webp");
    background-position: right 48%;
    background-repeat: no-repeat;
    background-size: min(52vw, 720px) auto;
    filter: saturate(0.72) contrast(1.06);
    opacity: 0.48;
}

.site-header__inner {
    display: flex;
    min-height: 96px;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    padding-block: 1rem;
}

.site-brand {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 0.8rem;
    color: var(--text);
    font-size: clamp(1.05rem, 2vw, 1.3rem);
    font-weight: 650;
    letter-spacing: -0.015em;
    text-decoration: none;
}

.site-brand:hover {
    color: var(--fog);
}

.site-brand__logo {
    width: auto;
    max-width: min(280px, 52vw);
    height: 46px;
    object-fit: contain;
    object-position: left center;
}

.site-brand__mark {
    position: relative;
    display: grid;
    width: 31px;
    height: 37px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(157, 196, 207, 0.42);
    border-radius: 50% 50% 44% 44%;
    background: linear-gradient(150deg, rgba(82, 120, 101, 0.25), rgba(56, 72, 88, 0.08));
}

.site-brand__mark::before,
.site-brand__mark::after,
.site-brand__mark span {
    position: absolute;
    bottom: 6px;
    width: 1px;
    border-radius: 999px;
    background: var(--cold-light);
    content: "";
}

.site-brand__mark::before {
    left: 10px;
    height: 14px;
    transform: rotate(9deg);
}

.site-brand__mark span {
    left: 15px;
    height: 23px;
}

.site-brand__mark::after {
    right: 9px;
    height: 16px;
    transform: rotate(-10deg);
}

.site-nav {
    min-width: 0;
}

.site-nav .nav,
.site-footer .nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem 1.2rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-nav a,
.site-footer .nav a {
    color: var(--text-soft);
    font-family: var(--font-mono);
    font-size: 0.73rem;
    letter-spacing: 0.055em;
    text-decoration: none;
    text-transform: uppercase;
}

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

.site-main {
    min-height: calc(100vh - 192px);
}

.shell--feed {
    padding-block: clamp(3.25rem, 8vw, 6.5rem);
}

.feed-intro,
.archive-header {
    max-width: 760px;
    margin-bottom: clamp(3rem, 7vw, 5rem);
}

.eyebrow,
.article-meta,
.post-entry__meta,
.post-entry__footer,
.error-code,
.pagination,
.article-tags,
.article-byline {
    font-family: var(--font-mono);
}

.eyebrow {
    margin: 0 0 0.7rem;
    color: var(--moss);
    font-size: 0.73rem;
    font-weight: 600;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.feed-intro h1,
.archive-header h1,
.article-header h1,
.error-page h1 {
    margin: 0;
    color: var(--text);
    font-family: var(--gh-font-heading, var(--font-sans));
    font-weight: 680;
    letter-spacing: -0.035em;
}

.feed-intro h1,
.archive-header h1 {
    font-size: clamp(2.4rem, 8vw, 5.2rem);
    line-height: 1.02;
}

.feed-intro__description,
.archive-header > p:last-child,
.archive-header > div > p:last-child {
    max-width: 680px;
    margin: 1.25rem 0 0;
    color: var(--mist);
    font-size: clamp(1.05rem, 2.2vw, 1.25rem);
    line-height: 1.6;
}

.archive-header {
    padding-bottom: 2.1rem;
    border-bottom: 1px solid var(--border);
}

.archive-header--author {
    display: flex;
    align-items: center;
    gap: 1.4rem;
}

.author-image {
    width: 88px;
    height: 88px;
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 50%;
    object-fit: cover;
    filter: saturate(0.78);
}

.post-feed {
    border-top: 1px solid var(--border);
}

.post-entry {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(170px, 240px);
    gap: clamp(1.5rem, 4vw, 3.2rem);
    padding-block: clamp(2rem, 5vw, 3.4rem);
    border-bottom: 1px solid var(--border);
}

.post-entry:not(:has(.post-entry__image)) {
    grid-template-columns: minmax(0, 1fr);
}

.post-entry__body {
    min-width: 0;
}

.post-entry__meta,
.post-entry__footer,
.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.7rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    letter-spacing: 0.035em;
}

.post-entry__meta a,
.article-meta a {
    color: var(--moss);
    text-decoration: none;
}

.post-entry h2 {
    max-width: 700px;
    margin: 0.7rem 0 0.75rem;
    color: var(--text);
    font-family: var(--gh-font-heading, var(--font-sans));
    font-size: clamp(1.45rem, 3.2vw, 2.2rem);
    font-weight: 650;
    letter-spacing: -0.028em;
    line-height: 1.17;
}

.post-entry h2 a {
    color: inherit;
    text-decoration: none;
}

.post-entry h2 a:hover {
    color: var(--cold-light);
}

.post-entry__body > p {
    max-width: 660px;
    margin: 0;
    color: var(--text-soft);
    line-height: 1.65;
}

.post-entry__footer {
    margin-top: 1.15rem;
}

.post-entry__signal {
    color: var(--fern);
}

.post-entry__signal::before {
    margin-right: 0.7rem;
    color: var(--border);
    content: "/";
}

.post-entry__image {
    align-self: start;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--forest-deep);
}

.post-entry__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(0.75) contrast(1.03);
    transition: filter 180ms ease, transform 240ms ease;
}

.post-entry__image:hover img {
    filter: saturate(0.95) contrast(1.04);
    transform: scale(1.015);
}

.empty-state {
    padding: 3rem 0;
    border-bottom: 1px solid var(--border);
}

.empty-state h2 {
    margin: 0;
    color: var(--text);
}

.empty-state p {
    margin: 0.6rem 0 0;
}

.pagination {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    margin-top: 2.5rem;
    color: var(--text-muted);
    font-size: 0.74rem;
}

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

.pagination__link {
    color: var(--moss);
    text-decoration: none;
}

.article {
    padding-block: clamp(3.5rem, 9vw, 7.5rem);
}

.article-header {
    margin-bottom: clamp(2.2rem, 6vw, 4rem);
}

.article-meta {
    margin-bottom: 1.1rem;
}

.article-header h1 {
    font-size: clamp(2.35rem, 7vw, 5rem);
    line-height: 1.03;
    text-wrap: balance;
}

.article-deck {
    margin: 1.4rem 0 0;
    color: var(--mist);
    font-size: clamp(1.08rem, 2.5vw, 1.32rem);
    line-height: 1.58;
}

.article-feature {
    margin-bottom: clamp(3rem, 8vw, 5.5rem);
}

.article-feature img {
    width: 100%;
    max-height: min(720px, 76vh);
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--forest-deep);
    object-fit: cover;
}

.article-feature figcaption,
.gh-content figcaption {
    margin-top: 0.65rem;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.78rem;
    line-height: 1.5;
    text-align: center;
}

.gh-content {
    color: var(--text);
    font-size: clamp(1.03rem, 1.2vw, 1.12rem);
    line-height: 1.78;
    overflow-wrap: break-word;
}

.gh-content > *:first-child {
    margin-top: 0;
}

.gh-content > *:last-child {
    margin-bottom: 0;
}

.gh-content h2,
.gh-content h3,
.gh-content h4,
.gh-content h5,
.gh-content h6 {
    scroll-margin-top: 2rem;
    margin: 2.2em 0 0.7em;
    color: var(--fog);
    font-family: var(--gh-font-heading, var(--font-sans));
    font-weight: 660;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.gh-content h2 {
    padding-bottom: 0.35em;
    border-bottom: 1px solid var(--border);
    font-size: clamp(1.65rem, 3.5vw, 2.2rem);
}

.gh-content h3 {
    font-size: clamp(1.35rem, 3vw, 1.7rem);
}

.gh-content h4 {
    font-size: 1.15rem;
}

.gh-content p,
.gh-content ul,
.gh-content ol,
.gh-content dl,
.gh-content blockquote,
.gh-content pre,
.gh-content table,
.gh-content figure,
.gh-content .kg-card {
    margin-block: 1.55em;
}

.gh-content ul,
.gh-content ol {
    padding-left: 1.35em;
}

.gh-content li {
    padding-left: 0.25em;
}

.gh-content li + li {
    margin-top: 0.35em;
}

.gh-content strong {
    color: var(--fog);
    font-weight: 680;
}

.gh-content hr {
    width: 42%;
    height: 1px;
    margin: 3.5rem auto;
    border: 0;
    background: linear-gradient(90deg, transparent, var(--fern), transparent);
}

.gh-content blockquote {
    padding: 0.25rem 0 0.25rem 1.35rem;
    border-left: 2px solid var(--fern);
    color: var(--mist);
    font-size: 1.08em;
}

.gh-content blockquote > :first-child {
    margin-top: 0;
}

.gh-content blockquote > :last-child {
    margin-bottom: 0;
}

.gh-content :not(pre) > code,
.gh-content kbd {
    padding: 0.16em 0.38em;
    border: 1px solid var(--code-border);
    border-radius: 3px;
    background: rgba(7, 16, 13, 0.92);
    color: #b7d2c8;
    font-family: var(--font-mono);
    font-size: 0.86em;
    overflow-wrap: anywhere;
}

.gh-content pre {
    max-width: 100%;
    overflow-x: auto;
    padding: clamp(1rem, 3vw, 1.4rem);
    border: 1px solid var(--code-border);
    border-radius: 4px;
    background:
        linear-gradient(90deg, rgba(33, 64, 55, 0.15), transparent 4rem),
        var(--code-bg);
    box-shadow: inset 0 1px rgba(157, 196, 207, 0.035);
    color: #c4d2ce;
    font-family: var(--font-mono);
    font-size: 0.84rem;
    line-height: 1.65;
    tab-size: 4;
    -webkit-overflow-scrolling: touch;
}

.gh-content pre code {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    overflow-wrap: normal;
    white-space: pre;
}

.gh-content table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: 0.9em;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.gh-content th,
.gh-content td {
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    text-align: left;
}

.gh-content th {
    background: var(--forest-deep);
    color: var(--fog);
    font-family: var(--font-mono);
    font-size: 0.84em;
    letter-spacing: 0.02em;
}

.gh-content tbody tr:nth-child(even) {
    background: rgba(21, 42, 35, 0.25);
}

.gh-content figure,
.gh-content .kg-card {
    max-width: 100%;
}

.gh-content img {
    margin-inline: auto;
    border: 1px solid rgba(82, 104, 121, 0.35);
    border-radius: 3px;
    background: var(--forest-deep);
}

.gh-content .kg-width-wide {
    width: min(var(--shell-wide), calc(100vw - (var(--space-page) * 2)));
    max-width: none;
    margin-left: 50%;
    transform: translateX(-50%);
}

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

.gh-content .kg-image-card img,
.gh-content .kg-gallery-image img {
    width: 100%;
}

.gh-content .kg-gallery-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gh-content .kg-gallery-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 0.5rem;
}

.gh-content .kg-gallery-image {
    flex: 1 1 0;
}

.gh-content .kg-gallery-image img {
    height: 100%;
    object-fit: cover;
}

.gh-content .kg-bookmark-card a.kg-bookmark-container {
    display: flex;
    min-height: 150px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: rgba(14, 28, 24, 0.58);
    color: var(--text-soft);
    text-decoration: none;
}

.gh-content .kg-bookmark-content {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: start;
    padding: 1.25rem;
}

.gh-content .kg-bookmark-title {
    color: var(--fog);
    font-weight: 650;
    line-height: 1.35;
}

.gh-content .kg-bookmark-description {
    display: -webkit-box;
    margin-top: 0.45rem;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.86rem;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.gh-content .kg-bookmark-metadata {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-top: auto;
    padding-top: 1rem;
    color: var(--mist);
    font-family: var(--font-mono);
    font-size: 0.7rem;
}

.gh-content .kg-bookmark-icon {
    width: 20px;
    height: 20px;
    border: 0;
}

.gh-content .kg-bookmark-thumbnail {
    position: relative;
    width: 34%;
    min-width: 160px;
}

.gh-content .kg-bookmark-thumbnail img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
    object-fit: cover;
}

.gh-content .kg-callout-card {
    padding: 1.25rem 1.35rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: rgba(21, 42, 35, 0.42);
    color: var(--text-soft);
}

.gh-content .kg-callout-card-grey {
    background: rgba(56, 72, 88, 0.18);
}

.gh-content .kg-toggle-card,
.gh-content .kg-file-card-container,
.gh-content .kg-audio-card,
.gh-content .kg-product-card-container {
    border-color: var(--border);
    background: var(--forest-deep);
    color: var(--text-soft);
}

.gh-content .kg-embed-card iframe,
.gh-content .kg-video-card video,
.gh-content .kg-audio-card {
    width: 100%;
}

.gh-content .kg-embed-card iframe[src*="youtube.com"],
.gh-content .kg-embed-card iframe[src*="youtube-nocookie.com"] {
    height: auto;
    aspect-ratio: 16 / 9;
}

.gh-content .kg-button-card .kg-btn,
.gh-content .kg-header-card .kg-header-card-button {
    background: var(--moss);
    color: var(--night);
    font-family: var(--font-sans);
    font-weight: 700;
}

.gh-content input,
.gh-content textarea,
.gh-content select {
    max-width: 100%;
    border: 1px solid var(--border);
    border-radius: 3px;
    background: var(--code-bg);
    color: var(--text);
    font: inherit;
}

.article-footer {
    margin-top: clamp(3.5rem, 8vw, 6rem);
    padding-top: 1.4rem;
    border-top: 1px solid var(--border);
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.article-tags a {
    padding: 0.25rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 2px;
    color: var(--moss);
    font-size: 0.68rem;
    letter-spacing: 0.045em;
    text-decoration: none;
    text-transform: uppercase;
}

.article-tags a:hover {
    border-color: var(--fern);
    color: var(--fog);
}

.article-byline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: 0.73rem;
}

.article-byline a {
    color: var(--text-soft);
    text-decoration: none;
}

.error-page {
    padding-block: clamp(5rem, 14vw, 10rem);
    text-align: center;
}

.error-code {
    margin: 0;
    color: var(--fern);
    font-size: clamp(3rem, 10vw, 7rem);
    letter-spacing: -0.06em;
    line-height: 1;
}

.error-page h1 {
    margin-top: 0.5rem;
    font-size: clamp(2rem, 6vw, 3.8rem);
    line-height: 1.1;
}

.error-page > p:not(.error-code) {
    max-width: 540px;
    margin: 1.2rem auto;
}

.text-link {
    display: inline-block;
    margin-top: 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.site-footer {
    border-top: 1px solid rgba(41, 59, 55, 0.8);
    background: rgba(7, 16, 13, 0.55);
}

.site-footer__inner {
    display: flex;
    min-height: 96px;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding-block: 1.25rem;
}

.site-footer p {
    margin: 0;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.7rem;
}

@media (max-width: 700px) {
    :root {
        --space-page: 1.25rem;
    }

    body {
        font-size: 16px;
    }

    .site-header__inner {
        min-height: 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
        padding-block: 1.05rem;
    }

    .site-nav {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.2rem;
        scrollbar-width: thin;
    }

    .site-nav .nav {
        width: max-content;
        max-width: none;
        flex-wrap: nowrap;
        justify-content: flex-start;
    }

    .site-header__atmosphere {
        background-position: right 54%;
        background-size: 78vw auto;
        opacity: 0.32;
    }

    .post-entry {
        grid-template-columns: minmax(0, 1fr);
    }

    .post-entry__image {
        grid-row: 1;
        width: 100%;
        aspect-ratio: 16 / 9;
    }

    .article-header h1 {
        font-size: clamp(2.25rem, 12vw, 3.5rem);
    }

    .gh-content .kg-width-full {
        width: calc(100vw - 1rem);
    }

    .gh-content .kg-gallery-row {
        flex-direction: column;
    }

    .gh-content .kg-bookmark-card a.kg-bookmark-container {
        flex-direction: column;
    }

    .gh-content .kg-bookmark-thumbnail {
        width: 100%;
        min-height: 180px;
    }

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

    .pagination__status {
        grid-column: 1 / -1;
        grid-row: 1;
        text-align: center;
    }

    .archive-header--author {
        align-items: flex-start;
    }

    .site-footer__inner {
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
    }

    .site-footer .nav {
        justify-content: flex-start;
    }
}

@media (max-width: 430px) {
    .archive-header--author {
        flex-direction: column;
    }

    .article-meta {
        gap: 0.3rem 0.55rem;
    }

    .gh-content pre {
        border-inline: 0;
        border-radius: 0;
    }
}

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

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

@media print {
    :root {
        color-scheme: light;
    }

    body {
        background: white;
        color: #1d2724;
    }

    .site-header,
    .site-footer,
    .article-footer {
        display: none;
    }

    .article {
        padding: 0;
    }

    .article-header h1,
    .gh-content,
    .gh-content h2,
    .gh-content h3,
    .gh-content h4 {
        color: #101815;
    }

    a {
        color: inherit;
    }
}
