:root {
    --paper: #f1f0e8;
    --paper-raised: #faf9f4;
    --ink: #1f2822;
    --ink-soft: #556057;
    --ember: #d8522f;
    --moss: #69746b;
    --line: #b8beb5;
    --display: "Avenir Next", "Segoe UI", Arial, sans-serif;
    --body: "Segoe UI", Arial, sans-serif;
    --utility: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --gh-font-heading: var(--display);
    --gh-font-body: var(--body);
    --shell: min(1180px, calc(100% - 48px));
    --reading: 720px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    overflow-wrap: break-word;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--body);
    font-size: 17px;
    line-height: 1.65;
    text-rendering: optimizeLegibility;
}

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

img {
    height: auto;
}

a {
    color: inherit;
    text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
    text-underline-offset: 0.2em;
}

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

button,
summary {
    font: inherit;
}

:focus-visible {
    outline: 3px solid var(--ember);
    outline-offset: 4px;
}

.skip-link {
    position: fixed;
    z-index: 100;
    top: 12px;
    left: 12px;
    padding: 10px 14px;
    transform: translateY(-160%);
    background: var(--ink);
    color: var(--paper-raised);
}

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

.page-shell {
    width: var(--shell);
    margin-inline: auto;
}

.site-main {
    min-height: 65vh;
}

.site-header {
    position: relative;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: var(--shell);
    min-height: 82px;
    margin-inline: auto;
    border-bottom: 4px solid var(--ink);
}

.site-identity {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    font-family: var(--display);
    font-weight: 800;
    letter-spacing: -0.025em;
    text-decoration: none;
}

.identity-mark {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    background: var(--ink);
    color: var(--paper-raised);
    font: 800 12px/1 var(--utility);
}

.identity-name {
    font-size: 15px;
    text-transform: uppercase;
}

.desktop-nav {
    display: flex;
    align-items: center;
    gap: 22px;
    white-space: nowrap;
}

