/* ============================================================
   Nebula — Modern Typecho Theme
   ============================================================ */

/*
 * Self-hosted Baskervville
 * ------------------------
 * Baskervville is distributed under the SIL Open Font License 1.1.
 * The files live with the theme so normal Latin text no longer depends
 * on a device having the same system font installed. Separate unicode
 * ranges keep CJK glyphs on the existing Songti stack below.
 */
@font-face {
    font-family: "Baskervville";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/Baskervville-latin-ext-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
        U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
        U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
        U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Baskervville";
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/Baskervville-latin-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC,
        U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F,
        U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Baskervville";
    font-style: italic;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/Baskervville-latin-ext-wght-italic.woff2") format("woff2-variations");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
        U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
        U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
        U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Baskervville";
    font-style: italic;
    font-weight: 400 700;
    font-display: swap;
    src: url("../fonts/Baskervville-latin-wght-italic.woff2") format("woff2-variations");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC,
        U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F,
        U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Design Tokens ---------- */
:root {
    --bg: #f8f9fb;
    --surface: #ffffff;
    --surface-2: #eef0f5;
    --text: #16192b;
    --text-2: #4d5364;
    --text-3: #8b91a4;
    --border: rgba(22, 25, 43, 0.1);
    --border-strong: rgba(22, 25, 43, 0.18);
    --code-bg: #f4f6fa;
    --shadow-sm: 0 1px 2px rgba(23, 26, 43, 0.06);
    --shadow-md: 0 6px 24px -8px rgba(23, 26, 43, 0.12);
    --shadow-lg: 0 16px 48px -12px rgba(23, 26, 43, 0.2);
    --header-h: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
    --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code",
        Menlo, Consolas, "Liberation Mono", monospace;
    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #0b0d13;
    --surface: #10131a;
    --surface-2: #171b26;
    --text: #eef1f8;
    --text-2: #a9b1c4;
    --text-3: #6e7589;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --code-bg: #0d1017;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 24px -8px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 16px 48px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
}

/* 强调色的文字场景用色：浅色模式用加深版，深色模式用提亮版 */
:root {
    --accent-text: var(--accent-strong);
}

[data-theme="dark"] {
    --accent-text: var(--accent);
    --accent-text: color-mix(in srgb, var(--accent) 60%, #ffffff);
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    font-family: var(--font-global);
    font-size: 16px;
    line-height: 1.75;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-wrap: break-word;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

p {
    margin: 0 0 1.1em;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

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

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

button {
    font-family: inherit;
    cursor: pointer;
}

ul, ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

::selection {
    background: var(--accent-soft);
    color: var(--accent-text);
}

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

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
}

.section {
    padding: 48px 0 64px;
}

.icon {
    width: 1.05em;
    height: 1.05em;
    vertical-align: -0.18em;
    flex-shrink: 0;
}

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

.skip-link {
    position: fixed;
    top: -48px;
    left: 16px;
    z-index: 200;
    padding: 10px 18px;
    background: var(--accent);
    color: var(--accent-contrast);
    border-radius: 0 0 10px 10px;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
    color: var(--accent-contrast);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 11px 24px;
    font-size: 14.5px;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: all 0.18s ease;
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-contrast);
}

.btn-primary:hover {
    background: var(--accent-strong);
    color: var(--accent-contrast);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border-strong);
}

.btn-ghost:hover {
    border-color: var(--text-3);
    transform: translateY(-1px);
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

@supports not (backdrop-filter: blur(1px)) {
    .site-header {
        background: var(--surface);
    }
}

.site-header.is-scrolled {
    border-bottom-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.site-header::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 34px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 24%, transparent), transparent);
    pointer-events: none;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    height: var(--header-h);
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

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

.site-logo img {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    object-fit: cover;
}

.site-nav {
    flex: 1;
    min-width: 0;
}

.site-nav ul {
    display: flex;
    align-items: center;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
}

.site-nav ul::-webkit-scrollbar {
    display: none;
}

.site-nav a {
    display: block;
    padding: 7px 13px;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--text-2);
    border-radius: 8px;
    white-space: nowrap;
}

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

.site-nav a[aria-current="page"] {
    color: var(--accent-text);
    background: var(--accent-soft);
}

.site-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    font-size: 18px;
    color: var(--text-2);
    background: transparent;
    border: none;
    border-radius: 10px;
    transition: color 0.18s ease, background-color 0.18s ease;
}

.icon-btn:hover {
    color: var(--text);
    background: var(--surface-2);
}

:root:not([data-theme="dark"]) .theme-icon-dark {
    display: none;
}

:root:not([data-theme="dark"]) .theme-icon-light {
    display: inline-flex;
}

.nav-toggle {
    display: none;
}

.theme-icon-dark,
[data-theme="dark"] .theme-icon-light {
    display: none;
}

[data-theme="dark"] .theme-icon-dark {
    display: inline-flex;
}

.theme-icon-light,
.theme-icon-dark {
    display: inline-flex;
}

/* ---------- Progress bar ---------- */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 110;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
    transition: width 0.08s linear;
}

/* ---------- Search modal ---------- */
.search-modal {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 14vh 20px 0;
}

.search-modal[hidden] {
    display: none;
}

.search-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 12, 20, 0.42);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

.search-panel {
    position: relative;
    width: min(560px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 10px 6px 20px;
    color: var(--text-3);
}

.search-form input {
    flex: 1;
    min-width: 0;
    padding: 14px 0;
    font-size: 17px;
    font-family: inherit;
    color: var(--text);
    background: transparent;
    border: none;
    outline: none;
}

.search-form input::placeholder {
    color: var(--text-3);
}

.search-hint {
    margin: 0;
    padding: 0 20px 14px;
    font-size: 12px;
    color: var(--text-3);
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}

.hero-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
    gap: 56px;
    align-items: center;
    padding-top: 88px;
    padding-bottom: 88px;
}

.hero-orbits {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: max(1200px, 100%);
    height: 100%;
    color: var(--text);
    pointer-events: none;
}

.hero-badge {
    display: inline-block;
    margin-bottom: 22px;
    padding: 5px 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--accent-text);
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.hero-title {
    font-size: clamp(34px, 5.2vw, 56px);
    line-height: 1.12;
    letter-spacing: -0.03em;
    overflow-wrap: anywhere;
}

.hero-desc {
    max-width: 480px;
    margin: 18px 0 0;
    font-size: 17px;
    line-height: 1.75;
    color: var(--text-2);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
}

.hero-copy > * {
    animation: hero-enter 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-copy .hero-badge {
    animation-delay: 0.05s;
}

.hero-copy .hero-title {
    animation-delay: 0.12s;
}

.hero-copy .hero-desc {
    animation-delay: 0.2s;
}

.hero-copy .hero-actions {
    animation-delay: 0.28s;
}

.hero-terminal {
    animation: hero-enter 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.34s both;
}

@keyframes hero-enter {
    from {
        opacity: 0;
        transform: translateY(18px);
        filter: blur(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* 终端窗口（固定深色，呼应主体） */
.hero-terminal {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: #0d1017;
}

.term-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #131722;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.term-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    flex-shrink: 0;
}

.term-dot-r {
    background: #ff5f57;
}

.term-dot-y {
    background: #febc2e;
}

.term-dot-g {
    background: #28c840;
}

.term-title {
    margin-left: 6px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: rgba(233, 237, 245, 0.45);
    user-select: none;
}

.term-body {
    margin: 0;
    padding: 20px 20px 24px;
    font-family: var(--font-mono);
    font-size: 13.5px;
    line-height: 2;
    overflow-x: auto;
    white-space: pre-wrap;
}

.term-line {
    display: block;
    color: #e9edf5;
}

.term-out {
    color: rgba(233, 237, 245, 0.55);
}

.term-prompt {
    color: var(--accent-text);
    user-select: none;
}

#post-list {
    scroll-margin-top: calc(var(--header-h) + 12px);
}

/* ---------- Post list ---------- */
.archive-header {
    margin-bottom: 8px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.archive-title {
    font-size: 28px;
}

.archive-count {
    margin: 6px 0 0;
    font-size: 14px;
    color: var(--text-3);
}

.empty-state {
    padding: 72px 0;
    text-align: center;
    color: var(--text-3);
}

.post-list.is-list .post-item {
    display: flex;
    gap: 24px;
    padding: 26px 0;
    border-bottom: 1px solid var(--border);
}

.post-list.is-list .post-item:first-child {
    padding-top: 30px;
}

.post-list.is-list .post-item-cover {
    flex-shrink: 0;
    width: 168px;
    height: 112px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface-2);
    align-self: flex-start;
}

.post-list.is-list .post-item-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.post-list.is-list .post-item:hover .post-item-cover img {
    transform: scale(1.04);
}

.post-item-body {
    min-width: 0;
    flex: 1;
}

.post-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-3);
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.meta-item .icon {
    opacity: 0.75;
}

.post-item-title {
    font-size: 20px;
    line-height: 1.4;
}

.post-item-title a {
    color: var(--text);
}

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

.post-item-excerpt {
    margin: 8px 0 0;
    font-size: 15px;
    color: var(--text-2);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.post-item-foot {
    margin-top: 12px;
}

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--accent-text);
}

.read-more::after {
    content: "";
    width: 0;
    height: 1.5px;
    background: currentColor;
    transition: width 0.2s ease;
}

.read-more:hover::after {
    width: 16px;
}

/* 卡片式列表 */
.post-list.is-card {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.post-list.is-card .post-item {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.post-list.is-card .post-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.pagination li.current {
    min-width: 0;
    height: auto;
    padding: 0;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 0;
}

.pagination li.current > a,
.pagination span.current {
    color: var(--accent-contrast);
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 10px 26px -16px color-mix(in srgb, var(--accent) 80%, transparent);
}

.empty-state {
    margin-top: 24px;
    padding: clamp(58px, 8vw, 92px) 24px;
    font-family: var(--font-global);
    font-size: 17px;
    background: color-mix(in srgb, var(--surface) 64%, transparent);
    border: 1px dashed var(--border-strong);
    border-radius: 20px;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.empty-state::before {
    content: "∅";
    display: block;
    margin-bottom: 13px;
    font-family: var(--font-global);
    font-size: 40px;
    line-height: 1;
    color: var(--accent-text);
    opacity: 0.68;
}

.empty-state p:last-child {
    margin-bottom: 0;
}

.post-list.is-card .post-item-cover {
    display: block;
    aspect-ratio: 16 / 9;
    background: var(--surface-2);
}

.post-list.is-card .post-item-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-list.is-card .post-item-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 20px 22px 18px;
}

.post-list.is-card .post-item-title {
    font-size: 19px;
}

.post-list.is-card .post-item-excerpt {
    flex: 1;
}

.post-list.is-card .read-more {
    display: none;
}

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
}

.pagination li {
    display: inline-block;
}

.pagination a,
.pagination .current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 10px;
}

