/*
Theme Name: praxis-skeleton
Description: 對應原 praxis.tw 結構的極簡主題 — 頂部水平選單 + 左側邊欄選單 + 雙欄佈局，含現代化排版、TOC、深色模式
Version: 0.2
Author: 立方 / Claude
*/

/* ===== Design tokens ===== */
:root {
    --brand: #b22222;
    --brand-soft: #d4a4a4;
    --accent: #e09800;
    --fg: #1c1c1c;
    --fg-muted: #6a6a6a;
    --fg-faint: #999;
    --bg: #ffffff;
    --bg-soft: #fafafa;
    --bg-card: #f7f4f0;
    --border: #e6e3dd;
    --border-soft: #efece6;
    --shadow: 0 1px 3px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.04);

    --font-serif: "Noto Serif TC", "Source Han Serif TC", "PingFang TC", "Songti TC", "Microsoft JhengHei", Georgia, serif;
    --font-sans: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", "Helvetica Neue", sans-serif;

    --prose: 740px;
    --shell: 1180px;
    --radius: 4px;
    --ease: cubic-bezier(.2,.6,.2,1);
    --input-bg: #f1efea;

    /* 4 條紅色錯落直線 — 對應 banner 標誌的小版本，透明背景 */
    --icon-bars: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 22'><rect x='0' y='6' width='2' height='14' fill='black'/><rect x='4' y='2' width='2' height='14' fill='black'/><rect x='8' y='6' width='2' height='14' fill='black'/><rect x='12' y='0' width='2' height='14' fill='black'/></svg>");
}

/* 「舊紙色」替代主題 — 不是 dark mode，而是溫潤的米黃／老紙色調 */
[data-theme="paper"] {
    --brand: #9c1f1f;          /* 老書紅墨 */
    --brand-soft: #c89a96;
    --accent: #b68235;         /* 舊金色 */
    --fg: #2d2620;             /* 棕黑 */
    --fg-muted: #6a5f4f;
    --fg-faint: #9c8f78;
    --bg: #f4ead4;             /* 老紙 */
    --bg-soft: #ecdfc1;
    --bg-card: #e6d6b1;
    --border: #d5c39c;
    --border-soft: #e3d4b2;
    --shadow: 0 1px 3px rgba(80,55,25,.06), 0 8px 24px rgba(80,55,25,.08);
    --input-bg: #ecdfc1;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.8;
    color: var(--fg);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: background .3s var(--ease), color .3s var(--ease);
}

a {
    color: var(--fg);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color .2s var(--ease), border-color .2s var(--ease);
}
a:hover {
    color: var(--brand);
    border-bottom-color: var(--brand-soft);
}

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

/* ===== Layout shell ===== */
.site {
    max-width: var(--shell);
    margin: 0 auto;
    padding: 0 28px;
}

@media (max-width: 720px) {
    .site { padding: 0 18px; }
}

/* ===== Reading progress bar ===== */
.reading-progress {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: transparent;
    z-index: 9999;
    pointer-events: none;
}
.reading-progress__bar {
    height: 100%;
    width: 0;
    background: var(--brand);
    transform-origin: left center;
    transition: width .1s linear;
}