.desktop-nav .nav {
    display: flex;
    gap: 22px;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

.desktop-nav a,
.text-button,
.site-menu a {
    min-height: 44px;
    padding: 10px 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    font: 750 12px/24px var(--utility);
    letter-spacing: 0.04em;
    text-decoration: none;
    text-transform: uppercase;
}

.desktop-nav a:hover,
.text-button:hover,
.site-menu a:hover {
    color: var(--ember);
}

.site-menu {
    display: none;
}

.home-hero {
    display: block;
    padding-block: 80px;
}

.section-label {
    margin: 0 0 14px;
    color: var(--ember);
    font: 750 11px/1.4 var(--utility);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.hero-copy h1,
.archive-header h1,
.article-header h1,
.error-page h1 {
    max-width: 950px;
    margin: 0;
    font-family: var(--display);
    font-weight: 700;
    letter-spacing: -0.055em;
    line-height: 0.98;
}

.hero-copy h1 {
    max-width: 880px;
    font-size: clamp(3rem, 6vw, 5.2rem);
}

.hero-intro {
    max-width: 650px;
    margin: 30px 0 0;
    color: var(--ink-soft);
    font-size: clamp(1.05rem, 2vw, 1.35rem);
    line-height: 1.55;
}

.topic-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 30px;
}

.topic-chips span {
    padding: 7px 10px;
    background: var(--ink);
    color: var(--paper-raised);
    font: 700 10px/1.2 var(--utility);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.margin-note {
    max-width: 560px;
    margin-top: 24px;
    padding: 16px 18px;
    border-left: 3px solid var(--ember);
    background: var(--paper-raised);
    color: var(--ink-soft);
    font: italic 1rem/1.55 Georgia, serif;
    transform: none;
}

.margin-note p {
    margin: 0;
}

.featured-section,
.writing-section,
.topics-section,
.proof-section,
.related-section {
    padding-block: clamp(64px, 9vw, 112px);
    border-top: 1px solid var(--line);
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 38px;
}

.section-heading h2,
.newsletter-panel h2,
.proof-section h2 {
    max-width: 720px;
    margin: 0;
    font-family: var(--display);
    font-size: clamp(1.9rem, 3.8vw, 3.4rem);
    font-weight: 700;
    letter-spacing: -0.045em;
    line-height: 1.05;
}

.section-heading > a {
    min-height: 44px;
    padding-block: 9px;
    font: 700 11px/24px var(--utility);
    text-transform: uppercase;
}

.post-list,
.archive-list {
    display: block;
}

.post-card {
    min-width: 0;
    border-top: 1px solid var(--line);
}

.post-card--feature {
    display: grid;
    grid-template-areas: "body";
    padding: clamp(30px, 5vw, 64px);
    border-top: 0;
    border-left: 6px solid var(--ember);
    background: var(--ink);
    color: var(--paper-raised);
}

.post-card--feature.has-image {
    grid-template-columns: minmax(280px, 1.08fr) minmax(280px, 0.92fr);
    grid-template-areas: "image body";
    gap: clamp(34px, 6vw, 88px);
    align-items: center;
}

.post-card-image {
    grid-area: image;
    overflow: hidden;
    background: var(--moss);
}

.post-card-image img {
    width: 100%;
    height: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform 220ms ease;
}

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

.post-card-body {
    min-width: 0;
}

.post-card--feature .post-card-body {
    grid-area: body;
}

.post-card--feature .post-meta {
    color: #cbd0cb;
}

.post-card--feature .post-meta a {
    color: var(--paper-raised);
}

.post-card.post-card--feature h3 {
    max-width: 760px;
    margin-top: 20px;
    font-size: clamp(2.25rem, 4.8vw, 4.6rem);
    line-height: 0.98;
}

.post-card.post-card--feature h3 a,
.post-card--feature .read-link {
    color: var(--paper-raised);
}

.post-card.post-card--feature p {
    max-width: 620px;
    color: #cbd0cb;
    font-size: 1.05rem;
}

.post-card--row {
    padding-block: 34px;
}

.post-card--row .post-card-body {
    display: grid;
    grid-template-columns: minmax(150px, 0.3fr) minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 10px 36px;
    align-items: start;
}

.post-card--row .post-meta {
    grid-column: 1;
    grid-row: 1 / span 2;
    padding-top: 5px;
}

.post-card.post-card--row h3 {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
}

.post-card.post-card--row p {
    grid-column: 2;
    grid-row: 2;
    max-width: 720px;
    margin: 0;
}

.post-card--row .read-link {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    color: var(--moss);
    font: 700 10px/1.5 var(--utility);
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.post-meta a {
    color: var(--ember);
    text-decoration: none;
}

.post-card h3 {
    margin: 14px 0 12px;
    font-family: var(--display);
    font-size: clamp(1.4rem, 2.5vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -0.045em;
    line-height: 1.07;
}

.post-card h3 a {
    text-decoration: none;
}

.post-card p {
    margin: 0 0 20px;
    color: var(--ink-soft);
}

.read-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font: 750 11px/1.4 var(--utility);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.topic-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 4px solid var(--ink);
}

.topic-grid a {
    display: flex;
    min-height: 190px;
    padding: 30px;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    text-decoration: none;
}

.topic-grid a:nth-child(2n) {
    border-right: 0;
}

.topic-grid a:hover {
    background: var(--ink);
    color: var(--paper-raised);
}

.topic-grid strong {
    font-family: var(--display);
    font-size: clamp(1.5rem, 3vw, 2.65rem);
    letter-spacing: -0.045em;
    line-height: 1;
}

.topic-grid span {
    max-width: 440px;
    margin-top: 28px;
    color: var(--ink-soft);
}

.topic-grid a:hover span {
    color: var(--paper);
}

.proof-section {
    display: grid;
    grid-template-columns: 0.8fr 1.5fr;
    gap: 44px 80px;
}

.proof-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0;
}

.proof-grid div {
    padding: 8px 24px 18px;
    border-left: 1px solid var(--line);
}

.proof-grid dt {
    color: var(--moss);
    font: 700 10px/1.4 var(--utility);
    text-transform: uppercase;
}

.proof-grid dd {
    margin: 12px 0 0;
    font-family: var(--display);
    font-size: clamp(1.65rem, 3vw, 3.2rem);
    font-weight: 700;
    letter-spacing: -0.055em;
    line-height: 1;
}

.proof-section > .read-link {
    grid-column: 2;
}

.newsletter-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 40px;
    align-items: end;
    margin-block: clamp(64px, 9vw, 112px);
    padding: clamp(34px, 6vw, 72px);
    background: var(--ink);
    color: var(--paper-raised);
}

.newsletter-panel p:not(.section-label) {
    max-width: 620px;
    margin: 20px 0 0;
    color: #cbd0cb;
}

.button {
    display: inline-flex;
    min-height: 48px;
    padding: 12px 18px;
    align-items: center;
    justify-content: center;
    border: 0;
    background: var(--ember);
    color: white;
    font: 750 11px/1.4 var(--utility);
    letter-spacing: 0.05em;
    text-decoration: none;
    text-transform: uppercase;
}

.site-footer {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 36px;
    width: var(--shell);
    margin: 0 auto;
    padding-block: 44px;
    border-top: 4px solid var(--ink);
}

.site-footer strong {
    font-family: var(--display);
    font-size: 1.1rem;
}

.site-footer p {
    max-width: 540px;
    margin: 8px 0 0;
    color: var(--ink-soft);
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    gap: 20px;
    font: 700 10px/1.4 var(--utility);
    text-transform: uppercase;
}

.archive-header {
    padding-block: clamp(78px, 12vw, 160px) clamp(54px, 8vw, 92px);
}

.archive-header h1,
.article-header h1,
.error-page h1 {
    font-size: clamp(3.2rem, 7vw, 6.2rem);
}

.archive-header > p:not(.section-label),
.archive-header > span {
    display: block;
    max-width: 650px;
    margin: 26px 0 0;
    color: var(--ink-soft);
    font-size: 1.2rem;
}

.archive-list {
    margin-bottom: 64px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 88px;
    margin-bottom: 80px;
    border-block: 1px solid var(--line);
    font: 700 11px/1.4 var(--utility);
    text-transform: uppercase;
}

.pagination a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
}