.pagination a {
    color: var(--text-2);
    background: var(--surface);
    border: 1px solid var(--border);
}

.pagination a:hover {
    color: var(--accent-text);
    border-color: var(--accent);
}

.pagination .current {
    color: var(--accent-contrast);
    background: var(--accent);
    border: 1px solid var(--accent);
}

/* ---------- Post page ---------- */
.post-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
    padding-top: 40px;
    padding-bottom: 72px;
}

.post-header {
    margin-bottom: 28px;
}

.post-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
    font-size: 13px;
}

.post-cats a {
    display: inline-block;
    padding: 3px 12px;
    color: var(--accent-text);
    background: var(--accent-soft);
    border-radius: 999px;
}

.post-cats a:hover {
    color: var(--accent-contrast);
    background: var(--accent);
}

.post-title {
    font-size: clamp(26px, 4vw, 36px);
    letter-spacing: -0.02em;
    overflow-wrap: anywhere;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    margin-top: 14px;
    font-size: 13.5px;
    color: var(--text-3);
}

.post-cover {
    margin: 0 0 32px;
}

.post-cover img {
    display: block;
    width: 100%;
    max-height: 440px;
    object-fit: cover;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
}

/* ---------- TOC ---------- */
.toc-desktop {
    display: none;
}

.toc-sticky {
    position: sticky;
    top: calc(var(--header-h) + 24px);
    max-height: calc(100vh - var(--header-h) - 48px);
    overflow-y: auto;
}

.toc-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
}

.toc-nav ul {
    position: relative;
    border-left: 2px solid var(--border);
}

.toc-nav li {
    margin: 2px 0;
}

.toc-nav a {
    display: block;
    padding: 4px 0 4px 14px;
    margin-left: -2px;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text-3);
    border-left: 2px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}

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

.toc-nav a.is-active {
    color: var(--accent-text);
    border-left-color: var(--accent);
}

.toc-nav ul ul {
    margin-left: 12px;
}

.toc-mobile {
    display: none;
    margin-bottom: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.toc-mobile summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-2);
    cursor: pointer;
    user-select: none;
}

.toc-mobile[open] summary {
    border-bottom: 1px solid var(--border);
}

.toc-mobile .toc-nav {
    padding: 10px 16px 14px;
}

/* ---------- Post content typography ---------- */
.post-content {
    font-size: 16.5px;
    line-height: 1.85;
    color: var(--text);
}

.post-content > *:first-child {
    margin-top: 0;
}

.post-content p {
    margin: 0 0 1.2em;
}

.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    margin: 1.9em 0 0.75em;
    scroll-margin-top: calc(var(--header-h) + 20px);
}

.post-content h2 {
    font-size: 24px;
    padding-bottom: 0.4em;
    border-bottom: 1px solid var(--border);
}

.post-content h3 {
    font-size: 20px;
}

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

.post-content h5,
.post-content h6 {
    font-size: 16px;
    color: var(--text-2);
}

.post-content a:not(.heading-anchor) {
    color: var(--accent-text);
    text-decoration: underline;
    text-decoration-color: var(--accent-soft);
    text-underline-offset: 3px;
}

.post-content a:not(.heading-anchor):hover {
    text-decoration-color: var(--accent);
}

.heading-anchor {
    margin-left: 6px;
    font-weight: 400;
    opacity: 0;
    text-decoration: none !important;
    transition: opacity 0.15s ease;
}

.post-content h2:hover .heading-anchor,
.post-content h3:hover .heading-anchor,
.post-content h4:hover .heading-anchor {
    opacity: 0.6;
}

.heading-anchor:focus-visible {
    opacity: 0.85;
}

.post-content ul,
.post-content ol {
    margin: 0 0 1.2em;
    padding-left: 1.6em;
}

.post-content ul {
    list-style: disc;
}

.post-content ol {
    list-style: decimal;
}

.post-content li {
    margin: 0.35em 0;
}

.post-content li::marker {
    color: var(--accent);
}

.post-content li > ul,
.post-content li > ol {
    margin-bottom: 0.35em;
}

.post-content img {
    display: block;
    margin: 1.4em auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.post-content blockquote {
    margin: 1.4em 0;
    padding: 14px 20px;
    background: var(--accent-softer);
    border-left: 3px solid var(--accent);
    border-radius: 0 10px 10px 0;
    color: var(--text-2);
}

.post-content blockquote p:last-child {
    margin-bottom: 0;
}

.post-content hr {
    margin: 2.2em 0;
    height: 1px;
    background: var(--border);
    border: none;
}

.post-content kbd {
    display: inline-block;
    padding: 2px 7px;
    font-size: 0.85em;
    font-family: var(--font-mono);
    color: var(--text-2);
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: 6px;
}

.post-content mark {
    padding: 1px 4px;
    background: var(--accent-soft);
    color: var(--accent-text);
    border-radius: 4px;
}

.post-content sup {
    font-size: 0.75em;
}

.table-wrap {
    margin: 1.4em 0;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.post-content table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-size: 14.5px;
}

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

.post-content th {
    font-weight: 600;
    background: var(--surface-2);
    white-space: nowrap;
}

.post-content tr:last-child td {
    border-bottom: none;
}

/* ---------- Code blocks ---------- */
.code-block {
    margin: 1.5em 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--code-bg);
}

.code-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px 9px 14px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.code-dots {
    display: inline-flex;
    gap: 6px;
    margin-right: 2px;
}

.code-dots i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-strong);
}

.code-dots i:nth-child(1) {
    background: #ff5f5799;
}

.code-dots i:nth-child(2) {
    background: #febc2e99;
}

.code-dots i:nth-child(3) {
    background: #28c84099;
}

.code-lang {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-3);
    user-select: none;
}

.code-copy {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--text-2);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 7px;
    transition: all 0.15s ease;
}

.code-copy:hover {
    color: var(--accent-text);
    border-color: var(--accent);
}

.code-copy .icon {
    width: 0.95em;
    height: 0.95em;
}

.code-copy.is-copied {
    color: #22a06b;
    border-color: #22a06b;
}

.code-block pre {
    margin: 0;
    padding: 14px 18px;
    overflow: auto;
    background: transparent;
    border-radius: 0;
    font-size: 14px;
    line-height: 1.7;
}

.post-content pre {
    margin: 1.5em 0;
    padding: 16px 18px;
    overflow: auto;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.7;
}

.post-content code {
    font-family: var(--font-mono);
    font-size: 0.88em;
}

.post-content :not(pre) > code {
    padding: 2px 6px;
    background: var(--accent-soft);
    color: var(--accent-text);
    border-radius: 5px;
}

.code-block pre code,
.post-content pre code {
    display: block;
    padding: 0;
    background: transparent;
    color: inherit;
    font-size: inherit;
}

/* ============================================================
   Prism 主题
   全部规则使用 .post-content 前缀提升特异性，
   以覆盖 CodePrettify 等插件注入的第三方 Prism 主题（如 coy.css）。
   ============================================================ */

/* ---------- 浅色 token 配色 ---------- */
.post-content .token.comment,
.post-content .token.prolog,
.post-content .token.doctype,
.post-content .token.cdata,
.post-content .token.block-comment {
    color: #8a919f;
}

.post-content .token.punctuation {
    color: #575f6e;
}

.post-content .token.namespace {
    opacity: 0.8;
}

.post-content .token.property,
.post-content .token.tag,
.post-content .token.constant,
.post-content .token.symbol,
.post-content .token.deleted {
    color: #b13a5e;
}

.post-content .token.boolean,
.post-content .token.number {
    color: #0f6db3;
}

.post-content .token.selector,
.post-content .token.attr-name,
.post-content .token.string,
.post-content .token.char,
.post-content .token.builtin,
.post-content .token.inserted {
    color: #147a4d;
}

.post-content .token.operator,
.post-content .token.entity,
.post-content .token.url,
.post-content .language-css .token.string,
.post-content .style .token.string,
.post-content .token.variable {
    color: #9a5b1f;
}

.post-content .token.atrule,
.post-content .token.attr-value,
.post-content .token.function,
.post-content .token.function-name,
.post-content .token.class-name {
    color: #6250d8;
}

.post-content .token.keyword {
    color: #c04585;
}

.post-content .token.regex,
.post-content .token.important {
    color: #c04585;
}

.post-content .token.bold {
    font-weight: 700;
}

.post-content .token.italic {
    font-style: italic;
}

/* coy 会给 CSS 字符串 token 加半透明白背景，暗色模式下会形成白斑 */
.post-content .language-css .token.string,
.post-content .style .token.string {
    background: transparent !important;
}

/* ---------- 深色 token 配色 ---------- */
[data-theme="dark"] .post-content .token.comment,
[data-theme="dark"] .post-content .token.prolog,
[data-theme="dark"] .post-content .token.doctype,
[data-theme="dark"] .post-content .token.cdata,
[data-theme="dark"] .post-content .token.block-comment {
    color: #7d8590;
}

[data-theme="dark"] .post-content .token.punctuation {
    color: #aab1c0;
}

[data-theme="dark"] .post-content .token.property,
[data-theme="dark"] .post-content .token.tag,
[data-theme="dark"] .post-content .token.constant,
[data-theme="dark"] .post-content .token.symbol,
[data-theme="dark"] .post-content .token.deleted {
    color: #ff7b93;
}

[data-theme="dark"] .post-content .token.boolean,
[data-theme="dark"] .post-content .token.number {
    color: #79b8ff;
}

[data-theme="dark"] .post-content .token.selector,
[data-theme="dark"] .post-content .token.attr-name,
[data-theme="dark"] .post-content .token.string,
[data-theme="dark"] .post-content .token.char,
[data-theme="dark"] .post-content .token.builtin,
[data-theme="dark"] .post-content .token.inserted {
    color: #7ee2a8;
}

[data-theme="dark"] .post-content .token.operator,
[data-theme="dark"] .post-content .token.entity,
[data-theme="dark"] .post-content .token.url,
[data-theme="dark"] .post-content .language-css .token.string,
[data-theme="dark"] .post-content .style .token.string,
[data-theme="dark"] .post-content .token.variable {
    color: #e2b56c;
}

[data-theme="dark"] .post-content .token.atrule,
[data-theme="dark"] .post-content .token.attr-value,
[data-theme="dark"] .post-content .token.function,
[data-theme="dark"] .post-content .token.function-name,
[data-theme="dark"] .post-content .token.class-name {
    color: #a5a0ff;
}

[data-theme="dark"] .post-content .token.keyword {
    color: #f07bb4;
}

[data-theme="dark"] .post-content .token.regex,
[data-theme="dark"] .post-content .token.important {
    color: #f07bb4;
}

/* ---------- 抵抗第三方 Prism 主题注入（coy.css 等） ----------
   这些 !important 仅用于对抗插件 CSS 中的同名 !important 声明：
   coy.css 会将 pre 压成 opacity:0.8、把 code 染成浅灰底白描边。 */
