@import url('fonts.css');

:root {
    --ink: #17331f;
    --accent: #2a8f45;
    --paper: #fbfbfa;
    --grid: #e9ece9;
    --hairline: #e4e7e4;
    --muted: #8b948d;

    --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
    --font-sans: 'IBM Plex Sans', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img, svg { max-width: 100%; height: auto; display: block; }

body {
    font-family: var(--font-sans);
    color: var(--ink);
    background: var(--paper);
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 11px 11px;
    padding: 0 32px 140px;
    -webkit-font-smoothing: antialiased;
}

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

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 0;
}

/* ---------- Content sheet ---------- */

.gh-sheet {
    max-width: 1040px;
    margin: 0 auto;
    background: var(--paper);
    box-shadow: 0 0 0 1px var(--hairline);
}

/* ---------- Masthead ---------- */

.gh-masthead {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    padding: 40px 48px 20px;
    border-bottom: 1px solid var(--ink);
}

.gh-masthead-logo {
    display: block;
    width: 300px;
    height: auto;
}

.gh-nav {
    display: flex;
    align-items: center;
    gap: 24px;
    padding-bottom: 4px;
}

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

.gh-nav .nav a {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    border-bottom: 2px solid transparent;
    padding-bottom: 2px;
    transition: border-color 150ms ease-out;
}

.gh-nav .nav a:hover,
.gh-nav .nav .nav-current a {
    border-bottom-color: var(--accent);
}

.gh-nav-search {
    display: flex;
    padding-bottom: 2px;
    background: none;
    border: 0;
    color: inherit;
    cursor: pointer;
}

/* ---------- Post/page body grid ---------- */

.gh-body-grid {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 48px;
    padding: 64px 48px 88px;
}

.gh-body-grid.no-rail {
    grid-template-columns: 1fr;
}

/* ---------- Meta rail ---------- */

.gh-meta-rail {
    display: flex;
    flex-direction: column;
    gap: 22px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    border-right: 1px solid var(--hairline);
    padding-right: 24px;
}

.gh-meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gh-meta-label {
    color: var(--muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: 10px;
}

.gh-meta-value {
    font-weight: 500;
}

.gh-share-button {
    margin-top: 6px;
    align-self: flex-start;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink);
    background: none;
    border: 1px solid var(--ink);
    border-radius: 0;
    padding: 9px 14px;
    cursor: pointer;
    transition: background-color 150ms ease-out, color 150ms ease-out;
}

.gh-share-button:hover {
    background: var(--ink);
    color: var(--paper);
}

/* ---------- Article column ---------- */

.gh-article-col {
    max-width: 640px;
}

.gh-eyebrow {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 20px;
}

.gh-article-col h1 {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 42px;
    line-height: 1.18;
    letter-spacing: -0.02em;
    margin: 0;
    text-wrap: balance;
}

/* ---------- Prose (.gh-content) ---------- */

.gh-content {
    font-size: 19px;
    line-height: 1.68;
}

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

.gh-content p {
    margin: 24px 0 0;
    text-wrap: pretty;
}

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

.gh-content h2 {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 28px;
    line-height: 1.25;
    letter-spacing: -0.01em;
    margin: 56px 0 0;
}

.gh-content h3 {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 22px;
    line-height: 1.3;
    margin: 44px 0 0;
}

.gh-content a {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-color: var(--hairline);
    text-underline-offset: 3px;
    transition: color 150ms ease-out;
}

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

.gh-content ul,
.gh-content ol {
    list-style: none;
    margin: 32px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.gh-content li {
    padding-left: 28px;
    position: relative;
}

.gh-content ul li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 11px;
    width: 9px;
    height: 9px;
    background: var(--accent);
}

.gh-content ol {
    counter-reset: gh-ol;
}

.gh-content ol li::before {
    counter-increment: gh-ol;
    content: counter(gh-ol) ".";
    position: absolute;
    left: 0;
    top: 0;
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
}

.gh-content li strong { font-weight: 600; }

.gh-content blockquote {
    margin: 40px 0 0;
    padding-left: 24px;
    border-left: 2px solid var(--accent);
    font-style: italic;
    color: var(--ink);
}

.gh-content code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--grid);
    padding: 0.15em 0.4em;
}