.empty-state {
    padding: 36px 0;
    border-top: 1px solid var(--line);
    color: var(--ink-soft);
}

.article {
    padding-top: clamp(72px, 11vw, 150px);
}

.article-header {
    max-width: 1020px;
}

.article-header h1 {
    margin-top: 22px;
}

.post-template .article {
    padding-top: clamp(64px, 8vw, 108px);
}

.post-template .article-header {
    max-width: 820px;
    margin-inline: auto;
}

.post-template .article-header h1 {
    margin-top: 18px;
    font-size: clamp(2.75rem, 4.5vw, 3.75rem);
    letter-spacing: -0.04em;
    line-height: 1.08;
}

.post-template .article-deck {
    font-size: clamp(1.1rem, 1.8vw, 1.3rem);
    line-height: 1.55;
}

.article-deck {
    max-width: 760px;
    margin: 30px 0 0;
    color: var(--ink-soft);
    font-size: clamp(1.15rem, 2vw, 1.45rem);
}

.article-image {
    margin: 60px 0 0;
}

.article-image img {
    width: 100%;
    max-height: 720px;
    object-fit: cover;
}

figcaption {
    margin-top: 10px;
    color: var(--moss);
    font-size: 0.8rem;
    text-align: center;
}

.article-layout {
    max-width: var(--reading);
    margin-top: clamp(56px, 8vw, 96px);
    margin-inline: auto;
}