.post-content .code-block,
.post-content pre[class*="language-"] {
    opacity: 1 !important;
    box-sizing: border-box;
}

.post-content .code-block pre,
.post-content .code-block pre[class*="language-"],
.post-content pre[class*="language-"] {
    margin: 1.5em 0;
    padding: 16px 18px;
    color: var(--text) !important;
    font-family: var(--font-mono) !important;
    background: var(--code-bg) !important;
    background-image: none !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    font-size: 14px;
    line-height: 1.7;
}

.post-content .code-block pre[class*="line-numbers"],
.post-content pre[class*="language-"].line-numbers {
    padding-left: 3.4em !important;
}

.post-content .code-block pre code,
.post-content pre[class*="language-"] > code,
.post-content pre[class*="language-"] code,
.post-content code[class*="language"] {
    margin: 0;
    padding: 0;
    display: block;
    color: var(--text) !important;
    font-family: var(--font-mono) !important;
    text-shadow: none !important;
    background: transparent !important;
    background-image: none !important;
    border: none !important;
    border-left: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    font-size: inherit;
    max-height: none;
    height: auto;
}

.post-content .code-block pre[class*="line-numbers"] > code,
.post-content pre[class*="language-"].line-numbers code {
    padding-left: 0 !important;
}

/* 清除 coy 的纸片角标与阴影装饰 */
.post-content .code-block pre::before,
.post-content .code-block pre::after,
.post-content pre[class*="language-"]::before,
.post-content pre[class*="language-"]::after {
    content: none !important;
    box-shadow: none !important;
}

/* 行内代码：对抗 coy 的行内样式 */
.post-content :not(pre) > code[class*="language-"] {
    display: inline;
    padding: 2px 6px;
    white-space: normal;
    color: var(--accent-text) !important;
    text-shadow: none !important;
    background: var(--accent-soft) !important;
    border: none !important;
    border-radius: 5px;
    opacity: 1 !important;
}

/* ---------- 行号 ---------- */
.post-content .code-block pre[class*="line-numbers"] {
    position: relative;
    counter-reset: linenumber;
}

.post-content .code-block pre[class*="line-numbers"] > code {
    position: relative;
    white-space: inherit;
}

.post-content .code-block .line-numbers .line-numbers-rows,
.post-content .line-numbers .line-numbers-rows {
    position: absolute;
    top: 0;
    left: -3.2em;
    width: 2.6em;
    border-right: 1px solid var(--border) !important;
    font-size: 100%;
    letter-spacing: -1px;
    user-select: none;
    pointer-events: none;
}

.post-content .line-numbers-rows > span {
    display: block;
    counter-increment: linenumber;
}

.post-content .line-numbers-rows > span::before {
    content: counter(linenumber);
    display: block;
    padding-right: 0.8em;
    color: var(--text-3) !important;
    text-align: right;
    font-size: 0.9em;
}

/* ---------- KaTeX ---------- */
.nebula-math-display {
    margin: 1.5em 0;
    overflow-x: auto;
    overflow-y: hidden;
    text-align: center;
    padding: 4px 0;
}

.post-content .katex {
    font-size: 1.06em;
}

.post-content .katex-display {
    margin: 0;
}

/* ---------- Tags / Copyright / Prev-Next ---------- */
.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 36px 0 0;
}

.post-tags a {
    display: inline-block;
    padding: 4px 14px;
    font-size: 13px;
    color: var(--text-2);
    background: var(--surface-2);
    border-radius: 999px;
}

.post-tags a:hover {
    color: var(--accent-text);
    background: var(--accent-soft);
}

.post-copyright {
    margin-top: 28px;
    padding: 16px 20px;
    font-size: 13.5px;
    line-height: 1.9;
    color: var(--text-3);
    background: var(--surface-2);
    border-radius: var(--radius);
}

.post-copyright a {
    color: var(--text-2);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.post-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 32px;
}

.post-nav-item.is-next {
    text-align: right;
}

.post-nav-label {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 6px;
    font-size: 12.5px;
    color: var(--text-3);
}

.post-nav-item.is-next .post-nav-label {
    justify-content: flex-end;
}

.post-nav-item a {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-nav-item a:hover {
    color: var(--accent-text);
}

/* ---------- Comments ---------- */
.comments {
    margin-top: 56px;
    padding-top: 36px;
    border-top: 1px solid var(--border);
}

.comments-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    font-size: 20px;
}

.comments-title small {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-3);
}

.comments-closed {
    color: var(--text-3);
}

.comment-respond {
    margin-bottom: 32px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.comment-logged {
    margin: 0 0 12px;
    font-size: 14px;
    color: var(--text-2);
}

.comment-logged a {
    margin: 0 4px;
}

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

.comment-field {
    margin-bottom: 12px;
}

.comment-row .comment-field {
    margin-bottom: 0;
}

.comment-row {
    margin-bottom: 12px;
}

.comment-field input,
.comment-field textarea {
    width: 100%;
    padding: 11px 14px;
    font-size: 14.5px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.comment-field textarea {
    resize: vertical;
    min-height: 110px;
}

.comment-field input:focus,
.comment-field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.comment-submit {
    text-align: right;
}

.cancel-comment-reply {
    margin-bottom: 10px;
    font-size: 13.5px;
}

.cancel-comment-reply a {
    color: var(--text-3);
}

.cancel-comment-reply a:hover {
    color: var(--accent-text);
}

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

.comment-list > li,
.comment-children > li {
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
}

.comment-list > li:last-child {
    border-bottom: none;
}

.comment-children {
    margin-left: 56px;
    padding-left: 20px;
    border-left: 2px solid var(--border);
}

.comment-children > li {
    border-bottom: none;
    padding: 14px 0;
}

.comment-children > li:last-child {
    padding-bottom: 0;
}

.comment-card {
    display: flex;
    gap: 14px;
}

.comment-avatar img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--surface-2);
}

.comment-main {
    flex: 1;
    min-width: 0;
}

.comment-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    margin-bottom: 6px;
}

.comment-authorname {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text);
}

.comment-authorname a {
    color: var(--text);
}

.comment-authorname a:hover {
    color: var(--accent-text);
}

.comment-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-text);
    background: var(--accent-soft);
    border-radius: 999px;
    vertical-align: 1px;
}

.comment-time {
    font-size: 12.5px;
    color: var(--text-3);
}

.comment-content {
    font-size: 14.5px;
    line-height: 1.75;
    color: var(--text-2);
    overflow-wrap: anywhere;
}

.comment-content p {
    margin: 0 0 0.6em;
}

.comment-content p:last-child {
    margin-bottom: 0;
}

.comment-waiting {
    display: block;
    margin-bottom: 6px;
    font-size: 12.5px;
    color: #c07f19;
    font-style: normal;
}

.comment-actions {
    margin-top: 8px;
}

.comment-actions a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12.5px;
    color: var(--text-3);
}

.comment-actions a:hover {
    color: var(--accent-text);
}

/* ---------- Archives page ---------- */
.page-archives .archive-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 24px 0 36px;
}

.archive-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 14px;
    font-size: 13px;
    color: var(--text-2);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.archive-tag small {
    font-size: 11px;
    color: var(--text-3);
}

.archive-tag:hover {
    color: var(--accent-text);
    border-color: var(--accent);
}

.archive-group {
    margin-bottom: 36px;
}

.archive-year {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 14px;
    font-size: 22px;
}

.archive-year small {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-3);
}

.archive-list {
    border-left: 2px solid var(--border);
    padding-left: 22px;
}

.archive-list li {
    display: flex;
    align-items: baseline;
    gap: 16px;
    padding: 7px 0;
}

.archive-list time {
    flex-shrink: 0;
    font-size: 13px;
    font-family: var(--font-mono);
    color: var(--text-3);
}

.archive-list a {
    color: var(--text-2);
    font-size: 15px;
    transition: color 0.15s ease, transform 0.15s ease;
}

.archive-list a:hover {
    color: var(--accent-text);
}

/* ---------- Friend links ---------- */
.page-friend-link .post-content > p:has(> a) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 0 0 18px;
    padding: 20px 22px;
    background: color-mix(in srgb, var(--surface) 74%, transparent);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.055), var(--shadow-md);
    -webkit-backdrop-filter: blur(18px) saturate(135%);
    backdrop-filter: blur(18px) saturate(135%);
}

.page-friend-link .post-content > p:has(> a) > a {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 40px;
    padding: 7px 14px;
    font-family: var(--font-global);
    font-size: 14px;
    text-decoration: none;
    background: var(--accent-soft);
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
    border-radius: 999px;
}

.page-friend-link .post-content > p:has(> a) > a::after {
    content: "↗";
    font-family: var(--font-global);
    font-size: 15px;
    line-height: 1;
}

.page-friend-link .post-content > p:has(> a) > a:hover {
    background: color-mix(in srgb, var(--accent) 17%, transparent);
    border-color: color-mix(in srgb, var(--accent) 42%, transparent);
}

@media (max-width: 560px) {
    .page-friend-link .post-content > p:has(> a) {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
        padding: 18px;
    }
}

/* ---------- 404 ---------- */
.error-page {
    max-width: 560px;
    margin: 0 auto;
    padding: 96px 24px 120px;
    text-align: center;
}