/* ===== Header / banner ===== */
.site-header {
    padding: 28px 0 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.site-header__row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 18px;
    flex-wrap: wrap;
}
.site-header__tools {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.site-banner {
    display: inline-block;
    line-height: 0;
    border-bottom: none;
    padding: 6px 4px;
}
.site-banner:hover { border-bottom: none; }

.banner-svg {
    width: 100%;
    max-width: 460px;
    height: auto;
    display: block;
    overflow: visible;
}
.banner-title {
    font-family: var(--font-serif);
    font-size: 74.1px;
    font-weight: 700;
    fill: var(--fg);
    letter-spacing: .02em;
    transition: fill .25s var(--ease);
}
.banner-subtitle {
    font-family: var(--font-sans);
    font-size: 17.14px;
    font-weight: 400;
    fill: var(--fg-muted);
    letter-spacing: .05em;
    transition: fill .25s var(--ease);
}
.banner-bar {
    fill: var(--brand);
    transform-origin: center bottom;
    transition: transform .35s var(--ease), fill .25s var(--ease);
}
.banner-subtitle__rule {
    stroke: var(--brand);
    stroke-width: 1;
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset .55s var(--ease);
}

.site-banner:hover .banner-bar--1 { transform: translateY(-2px); transition-delay: 0ms; }
.site-banner:hover .banner-bar--2 { transform: translateY(-5px); transition-delay: 60ms; }
.site-banner:hover .banner-bar--3 { transform: translateY(-3px); transition-delay: 120ms; }
.site-banner:hover .banner-bar--4 { transform: translateY(-6px); transition-delay: 180ms; }
.site-banner:hover .banner-title { fill: var(--brand); }
.site-banner:hover .banner-subtitle__rule { stroke-dashoffset: 0; }

/* Header 工具區的搜尋與切換 */
.site-header__tools .search-form { margin: 0; }
.site-header__tools input[type="search"] {
    padding: 6px 10px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--fg);
    font-size: 14px;
    border-radius: var(--radius);
    width: 180px;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
}
.site-header__tools input[type="search"]:hover {
    background: color-mix(in srgb, var(--input-bg) 80%, var(--bg) 20%);
}
.site-header__tools input[type="search"]:focus {
    outline: none;
    border-color: var(--brand-soft);
    background: var(--bg);
    box-shadow: 0 0 0 3px rgba(178,34,34,.12);
}
.site-header__tools input[type="submit"] {
    display: none;
}

/* Theme toggle */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--fg-muted);
    border-radius: 999px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.theme-toggle:hover { color: var(--brand); border-color: var(--brand-soft); transform: rotate(20deg); }
.theme-toggle svg { width: 16px; height: 16px; }

/* Mobile menu trigger */
.menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--fg);
    padding: 6px 10px;
    cursor: pointer;
    font-size: 14px;
}

/* ===== Content layout ===== */
.site-content {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 48px;
    margin-top: 36px;
    padding-bottom: 80px;
}
.site-sidebar { position: relative; }
.site-main { min-width: 0; }