.gh-content {
    min-width: 0;
    font-size: clamp(1.05rem, 1.5vw, 1.18rem);
    line-height: 1.78;
}

.gh-content > * {
    max-width: var(--reading);
    margin-inline: auto;
}

.gh-content h2,
.gh-content h3,
.gh-content h4 {
    margin-top: 2.25em;
    margin-bottom: 0.65em;
    font-family: var(--display);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.08;
}

.gh-content h2 {
    font-size: clamp(2rem, 4vw, 3.25rem);
}

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

.gh-content p,
.gh-content ul,
.gh-content ol,
.gh-content blockquote,
.gh-content pre,
.gh-content table,
.gh-content figure {
    margin-top: 1.4em;
    margin-bottom: 1.4em;
}

.gh-content blockquote {
    padding: 0.2em 0 0.2em 1.25em;
    border-left: 4px solid var(--ember);
    font-family: Georgia, serif;
    font-size: 1.2em;
    font-style: italic;
}

.gh-content code {
    padding: 0.15em 0.35em;
    background: #e0e2dc;
    font: 0.86em/1.5 var(--utility);
}

.gh-content pre {
    max-width: min(900px, calc(100vw - 32px));
    overflow-x: auto;
    padding: 22px;
    background: #18201b;
    color: #eef1ed;
    font: 0.84em/1.65 var(--utility);
}

.gh-content pre code {
    padding: 0;
    background: transparent;
    color: inherit;
}

.gh-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: 0.9em;
}

.gh-content th,
.gh-content td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.gh-content hr {
    margin-block: 3em;
    border: 0;
    border-top: 1px solid var(--line);
}

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

.gh-content .kg-width-full {
    width: 100vw;
    max-width: none;
    margin-left: 50%;
    transform: translateX(-50%);
}

.kg-gallery-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kg-gallery-row {
    display: flex;
    gap: 8px;
}

.kg-gallery-image {
    flex: 1;
}

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

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

.article-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    max-width: var(--reading);
    min-height: 110px;
    margin: 80px auto 0;
    border-block: 1px solid var(--line);
}

.copy-link-button {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    min-height: 44px;
    padding: 10px 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    font: 700 11px/24px var(--utility);
    text-transform: uppercase;
}

.copy-link-button:hover {
    color: var(--ember);
}

.page-article {
    width: min(var(--reading), calc(100% - 48px));
    padding-bottom: 100px;
}

.page-article .page-header {
    max-width: none;
    text-align: center;
}

.page-header .article-deck {
    margin-inline: auto;
}

.page-article > .gh-content {
    width: 100%;
    max-width: none;
    margin: 70px 0 0;
    text-align: left;
}

.page-article > .gh-content > :not(.kg-width-wide):not(.kg-width-full) {
    max-width: none;
    margin-inline: 0;
}

.comments-section {
    width: min(var(--reading), calc(100% - 48px));
    margin-inline: auto;
    padding-block: 60px 100px;
}

.error-page {
    min-height: 66vh;
    padding-block: clamp(90px, 15vw, 190px);
}

.error-page p:not(.section-label) {
    max-width: 600px;
    color: var(--ink-soft);
}

.error-actions {
    display: flex;
    gap: 24px;
    align-items: center;
    margin-top: 30px;
}

