@import url("../fonts/source-han-serif/index.css");
@import url("../fonts/source-han-sans/index.css");

:root {
    --paper: #f7f7f5;
    --panel: #fff;
    --ink: #161716;
    --muted: #6f716e;
    --soft: #ececea;
    --line: #dededb;
    --green: #bfe8cb;
    --green-ink: #23613a;
    --serif: "Noto Serif SC Variable", "Source Han Serif SC", "Noto Serif CJK SC", STSong, Georgia, serif;
    --sans: "Noto Sans SC Variable", "Source Han Sans SC", "Noto Sans CJK SC", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
}

html[data-theme="dark"] {
    --paper: #171817;
    --panel: #202120;
    --ink: #f1f1ee;
    --muted: #aaaCA8;
    --soft: #292b29;
    --line: #393b39;
    --green: #315f40;
    --green-ink: #d5f6dd;
}

* { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--ink);
    background-color: var(--paper);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    transition: color .2s ease, background .2s ease;
}
body.menu-opened { overflow: hidden; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
button { color: inherit; font: inherit; }

.site-header {
    position: fixed;
    z-index: 30;
    top: 0;
    left: 0;
    right: 0;
    height: 82px;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
}
.brand, .header-actions { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 650; font-size: .92rem; }
.brand-mark {
    width: 25px;
    height: 25px;
    padding: 4px;
    border-radius: 7px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
    background: var(--ink);
}
.brand-mark i { border-radius: 999px; background: var(--paper); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.theme-toggle, .menu-toggle {
    min-height: 38px;
    border: 0;
    border-radius: 999px;
    background: color-mix(in srgb, var(--soft) 92%, transparent);
    cursor: pointer;
}
.theme-toggle { width: 38px; }
.menu-toggle { padding: 0 8px 0 16px; display: flex; gap: 10px; align-items: center; }
.menu-toggle b {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--panel);
    font-size: 1.05rem;
    line-height: 1;
    transition: transform .25s ease;
}
.menu-close { display: none; }
.menu-opened .menu-open { display: none; }
.menu-opened .menu-close { display: inline; }
.menu-opened .menu-toggle b { transform: rotate(45deg); }

.menu-panel {
    position: fixed;
    z-index: 20;
    inset: 0;
    padding: 110px 28px 32px;
    display: grid;
    justify-content: end;
    visibility: hidden;
    opacity: 0;
    background: color-mix(in srgb, var(--paper) 96%, transparent);
    backdrop-filter: blur(16px);
    transition: opacity .2s ease, visibility .2s ease;
}
.menu-opened .menu-panel { visibility: visible; opacity: 1; }
.menu-panel-inner { width: min(520px, calc(100vw - 56px)); }
.menu-panel-inner > span { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; }
.menu-panel .nav { margin: 24px 0 50px; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.menu-panel .nav li { border-bottom: 1px solid var(--line); }
.menu-panel .nav a { display: block; padding: 16px 0; font: 500 clamp(1.45rem, 3vw, 2.25rem)/1.25 var(--sans); }
.menu-panel .nav a:hover { padding-left: 10px; color: var(--green-ink); }
.menu-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: .78rem; }

.home-layout { min-height: 100vh; display: grid; grid-template-columns: 43% 57%; }
.home-rail {
    position: sticky;
    top: 0;
    height: 100vh;
    background-color: var(--paper);
    padding: 128px clamp(28px, 4vw, 70px) 38px 28px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.rail-copy { max-width: 520px; }
.eyebrow { color: var(--muted); font-size: .7rem; letter-spacing: .14em; }
.rail-copy h1 {
    margin: 22px 0 25px;
    font: 450 clamp(1.85rem, 2.25vw, 2.75rem)/1.32 var(--sans);
    letter-spacing: -.025em;
}
.rail-copy p { max-width: 450px; margin: 0; color: var(--muted); font: 1rem/1.85 var(--serif); }
.rail-links { position: absolute; bottom: 38px; left: 28px; display: flex; gap: 23px; font-size: .78rem; }
.rail-links a { border-bottom: 1px solid transparent; }
.rail-links a:hover { border-color: currentColor; }

.home-stream {
    min-width: 0;
    padding: 95px clamp(24px, 4vw, 62px) 80px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px 0 0 0;
}
.stream-heading {
    padding: 0 0 25px;
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: .72rem;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.post-stream { border-top: 1px solid var(--line); }
.thought-card { position: relative; padding: 46px 0 62px 66px; border-bottom: 1px solid var(--line); }
.date-chip {
    position: absolute;
    top: 56px;
    left: -28px;
    width: 98px;
    color: var(--muted);
    font-size: .68rem;
    text-align: center;
    transform: rotate(-90deg);
}
.thought-meta { display: flex; align-items: center; gap: 10px; min-height: 27px; color: var(--muted); font-size: .72rem; }
.thought-meta a, .thought-meta em {
    padding: 6px 11px;
    border-radius: 999px;
    background: var(--green);
    color: var(--green-ink);
    font-style: normal;
}
.thought-meta em { margin-left: auto; background: var(--soft); color: var(--muted); }
.thought-card h2 { margin: 16px 0 22px; font: 500 clamp(1.6rem, 2.2vw, 2.3rem)/1.32 var(--sans); letter-spacing: -.025em; }
.thought-card h2 a:hover { color: var(--green-ink); }
.thought-image { display: block; margin: 0 0 26px; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--soft); }
.thought-image img { width: 100%; aspect-ratio: 16/9; object-fit: cover; transition: transform .45s ease; }
.thought-image:hover img { transform: scale(1.015); }
.thought-card p { margin: 0 0 17px; color: var(--muted); font: 1rem/1.8 var(--serif); }
.thought-card .thought-lead { color: var(--ink); font-weight: 600; line-height: 1.7; }
.read-more { display: inline-flex; align-items: center; gap: 9px; margin-top: 7px; padding: 8px 13px; border-radius: 8px; background: var(--soft); font-size: .74rem; }
.read-more span { transition: transform .2s ease; }
.read-more:hover span { transform: translateX(4px); }
.empty-state { min-height: 58vh; padding: 90px 8%; display: flex; flex-direction: column; justify-content: center; }
.empty-state > span { color: var(--green-ink); font-size: .7rem; letter-spacing: .14em; }
.empty-state h3 { margin: 22px 0 12px; font: 450 clamp(1.6rem, 2.4vw, 2.5rem)/1.4 var(--sans); }
.empty-state p { color: var(--muted); font: 1rem/1.8 var(--serif); }

.pagination { display: grid; grid-template-columns: 1fr auto 1fr; margin: 38px 0 0 66px; color: var(--muted); font-size: .75rem; }
.pagination > :last-child { text-align: right; }

.site-footer {
    min-height: 110px;
    padding: 38px max(28px, calc((100% - 1180px)/2));
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .72rem;
}
.home-template .site-footer { display: none; }

.collection-header, .article-header {
    width: min(940px, calc(100% - 48px));
    margin: 0 auto;
    padding: 150px 0 65px;
}
.collection-header > span, .article-eyebrow { color: var(--muted); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; }
.collection-header h1, .article-header h1 {
    margin: 24px 0;
    font: 500 clamp(2.6rem, 4vw, 4.5rem)/1.12 var(--sans);
    letter-spacing: -.035em;
}
.collection-header p, .article-deck { max-width: 720px; color: var(--muted); font: 1.12rem/1.85 var(--serif); }
.content-grid {
    width: min(900px, calc(100% - 48px));
    margin: 0 auto 100px;
    padding: 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
}
.content-grid .thought-card { padding-right: 44px; padding-left: 90px; }
.content-grid .date-chip { left: -8px; }
.content-grid .empty-state { min-height: 360px; }
.content-grid .empty-state h3 { font-size: clamp(1.65rem, 2.6vw, 2.75rem); }

.article { padding-bottom: 110px; }
.article-eyebrow { display: flex; flex-wrap: wrap; gap: 18px; }
.article-eyebrow a { color: var(--green-ink); }
.article-header h1 { max-width: 900px; }
.article-deck { margin: 30px 0 0; }
.article-image { width: min(1060px, calc(100% - 48px)); margin: 0 auto 72px; }
.article-image img { width: 100%; border-radius: 14px; }
.article-image figcaption { margin-top: 10px; color: var(--muted); font-size: .72rem; text-align: center; }
.article-layout { display: grid; grid-template-columns: 145px minmax(0, 740px); justify-content: center; gap: clamp(38px, 6vw, 90px); }
.article-aside { padding-top: 7px; color: var(--muted); font-size: .67rem; line-height: 1.8; letter-spacing: .08em; }
.article-aside span, .article-aside strong { display: block; }
.article-aside strong { margin-top: 8px; color: var(--ink); font: 400 1rem/1.4 var(--serif); letter-spacing: 0; }
.article-tags { margin-top: 24px; }
.gh-content { min-width: 0; font: 400 1.105rem/2 var(--serif); }
.gh-content > * { margin-top: 0; margin-bottom: 1.55em; }
.gh-content h2 { margin-top: 2.5em; font: 600 1.75rem/1.45 var(--sans); }
.gh-content h3 { margin-top: 2.1em; font: 600 1.35rem/1.5 var(--sans); }
.gh-content a { color: var(--green-ink); border-bottom: 1px solid currentColor; }
.gh-content blockquote { margin: 2.2em 0; padding: .15em 0 .15em 1.5em; border-left: 3px solid var(--green-ink); color: var(--muted); }
.gh-content hr { width: 60px; height: 1px; margin: 4em auto; border: 0; background: var(--line); }
.gh-content figcaption { color: var(--muted); font: .75rem/1.6 var(--sans); text-align: center; }
.gh-content pre { overflow-x: auto; padding: 24px; border-radius: 10px; background: var(--ink); color: var(--paper); font: .88rem/1.7 ui-monospace, monospace; }
.gh-content code { font-family: ui-monospace, monospace; font-size: .88em; }
.gh-content table { width: 100%; border-collapse: collapse; font: .9rem/1.65 var(--sans); }
.gh-content th, .gh-content td { padding: 11px 9px; border-bottom: 1px solid var(--line); text-align: left; }
.gh-content .kg-width-wide { width: min(1000px, 86vw); margin-left: 50%; transform: translateX(-50%); }
.gh-content .kg-width-full { width: 100vw; margin-left: 50%; transform: translateX(-50%); }
.article-footer { width: min(740px, calc(100% - 48px)); margin: 80px auto 0; padding-top: 22px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; }
.article-footer > span { color: var(--green-ink); }
.page-content { width: min(740px, calc(100% - 48px)); margin: 140px auto 0; }
.page-article .article-header + .page-content { margin-top: 0; }
.error-page { min-height: 78vh; padding: 120px 24px; display: grid; place-content: center; text-align: center; }
.error-page > span { color: var(--green-ink); font-size: .75rem; letter-spacing: .2em; }
.error-page h1 { margin: 20px 0 8px; font: 500 clamp(2.5rem, 6vw, 4.75rem)/1.15 var(--sans); }
.error-page p { color: var(--muted); }
.error-page a { display: inline-block; margin-top: 25px; }

@media (max-width: 900px) {
    .site-header { height: 70px; padding: 0 18px; }
    .home-layout { display: block; }
    .home-rail { position: relative; height: auto; min-height: 70vh; padding: 128px 24px 90px; justify-content: center; }
    .rail-copy h1 { font-size: clamp(2rem, 6.5vw, 3rem); }
    .rail-links { left: 24px; bottom: 28px; }
    .home-stream { padding: 72px 24px 60px; border-radius: 18px 18px 0 0; }
    .article-layout { display: block; width: min(740px, calc(100% - 48px)); margin: 0 auto; }
    .article-aside { display: none; }
    .gh-content { width: 100%; }
}

@media (max-width: 620px) {
    .brand-name { font-size: .82rem; }
    .theme-toggle { display: none; }
    .menu-toggle { min-height: 34px; font-size: .78rem; }
    .home-rail { min-height: 620px; padding: 110px 20px 82px; }
    .rail-copy h1 { font-size: clamp(2rem, 9vw, 2.8rem); line-height: 1.34; }
    .rail-copy p { font-size: .96rem; }
    .rail-links { left: 20px; gap: 18px; }
    .home-stream { padding: 62px 18px 50px; }
    .thought-card { padding: 36px 0 50px 30px; }
    .date-chip { top: 49px; left: -39px; font-size: .62rem; }
    .thought-card h2 { font-size: 1.7rem; }
    .thought-card p { font-size: .96rem; }
    .content-grid { width: calc(100% - 24px); }
    .content-grid .thought-card { padding: 34px 18px 45px 46px; }
    .content-grid .date-chip { left: -27px; }
    .collection-header, .article-header { width: calc(100% - 36px); padding: 118px 0 48px; }
    .collection-header h1, .article-header h1 { font-size: clamp(2.4rem, 10vw, 3.5rem); }
    .article-image { width: calc(100% - 24px); margin-bottom: 50px; }
    .article-layout, .article-footer, .page-content { width: calc(100% - 36px); }
    .gh-content { font-size: 1.04rem; line-height: 1.95; }
    .gh-content .kg-width-wide, .gh-content .kg-width-full { width: 100%; margin-left: 0; transform: none; }
    .site-footer { min-height: 135px; padding: 38px 18px; display: block; }
    .site-footer span { display: block; margin-bottom: 8px; }
}