/* Sidebar nav — 分群＋內嵌 accordion */
.sidebar-group { margin-bottom: 16px; }
.sidebar-group:last-child { margin-bottom: 0; }
.sidebar-group__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--brand);
    letter-spacing: .22em;
    margin: 0 0 4px;
    padding: 0 0 4px;
    border-bottom: 1px solid var(--border-soft);
    background: none;
}
.sidebar-nav .menu {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sidebar-nav .menu > li {
    margin-bottom: 0;
}
.sidebar-nav .menu > li > a {
    font-size: 15px;
    color: var(--fg);
    display: flex;
    align-items: center;
    padding: 3px 0;
    border-bottom: none;
    position: relative;
}
.sidebar-nav .menu a:hover,
.sidebar-nav .current-menu-item > a { color: var(--brand); }

/* The » suffix from theme markup */
.sidebar-nav .menu .menu-item-has-children > a::after {
    content: "›";
    color: var(--fg-faint);
    font-size: 18px;
    margin-left: auto;
    padding-left: 10px;
    transform: rotate(90deg);
    transition: transform .25s var(--ease), color .2s var(--ease);
}
.sidebar-nav .menu .menu-item-has-children:hover > a::after,
.sidebar-nav .menu .menu-item-has-children:focus-within > a::after {
    transform: rotate(180deg);
    color: var(--brand);
}

/* Inline accordion via max-height */
.sidebar-nav .sub-menu {
    list-style: none;
    margin: 0;
    padding: 0 0 0 12px;
    border-left: 2px solid var(--border);
    margin-left: 4px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height .35s var(--ease),
                opacity .25s var(--ease),
                padding .25s var(--ease),
                margin .25s var(--ease);
}
.sidebar-nav .menu li:hover > .sub-menu,
.sidebar-nav .menu li:focus-within > .sub-menu {
    max-height: 600px;
    opacity: 1;
    padding-top: 2px;
    padding-bottom: 4px;
    margin-top: 2px;
    margin-bottom: 4px;
}
.sidebar-nav .sub-menu li { margin: 0; }
.sidebar-nav .sub-menu a {
    color: var(--fg-muted);
    padding: 1px 6px;
    font-size: 13.5px;
    line-height: 1.7;
    display: block;
    border-bottom: none;
    border-left: 2px solid transparent;
    margin-left: -8px;
    transition: color .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.sidebar-nav .sub-menu a:hover {
    color: var(--brand);
    border-left-color: var(--brand);
    background: var(--bg-soft);
}

/* ===== Section headings ===== */
.site-main h1,
.site-main h2.section-title,
.site-main h2 {
    color: var(--brand);
    font-family: var(--font-serif);
    font-weight: 600;
    margin: 32px 0 18px;
    font-size: 22px;
    letter-spacing: .01em;
    display: flex;
    align-items: center;
    gap: 12px;
}
.site-main h1 { font-size: 26px; }
.site-main h1::before,
.site-main h2.section-title::before,
.site-main h2::before {
    content: '';
    display: inline-block;
    flex: 0 0 auto;
    width: 18px;
    height: 26px;
    background-color: var(--brand);
    -webkit-mask: var(--icon-bars) no-repeat center / contain;
            mask: var(--icon-bars) no-repeat center / contain;
}
.site-main h2 a { color: inherit; border-bottom: none; }
.site-main h2 a:hover { color: var(--accent); }

/* ===== Article list ===== */
.site-main .post,
.site-main .page,
.site-main article {
    padding-bottom: 8px;
    margin-bottom: 28px;
}
.site-main .entry-title {
    margin: 6px 0 10px;
    color: var(--fg);
    font-size: 19px;
    font-family: var(--font-serif);
    font-weight: 600;
    border: none;
    padding: 0;
    background: none;
}
.site-main .entry-title a {
    color: inherit;
    border-bottom: none;
}
.site-main .entry-title a:hover { color: var(--brand); }
.site-main .post-meta {
    color: var(--fg-faint);
    font-size: 12.5px;
    letter-spacing: .04em;
    margin-bottom: 12px;
}
.site-main .entry-content { font-size: 15.5px; }

/* ===== Single post / prose ===== */
.single-article { /* 縱向流動：標題 → article-body → related-articles */ }

.article-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    column-gap: 44px;
}
.article-body:not(:has(.article-sidebar)) {
    grid-template-columns: 1fr;
    column-gap: 0;
}
.article-main { min-width: 0; }

.article-sidebar {
    align-self: start;
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    font-size: 14px;
}
.article-sidebar > * + * { margin-top: 18px; }
/* 側欄內的 TOC 不需要再 sticky */
.article-sidebar .toc {
    position: static;
    max-height: none;
    overflow-y: visible;
    top: auto;
}

/* 文章 metadata 區（解析 post_excerpt 的 key:value） */
.article-meta {
    margin: 8px 0 32px;
    padding: 0 0 18px;
    border-bottom: 1px dashed var(--border);
    color: var(--fg-muted);
    font-size: 14.5px;
    line-height: 1.95;
}
.article-meta__row {
    display: grid;
    grid-template-columns: 6em 1fr;
    column-gap: 10px;
    align-items: baseline;
}
.article-meta__key {
    color: var(--fg);
    font-weight: 500;
    margin: 0;
    text-align: justify;
    text-align-last: justify;
}
.article-meta__key::after { content: '：'; color: var(--fg-faint); margin-left: 2px; }
.article-meta__val { margin: 0; color: var(--fg-muted); }
.article-meta__val--full { grid-column: 1 / -1; padding-left: 0; }

/* 右側分類／標籤方塊 */
.taxonomy-box {
    background: var(--bg-soft);
    padding: 16px 18px;
    border-radius: var(--radius);
    line-height: 1.95;
    border: 1px solid var(--border-soft);
}
.taxonomy-box__label {
    color: var(--brand);
    font-family: var(--font-serif);
    font-size: 14.5px;
    font-weight: 600;
    margin: 0 0 4px;
    padding: 0;
    background: none;
    border: none;
}
.taxonomy-box__label + .taxonomy-box__items + .taxonomy-box__label { margin-top: 14px; }
.taxonomy-box__items {
    margin: 0;
    color: var(--fg-muted);
    font-size: 13.5px;
    word-break: break-word;
}
.taxonomy-box__items a {
    color: var(--fg);
    border-bottom: none;
}
.taxonomy-box__items a:hover {
    color: var(--brand);
    border-bottom: 1px solid var(--brand-soft);
}

/* Mobile：sidebar 不浮、改在下方 */
@media (max-width: 960px) {
    .article-body { grid-template-columns: 1fr; column-gap: 0; row-gap: 24px; }
    .article-sidebar {
        position: static;
        max-height: none;
        overflow-y: visible;
        order: 99; /* 移到內容之後 */
    }
}

.entry-content {
    max-width: var(--prose);
    font-size: 16.5px;
    line-height: 1.9;
    color: var(--fg);
}
.entry-content > * { margin-top: 0; margin-bottom: 1.2em; }
.entry-content h2,
.entry-content h3,
.entry-content h4 {
    font-family: var(--font-serif);
    font-weight: 600;
    color: var(--fg);
    line-height: 1.4;
    margin-top: 2em;
    background: none;
    padding-left: 0;
}
.entry-content h2 { font-size: 22px; padding-bottom: .35em; border-bottom: 1px solid var(--border); }
.entry-content h3 { font-size: 19px; color: var(--brand); }
.entry-content h4 { font-size: 17px; }
.entry-content p { margin-bottom: 1.3em; }
.entry-content blockquote {
    margin: 1.5em 0;
    padding: .2em 1.2em;
    border-left: 3px solid var(--brand-soft);
    color: var(--fg-muted);
    font-style: italic;
    background: var(--bg-soft);
}
.entry-content img {
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    cursor: zoom-in;
    transition: transform .3s var(--ease);
}
.entry-content img:hover { transform: translateY(-2px); }
.entry-content a {
    color: var(--brand);
    border-bottom: 1px solid var(--brand-soft);
}
.entry-content a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.entry-content ul, .entry-content ol { padding-left: 1.4em; }
.entry-content li { margin-bottom: .4em; }
.entry-content code {
    background: var(--bg-soft);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: .92em;
}

.single-article .entry-title {
    font-family: var(--font-serif);
    font-size: 28px;
    line-height: 1.4;
    color: var(--fg);
    margin: 10px 0 6px;
    padding: 0;
    background: none;
}

.post-relations {
    margin-top: 40px;
    padding: 18px 22px;
    background: var(--bg-card);
    border-left: 3px solid var(--brand);
    font-size: 14px;
    border-radius: 0 var(--radius) var(--radius) 0;
}
.post-relations .rel-row { margin: 4px 0; }
.post-relations a { border-bottom-color: var(--border); }

/* ===== TOC ===== */
.toc {
    align-self: start;
    position: sticky;
    top: 28px;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    font-size: 13.5px;
    line-height: 1.6;
    padding: 0 0 0 18px;
    border-left: 1px solid var(--border);
}
.toc__heading {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--fg-faint);
    margin-bottom: 10px;
}
.toc ol, .toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.toc li { margin: 4px 0; }
.toc li.toc-level-3 { padding-left: 14px; }
.toc li.toc-level-4 { padding-left: 28px; }
.toc a {
    color: var(--fg-muted);
    border-bottom: none;
    display: block;
    padding: 2px 0;
    border-left: 2px solid transparent;
    margin-left: -20px;
    padding-left: 18px;
    transition: color .2s var(--ease), border-color .2s var(--ease);
}
.toc a:hover { color: var(--brand); }
.toc a.is-active {
    color: var(--brand);
    border-left-color: var(--brand);
}

