:root {
    color-scheme: light dark;
    --bg: light-dark(#ffffff, #111210);
    --surface: light-dark(#ffffff, #1a1b18);
    --ink: light-dark(#222426, #f2f2ed);
    --muted: light-dark(#85898b, #a8aaa4);
    --line: light-dark(#e7e8e5, #30312e);
    --accent: light-dark(#087ff0, #66adff);
}

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

html {
    background: var(--bg);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    text-rendering: optimizeLegibility;
}

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

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

a:focus-visible,
button:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.site-shell {
    min-height: 100vh;
}

/* Header keeps the original theme's left navigation, centered wordmark and right actions. */
.site-header {
    width: min(calc(100% - 64px), 2400px);
    min-height: 76px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
    margin: 0 auto;
}

.site-nav ul,
.mobile-nav-panel ul {
    display: flex;
    align-items: center;
    gap: 25px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-nav a,
.mobile-nav-panel a {
    font-size: 13px;
    font-weight: 600;
}

.site-nav a:hover,
.mobile-nav-panel a:hover,
.site-nav .nav-current a,
.mobile-nav-panel .nav-current a {
    color: var(--accent);
}

.site-brand {
    display: inline-flex;
    align-items: center;
    justify-self: center;
}

.site-brand img {
    width: auto;
    max-width: 180px;
    max-height: 35px;
}

.site-monogram {
    color: var(--ink);
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.08em;
}

.site-actions {
    display: flex;
    align-items: center;
    justify-self: end;
    gap: 20px;
}

.site-search {
    position: relative;
    width: 19px;
    height: 19px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.site-search::before {
    content: "";
    position: absolute;
    top: 1px;
    left: 1px;
    width: 10px;
    height: 10px;
    border: 1.5px solid var(--ink);
    border-radius: 50%;
}

.site-search::after {
    content: "";
    position: absolute;
    top: 12px;
    left: 12px;
    width: 6px;
    height: 1.5px;
    transform: rotate(45deg);
    transform-origin: left center;
    background: var(--ink);
}

.site-login {
    border-radius: 999px;
    padding: 9px 17px;
    background: var(--accent);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.site-login:hover {
    filter: brightness(.95);
}

.mobile-nav {
    display: none;
    position: relative;
}

.mobile-nav summary {
    cursor: pointer;
    list-style: none;
    font-size: 0;
}

.mobile-nav summary::-webkit-details-marker {
    display: none;
}

.mobile-nav summary::before,
.mobile-nav summary::after {
    content: "";
    display: block;
    width: 23px;
    height: 1px;
    background: var(--ink);
}

.mobile-nav summary::after {
    margin-top: 6px;
}

.mobile-nav-panel {
    position: absolute;
    z-index: 10;
    top: calc(100% + 13px);
    right: 0;
    min-width: 180px;
    display: grid;
    gap: 14px;
    padding: 15px 17px;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .13);
}

.mobile-nav-panel ul {
    display: grid;
    gap: 12px;
}

.mobile-nav-panel > a {
    color: var(--muted);
    font-size: 12px;
}

/* CSS multi-column is native masonry; breakpoints mirror the original fluid gallery. */
.feed {
    width: min(80%, 2080px);
    margin: 0 auto;
    padding: 50px 0 86px;
    column-count: 3;
    column-gap: 28px;
}

.feed-post {
    display: inline-block;
    width: 100%;
    margin: 0 0 31px;
    break-inside: avoid;
    vertical-align: top;
}

.post-feature {
    position: relative;
    display: block;
    min-height: 150px;
    overflow: hidden;
    background: var(--line);
}

.post-feature .feature-preview {
    position: absolute;
    z-index: 1;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--line);
}

.post-feature .feature-preview[hidden] {
    display: none;
}

.post-thumb img[tabindex="0"] {
    cursor: pointer;
}

.post-thumb img[tabindex="0"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.feature-picture,
.feature-empty {
    display: block;
}

.feature-image {
    width: 100%;
    height: auto;
    object-fit: cover;
    transition: transform 240ms ease;
}

.post-feature:hover .feature-image {
    transform: scale(1.012);
}

.feature-empty {
    display: grid;
    aspect-ratio: 3 / 2;
    place-items: center;
    padding: 18px;
    background: var(--line);
    color: var(--muted);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 22px;
    text-align: center;
}

.post-thumbs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin-top: 4px;
}

.post-thumbs[hidden] {
    display: none;
}

.post-thumb {
    position: relative;
    min-height: 48px;
    overflow: hidden;
    margin: 0;
    background: var(--line);
}

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

.post-thumb:hover img {
    transform: scale(1.035);
}

.post-thumb-more::after {
    content: attr(data-more);
    position: absolute;
    right: 5px;
    bottom: 5px;
    display: grid;
    min-width: 25px;
    height: 20px;
    place-items: center;
    border-radius: 999px;
    background: rgba(0, 0, 0, .72);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
}

.post-caption {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding-top: 7px;
}

.post-title {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 15px;
    font-weight: 400;
    letter-spacing: -0.025em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.post-meta {
    flex: 0 0 auto;
    margin: 0;
    color: var(--muted);
    font-size: 9px;
    white-space: nowrap;
}

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

.post-meta .post-count {
    display: inline-block;
    margin-left: 4px;
    color: var(--muted);
}

.post-meta .post-count::before {
    content: "·";
    margin-right: 4px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    width: 100%;
    margin-top: 18px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
    column-span: all;
}

.text-link {
    color: var(--accent);
}

.text-link:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

.empty-feed,
.error-page {
    width: min(calc(100% - 48px), 680px);
    margin: 0 auto;
    padding: 120px 0;
    text-align: center;
}

.error-page h1 {
    margin: 8px 0 20px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(42px, 8vw, 84px);
    font-weight: 400;
    line-height: .95;
}

/* Single post: the home page is compact, while a post keeps a comfortable reading measure. */
.single-post {
    width: min(calc(100% - 48px), 1000px);
    margin: 0 auto;
    padding: 64px 0 100px;
}

.single-post-head {
    max-width: 840px;
    margin: 0 auto 35px;
    text-align: center;
}

.single-post-head h1 {
    margin: 8px 0 13px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(44px, 7vw, 82px);
    font-weight: 400;
    line-height: .94;
    letter-spacing: -.035em;
}

.post-kicker {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
}

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

.single-summary {
    max-width: 640px;
    margin: 0 auto;
    color: var(--muted);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 17px;
}

.single-feature {
    margin: 0 0 55px;
}

.single-feature .feature-image {
    width: 100%;
}

.single-feature figcaption {
    margin-top: 9px;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.post-content {
    max-width: 760px;
    margin: 0 auto;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 18px;
    line-height: 1.65;
}

.post-content > * {
    margin-top: 0;
    margin-bottom: 1.4em;
}

.post-content img {
    width: auto;
    height: auto;
}

.post-content .kg-image-card,
.post-content .kg-gallery-card {
    width: 100%;
    margin-right: 0;
    margin-left: 0;
}

.post-content .kg-width-wide {
    width: min(100% + 200px, 960px);
    margin-left: -100px;
}

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

.kg-gallery-container {
    display: grid;
    gap: 8px;
}

.kg-gallery-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.kg-gallery-image {
    min-width: 0;
}

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

.single-post-foot {
    max-width: 760px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 60px auto 0;
    padding-top: 22px;
    border-top: 1px solid var(--line);
    font-size: 12px;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--muted);
}

.post-tags a + a::before {
    content: "·";
    margin-right: 10px;
    color: var(--line);
}

.site-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 34px 20px 40px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 10px;
    text-align: center;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (min-width: 2000px) {
    .feed {
        column-count: 5;
    }
}

@media (min-width: 1700px) and (max-width: 1999px) {
    .feed {
        column-count: 4;
    }
}

@media (max-width: 900px) {
    .feed {
        width: calc(100% - 40px);
        padding-top: 34px;
        column-count: 2;
        column-gap: 16px;
    }

    .site-header {
        width: calc(100% - 40px);
    }
}

@media (max-width: 700px) {
    .site-header {
        min-height: 64px;
        grid-template-columns: 1fr auto;
        gap: 16px;
    }

    .site-nav,
    .site-search,
    .site-login {
        display: none;
    }

    .site-brand {
        justify-self: start;
    }

    .mobile-nav {
        display: block;
    }

    .feed {
        width: calc(100% - 28px);
        padding: 28px 0 58px;
        column-count: 2;
        column-gap: 12px;
    }

    .feed-post {
        margin-bottom: 19px;
    }

    .post-feature {
        min-height: 90px;
    }

    .post-thumb {
        min-height: 34px;
    }

    .post-thumbs {
        gap: 3px;
        margin-top: 3px;
    }

    .post-caption {
        gap: 5px;
        padding-top: 5px;
    }

    .post-title {
        font-size: 12px;
    }

    .post-meta {
        font-size: 7px;
    }

    .post-meta .post-count {
        display: none;
    }

    .post-thumb-more::after {
        right: 3px;
        bottom: 3px;
        min-width: 19px;
        height: 16px;
        font-size: 7px;
    }

    .single-post {
        width: calc(100% - 32px);
        padding: 48px 0 65px;
    }

    .single-post-head {
        margin-bottom: 27px;
    }

    .single-post-head h1 {
        font-size: 48px;
    }

    .post-content {
        font-size: 17px;
    }

    .post-content .kg-width-wide,
    .post-content .kg-width-full {
        width: 100%;
        margin-left: 0;
    }

    .single-post-foot {
        align-items: flex-start;
        flex-direction: column;
        margin-top: 44px;
    }
}

@media (max-width: 360px) {
    .feed {
        width: calc(100% - 24px);
        column-gap: 9px;
    }

    .site-header {
        width: calc(100% - 28px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .feature-image,
    .post-thumb img {
        transition: none;
    }
}
