:root {
    --bg: #fbfaf7;
    --paper: #fffdfa;
    --text: #17212b;
    --muted: #6f7b86;
    --soft: #8d99a4;
    --line: #e5ded3;
    --line-strong: #d4c7b8;
    --accent: #2b7a78;
    --accent-ink: #155351;
    --warm: #b66a3c;
    --code-bg: #f1eee7;
    --code-text: #9f2946;
    --shadow: 0 18px 45px rgba(32, 43, 53, .07);
}

* {
    box-sizing: border-box;
    padding: 0;
    margin: 0;
    border: none;
    outline: 0;
}

html {
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    color: var(--text);
    background:
        linear-gradient(180deg, rgba(43, 122, 120, .08), rgba(251, 250, 247, 0) 300px),
        var(--bg);
    font-family: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 17px;
    line-height: 1.78;
    letter-spacing: 0;
    text-rendering: optimizeLegibility;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color .18s ease, border-color .18s ease, background-color .18s ease, transform .18s ease;
}

a:hover {
    color: var(--accent-ink);
}

img {
    max-width: 100%;
    height: auto;
}

#container {
    width: min(92vw, 860px);
    margin: 42px auto 54px;
}

#main {
    display: block;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    align-items: center;
    margin-bottom: 34px;
    padding: 12px 0 16px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 14px;
    line-height: 1.4;
}

.site-nav a {
    position: relative;
    padding: 3px 0;
    color: var(--muted);
}

.site-nav a::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -4px;
    left: 0;
    height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .18s ease;
}

.site-nav a:hover {
    color: var(--text);
}

.site-nav a:hover::after {
    transform: scaleX(1);
}

header {
    padding: 4px 0 24px;
    border-bottom: 1px solid var(--line-strong);
}

header > a {
    color: var(--muted);
    font-size: 15px;
}

header > a:hover {
    color: var(--accent-ink);
}

.site-kicker {
    margin-bottom: 8px;
    color: var(--warm);
    font-size: 13px;
    font-weight: 700;
}

h1,
h2,
h3,
h4 {
    color: var(--text);
    font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
    font-weight: 800;
    line-height: 1.28;
}

h1 {
    max-width: 780px;
    font-size: clamp(2rem, 5vw, 3.5rem);
}

h1 a {
    color: var(--text);
}

h1 a:hover {
    color: var(--accent-ink);
}

h2 {
    margin: 2.2em 0 .85em;
    font-size: 1.42em;
}

h3 {
    margin: 1.55em 0 .7em;
    font-size: 1.16em;
}

h4 {
    margin: 1.35em 0 .65em;
    font-size: 1.05em;
}

.site-description {
    max-width: 620px;
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 1.02em;
}

.slash {
    padding: 0 8px;
    color: var(--soft);
}

.content {
    margin-top: 26px;
}

.home-index {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(260px, .85fr);
    gap: 24px;
    margin: 4px 0 34px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--line);
}