.gh-content pre {
    margin: 32px 0 0;
    padding: 20px 24px;
    background: var(--ink);
    color: var(--paper);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.6;
}

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

.gh-content figure {
    margin: 40px 0 0;
}

.gh-content figure img {
    width: 100%;
    box-shadow: 0 0 0 1px var(--hairline);
}

.gh-content figcaption {
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

.gh-content hr {
    margin: 56px 0 0;
    border: none;
    border-top: 1px solid var(--hairline);
}

.gh-content table {
    margin: 32px 0 0;
    width: 100%;
    border-collapse: collapse;
    font-size: 16px;
}

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

.gh-content th {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 500;
}

/* ---------- Koenig editor cards ---------- */

.gh-content .kg-width-wide {
    width: 100%;
    max-width: 860px;
    margin-left: 50%;
    transform: translateX(-50%);
}

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

.gh-content .kg-width-full img {
    box-shadow: none;
}

.gh-content .kg-gallery-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 40px 0 0;
}

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

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

.gh-content .kg-gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    box-shadow: 0 0 0 1px var(--hairline);
}

.gh-content .kg-bookmark-card {
    margin: 40px 0 0;
}

.gh-content .kg-bookmark-container {
    display: flex;
    color: var(--ink);
    box-shadow: 0 0 0 1px var(--hairline);
    text-decoration: none;
    transition: box-shadow 150ms ease-out;
}

.gh-content .kg-bookmark-container:hover {
    box-shadow: 0 0 0 1px var(--accent);
}

.gh-content .kg-bookmark-content {
    flex: 1 1 auto;
    padding: 20px 24px;
    min-width: 0;
}

.gh-content .kg-bookmark-title {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 16px;
    line-height: 1.4;
}

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

.gh-content .kg-bookmark-metadata {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.gh-content .kg-bookmark-icon {
    width: 16px;
    height: 16px;
}

.gh-content .kg-bookmark-author {
    color: var(--muted);
}

.gh-content .kg-bookmark-publisher::before {
    content: "\2013";
    margin-right: 8px;
}

.gh-content .kg-bookmark-thumbnail {
    flex: 0 0 200px;
    align-self: stretch;
}

.gh-content .kg-bookmark-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    box-shadow: none;
}

@media (max-width: 600px) {
    .gh-content .kg-bookmark-container { flex-direction: column-reverse; }
    .gh-content .kg-bookmark-thumbnail { flex-basis: 160px; }
}

/* ---------- Post list (index) ---------- */

.gh-post-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.gh-post-list-item {
    padding: 32px 0;
    border-bottom: 1px solid var(--hairline);
}

.gh-post-list-item:first-child { padding-top: 0; }
.gh-post-list-item:last-child { border-bottom: none; }

.gh-post-list-date {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 10px;
}

.gh-post-list-title {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 24px;
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin: 0 0 10px;
}

.gh-post-list-title a:hover { color: var(--accent); }

.gh-post-list-excerpt {
    font-size: 17px;
    line-height: 1.6;
    color: var(--ink);
    max-width: 640px;
}

.gh-post-list-more {
    margin-top: 40px;
}

.gh-post-list-more a {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
}

/* ---------- Footer ---------- */

.gh-footer {
    padding: 24px 48px 40px;
    border-top: 1px solid var(--hairline);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
}

.gh-footer a { color: var(--muted); }
.gh-footer a:hover { color: var(--accent); }

.gh-footer-social {
    display: flex;
    gap: 16px;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .gh-body-grid {
        grid-template-columns: 1fr;
    }

    .gh-meta-rail {
        flex-direction: row;
        flex-wrap: wrap;
        border-right: none;
        border-bottom: 1px solid var(--hairline);
        padding-right: 0;
        padding-bottom: 24px;
        gap: 32px;
    }

    .gh-article-col {
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    body { padding: 0 12px 80px; }

    .gh-sheet { padding: 0; }

    .gh-masthead {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 20px;
    }

    .gh-masthead-logo { width: 220px; }

    .gh-nav { flex-wrap: wrap; }

    .gh-body-grid { padding: 20px; }

    .gh-article-col h1 { font-size: 32px; }

    .gh-footer {
        padding: 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}