.error-code {
    margin: 0;
    font-size: 96px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.04em;
    background: linear-gradient(135deg, var(--accent-text), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.error-title {
    margin: 18px 0 8px;
    font-size: 26px;
}

.error-desc {
    color: var(--text-2);
}

.error-search {
    display: flex;
    gap: 10px;
    margin: 26px auto 18px;
    max-width: 420px;
}

.error-search input {
    flex: 1;
    min-width: 0;
    padding: 11px 16px;
    font-size: 14.5px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
}

.error-search input:focus {
    border-color: var(--accent);
}

.error-home {
    margin: 0;
}

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.footer-inner {
    padding: 44px 24px 48px;
    text-align: center;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 18px;
}

.footer-title {
    font-size: 17px;
    font-weight: 700;
}

.footer-desc {
    font-size: 13.5px;
    color: var(--text-3);
}

.footer-social {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 20px;
}

.footer-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    font-size: 17px;
    color: var(--text-3);
    border-radius: 10px;
    transition: all 0.15s ease;
}

.footer-social a:hover {
    color: var(--accent-text);
    background: var(--accent-soft);
}

.footer-meta {
    font-size: 13px;
    color: var(--text-3);
    line-height: 2;
}

.footer-meta p {
    margin: 0;
}

.footer-meta a {
    color: var(--text-2);
}

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

/* ---------- Back to top ---------- */
.back-top {
    position: fixed;
    right: 24px;
    bottom: 28px;
    z-index: 90;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    font-size: 18px;
    color: var(--text-2);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(12px);
    visibility: hidden;
    transition: all 0.25s ease;
}

.back-top.is-visible {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

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

/* ---------- Lightbox ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 180;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: rgba(8, 10, 16, 0.86);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    cursor: zoom-out;
    animation: nebula-fade-in 0.2s ease;
}

.lightbox img {
    max-width: min(94vw, 1400px);
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

.post-content img.lightbox-trigger {
    cursor: zoom-in;
}

.post-content img.lightbox-trigger:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 5px;
}

.lightbox:focus {
    outline: none;
}

.lightbox-close {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 21px;
    color: rgba(255, 255, 255, 0.84);
    background: rgba(18, 24, 36, 0.64);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    box-shadow: 0 14px 34px -18px rgba(0, 0, 0, 0.9);
    transition: transform 0.35s var(--ease-out-expo), background-color 0.25s ease;
}

.lightbox-close:hover {
    color: #ffffff;
    background: rgba(35, 43, 60, 0.86);
    transform: rotate(5deg) scale(1.06);
}

@media (max-width: 768px) {
    .lightbox {
        padding: 18px;
    }

    .lightbox-close {
        top: 14px;
        right: 14px;
    }
}

/* ============================================================
   Nebula 1.5 — Fluid glass homepage
   A tangible abstract form replaces the orbital illustration and
   terminal, softened by a full-bleed frosted layer.
   ============================================================ */
body {
    background-image: none;
}

[data-theme="dark"] body {
    background-image: none;
}

.hero {
    min-height: min(720px, calc(100vh - var(--header-h)));
    background: #e7edf6;
    border-bottom-color: color-mix(in srgb, var(--border-strong) 72%, transparent);
}

[data-theme="dark"] .hero {
    background: #07111f;
}

.hero::before,
.hero::after {
    display: none;
}

.hero-fluid,
.hero-frost {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.hero-fluid {
    z-index: 0;
    overflow: hidden;
    transform: translate3d(calc(var(--pointer-x) * -7px), calc(var(--pointer-y) * -5px), 0);
    transition: transform 1.4s var(--ease-out-expo);
}

.hero-fluid::after {
    content: "";
    position: absolute;
    inset: 5% -8% 4% 24%;
    background: url("../images/hero-fluid.webp") center / contain no-repeat;
    opacity: 0.3;
    mix-blend-mode: multiply;
    filter: saturate(1.42) contrast(1.08);
    -webkit-mask-image: radial-gradient(ellipse at 58% 52%, #000 18%, rgba(0, 0, 0, 0.82) 56%, transparent 78%);
    mask-image: radial-gradient(ellipse at 58% 52%, #000 18%, rgba(0, 0, 0, 0.82) 56%, transparent 78%);
    will-change: transform;
    animation: hero-fluid-fold 21s cubic-bezier(0.45, 0, 0.3, 1) infinite alternate;
}

.hero-fluid img {
    position: absolute;
    top: 50%;
    left: 52%;
    width: max(1840px, 128vw);
    max-width: none;
    height: auto;
    opacity: 0.88;
    mix-blend-mode: multiply;
    filter: saturate(1.24) contrast(1.02) brightness(1.06);
    will-change: transform;
    animation: hero-fluid-drift 18s cubic-bezier(0.45, 0, 0.3, 1) infinite;
}

[data-theme="dark"] .hero-fluid img {
    opacity: 0.92;
    mix-blend-mode: screen;
    filter: saturate(1.36) contrast(1.12) brightness(0.82);
}

[data-theme="dark"] .hero-fluid::after {
    opacity: 0.36;
    mix-blend-mode: screen;
    filter: saturate(1.55) contrast(1.16) brightness(0.82);
}

@keyframes hero-fluid-drift {
    0%,
    100% {
        transform: translate3d(-50.5%, -49%, 0) scale3d(1.02, 0.98, 1) rotate(-0.45deg) skewX(-0.7deg);
    }
    28% {
        transform: translate3d(-49%, -52%, 0) scale3d(1.085, 1.025, 1) rotate(0.35deg) skewX(0.55deg);
    }
    57% {
        transform: translate3d(-47.8%, -50.3%, 0) scale3d(1.045, 1.08, 1) rotate(0.65deg) skewY(-0.45deg);
    }
    79% {
        transform: translate3d(-49.8%, -48.4%, 0) scale3d(1.105, 1.01, 1) rotate(-0.15deg) skewX(0.8deg);
    }
}

@keyframes hero-fluid-fold {
    0%,
    100% {
        transform: translate3d(-2%, 1%, 0) scale3d(0.98, 1.06, 1) rotate(0.8deg) skewY(-1.2deg);
    }
    48% {
        transform: translate3d(3%, -3%, 0) scale3d(1.08, 0.96, 1) rotate(-1.15deg) skewX(1.1deg);
    }
}

.hero-frost {
    z-index: 1;
    inset: -2px;
    background:
        linear-gradient(90deg, rgba(239, 244, 251, 0.7) 0%, rgba(238, 244, 251, 0.36) 42%, rgba(229, 237, 247, 0.1) 100%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(226, 235, 246, 0.05));
    -webkit-backdrop-filter: blur(9px) saturate(126%);
    backdrop-filter: blur(9px) saturate(126%);
}

[data-theme="dark"] .hero-frost {
    background:
        linear-gradient(90deg, rgba(5, 10, 19, 0.68) 0%, rgba(5, 12, 22, 0.32) 42%, rgba(4, 11, 21, 0.09) 100%),
        linear-gradient(180deg, rgba(4, 8, 16, 0.04), rgba(7, 14, 25, 0.14));
    -webkit-backdrop-filter: blur(9px) saturate(122%);
    backdrop-filter: blur(9px) saturate(122%);
}

.hero-frost::before,
.hero-frost::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    z-index: 1;
    pointer-events: none;
}

.hero-frost::before {
    top: 0;
    height: 104px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 24%, transparent), transparent);
}

.hero-frost::after {
    bottom: 0;
    height: clamp(110px, 17vh, 190px);
    background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--bg) 94%, transparent));
}

.hero-grid {
    z-index: 2;
    grid-template-columns: minmax(0, 1.08fr) minmax(330px, 0.72fr);
    gap: clamp(48px, 8vw, 112px);
    padding-top: 104px;
    padding-bottom: 112px;
}

.hero-copy {
    position: relative;
    z-index: 1;
}

.hero-actions .btn {
    color: var(--text);
    background: color-mix(in srgb, var(--surface) 35%, transparent);
    border-color: color-mix(in srgb, var(--surface) 58%, var(--border-strong));
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.32), 0 16px 34px -24px rgba(28, 47, 78, 0.72);
    -webkit-backdrop-filter: blur(18px) saturate(145%);
    backdrop-filter: blur(18px) saturate(145%);
}

.hero-actions .btn-primary {
    color: var(--accent-contrast);
    background: color-mix(in srgb, var(--accent) 58%, transparent);
    border-color: color-mix(in srgb, var(--accent) 62%, rgba(255, 255, 255, 0.42));
}

.hero-actions .btn:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--surface) 56%, transparent);
    border-color: color-mix(in srgb, var(--accent) 34%, var(--border-strong));
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.42), 0 20px 42px -25px rgba(28, 47, 78, 0.76);
}

.hero-actions .btn-primary:hover {
    color: var(--accent-contrast);
    background: color-mix(in srgb, var(--accent) 70%, transparent);
}

.hero-feature {
    position: relative;
    width: min(100%, 430px);
    min-height: 318px;
    justify-self: end;
    display: flex;
    flex-direction: column;
    padding: 28px 30px 26px;
    overflow: hidden;
    color: var(--text);
    background: color-mix(in srgb, var(--surface) 58%, transparent);
    border: 1px solid color-mix(in srgb, var(--border-strong) 84%, transparent);
    border-radius: 28px;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.22), 0 38px 90px -48px rgba(29, 50, 82, 0.72);
    -webkit-backdrop-filter: blur(30px) saturate(132%);
    backdrop-filter: blur(30px) saturate(132%);
    transform: translate3d(calc(var(--pointer-x) * -8px), calc(var(--pointer-y) * -6px), 0) rotate(0.45deg);
    transition: border-color 0.45s ease, box-shadow 0.55s var(--ease-out-expo), transform 1.15s var(--ease-out-expo);
    animation: hero-enter 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both;
}

[data-theme="dark"] .hero-feature {
    background: rgba(9, 20, 36, 0.42);
    border-color: rgba(205, 220, 244, 0.17);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.09), 0 42px 100px -48px rgba(15, 45, 91, 0.88);
}

.hero-feature::before {
    content: "";
    position: absolute;
    width: 230px;
    height: 230px;
    right: -82px;
    top: -105px;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--accent) 17%, transparent), transparent 68%);
    pointer-events: none;
}

.hero-feature::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background: linear-gradient(132deg, rgba(255, 255, 255, 0.15), transparent 30%);
    pointer-events: none;
}

.hero-feature:hover {
    color: var(--text);
    border-color: color-mix(in srgb, var(--accent) 34%, var(--border));
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.2), 0 44px 105px -48px rgba(28, 54, 100, 0.82);
}

.hero-feature-head,
.hero-feature-foot {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-3);
}

.hero-feature-body {
    position: relative;
    z-index: 1;
    margin: auto 0;
    padding: 44px 0 38px;
}

.hero-feature-kicker {
    display: block;
    margin-bottom: 11px;
    font-size: 13px;
    color: var(--accent-text);
}

.hero-feature-body p {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    font-family: var(--font-global);
    font-size: clamp(21px, 2vw, 26px);
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: -0.018em;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.hero-feature-foot span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-2);
}

.hero-feature-foot .icon {
    transition: transform 0.4s var(--ease-out-expo);
}

.hero-feature:hover .hero-feature-foot .icon {
    transform: translateX(4px);
}

@media (max-width: 1024px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 42px;
    }

    .hero-feature {
        width: min(100%, 620px);
        min-height: 250px;
        justify-self: start;
    }

    .hero-feature-body {
        padding-block: 31px;
    }
}

@media (max-width: 768px) {
    .hero-grid {
        gap: 34px;
        padding-top: 70px;
        padding-bottom: 72px;
    }

    .hero-fluid img {
        left: 62%;
        width: 1120px;
        opacity: 0.76;
    }

    [data-theme="dark"] .hero-fluid img {
        opacity: 0.82;
    }

    .hero-fluid::after {
        inset: 8% -42% 10% 2%;
        opacity: 0.24;
    }

    [data-theme="dark"] .hero-fluid::after {
        opacity: 0.3;
    }

    .hero-frost {
        -webkit-backdrop-filter: blur(8px) saturate(124%);
        backdrop-filter: blur(8px) saturate(124%);
    }

    .hero-feature {
        min-height: 220px;
        padding: 21px 22px 20px;
        border-radius: 22px;
        transform: none;
    }

    .hero-feature-body {
        padding-block: 24px;
    }

    .hero-feature-body p {
        font-size: 20px;
        -webkit-line-clamp: 2;
    }
}

@media (max-width: 360px) {
    .header-inner {
        gap: 16px;
    }

    .site-actions {
        gap: 2px;
    }
}