.section-label {
    display: block;
    margin-bottom: 8px;
    color: var(--warm);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.feature-topic-stack {
    display: grid;
    gap: 14px;
}

.feature-topic {
    display: grid;
    gap: 10px;
    min-height: 172px;
    padding: 22px;
    color: var(--text);
    background:
        linear-gradient(135deg, rgba(43, 122, 120, .13), rgba(182, 106, 60, .07)),
        var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.feature-topic strong {
    font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
    font-size: 1.34em;
    line-height: 1.35;
}

.feature-topic span:last-child {
    max-width: 560px;
    color: var(--muted);
    font-size: .96em;
}

.feature-topic:hover {
    color: var(--text);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.quick-categories {
    padding-top: 2px;
}

.category-grid {
    display: grid;
    gap: 10px;
}

.category-grid a {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
}

.category-grid span {
    color: var(--text);
    font-weight: 700;
}

.category-grid em {
    color: var(--soft);
    font-size: 13px;
    font-style: normal;
    white-space: nowrap;
}

.category-grid a:hover span {
    color: var(--accent-ink);
}

.section-heading {
    display: flex;
    gap: 16px;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 14px;
}

.section-heading span {
    color: var(--warm);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.section-heading h2 {
    margin: 0;
    font-size: 1.18em;
}

.post-list {
    display: grid;
    gap: 0;
    padding: 0;
    border-top: 1px solid var(--line);
}

.post-item {
    position: relative;
    display: grid;
    gap: 7px;
    padding: 18px 0 19px 18px;
    border-bottom: 1px solid var(--line);
    list-style: none;
}

.post-item::before {
    content: "";
    position: absolute;
    top: 22px;
    bottom: 22px;
    left: 0;
    width: 3px;
    border-radius: 3px;
    background: transparent;
    transition: background-color .18s ease;
}

.post-item:hover::before {
    background: var(--accent);
}

.post-title {
    width: fit-content;
    max-width: 100%;
    color: var(--text);
    font-size: 1.08em;
    font-weight: 700;
    line-height: 1.45;
}

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

.post-meta,
.entry-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.post-meta a,
.entry-meta a {
    color: var(--muted);
    border-bottom: 1px solid transparent;
}

.post-meta a:hover,
.entry-meta a:hover {
    color: var(--accent-ink);
    border-bottom-color: var(--accent);
}

.post-meta span,
.entry-meta span {
    position: relative;
}

.post-meta span::before,
.entry-meta span::before {
    content: "/";
    margin-right: 14px;
    color: var(--line-strong);
}

.post-excerpt {
    max-width: 720px;
    margin: 2px 0 0;
    color: var(--muted);
    font-size: .96em;
    line-height: 1.7;
}

.entry-meta {
    margin-top: 16px;
}

.article-series-badge {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    margin-top: 14px;
    padding: 9px 12px;
    color: var(--muted);
    background: rgba(43, 122, 120, .07);
    border: 1px solid rgba(43, 122, 120, .16);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.article-series-badge span {
    color: var(--soft);
    font-size: 12px;
    font-weight: 700;
}

.article-series-badge a {
    color: var(--accent-ink);
    border-bottom: 1px solid rgba(43, 122, 120, .28);
    font-weight: 700;
}

.article-series-badge a:hover {
    border-bottom-color: var(--accent-ink);
}

.article-series-badge em {
    color: var(--muted);
    font-style: normal;
}

.article-series-badge .series-badge-action {
    font-weight: 600;
}

.post-content {
    max-width: 760px;
}

.post-content h2,
.post-content h3 {
    scroll-margin-top: 28px;
}

.post-content p {
    margin: 1.08em 0;
    line-height: 1.9;
}

.post-content a {
    color: var(--accent-ink);
    border-bottom: 1px solid rgba(43, 122, 120, .35);
}

.post-content a:hover {
    border-bottom-color: var(--accent-ink);
}

.post-content ul,
.post-content ol {
    margin: 1em 0 1.1em 1.35em;
    padding-left: 1em;
}

.post-content li {
    padding: .16em 0;
}

blockquote {
    margin: 1.35em 0;
    padding: .1em 0 .1em 1.05em;
    color: #3f4b55;
    border-left: 4px solid var(--warm);
    background: linear-gradient(90deg, rgba(182, 106, 60, .08), transparent 68%);
}

.insight-card,
.risk-card,
.article-diagram {
    margin: 1.6em 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 253, 250, .76);
}

.insight-card {
    display: grid;
    gap: 8px;
    padding: 18px 20px;
    box-shadow: var(--shadow);
}

.insight-card em,
.risk-card em,
.article-diagram em {
    color: var(--warm);
    font-size: 12px;
    font-style: normal;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.insight-card strong {
    color: var(--text);
    font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
    font-size: 1.18em;
    line-height: 1.45;
}

.insight-card p,
.risk-card p,
.article-diagram p {
    margin: 0;
    color: var(--muted);
    font-size: .94em;
    line-height: 1.72;
}

.article-diagram {
    padding: 18px;
    background:
        linear-gradient(135deg, rgba(43, 122, 120, .08), rgba(182, 106, 60, .04)),
        rgba(255, 253, 250, .72);
}

.article-diagram-header {
    display: flex;
    gap: 12px;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 14px;
}

.article-diagram-header strong {
    font-size: .96em;
}

.flow-lane {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    align-items: stretch;
}

.flow-node {
    display: grid;
    gap: 6px;
    min-height: 92px;
    padding: 13px;
    color: var(--text);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.flow-node b {
    color: var(--text);
    font-size: .95em;
    line-height: 1.45;
}

.flow-node span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.flow-node.is-primary {
    border-color: rgba(43, 122, 120, .42);
    background: rgba(43, 122, 120, .08);
}

.flow-node.is-risk {
    border-color: rgba(182, 106, 60, .42);
    background: rgba(182, 106, 60, .08);
}

.flow-caption {
    margin-top: 12px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

.risk-card {
    display: grid;
    gap: 0;
    overflow: hidden;
}

.risk-card-header {
    display: grid;
    gap: 6px;
    padding: 16px 18px;
    background: rgba(43, 122, 120, .07);
    border-bottom: 1px solid var(--line);
}

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

.risk-grid div {
    display: grid;
    gap: 6px;
    padding: 16px;
    border-right: 1px solid var(--line);
}

.risk-grid div:last-child {
    border-right: 0;
}

.risk-grid strong {
    color: var(--text);
    font-size: .98em;
}

.post-content hr {
    width: 110px;
    margin: 2.1em auto;
    border-top: 2px solid var(--line-strong);
}

code,
kbd,
tt,
var {
    padding: 2px 6px;
    color: var(--code-text);
    background: var(--code-bg);
    border-radius: 5px;
    font-family: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: .9em;
    word-break: break-word;
}

pre {
    max-width: 100%;
    margin: 1.2em 0;
    padding: 18px;
    overflow: auto;
    color: var(--text);
    background: #f2efe8;
    border: 1px solid var(--line);
    border-radius: 8px;
}

pre code {
    padding: 0;
    color: inherit;
    background: transparent;
    border-radius: 0;
    word-break: normal;
}

.post-taxonomy {
    display: grid;
    gap: 6px;
    margin-top: 34px;
    padding: 18px 0 0;
    color: var(--muted);
    border-top: 1px solid var(--line);
    font-size: 14px;
    line-height: 1.8;
}

.post-taxonomy a {
    color: var(--accent-ink);
    border-bottom: 1px solid rgba(43, 122, 120, .28);
}

.post-taxonomy a:hover {
    border-bottom-color: var(--accent-ink);
}

.article-toc {
    display: none;
}

.article-toc nav {
    display: grid;
    gap: 8px;
}

.article-toc a {
    display: block;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.article-toc a:hover {
    color: var(--accent-ink);
}

.article-toc .toc-depth-3 {
    padding-left: 14px;
    color: var(--soft);
}

.series-nav {
    display: flex;
    gap: 18px;
    align-items: center;
    justify-content: space-between;
    margin-top: 36px;
    padding: 18px 20px;
    background:
        linear-gradient(135deg, rgba(43, 122, 120, .11), rgba(182, 106, 60, .06)),
        var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.series-nav strong {
    display: block;
    color: var(--text);
    font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
    font-size: 1.1em;
    line-height: 1.35;
}

.series-nav em {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
    font-style: normal;
}

.series-nav a {
    flex: 0 0 auto;
    margin: 0;
    color: var(--accent-ink);
    border-bottom: 1px solid rgba(43, 122, 120, .3);
    font-size: 14px;
}

.series-nav a:hover {
    border-bottom-color: var(--accent-ink);
}

.post-neighbors {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 22px;
}

.post-neighbors a {
    display: grid;
    gap: 6px;
    min-height: 96px;
    margin: 0;
    padding: 16px;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 253, 250, .55);
}

.post-neighbors a:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.post-neighbors span {
    color: var(--warm);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.post-neighbors strong {
    color: var(--text);
    font-size: .98em;
    line-height: 1.5;
}

.pagenav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 26px;
    color: var(--muted);
    font-size: 15px;
}

.pagenav a {
    padding: 6px 0;
    color: var(--accent-ink);
    border-bottom: 1px solid rgba(43, 122, 120, .28);
}

.pagenav a:hover {
    border-bottom-color: var(--accent-ink);
}

#footer {
    margin-top: 58px;
    padding-top: 24px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: 14px;
}

#footer nav {
    margin-bottom: 8px;
}

#footer a {
    color: var(--muted);
}

#footer a:hover {
    color: var(--accent-ink);
}

.icp {
    margin-top: 6px;
    color: var(--soft);
    font-size: 13px;
}

.back-to-top {
    position: fixed;
    right: max(18px, calc((100vw - 860px) / 2 - 76px));
    bottom: 28px;
    z-index: 20;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    color: var(--accent-ink);
    background: rgba(255, 253, 250, .86);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: var(--shadow);
    cursor: pointer;
    font: inherit;
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity .18s ease, transform .18s ease, color .18s ease, border-color .18s ease, background-color .18s ease;
}

.back-to-top.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.back-to-top:hover {
    color: var(--paper);
    background: var(--accent-ink);
    border-color: var(--accent-ink);
}

.back-to-top:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

nav a {
    margin: 0 5px;
}

[hidden] {
    display: none !important;
}

#container:has(.topics-content) {
    width: min(94vw, 1120px);
}

.topics-content {
    max-width: none;
}

.topic-dashboard {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 34px;
    align-items: start;
}

.topic-index-panel {
    position: sticky;
    top: 28px;
    display: grid;
    gap: 16px;
    padding: 18px;
    background: rgba(255, 253, 250, .72);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.topic-index-panel h2,
.topic-overview h2 {
    margin: 0;
    font-size: 1.12em;
}

.topic-search {
    display: grid;
    gap: 6px;
}

.topic-search span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.topic-search input {
    width: 100%;
    padding: 9px 0;
}

.topic-filter-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 4px;
    background: rgba(43, 122, 120, .07);
    border: 1px solid rgba(43, 122, 120, .16);
    border-radius: 8px;
}

.topic-filter-tabs button {
    min-height: 34px;
    padding: 6px 8px;
    color: var(--muted);
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
}

.topic-filter-tabs button:hover,
.topic-filter-tabs button.is-active {
    color: var(--text);
    background: var(--paper);
}

.topic-outline {
    display: grid;
    gap: 8px;
    max-height: 42vh;
    overflow: auto;
}

.topic-outline a {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: baseline;
    margin: 0;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
}

.topic-outline strong {
    overflow: hidden;
    color: var(--text);
    font-size: 14px;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topic-outline span {
    color: var(--soft);
    font-size: 12px;
    white-space: nowrap;
}

.topics-main {
    min-width: 0;
}

.topic-overview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 22px;
    align-items: end;
    margin-bottom: 30px;
    padding: 2px 0 24px;
    border-bottom: 1px solid var(--line-strong);
}

.topic-overview p {
    max-width: 620px;
    margin: 10px 0 0;
    color: var(--muted);
    font-size: .96em;
    line-height: 1.75;
}

.topic-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.topic-stats span {
    min-width: 96px;
    padding: 10px 12px;
    color: var(--muted);
    background: rgba(43, 122, 120, .07);
    border: 1px solid rgba(43, 122, 120, .16);
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
}

.topic-stats strong {
    display: block;
    color: var(--text);
    font-size: 1.35em;
    line-height: 1.1;
}

.topic-section {
    margin: 2.2em 0 2.7em;
}

.topic-section h2 {
    padding-bottom: .42em;
    border-bottom: 1px solid var(--line);
}

.topic-block {
    margin-top: 1em;
}

.topic-feature-block {
    padding: 22px;
    background: linear-gradient(135deg, rgba(43, 122, 120, .09), rgba(255, 253, 250, .6));
    border: 1px solid var(--line);
    border-radius: 8px;
}

.topic-block h3 {
    font-size: 1.12em;
}

.topic-feature-block h3 {
    margin-top: 0;
    font-size: 1.34em;
}

.topic-audience {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 18px;
}

.topic-audience span {
    padding: 3px 8px;
    color: var(--accent-ink);
    background: rgba(43, 122, 120, .09);
    border: 1px solid rgba(43, 122, 120, .22);
    border-radius: 999px;
    font-size: 13px;
}

.topic-audience-note {
    display: grid;
    gap: 4px;
    margin: 14px 0 4px;
    padding: 12px 14px;
    color: var(--muted);
    background: rgba(182, 106, 60, .07);
    border: 1px solid rgba(182, 106, 60, .18);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.65;
}

.topic-audience-note strong {
    color: var(--warm);
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.topic-posts {
    display: grid;
    gap: 0;
    margin: 1.2em 0 0;
    padding: 0;
    counter-reset: topic;
}

.topic-posts li {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 16px;
    align-items: start;
    padding: 14px 0;
    border-top: 1px solid var(--line);
    counter-increment: topic;
    list-style: none;
}

.topic-posts li::before {
    content: counter(topic, decimal-leading-zero);
    grid-column: 1;
    color: var(--soft);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
}

.topic-posts li > div {
    grid-column: 2;
}

.topic-posts a {
    font-weight: 700;
}

.topic-posts p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: .92em;
    line-height: 1.65;
}

.topic-posts .post-meta {
    grid-column: 3;
    justify-self: end;
    margin: 1px 0 0;
    white-space: nowrap;
}

.topic-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: .55em 1.2em;
    margin: .9em 0;
    padding: 0;
}

.topic-list li {
    display: flex;
    gap: 1em;
    justify-content: space-between;
    padding: .16em 0 .28em;
    border-bottom: 1px dotted var(--line-strong);
    list-style: none;
}

.topic-count {
    color: var(--soft);
    white-space: nowrap;
}

.topic-empty,
.topic-no-results {
    margin: 1em 0;
    padding: 18px;
    color: var(--muted);
    background: rgba(255, 253, 250, .72);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: .58em;
    margin-top: .9em;
}

.tag-cloud a {
    display: inline-flex;
    gap: .35em;
    align-items: center;
    padding: .22em .6em;
    color: var(--muted);
    background: rgba(255, 253, 250, .72);
    border: 1px solid var(--line);
    border-radius: 8px;
    line-height: 1.5;
}

.tag-cloud a:hover {
    color: var(--accent-ink);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.tag-cloud span {
    color: var(--soft);
    font-size: .85em;
}

.license {
    font-size: 12px;
}

textarea {
    overflow: auto;
    resize: vertical;
}

input,
textarea {
    padding: 7px 0;
    font: inherit;
    font-size: 15px;
}

input:not([type='button']):not([type='submit']),
textarea {
    color: var(--text);
    background: transparent;
    border-bottom: 1px solid var(--line-strong);
}

input:not([type='button']):not([type='submit']):focus,
textarea:focus {
    border-bottom-color: var(--accent);
}

textarea {
    width: 100%;
    min-height: 120px;
}

input#author,
input#mail,
input#url {
    width: 32.8%;
}

input.button,
input.submit {
    padding: 7px 12px;
    color: #fff;
    background: var(--text);
    border-radius: 8px;
    cursor: pointer;
}

input.button:hover,
input.submit:hover {
    background: var(--accent-ink);
}

.alert {
    margin: 1em 0;
    padding: 6px 10px;
    border-radius: 8px;
}

.alert a {
    font-weight: 700;
    border: 0;
}

.alert > p,
.alert > ul {
    margin-bottom: 0;
}

.alert > p + p {
    margin-top: 5px;
}

.success {
    color: #176a45;
    border: 1px solid #31a36d;
}

.info {
    color: #1f5f9f;
    border: 1px solid #4b8fd3;
}

.warning {
    color: #93660f;
    border: 1px solid #c9972d;
}

.danger {
    color: #a13528;
    border: 1px solid #d76455;
}

.center {
    text-align: center;
}

.comment-head {
    margin: 1.7em 0 .7em;
    font-size: 1.12em;
    font-weight: 700;
}

ol.comment-list {
    list-style: none;
}

li.comment-parent {
    padding: .8em 0;
    border-top: 1px dashed var(--line-strong);
}

li.comment-child {
    padding: 0;
}

p.comment-user-info {
    margin-bottom: .5em;
}

cite.fn {
    font-style: normal;
    font-weight: 700;
}

span.comment-author cite,
span.comment-author cite a {
    color: var(--text);
}

span.author cite,
span.author cite a {
    color: var(--accent-ink);
}

span.user cite,
span.user cite a {
    color: #455a64;
}

.comment-list p {
    display: inline;
}

.comment-list p.comment-user-info {
    display: block;
    margin-bottom: .5em;
}

.comment-children {
    margin-left: 1.5em;
}

.comment-meta {
    font-size: 14px;
}

.cancel-comment-reply a,
.comment-reply a {
    padding: 0 5px;
    font-size: 14px;
}

.cancel-comment-reply a:hover,
.comment-reply a:hover {
    color: var(--accent-ink);
    border-bottom: 1px solid var(--accent);
}

.comment-button {
    display: block !important;
    margin-bottom: 1em !important;
    text-align: right;
}

@media screen and (max-width: 768px) {
    body {
        font-size: 16px;
    }

    #container {
        width: min(90vw, 860px);
        margin-top: 24px;
    }

    .site-nav {
        gap: 8px 14px;
        margin-bottom: 26px;
        font-size: 14px;
    }

    header {
        padding-bottom: 20px;
    }

    .home-index {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-bottom: 28px;
    }

    .feature-topic {
        min-height: 0;
        padding: 18px;
    }

    .section-heading {
        align-items: center;
    }

    h1 {
        font-size: clamp(1.9rem, 8vw, 2.65rem);
    }

    .post-item {
        padding: 16px 0 17px 14px;
    }

    .post-excerpt {
        font-size: .95em;
    }

    .post-content p {
        line-height: 1.86;
    }

    .article-diagram-header {
        display: grid;
        gap: 4px;
    }

    .flow-lane,
    .risk-grid {
        grid-template-columns: 1fr;
    }

    .flow-node {
        min-height: 0;
    }

    .risk-grid div {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .risk-grid div:last-child {
        border-bottom: 0;
    }

    .back-to-top {
        right: 16px;
        bottom: 18px;
        width: 44px;
        height: 44px;
    }

    .series-nav {
        display: grid;
        padding: 16px;
    }

    .article-series-badge {
        width: 100%;
    }

    .post-neighbors {
        grid-template-columns: 1fr;
    }

    .topic-feature-block {
        padding: 18px;
    }

    .topic-posts li {
        grid-template-columns: 32px minmax(0, 1fr);
        gap: 8px 12px;
    }

    .topic-posts .post-meta {
        grid-column: 2;
        justify-self: start;
    }

    input#author,
    input#mail,
    input#url {
        width: 100%;
    }

    input#author,
    input#mail {
        margin-bottom: .5em;
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #151817;
        --paper: #1d211f;
        --text: #eef1ec;
        --muted: #aab5b0;
        --soft: #87938f;
        --line: #303936;
        --line-strong: #46504c;
        --accent: #76c7bf;
        --accent-ink: #9edbd5;
        --warm: #d59a70;
        --code-bg: #262b28;
        --code-text: #ff9cab;
        --shadow: none;
    }

    body {
        background:
            linear-gradient(180deg, rgba(118, 199, 191, .09), rgba(21, 24, 23, 0) 300px),
            var(--bg);
    }

    blockquote {
        color: #d9ded9;
        background: linear-gradient(90deg, rgba(213, 154, 112, .1), transparent 68%);
    }

    .insight-card,
    .risk-card,
    .article-diagram,
    .flow-node {
        background: rgba(29, 33, 31, .72);
    }

    .article-diagram {
        background:
            linear-gradient(135deg, rgba(118, 199, 191, .09), rgba(213, 154, 112, .06)),
            rgba(29, 33, 31, .72);
    }

    .flow-node.is-primary {
        background: rgba(118, 199, 191, .1);
    }

    .flow-node.is-risk,
    .risk-card-header,
    .topic-audience-note {
        background: rgba(213, 154, 112, .1);
    }

    pre {
        background: #202522;
    }

    input:not([type='button']):not([type='submit']),
    textarea {
        color: var(--text);
    }

    .tag-cloud a {
        background: rgba(29, 33, 31, .72);
    }

    .post-neighbors a {
        background: rgba(29, 33, 31, .55);
    }

    .topic-index-panel,
    .topic-empty,
    .topic-no-results {
        background: rgba(29, 33, 31, .72);
    }

    .back-to-top {
        background: rgba(29, 33, 31, .86);
    }
}

@media screen and (max-width: 960px) {
    #container:has(.topics-content) {
        width: min(90vw, 860px);
    }

    .topic-dashboard {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .topic-index-panel {
        position: relative;
        top: auto;
    }

    .topic-outline {
        max-height: none;
    }

    .topic-overview {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .topic-stats {
        justify-content: flex-start;
    }
}

@media screen and (min-width: 1180px) {
    .article-toc {
        position: fixed;
        top: 132px;
        left: calc(50% + 470px);
        display: block;
        width: 210px;
        max-height: calc(100vh - 170px);
        padding-left: 18px;
        overflow: auto;
        border-left: 1px solid var(--line);
    }
}