/* ===== Archive list ===== */
.archive-title {
    color: var(--brand);
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 22px;
    margin: 28px 0 18px;
    padding: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
}
.archive-title::before {
    content: '';
    display: inline-block;
    flex: 0 0 auto;
    width: 18px;
    height: 26px;
    background-color: var(--brand);
    -webkit-mask: var(--icon-bars) no-repeat center / contain;
            mask: var(--icon-bars) no-repeat center / contain;
}
/* 有 toolbar 時，把分隔線下移到 toolbar 底部 */
.archive-title:has(+ .archive-toolbar) {
    border-bottom: none;
    padding-bottom: 4px;
    margin-bottom: 8px;
}
.archive-subtitle {
    color: var(--fg-muted);
    font-weight: 400;
    font-size: 18px;
    margin-left: 6px;
}
.archive-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.archive-list > li {
    padding: 10px 0;
    margin: 0;
}
.archive-list .archive-item__title {
    font-size: 16.5px;
    color: var(--fg);
    border-bottom: none;
}
.archive-list .archive-item__title:hover {
    color: var(--brand);
    border-bottom-color: var(--brand-soft);
}
.archive-list .post-meta {
    margin-top: 4px;
    font-size: 13px;
    color: var(--fg-faint);
}

/* Archive 工具列：篇數總計＋排序切換 */
.archive-toolbar {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin: 4px 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13px;
    color: var(--fg-muted);
    flex-wrap: wrap;
}
.archive-toolbar__count {
    letter-spacing: .04em;
}
.archive-sort {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
}
.archive-sort__label {
    color: var(--fg-faint);
    letter-spacing: .04em;
}
.archive-sort__sep {
    color: var(--fg-faint);
}
.archive-sort__opt {
    color: var(--fg-muted);
    border-bottom: none;
    padding-bottom: 2px;
    transition: color .2s var(--ease);
}
.archive-sort__opt:hover { color: var(--brand); }
.archive-sort__opt.is-active {
    color: var(--brand);
    border-bottom: 1px solid var(--brand);
}