@keyframes nebula-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ---------- Responsive ---------- */
@media (min-width: 1200px) {
    .post-layout {
        grid-template-columns: minmax(0, 1fr) 232px;
    }

    .post-layout .post-body {
        max-width: 820px;
    }

    .toc-desktop {
        display: block;
    }

    .toc-mobile {
        display: none !important;
    }
}

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

    .toc-mobile.has-items {
        display: block;
    }
}

@media (max-width: 1024px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 40px;
        padding-top: 64px;
        padding-bottom: 64px;
    }

    .hero-terminal {
        max-width: 560px;
    }
}

@media (max-width: 992px) {
    .site-nav {
        position: absolute;
        top: var(--header-h);
        left: 0;
        right: 0;
        display: none;
        max-height: calc(100vh - var(--header-h));
        overflow-y: auto;
        padding: 10px 16px 16px;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-md);
    }

    .site-header.nav-open .site-nav {
        display: block;
    }

    .site-nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        overflow: visible;
    }

    .site-nav a {
        padding: 11px 14px;
        font-size: 15px;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .post-list.is-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    .site-nav {
        top: calc(var(--header-h) + 8px);
        left: 12px;
        right: 12px;
        padding: 10px;
        background: color-mix(in srgb, var(--bg) 96%, transparent);
        -webkit-backdrop-filter: blur(30px) saturate(145%);
        backdrop-filter: blur(30px) saturate(145%);
        border: 1px solid var(--border-strong);
        border-radius: 16px;
        box-shadow: 0 28px 60px -38px rgba(5, 10, 22, 0.75);
    }

    .site-nav a {
        border: 1px solid transparent;
    }

    .site-nav a[aria-current="page"] {
        border-color: color-mix(in srgb, var(--accent) 12%, transparent);
    }
}

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

    .hero-grid {
        padding-top: 44px;
        padding-bottom: 48px;
        gap: 32px;
    }

    .hero-desc {
        font-size: 16px;
    }

    .section {
        padding: 32px 0 48px;
    }

    .post-list.is-list .post-item {
        flex-direction: column;
        gap: 14px;
        padding: 22px 0;
    }

    .post-list.is-list .post-item-cover {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .post-item-title {
        font-size: 18px;
    }

    .comment-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .comment-row .comment-field {
        margin-bottom: 12px;
    }

    .comment-children {
        margin-left: 24px;
        padding-left: 14px;
    }

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

    .post-nav-item.is-next {
        text-align: left;
    }

    .post-nav-item.is-next .post-nav-label {
        justify-content: flex-start;
    }

    .container {
        padding: 0 18px;
    }

    .back-top {
        right: 16px;
        bottom: 18px;
    }
}

/* ---------- Print refinement (kept last to override visual theme) ---------- */
@media print {
    :root,
    [data-theme="dark"] {
        --bg: #ffffff;
        --surface: #ffffff;
        --surface-2: #f3f4f6;
        --text: #111111;
        --text-2: #333333;
        --text-3: #666666;
        --border: rgba(0, 0, 0, 0.14);
        --border-strong: rgba(0, 0, 0, 0.24);
        --code-bg: #f5f6f8;
        color-scheme: light;
    }

    @page {
        margin: 18mm;
    }

    body {
        display: block;
        min-height: 0;
        color: #111111;
        background: #ffffff !important;
        background-image: none !important;
    }

    .site-main {
        display: block;
    }

    .post-layout,
    .post-layout.has-no-toc {
        display: block;
        max-width: none;
        padding: 0;
    }

    .post-content {
        color: #111111;
        font-size: 11pt;
        line-height: 1.7;
    }

    .post-content a {
        color: #111111;
        text-decoration-color: #777777;
    }

    .post-content pre,
    .post-content blockquote,
    .post-content img,
    .code-block {
        break-inside: avoid;
        box-shadow: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .hero-copy > *,
    .hero-terminal {
        animation: none;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- Print ---------- */
@media print {
    .site-header,
    .site-footer,
    .back-top,
    .progress-bar,
    .toc,
    .post-nav,
    .comments,
    .search-modal,
    .code-copy {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
    }

    .post-layout {
        display: block;
    }
}

/* ============================================================
   Nebula 1.2 — Editorial glass refinement
   Inspired by quiet technical editorial layouts: restrained
   grids, luminous depth and Chinese serif typography.
   ============================================================ */
:root {
    --bg: #f1f3f7;
    --surface: rgba(255, 255, 255, 0.68);
    --surface-2: rgba(225, 230, 239, 0.58);
    --text: #151a29;
    --text-2: #525b70;
    --text-3: #626d82;
    --border: rgba(30, 42, 69, 0.105);
    --border-strong: rgba(30, 42, 69, 0.2);
    --shadow-sm: 0 1px 2px rgba(20, 29, 48, 0.04);
    --shadow-md: 0 18px 50px -30px rgba(24, 34, 59, 0.38);
    --shadow-lg: 0 32px 90px -44px rgba(20, 29, 54, 0.58);
    --font-serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
    --font-global: "Baskervville", Georgia, "Times New Roman", var(--font-serif);
    --font-article: var(--font-global);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --glass-blur: 24px;
    --header-h: 72px;
}

[data-theme="dark"] {
    --bg: #090d16;
    --surface: rgba(17, 24, 38, 0.62);
    --surface-2: rgba(36, 45, 64, 0.5);
    --text: #f0f3f8;
    --text-2: #abb4c7;
    --text-3: #707b91;
    --border: rgba(222, 231, 250, 0.09);
    --border-strong: rgba(222, 231, 250, 0.18);
    --shadow-md: 0 20px 58px -30px rgba(0, 0, 0, 0.72);
    --shadow-lg: 0 36px 100px -42px rgba(0, 0, 0, 0.9);
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 16% 4%, color-mix(in srgb, var(--accent) 11%, transparent) 0, transparent 30rem),
        radial-gradient(circle at 86% 22%, rgba(70, 126, 170, 0.09) 0, transparent 26rem),
        linear-gradient(rgba(28, 41, 66, 0.026) 1px, transparent 1px),
        linear-gradient(90deg, rgba(28, 41, 66, 0.026) 1px, transparent 1px);
    background-size: auto, auto, 48px 48px, 48px 48px;
    background-attachment: fixed;
}

.site-main {
    width: 100%;
    flex: 1 0 auto;
}

.site-footer {
    flex-shrink: 0;
}

[data-theme="dark"] body {
    background-image:
        radial-gradient(circle at 18% 2%, color-mix(in srgb, var(--accent) 19%, transparent) 0, transparent 34rem),
        radial-gradient(circle at 86% 24%, rgba(68, 119, 166, 0.16) 0, transparent 32rem),
        linear-gradient(rgba(222, 231, 250, 0.022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(222, 231, 250, 0.022) 1px, transparent 1px);
    background-size: auto, auto, 48px 48px, 48px 48px;
}

h1, h2, h3, h4, h5, h6,
.site-logo,
.footer-title {
    font-family: var(--font-global);
    font-weight: 600;
}

.container {
    max-width: 1180px;
}

.site-header {
    height: 72px;
    background: color-mix(in srgb, var(--bg) 58%, transparent);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(145%);
    backdrop-filter: blur(var(--glass-blur)) saturate(145%);
}

.site-header.is-scrolled {
    border-bottom-color: var(--border);
    box-shadow: 0 10px 40px -28px rgba(20, 29, 48, 0.55);
}

.site-logo {
    font-size: 19px;
    letter-spacing: 0.02em;
}

.site-logo::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 5px var(--accent-soft), 0 0 22px color-mix(in srgb, var(--accent) 55%, transparent);
}

.site-logo:has(img)::before {
    display: none;
}

.site-nav a {
    padding: 8px 14px;
    font-size: 13.5px;
    letter-spacing: 0.04em;
}

.icon-btn {
    border: 1px solid transparent;
}

.icon-btn:hover {
    border-color: var(--border);
    background: var(--surface);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.hero {
    min-height: min(690px, calc(100vh - 72px));
    display: flex;
    align-items: center;
    isolation: isolate;
    border-bottom-color: var(--border);
    --pointer-x: 0;
    --pointer-y: 0;
}

.hero::before,
.hero::after {
    content: "";
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    pointer-events: none;
    transition: transform 1.2s var(--ease-out-expo);
}

.hero::before {
    width: min(56vw, 780px);
    aspect-ratio: 1;
    left: -18%;
    top: -52%;
    border: 1px solid color-mix(in srgb, var(--accent) 16%, transparent);
    box-shadow: inset 0 0 110px color-mix(in srgb, var(--accent) 5%, transparent);
    transform: translate(calc(var(--pointer-x) * 8px), calc(var(--pointer-y) * 8px));
}

.hero::after {
    width: 220px;
    height: 220px;
    right: 7%;
    bottom: 5%;
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    filter: blur(55px);
    transform: translate(calc(var(--pointer-x) * -12px), calc(var(--pointer-y) * -12px));
}

[data-theme="dark"] .hero::after {
    width: 340px;
    height: 340px;
    right: 3%;
    bottom: -5%;
    background: color-mix(in srgb, #4169c1 17%, transparent);
    filter: blur(72px);
}

.hero-grid {
    width: 100%;
    grid-template-columns: minmax(0, 1.12fr) minmax(340px, 0.88fr);
    gap: clamp(42px, 7vw, 92px);
    padding-top: 96px;
    padding-bottom: 104px;
}

.hero-orbits {
    opacity: 0.72;
    transform: translateX(calc(-50% + var(--pointer-x) * -5px)) translateY(calc(var(--pointer-y) * -4px));
    transition: transform 1.25s var(--ease-out-expo);
}

.hero-badge,
.section-kicker {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.hero-badge {
    position: relative;
    padding: 0 0 0 26px;
    color: var(--text-3);
    background: transparent;
    border: 0;
}

.hero-badge::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 16px;
    height: 1px;
    background: var(--accent);
}

.hero-title {
    max-width: 760px;
    font-size: clamp(48px, 6.4vw, 82px);
    line-height: 1.05;
    font-weight: 600;
    letter-spacing: -0.055em;
    text-wrap: balance;
}

.hero-desc {
    max-width: 540px;
    margin-top: 26px;
    font-family: var(--font-global);
    font-size: clamp(17px, 1.65vw, 21px);
    line-height: 1.8;
    letter-spacing: 0.025em;
}

.hero-actions {
    margin-top: 38px;
}

.btn {
    min-height: 44px;
    padding-inline: 22px;
    border-radius: 999px;
    transition: transform 0.45s var(--ease-out-expo), box-shadow 0.45s var(--ease-out-expo), background-color 0.3s ease, border-color 0.3s ease;
}

.btn-primary {
    box-shadow: 0 12px 30px -16px color-mix(in srgb, var(--accent) 80%, transparent);
}

.btn-primary:hover,
.btn-ghost:hover {
    transform: translateY(-3px);
}

.btn-ghost {
    background: color-mix(in srgb, var(--surface) 70%, transparent);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.hero-terminal {
    position: relative;
    background: linear-gradient(145deg, rgba(13, 19, 31, 0.92), rgba(12, 16, 26, 0.76));
    border-color: rgba(255, 255, 255, 0.13);
    border-radius: 22px;
    box-shadow: 0 36px 90px -42px rgba(5, 9, 18, 0.9), inset 0 1px rgba(255, 255, 255, 0.06);
    -webkit-backdrop-filter: blur(26px) saturate(130%);
    backdrop-filter: blur(26px) saturate(130%);
    transform: perspective(1000px) rotateY(calc(var(--pointer-x) * -1.2deg)) rotateX(calc(var(--pointer-y) * 1deg));
    transition: transform 1.1s var(--ease-out-expo), box-shadow 0.5s ease;
}

[data-theme="dark"] .hero-terminal {
    border-color: rgba(179, 195, 231, 0.17);
    box-shadow: 0 38px 100px -42px rgba(32, 60, 125, 0.78), inset 0 1px rgba(255, 255, 255, 0.065);
}

.hero-terminal::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background: linear-gradient(125deg, rgba(255,255,255,0.075), transparent 32%);
    pointer-events: none;
}

.term-head {
    padding: 15px 18px;
    background: rgba(255, 255, 255, 0.025);
}

.term-dot {
    width: 8px;
    height: 8px;
    opacity: 0.72;
}

.term-body {
    min-height: 230px;
    padding: 26px 26px 31px;
    font-size: 13px;
    line-height: 2.15;
}

.section {
    padding-top: clamp(62px, 8vw, 104px);
    padding-bottom: clamp(72px, 9vw, 120px);
}

.container.section {
    padding-left: 24px;
    padding-right: 24px;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-strong);
}

.section-kicker {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--accent-text);
}

.section-heading h2 {
    font-size: clamp(29px, 3.2vw, 42px);
    letter-spacing: -0.03em;
}

.archive-header {
    margin-bottom: 20px;
    padding: 38px 0 34px;
    border-bottom-color: var(--border-strong);
}

.archive-kicker {
    display: block;
    margin-bottom: 10px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent-text);
}

.archive-heading-row {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
}

.archive-title {
    font-size: clamp(31px, 4vw, 48px);
    letter-spacing: -0.035em;
}

.archive-count {
    flex-shrink: 0;
    margin-bottom: 8px;
    font-family: var(--font-global);
}

.section-index {
    padding-bottom: 5px;
    font-family: var(--font-global);
    font-size: 14px;
    color: var(--text-3);
}

.post-list.is-list .post-item {
    position: relative;
    gap: clamp(22px, 4vw, 50px);
    padding: 35px 22px;
    margin-inline: -22px;
    border-radius: 18px;
    border-bottom-color: var(--border);
    transition: background-color 0.5s var(--ease-out-expo), transform 0.5s var(--ease-out-expo), border-color 0.35s ease;
}

.post-list.is-list .post-item:hover {
    z-index: 1;
    transform: translateX(6px);
    background: color-mix(in srgb, var(--surface) 78%, transparent);
    border-bottom-color: transparent;
}

.post-list.is-list .post-item-cover {
    width: 210px;
    height: 132px;
    border-radius: 14px;
    box-shadow: var(--shadow-md);
}

.post-item-title {
    font-size: clamp(21px, 2.2vw, 27px);
    font-weight: 600;
    letter-spacing: -0.02em;
    text-wrap: pretty;
}

:lang(en) .post-item-title,
.post-item-title a {
    overflow-wrap: anywhere;
}

.post-item-excerpt {
    max-width: 760px;
    margin-top: 11px;
    font-family: var(--font-article);
    font-size: 16px;
    line-height: 1.9;
}

.post-item-meta {
    margin-bottom: 11px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.read-more {
    min-height: 40px;
    font-size: 12.5px;
    letter-spacing: 0.07em;
}

.post-list.is-card .post-item,
.toc-mobile,
.search-panel,
.pagination a,
.back-top {
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    -webkit-backdrop-filter: blur(20px) saturate(135%);
    backdrop-filter: blur(20px) saturate(135%);
}

.post-list.is-card .post-item {
    border-radius: 20px;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.06);
}

.post-list.is-card .post-item:hover {
    transform: translateY(-7px);
    box-shadow: var(--shadow-lg);
}

.post-header,
.archive-header {
    padding-top: 20px;
}

.post-title,
.archive-title {
    font-weight: 600;
}

.post-nav-item {
    min-width: 0;
}

.post-title {
    font-size: clamp(34px, 5vw, 54px);
    line-height: 1.18;
}

.post-content {
    font-family: var(--font-article);
    font-size: 17px;
    line-height: 2;
    letter-spacing: 0.012em;
}

/* Keep script-aware editorial typography for article headings. */
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    font-family: var(--font-global);
}