@media (max-width: 900px) {
    .desktop-nav {
        display: none;
    }

    .site-menu {
        display: block;
    }

    .site-menu summary {
        display: flex;
        min-width: 60px;
        min-height: 44px;
        align-items: center;
        justify-content: flex-end;
        cursor: pointer;
        font: 750 11px/1 var(--utility);
        list-style: none;
        text-transform: uppercase;
    }

    .site-menu summary::-webkit-details-marker {
        display: none;
    }

    .site-menu nav {
        position: absolute;
        top: 82px;
        right: 0;
        display: grid;
        width: min(260px, calc(100vw - 48px));
        padding: 12px 20px 18px;
        background: var(--ink);
        box-shadow: 0 16px 35px rgb(24 32 27 / 20%);
    }

    .site-menu .nav {
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .site-menu a,
    .site-menu .text-button {
        display: block;
        width: 100%;
        color: var(--paper-raised);
        text-align: left;
    }

    .proof-section {
        grid-template-columns: 1fr;
    }

    .proof-section > .read-link {
        grid-column: auto;
    }

    .post-card--row .post-card-body {
        grid-template-columns: 135px minmax(0, 1fr);
    }

    .post-card--row .read-link {
        grid-column: 2;
        grid-row: 3;
        justify-self: start;
    }
}

@media (max-width: 720px) {
    :root {
        --shell: min(100% - 28px, 1180px);
    }

    body {
        font-size: 16px;
    }

    .site-header {
        min-height: 68px;
        border-bottom-width: 3px;
    }

    .identity-name {
        display: none;
    }

    .site-menu nav {
        top: 68px;
        width: min(260px, calc(100vw - 28px));
    }

    .home-hero {
        display: block;
        min-height: auto;
        padding-block: 72px 64px;
    }

    .hero-copy h1 {
        font-size: clamp(2.7rem, 13vw, 4rem);
        line-height: 0.98;
    }

    .archive-header h1,
    .article-header h1,
    .error-page h1 {
        font-size: clamp(2.9rem, 14vw, 4.8rem);
        line-height: 0.98;
    }

    .post-template .article-header h1 {
        font-size: clamp(2.35rem, 10vw, 3rem);
        line-height: 1.08;
    }

    .hero-intro {
        margin-top: 24px;
    }

    .section-heading {
        display: block;
    }

    .section-heading > a {
        display: inline-flex;
        margin-top: 18px;
        align-items: center;
    }

    .topic-grid,
    .newsletter-panel {
        grid-template-columns: 1fr;
    }

    .post-card--feature,
    .post-card--feature.has-image {
        grid-template-columns: 1fr;
        grid-template-areas: "body" "image";
        gap: 28px;
        padding: 28px 24px;
    }

    .post-card--row {
        padding-block: 26px;
    }

    .post-card--row .post-card-body {
        display: block;
    }

    .post-card.post-card--row h3 {
        margin-top: 12px;
    }

    .post-card.post-card--row p {
        margin: 10px 0 18px;
    }

    .post-card h3 {
        font-size: clamp(1.45rem, 7vw, 2.15rem);
    }

    .post-card.post-card--feature h3 {
        font-size: clamp(2.1rem, 10vw, 3.4rem);
    }

    .page-article {
        width: min(var(--reading), calc(100% - 28px));
    }

    .topic-grid a,
    .topic-grid a:nth-child(2n) {
        min-height: 150px;
        padding: 24px 8px;
        border-right: 0;
    }

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

    .proof-grid div {
        display: flex;
        min-height: 74px;
        padding: 15px 0;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid var(--line);
        border-left: 0;
    }

    .proof-grid dd {
        margin: 0;
        font-size: 1.8rem;
        text-align: right;
    }

    .newsletter-panel {
        padding: 30px 24px;
    }

    .newsletter-panel .button {
        justify-self: start;
    }

    .site-footer {
        display: block;
    }

    .footer-links {
        flex-wrap: wrap;
        margin-top: 28px;
    }

    .article {
        padding-top: 72px;
    }

    .article-image {
        width: 100vw;
        margin-top: 42px;
        margin-left: 50%;
        transform: translateX(-50%);
    }

    .article-image figcaption {
        padding-inline: 14px;
    }

    .article-layout {
        margin-top: 50px;
    }

    .gh-content .kg-width-wide,
    .gh-content .kg-width-full {
        width: 100vw;
    }

    .article-footer {
        padding-block: 22px;
    }

    .error-actions {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