/* ===== 標籤雲 ===== */
.tag-cloud-tools {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    margin: 0 0 22px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.tag-cloud-search { flex: 1; min-width: 220px; }
.tag-cloud-filter {
    width: 100%;
    padding: 8px 12px;
    font-size: 14.5px;
    background: var(--bg);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.tag-cloud-filter:focus {
    outline: none;
    border-color: var(--brand-soft);
    box-shadow: 0 0 0 3px rgba(178,34,34,.10);
}
.tag-cloud-empty {
    color: var(--fg-muted);
    text-align: center;
    padding: 40px 0;
}

.tag-cloud-wrap {
    position: relative;
    margin: 8px 0 24px;
    min-height: 480px;
}
#tag-cloud-canvas {
    display: block;
    width: 100%;
    height: 640px;
    cursor: default;
    position: relative;
    z-index: 1;
}

/* 自訂浮動 tooltip，跳過原生 title 的延遲 */
.tag-cloud-tip {
    position: fixed;
    z-index: 9999;
    background: var(--fg);
    color: var(--bg);
    padding: 4px 10px;
    font-size: 13px;
    border-radius: 3px;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
    white-space: nowrap;
}

/* 點擊用透明 anchor overlay，定位疊在 canvas 上 */
.tag-cloud-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}
.tag-cloud-link {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;
    border-bottom: none;
    border-radius: 2px;
    transition: background .15s var(--ease), outline-color .15s var(--ease);
    outline: 1px solid transparent;
    outline-offset: 1px;
}
.tag-cloud-link:hover {
    background: rgba(178,34,34,.08);
    outline-color: var(--brand-soft);
    border-bottom: none;
}
[data-theme="paper"] .tag-cloud-link:hover {
    background: rgba(156,31,31,.08);
}