.post-content code,
.post-content pre,
.post-content kbd,
.code-head {
    font-family: var(--font-mono);
    letter-spacing: 0;
}

.comment-respond {
    padding: 24px;
    background: color-mix(in srgb, var(--surface) 78%, transparent);
    border-radius: 18px;
    -webkit-backdrop-filter: blur(18px) saturate(135%);
    backdrop-filter: blur(18px) saturate(135%);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.045), var(--shadow-md);
}

.comment-field input,
.comment-field textarea {
    background: color-mix(in srgb, var(--bg) 76%, transparent);
    border-radius: 12px;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

.comment-field input:hover,
.comment-field textarea:hover {
    border-color: var(--border-strong);
}

.comment-list > li {
    padding-block: 24px;
}

.comment-avatar img {
    box-shadow: 0 0 0 1px var(--border), var(--shadow-sm);
}

.toc-desktop.is-empty {
    display: none;
}

@media (min-width: 1200px) {
    .post-layout.has-no-toc {
        grid-template-columns: minmax(0, 820px);
        justify-content: center;
    }

    .toc-sticky {
        padding: 18px 16px 20px;
        background: color-mix(in srgb, var(--surface) 58%, transparent);
        border: 1px solid var(--border);
        border-radius: 16px;
        -webkit-backdrop-filter: blur(18px) saturate(130%);
        backdrop-filter: blur(18px) saturate(130%);
        box-shadow: var(--shadow-md);
    }

    .toc-title {
        padding-inline: 4px;
    }

    .toc-nav ul {
        border-left-width: 1px;
    }

    .toc-nav a {
        margin-block: 1px;
        padding: 5px 8px 5px 13px;
        border-radius: 0 7px 7px 0;
    }

    .toc-nav a.is-active {
        background: var(--accent-soft);
    }
}

.site-footer {
    position: relative;
    overflow: hidden;
    background: color-mix(in srgb, var(--surface) 58%, transparent);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

.footer-inner {
    padding-top: 62px;
    padding-bottom: 64px;
}

.footer-title {
    font-size: 22px;
}

.will-reveal {
    opacity: 1;
    transform: none;
    transition: none;
}

.will-reveal.is-revealed {
    opacity: 1;
    transform: none;
}

/* Deterministic cross-document transitions. Native View Transition snapshots
   were intentionally avoided here: their root transform could move the
   footer and latest-notes heading independently of the new document. */
html.page-entering .site-main,
html.page-entering .site-footer {
    animation: nebula-page-enter 0.76s var(--ease-out-expo) both;
}

html.page-leaving {
    cursor: progress;
}

html.page-leaving body {
    pointer-events: none;
}

html.page-leaving .site-main,
html.page-leaving .site-footer {
    animation: nebula-page-leave 0.26s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes nebula-page-enter {
    from {
        opacity: 1;
        filter: blur(4px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

@keyframes nebula-page-leave {
    from {
        opacity: 1;
        filter: blur(0);
    }
    to {
        opacity: 0;
        filter: blur(2px);
    }
}

/* Theme tokens transition in place so text and controls remain readable;
   there is no opaque full-screen layer to cover the current page. */
html.theme-transitioning,
html.theme-transitioning body,
html.theme-transitioning body *,
html.theme-transitioning body *::before,
html.theme-transitioning body *::after {
    transition-property: color, background, background-color, border-color,
        box-shadow, fill, stroke, opacity, filter !important;
    transition-duration: 0.82s !important;
    transition-timing-function: var(--ease-out-expo) !important;
}

/* Explicit theme View Transition: both complete page snapshots cross-fade in
   lockstep, so the hero and article list can never be on different timelines.
   Navigation itself uses the deterministic link transition above. */
::view-transition {
    background: transparent;
}

::view-transition-group(root) {
    animation: none;
}

::view-transition-image-pair(root) {
    isolation: isolate;
}

::view-transition-old(root),
::view-transition-new(root) {
    mix-blend-mode: normal;
}

::view-transition-old(root) {
    z-index: 1;
    animation: nebula-theme-old 0.82s ease both;
}

::view-transition-new(root) {
    z-index: 2;
    animation: nebula-theme-new 0.82s var(--ease-out-expo) both;
}

@keyframes nebula-theme-old {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes nebula-theme-new {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 1024px) {
    .hero {
        min-height: auto;
    }

    .hero-grid {
        grid-template-columns: 1fr;
        gap: 48px;
    }

    .hero-terminal {
        max-width: 620px;
    }
}

@media (max-width: 768px) {
    :root {
        --header-h: 64px;
        --glass-blur: 18px;
    }

    body {
        background-size: auto, auto, 32px 32px, 32px 32px;
        background-attachment: scroll;
    }

    .container.section {
        padding-left: 18px;
        padding-right: 18px;
    }

    .site-header {
        height: var(--header-h);
    }

    .icon-btn {
        width: 40px;
        height: 40px;
    }

    .pagination a,
    .pagination .current {
        min-width: 42px;
        height: 42px;
    }

    .hero-grid {
        gap: 34px;
        padding-top: 66px;
        padding-bottom: 62px;
    }

    .hero-title {
        font-size: clamp(42px, 14vw, 60px);
        letter-spacing: -0.045em;
    }

    .hero-desc {
        margin-top: 21px;
        font-size: 17px;
    }

    .hero-actions {
        margin-top: 30px;
    }

    .hero-terminal {
        border-radius: 18px;
    }

    .term-body {
        min-height: 0;
        padding: 21px 20px 25px;
        font-size: 12px;
        line-height: 2;
    }

    .term-line:nth-child(n+5) {
        display: none;
    }

    .section-heading {
        margin-bottom: 10px;
    }

    .archive-header {
        padding-top: 20px;
    }

    .archive-heading-row {
        align-items: start;
        flex-direction: column;
        gap: 3px;
    }

    .archive-count {
        margin: 0;
    }

    .comment-respond {
        padding: 16px;
        border-radius: 15px;
    }

    .comment-children {
        padding-left: 12px;
        border-left-width: 1px;
    }

    .comment-children .comment-children {
        margin-left: 10px;
        padding-left: 10px;
    }

    .comment-children .comment-avatar img {
        width: 40px;
        height: 40px;
    }

    .post-list.is-list .post-item {
        gap: 18px;
        margin-inline: -10px;
        padding: 27px 10px;
        border-radius: 14px;
    }

    .post-list.is-list .post-item:hover {
        transform: translateY(-2px);
    }

    .post-list.is-list .post-item-cover {
        width: 100%;
        height: auto;
    }

    .post-item-title {
        font-size: 21px;
    }

    .post-item-excerpt {
        font-size: 15.5px;
        line-height: 1.85;
    }

    .post-content {
        font-size: 16.5px;
        line-height: 1.95;
    }
}

/* Keep the fluid art direction authoritative over earlier theme layers. */
body {
    background-image: none;
}

[data-theme="dark"] body {
    background-image: none;
}

.hero {
    min-height: min(792px, 100vh);
    margin-top: calc(-1 * var(--header-h));
    padding-top: var(--header-h);
    background: linear-gradient(180deg, #e7edf6 0%, #e7edf6 70%, color-mix(in srgb, var(--bg) 72%, #e7edf6) 88%, var(--bg) 100%);
    border-bottom-color: transparent;
}

[data-theme="dark"] .hero {
    background: linear-gradient(180deg, #07111f 0%, #07111f 70%, color-mix(in srgb, var(--bg) 74%, #07111f) 88%, var(--bg) 100%);
}

.hero-fluid {
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.72) 9%, #000 17%, #000 76%, rgba(0, 0, 0, 0.72) 86%, transparent 100%);
    mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.72) 9%, #000 17%, #000 76%, rgba(0, 0, 0, 0.72) 86%, transparent 100%);
}

.hero-grid {
    grid-template-columns: minmax(0, 1.08fr) minmax(330px, 0.72fr);
    gap: clamp(48px, 8vw, 112px);
    padding-top: 104px;
    padding-bottom: 112px;
}

@media (max-width: 1024px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 42px;
    }
}

@media (max-width: 768px) {
    .site-logo {
        min-width: 0;
        max-width: calc(100% - 136px);
        overflow: hidden;
    }

    .site-logo span {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .site-actions {
        margin-left: auto;
    }

    .hero-grid {
        gap: 34px;
        padding-top: 70px;
        padding-bottom: 72px;
    }
}

/* Final navigation cascade: the navigation sits inside the hero glass. */
.site-header {
    background: transparent;
    border-bottom-color: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    transition: background-color 0.55s var(--ease-out-expo), border-color 0.45s ease, box-shadow 0.55s ease;
}

.site-header::after {
    height: 0;
    background: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    opacity: 0;
}

.site-header.is-scrolled {
    background: color-mix(in srgb, var(--bg) 52%, transparent);
    border-bottom-color: color-mix(in srgb, var(--border-strong) 72%, transparent);
    box-shadow: 0 16px 46px -34px rgba(12, 23, 45, 0.72);
}

.site-header .header-inner {
    max-width: 1280px;
    gap: clamp(18px, 3vw, 44px);
}

.site-header .site-logo {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.025em;
    transition: opacity 0.3s ease, transform 0.5s var(--ease-out-expo);
}

.site-header .site-logo::before {
    content: none !important;
    display: none !important;
}

.site-header .site-logo:hover {
    opacity: 0.78;
    transform: translateY(-1px);
}

.site-header .site-logo:has(img)::before {
    display: none !important;
}

.site-header .site-nav {
    display: flex;
    justify-content: center;
    min-width: 0;
}

.site-header .site-nav ul {
    width: max-content;
    max-width: 100%;
    gap: 5px;
    overflow-x: auto;
    padding: 2px;
}

.site-header .site-nav a {
    position: relative;
    padding: 9px 13px;
    font-family: var(--font-global);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.075em;
    color: color-mix(in srgb, var(--text-2) 92%, transparent);
    border-radius: 999px;
    transition: color 0.3s ease, background-color 0.35s ease, transform 0.45s var(--ease-out-expo);
}

.site-header .site-nav a::after {
    content: none !important;
    display: none !important;
}

.site-header .site-nav a:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--surface) 24%, transparent);
    transform: translateY(-1px);
}

.site-header .site-nav a[aria-current="page"] {
    color: var(--accent-text);
    background: transparent;
}

.site-header .site-actions {
    gap: 3px;
}

.site-header .site-actions .icon-btn {
    width: 36px;
    height: 36px;
    border: 1px solid transparent;
    border-radius: 50%;
    color: color-mix(in srgb, var(--text-2) 94%, transparent);
    transition: color 0.3s ease, background-color 0.35s ease, border-color 0.35s ease, transform 0.45s var(--ease-out-expo);
}

.site-header .site-actions .icon-btn:hover,
.site-header .site-actions .icon-btn:focus-visible {
    color: var(--text);
    background: color-mix(in srgb, var(--surface) 36%, transparent);
    border-color: color-mix(in srgb, var(--border-strong) 68%, transparent);
    -webkit-backdrop-filter: blur(16px) saturate(145%);
    backdrop-filter: blur(16px) saturate(145%);
    transform: translateY(-1px);
}

@media (max-width: 992px) {
    .site-header .site-nav {
        display: none;
        justify-content: initial;
    }

    .site-header.nav-open .site-nav {
        display: block;
    }

    .site-header .site-nav ul {
        width: auto;
        max-width: none;
        gap: 2px;
        padding: 4px;
    }

    .site-header .site-nav a {
        padding: 11px 14px;
        border-radius: 11px;
    }

}

@media (max-width: 768px) {
    .site-header .header-inner {
        gap: 14px;
    }

    .site-header .site-logo {
        min-width: 0;
        max-width: calc(100% - 136px);
        overflow: hidden;
    }

    .site-header .site-logo span {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .site-header .site-actions {
        margin-left: auto;
    }
}

/* Keep the hero's base color interpolable during theme changes. The fluid
   artwork and frost layer still provide the depth gradient independently. */
.hero {
    background-color: #e7edf6;
    background-image: none;
}

[data-theme="dark"] .hero {
    background-color: #07111f;
    background-image: none;
}

@media (prefers-reduced-motion: reduce) {
    html.page-entering .site-main,
    html.page-entering .site-footer,
    html.page-leaving .site-main,
    html.page-leaving .site-footer {
        animation: none;
    }

    html.theme-transitioning,
    html.theme-transitioning body,
    html.theme-transitioning body *,
    html.theme-transitioning body *::before,
    html.theme-transitioning body *::after {
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   Nebula 2.2 — editorial code slabs, hydrated TOC and mobile nav
   ============================================================ */

/* Keep a late-loading TOC from appearing as a hard insertion. The server
   marks post/page bodies as pending and main.js releases them after the
   heading tree has been built. */
body.toc-pending .toc-desktop,
body.toc-pending .toc-mobile {
    opacity: 0;
    visibility: hidden;
    transform: translate3d(0, 9px, 0);
    will-change: opacity, transform;
}

body.toc-pending .toc-mobile {
    display: block;
    max-height: 58px;
    overflow: hidden;
}

body.toc-ready .toc-desktop:not(.is-empty),
body.toc-ready .toc-mobile.has-items {
    animation: nebula-toc-reveal 0.68s var(--ease-out-expo) both;
}

body.toc-ready .toc-mobile.has-items {
    max-height: min(70vh, 640px);
    overflow: hidden;
}

body.toc-ready .toc-mobile.has-items[open] .toc-nav {
    max-height: min(54vh, 460px);
    overflow: auto;
}

@keyframes nebula-toc-reveal {
    from {
        opacity: 0;
        transform: translate3d(0, 9px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* Code is presented as an editorial slab instead of a faux desktop window.
   The accent rail gives it a clear edge while the code surface itself
   remains seamless with the page—no nested rounded border or halo line. */
.post-content .code-block {
    position: relative;
    margin: 2.25em 0;
    padding: 16px 20px 18px 22px;
    overflow: visible;
    border: 0 !important;
    border-radius: 0 18px 18px 0;
    background: color-mix(in srgb, var(--code-bg) 86%, transparent);
    box-shadow: inset 2px 0 color-mix(in srgb, var(--accent) 72%, transparent);
}

.post-content .code-block::before {
    content: "";
    position: absolute;
    left: 0;
    top: 14px;
    bottom: 14px;
    width: 2px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 26%, transparent));
    pointer-events: none;
}

.post-content .code-head {
    min-height: 24px;
    padding: 0 0 10px;
    background: transparent;
    border: 0;
}

.post-content .code-dots {
    display: none;
}

.post-content .code-lang {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.16em;
    color: var(--text-3);
}

.post-content .code-lang::before {
    content: "CODE";
    margin-right: 9px;
    color: var(--accent-text);
    font-size: 0.82em;
    letter-spacing: 0.18em;
}

.post-content .code-copy {
    padding: 5px 10px;
    color: var(--text-2);
    background: color-mix(in srgb, var(--surface) 44%, transparent);
    border-color: color-mix(in srgb, var(--border-strong) 72%, transparent);
    border-radius: 999px;
    transition: color 0.25s ease, background-color 0.3s ease, border-color 0.3s ease, transform 0.35s var(--ease-out-expo);
}

.post-content .code-copy:hover {
    transform: translateY(-1px);
    color: var(--accent-text);
    background: color-mix(in srgb, var(--accent) 12%, var(--surface));
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.post-content .code-block pre,
.post-content .code-block pre[class*="language-"],
.post-content pre[class*="language-"],
.post-content pre {
    margin: 0 !important;
    padding: 11px 0 2px !important;
    background: transparent !important;
    background-image: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.post-content .code-block pre[class*="line-numbers"],
.post-content pre[class*="language-"].line-numbers {
    padding-left: 3.4em !important;
}

/* Give wide screens a little more air between the editorial nav labels. */
@media (min-width: 993px) {
    .site-header .site-nav ul {
        gap: clamp(10px, 1.1vw, 20px);
    }

    .site-header .site-nav a {
        padding-inline: clamp(14px, 0.95vw, 19px);
    }
}

/* Mobile navigation: keep it mounted so open/close can animate instead of
   switching display values in one frame. Numbered entries fill the unused
   right side and make the panel read as a designed index. */
@media (max-width: 992px) {
    .site-header .site-nav {
        display: block;
        justify-content: initial;
        top: calc(var(--header-h) + 10px);
        left: 12px;
        right: 12px;
        max-height: calc(100vh - var(--header-h) - 24px);
        overflow-y: auto;
        padding: 15px 12px 13px;
        background: color-mix(in srgb, var(--bg) 91%, transparent);
        border: 1px solid color-mix(in srgb, var(--border-strong) 94%, transparent);
        border-radius: 20px;
        box-shadow: 0 30px 76px -42px rgba(5, 10, 22, 0.9), inset 0 1px rgba(255, 255, 255, 0.07);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translate3d(0, -12px, 0) scale(0.975);
        transform-origin: top right;
        transition: opacity 0.36s ease, transform 0.52s var(--ease-out-expo), visibility 0s linear 0.52s;
    }

    .site-header.nav-open .site-nav {
        display: block;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translate3d(0, 0, 0) scale(1);
        transition-delay: 0s;
    }

    .site-header .site-nav::before {
        content: "NAVIGATION / INDEX";
        display: block;
        padding: 0 8px 10px;
        color: var(--text-3);
        font-family: var(--font-mono);
        font-size: 10px;
        letter-spacing: 0.18em;
    }

    .site-header .site-nav ul {
        width: auto;
        max-width: none;
        gap: 5px;
        padding: 3px;
        overflow: visible;
        counter-reset: nav-entry;
    }

    .site-header .site-nav li {
        position: relative;
        counter-increment: nav-entry;
    }

    .site-header .site-nav li::after {
        content: counter(nav-entry, decimal-leading-zero);
        position: absolute;
        top: 50%;
        right: 20px;
        color: var(--text-3);
        font-family: var(--font-mono);
        font-size: 10px;
        letter-spacing: 0.12em;
        opacity: 0.72;
        transform: translateY(-50%);
        pointer-events: none;
    }

    .site-header .site-nav a {
        display: flex;
        align-items: center;
        min-height: 52px;
        padding: 14px 70px 14px 18px;
        font-size: 18px;
        font-weight: 700;
        letter-spacing: 0.055em;
        border: 1px solid transparent;
        border-radius: 14px;
        transition: color 0.28s ease, background-color 0.32s ease, border-color 0.32s ease, transform 0.45s var(--ease-out-expo);
    }

    .site-header .site-nav a:hover {
        transform: translateX(4px);
        background: color-mix(in srgb, var(--surface) 38%, transparent);
    }

    .site-header .site-nav a[aria-current="page"] {
        color: var(--accent-text);
        background: color-mix(in srgb, var(--accent) 12%, transparent);
        border-color: color-mix(in srgb, var(--accent) 25%, transparent);
        box-shadow: inset 3px 0 var(--accent);
    }

    .site-header.nav-open .site-nav li {
        animation: nebula-mobile-nav-in 0.58s var(--ease-out-expo) both;
    }

    .site-header.nav-open .site-nav li:nth-child(2) { animation-delay: 0.035s; }
    .site-header.nav-open .site-nav li:nth-child(3) { animation-delay: 0.07s; }
    .site-header.nav-open .site-nav li:nth-child(4) { animation-delay: 0.105s; }
    .site-header.nav-open .site-nav li:nth-child(5) { animation-delay: 0.14s; }
    .site-header.nav-open .site-nav li:nth-child(6) { animation-delay: 0.175s; }
}

@keyframes nebula-mobile-nav-in {
    from {
        opacity: 0;
        transform: translate3d(-10px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* On portrait phones the hero is a complete first screen. The latest notes
   begin below the fold and are reached by the down-reading link or a swipe. */
@media (max-width: 768px) {
    .hero {
        min-height: 100vh;
        min-height: 100svh;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.toc-ready .toc-desktop:not(.is-empty),
    body.toc-ready .toc-mobile.has-items,
    .site-header.nav-open .site-nav li {
        animation: none;
    }

    .site-header .site-nav {
        transition-duration: 0.01ms;
    }
}

/* ============================================================
   Nebula 2.4 — full-screen hero and fluid velocity response
   ============================================================ */

/* The home hero is a complete first-screen composition at every viewport
   size. The notes section starts on the following screen while the normal
   browser scroll remains available immediately. */
body.view-index .hero {
    min-height: 100vh;
    min-height: 100svh;
}

/* Keep the image's keyframe drift independent from page position. The wrapper
   owns the animation tempo, while its inner image and secondary fold layer
   remain free to move organically. */
body.view-index .hero-fluid-scroll {
    position: absolute;
    inset: 0;
    --hero-fluid-drift-duration: 18s;
    --hero-fluid-fold-duration: 21s;
}

body.view-index .hero-fluid-scroll img {
    animation-duration: var(--hero-fluid-drift-duration, 18s);
}

/* Move the layered fold into the scroll-aware wrapper so the whole fluid
   form bends as one body instead of leaving a second rigid silhouette. */
body.view-index .hero-fluid::after {
    display: none;
}

body.view-index .hero-fluid-scroll::after {
    content: "";
    position: absolute;
    inset: 5% -8% 4% 24%;
    background: url("../images/hero-fluid.webp") center / contain no-repeat;
    opacity: 0.3;
    mix-blend-mode: multiply;
    filter: saturate(1.42) contrast(1.08);
    -webkit-mask-image: radial-gradient(ellipse at 58% 52%, #000 18%, rgba(0, 0, 0, 0.82) 56%, transparent 78%);
    mask-image: radial-gradient(ellipse at 58% 52%, #000 18%, rgba(0, 0, 0, 0.82) 56%, transparent 78%);
    will-change: transform;
    animation: hero-fluid-fold 21s cubic-bezier(0.45, 0, 0.3, 1) infinite alternate;
    animation-duration: var(--hero-fluid-fold-duration, 21s);
    pointer-events: none;
}

[data-theme="dark"] body.view-index .hero-fluid-scroll::after {
    opacity: 0.36;
    mix-blend-mode: screen;
    filter: saturate(1.55) contrast(1.16) brightness(0.82);
}

@media (max-width: 768px) {
    body.view-index .hero-fluid-scroll::after {
        inset: 8% -42% 10% 2%;
        opacity: 0.24;
    }

    [data-theme="dark"] body.view-index .hero-fluid-scroll::after {
        opacity: 0.3;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.view-index .hero-fluid-scroll img,
    body.view-index .hero-fluid-scroll::after {
        animation-duration: 0.01ms;
    }
}

/* ============================================================
   Nebula 2.6 — luminous primary and open secondary hero actions
   ============================================================ */

.hero-actions {
    align-items: center;
    gap: 16px;
    margin-top: 34px;
}

.hero-actions .btn {
    position: relative;
    min-height: 42px;
    padding: 8px 18px 9px;
    gap: 9px;
    color: rgba(232, 240, 255, 0.9);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: 0.018em;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    transition: transform 0.42s var(--ease-out-expo), color 0.28s ease,
        background 0.38s ease, border-color 0.38s ease, box-shadow 0.42s var(--ease-out-expo);
}

.hero-actions .btn-primary {
    padding-inline: 21px 18px;
    color: #31527d;
    border: 1px solid rgba(220, 233, 255, 0.78);
    border-radius: 999px;
    background:
        radial-gradient(110% 150% at 8% -16%, rgba(255, 255, 255, 0.88) 0%, rgba(255, 255, 255, 0) 50%),
        linear-gradient(108deg, rgba(208, 225, 255, 0.94) 0%, rgba(151, 184, 247, 0.92) 58%, rgba(128, 165, 239, 0.9) 100%);
    box-shadow:
        inset 0 1px rgba(255, 255, 255, 0.84),
        inset 0 -9px 18px rgba(74, 117, 204, 0.14),
        0 13px 30px -17px rgba(72, 126, 230, 0.62);
    -webkit-backdrop-filter: blur(15px) saturate(128%);
    backdrop-filter: blur(15px) saturate(128%);
}

.hero-actions .btn-primary .hero-action-arrow {
    width: 15px;
    height: 15px;
    opacity: 0.78;
    transition: transform 0.42s var(--ease-out-expo), opacity 0.28s ease;
}

.hero-actions .btn-primary:hover,
.hero-actions .btn-primary:focus-visible {
    color: #24466f;
    border-color: rgba(236, 244, 255, 0.94);
    background:
        radial-gradient(110% 150% at 8% -16%, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0) 52%),
        linear-gradient(108deg, rgba(220, 234, 255, 0.98) 0%, rgba(164, 197, 255, 0.96) 58%, rgba(137, 177, 250, 0.94) 100%);
    box-shadow:
        inset 0 1px rgba(255, 255, 255, 0.92),
        inset 0 -9px 18px rgba(74, 117, 204, 0.17),
        0 17px 36px -18px rgba(72, 129, 238, 0.78);
    transform: translateY(-2px);
}

.hero-actions .btn-primary:hover .hero-action-arrow,
.hero-actions .btn-primary:focus-visible .hero-action-arrow {
    opacity: 1;
    transform: translateX(3px);
}

.hero-actions .btn-ghost {
    padding: 8px 5px 9px;
    color: rgba(232, 240, 255, 0.9);
}

.hero-actions .hero-action-divider {
    display: block;
    flex: 0 0 1px;
    width: 1px;
    height: 30px;
    background: linear-gradient(180deg, transparent, rgba(199, 216, 244, 0.3) 20%, rgba(199, 216, 244, 0.3) 80%, transparent);
    pointer-events: none;
}

.hero-actions .btn-ghost .hero-action-icon {
    width: 17px;
    height: 17px;
    opacity: 0.82;
    transition: opacity 0.28s ease, transform 0.42s var(--ease-out-expo);
}

.hero-actions .btn-ghost:hover,
.hero-actions .btn-ghost:focus-visible {
    color: #ffffff;
    border: 0;
    background: none;
    box-shadow: none;
    transform: translateX(2px);
}

.hero-actions .btn-ghost:hover .hero-action-icon,
.hero-actions .btn-ghost:focus-visible .hero-action-icon {
    opacity: 1;
    transform: scale(1.08);
}

.hero-actions .btn:active {
    transform: translateY(0) scale(0.985);
    transition-duration: 0.12s;
}

[data-theme="light"] .hero-actions .btn-primary {
    color: #294e7b;
    border-color: rgba(135, 169, 225, 0.72);
    background:
        radial-gradient(110% 150% at 8% -16%, rgba(255, 255, 255, 0.94) 0%, rgba(255, 255, 255, 0) 50%),
        linear-gradient(108deg, rgba(205, 223, 253, 0.98) 0%, rgba(143, 180, 245, 0.96) 58%, rgba(116, 158, 235, 0.94) 100%);
    box-shadow:
        inset 0 1px rgba(255, 255, 255, 0.9),
        inset 0 -9px 18px rgba(67, 108, 188, 0.14),
        0 13px 28px -17px rgba(60, 106, 189, 0.52);
}

[data-theme="light"] .hero-actions .btn-ghost {
    color: #294664;
}

[data-theme="light"] .hero-actions .hero-action-divider {
    background: linear-gradient(180deg, transparent, rgba(40, 66, 101, 0.26) 20%, rgba(40, 66, 101, 0.26) 80%, transparent);
}

[data-theme="light"] .hero-actions .btn-ghost:hover,
[data-theme="light"] .hero-actions .btn-ghost:focus-visible {
    color: #15385f;
}

@media (max-width: 768px) {
    .hero-actions {
        gap: 12px;
        margin-top: 28px;
    }

    .hero-actions .btn {
        min-height: 41px;
        font-size: 14.5px;
    }

    .hero-actions .btn-primary {
        padding-inline: 18px 15px;
    }

}