/* 底部長尾標籤索引 */
.tag-cloud-index {
    margin-top: 8px;
    border-top: 1px solid var(--border);
    padding-top: 18px;
}
.tag-cloud-index > summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: baseline;
    gap: 10px;
    color: var(--fg-muted);
    padding: 6px 0 12px;
    user-select: none;
    transition: color .2s var(--ease);
}
.tag-cloud-index > summary::-webkit-details-marker { display: none; }
.tag-cloud-index > summary::before {
    content: "▸";
    color: var(--fg-faint);
    transition: transform .2s var(--ease);
    display: inline-block;
}
.tag-cloud-index[open] > summary::before { transform: rotate(90deg); }
.tag-cloud-index > summary:hover { color: var(--brand); }
.tag-cloud-index__count {
    font-size: 13px;
    color: var(--fg-faint);
}
.tag-cloud-index__list {
    list-style: none;
    padding: 6px 0 12px;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 4px 18px;
}
.tag-cloud-index__list a {
    display: block;
    color: var(--fg-muted);
    font-size: 14px;
    padding: 3px 4px;
    border-bottom: none;
    border-left: 2px solid transparent;
    padding-left: 6px;
    transition: color .15s var(--ease), border-color .15s var(--ease), background .15s var(--ease);
}
.tag-cloud-index__list a:hover {
    color: var(--brand);
    border-left-color: var(--brand);
    background: var(--bg-soft);
}
.tag-cloud-index__num {
    color: var(--fg-faint);
    font-size: 12px;
    margin-left: 4px;
    font-variant-numeric: tabular-nums;
}

.tag-cloud-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fg-faint);
    font-size: 14px;
    letter-spacing: .1em;
    pointer-events: none;
    transition: opacity .3s var(--ease);
}
.tag-cloud-loading.is-hidden { opacity: 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;
}

@media (max-width: 760px) {
    #tag-cloud-canvas { height: 520px; }
}

/* 「相關文章」區（CPT 實體頁＋一般文章共用） */
.related-articles {
    margin-top: 44px;
    padding-top: 24px;
    border-top: 1px dashed var(--border);
}
.related-articles__title {
    color: var(--brand);
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 19px;
    margin: 0 0 14px;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: none;
}
.related-articles__title::before {
    content: '';
    display: inline-block;
    flex: 0 0 auto;
    width: 15px;
    height: 22px;
    background-color: var(--brand);
    -webkit-mask: var(--icon-bars) no-repeat center / contain;
            mask: var(--icon-bars) no-repeat center / contain;
}
.archive-list--compact > li { padding: 6px 0; }
.archive-list--compact .archive-item__title { font-size: 16px; }

/* Topic 列表（創作類型／專題子項目）：■ bullet + 標題 + 來源縮排 */
.archive-list--topic {
    list-style: square;
    padding-left: 22px;
    margin: 0;
}
.archive-list--topic > li {
    padding: 6px 0 22px;
    color: var(--fg-muted);
}
.archive-list--topic > li::marker { color: var(--fg-faint); }
.archive-list--topic .archive-item__title {
    font-size: 16.5px;
    color: var(--fg);
    font-weight: 500;
    border-bottom: 1px dashed var(--brand-soft);
    padding-bottom: 1px;
    transition: color .2s var(--ease), border-color .2s var(--ease);
}
.archive-list--topic .archive-item__title:hover {
    color: var(--brand);
    border-bottom-color: var(--brand);
}
.archive-list--topic .archive-item__excerpt {
    margin-top: 8px;
    padding-left: 4px;
    color: var(--fg-muted);
    font-size: 14px;
    line-height: 1.85;
}

/* CPT 列表（藝術家／策展人／機構…）：方塊 bullet + 緊湊行高 + 篇數 */
.archive-list--cpt {
    list-style: square;
    padding-left: 22px;
    column-count: 2;
    column-gap: 32px;
}
.archive-list--cpt > li {
    padding: 6px 0;
    break-inside: avoid;
    list-style-position: outside;
    color: var(--fg-muted);
}
.archive-list--cpt::marker,
.archive-list--cpt > li::marker { color: var(--fg-faint); }
.archive-list--cpt .archive-item__title { font-size: 16px; }
.archive-list--cpt .archive-item__count {
    color: var(--fg-muted);
    font-size: 14px;
    margin-left: 2px;
    font-variant-numeric: tabular-nums;
}
@media (max-width: 760px) {
    .archive-list--cpt { column-count: 1; }
}

/* ===== Front page bits ===== */
.front-page-content { max-width: 100%; }
.praxis-related-posts {
    list-style: square;
    padding-left: 22px;
}
.praxis-related-posts li {
    margin-bottom: 6px;
    border: none;
    padding-bottom: 0;
}
.praxis-related-posts .post-date {
    color: var(--fg-faint);
    font-size: 12.5px;
    margin-left: 8px;
}

/* ===== 分頁 ===== */
.navigation.pagination {
    margin-top: 44px;
    padding-top: 22px;
    border-top: 1px dashed var(--border);
}
.navigation.pagination .screen-reader-text {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden; clip: rect(0,0,0,0);
}
.navigation.pagination .nav-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--fg-muted);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    background: var(--bg);
    transition: color .2s var(--ease),
                border-color .2s var(--ease),
                background .2s var(--ease),
                transform .15s var(--ease);
}
.page-numbers:hover {
    color: var(--brand);
    border-color: var(--brand-soft);
    background: var(--bg-soft);
    border-bottom: 1px solid var(--brand-soft);
    transform: translateY(-1px);
}
.page-numbers.current {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
    font-weight: 600;
}
[data-theme="paper"] .page-numbers.current { color: var(--bg); }
.page-numbers.dots {
    border-color: transparent;
    background: transparent;
    color: var(--fg-faint);
    cursor: default;
}
.page-numbers.dots:hover {
    transform: none;
    background: transparent;
    border-color: transparent;
}
.page-numbers.prev,
.page-numbers.next {
    padding: 0 14px;
    color: var(--fg);
}
.page-numbers.prev:hover,
.page-numbers.next:hover {
    color: var(--brand);
}

/* ===== Footer ===== */
.site-footer {
    border-top: 1px solid var(--border);
    margin-top: 40px;
    padding: 24px 0 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--fg-muted);
}
.site-footer__left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.site-footer__label {
    color: var(--fg-muted);
    letter-spacing: .08em;
}
.site-footer__sponsor {
    height: 30px;
    width: auto;
    display: block;
    opacity: .9;
}
.site-footer__right {
    text-align: right;
    color: var(--fg-faint);
    line-height: 1.7;
}
.site-footer__right p { margin: 0; }
.site-footer__copy {
    font-variant-numeric: tabular-nums;
}

@media (max-width: 600px) {
    .site-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .site-footer__right { text-align: left; }
}

/* ===== Page transition fade ===== */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: .22s;
    animation-timing-function: cubic-bezier(.2,.6,.2,1);
}

/* ===== Lightbox ===== */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s var(--ease), visibility 0s .25s linear;
    cursor: zoom-out;
}
.lightbox.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity .25s var(--ease), visibility 0s 0s linear;
}
.lightbox img {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
    border-radius: var(--radius);
}

/* ===== Responsive ===== */
@media (max-width: 960px) {
    .single-article { grid-template-columns: 1fr; }
    .toc {
        position: static;
        max-height: none;
        margin-bottom: 24px;
        padding: 14px 16px;
        border-left: 3px solid var(--brand-soft);
        background: var(--bg-soft);
        border-radius: var(--radius);
    }
}

@media (max-width: 760px) {
    body { font-size: 15.5px; }
    .site-header__row { align-items: center; padding-bottom: 14px; }
    .site-header__tools input[type="search"] { width: 140px; }
    .menu-toggle { display: inline-flex; align-items: center; gap: 6px; }

    .site-content {
        grid-template-columns: 1fr;
        gap: 0;
        margin-top: 18px;
    }
    .site-sidebar {
        max-height: 0;
        overflow: hidden;
        transition: max-height .3s var(--ease);
        border-bottom: 1px solid transparent;
    }
    .site-sidebar.is-open {
        max-height: 2000px;
        border-bottom-color: var(--border);
        padding-bottom: 18px;
        margin-bottom: 18px;
    }

    .single-article .entry-title { font-size: 24px; }
    .entry-content { font-size: 16px; line-height: 1.85; }
    .banner-svg { max-width: 320px; }
}

/* 桌面下，漢堡按鈕隱藏（選單永遠展開）；超過 760px 時 site-sidebar 維持原版面 */
@media (min-width: 761px) {
    .menu-toggle { display: none; }
    .site-sidebar { max-height: none; overflow: visible; }
}

/* ===== Print ===== */
@media print {
    .top-nav, .site-sidebar, .toc, .reading-progress, .theme-toggle, .menu-toggle { display: none !important; }
    .site-content { display: block; }
    .entry-content { max-width: 100%; }
}
