/*
Theme Name: Doca
Theme URI: https://typecho.org/
Description: Multi-project developer documentation theme for Typecho.
Version: 0.2.3
Author: Genarch
*/

:root {
    --accent: #2563eb;
    --violet: #8b5cf6;
    --lavender: #f7f4ff;
    --lavender-line: #e7ddff;
    --ink: #172033;
    --muted: #657087;
    --soft: #8c96a8;
    --line: #e6e9ef;
    --panel: #f7f8fa;
    --code: #111827;
    --header-height: 64px;
    --content: 760px;
    color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
    margin: 0;
    color: var(--ink);
    background: #fff;
    font: 15px/1.75 -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
    background-image: radial-gradient(circle at 86% 2%, rgba(139, 92, 246, .055), transparent 24rem);
    background-attachment: fixed;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
.skip-link { position: fixed; z-index: 100; top: -60px; left: 16px; padding: 8px 14px; color: #fff; background: var(--accent); border-radius: 6px; }
.skip-link:focus { top: 10px; }
.site-header {
    position: sticky;
    z-index: 50;
    top: 0;
    height: var(--header-height);
    border-bottom: 1px solid rgba(230, 233, 239, .88);
    background: rgba(255, 255, 255, .9);
    backdrop-filter: blur(14px);
}
.header-inner { width: min(1440px, 100%); height: 100%; margin: auto; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.02em; }
.brand-mark { display: grid; width: 30px; height: 30px; place-items: center; color: #fff; background: linear-gradient(145deg, var(--accent), var(--violet)); border-radius: 8px; font: 700 15px/1 ui-monospace, SFMono-Regular, Consolas, monospace; box-shadow: 0 5px 14px rgba(139, 92, 246, .18); }
.brand small { padding: 1px 6px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 5px; font: 600 10px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; }
.top-nav { display: flex; align-items: center; gap: 6px; }
.top-nav a { padding: 6px 11px; color: #4d586d; border-radius: 6px; font-size: 13px; font-weight: 600; }
.top-nav a:hover { color: var(--ink); background: var(--panel); }
.top-nav .nav-avatar { width: 32px; height: 32px; margin-left: 4px; padding: 0; overflow: hidden; border: 1px solid var(--lavender-line); border-radius: 50%; box-shadow: 0 0 0 3px var(--lavender); }
.nav-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.menu-toggle { display: none; width: 38px; height: 38px; padding: 9px; border: 0; background: transparent; }
.menu-toggle span { display: block; height: 1px; margin: 5px 0; background: var(--ink); }

.home-hero { max-width: 960px; min-height: 380px; margin: auto; padding: 110px 32px 76px; text-align: center; }
.eyebrow { display: inline-block; margin-bottom: 18px; color: var(--violet); font: 700 11px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .14em; }
.home-hero h1 { margin: 0; font-size: clamp(42px, 7vw, 72px); line-height: 1.05; letter-spacing: -.055em; }
.home-hero p { max-width: 620px; margin: 22px auto 30px; color: var(--muted); font-size: 17px; }
.primary-action { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; color: #fff; background: var(--accent); border-radius: 7px; font-size: 13px; font-weight: 700; box-shadow: 0 7px 20px color-mix(in srgb, var(--accent) 22%, transparent); }
.projects-section { max-width: 1120px; margin: auto; padding: 34px 32px 100px; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 40px; margin: 0 0 28px; }
.section-heading span { color: var(--accent); font: 700 10px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .14em; }
.section-heading h2 { margin: 9px 0 0; font-size: 25px; letter-spacing: -.035em; }
.section-heading > p { max-width: 440px; margin: 0; color: var(--muted); font-size: 13px; }
.section-heading.compact { margin-bottom: 18px; }
.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.project-card { position: relative; display: flex; gap: 18px; min-height: 184px; padding: 24px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.project-card::after { position: absolute; right: -32px; bottom: -38px; width: 100px; height: 100px; content: ""; background: radial-gradient(circle, rgba(139, 92, 246, .1), transparent 68%); pointer-events: none; }
.project-card:hover { transform: translateY(-2px); border-color: var(--lavender-line); box-shadow: 0 14px 36px rgba(90, 66, 150, .08); }
.project-icon { display: grid; flex: 0 0 42px; height: 42px; place-items: center; color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, white); border: 1px solid color-mix(in srgb, var(--accent) 18%, white); border-radius: 9px; font-weight: 800; }
.project-card-copy { min-width: 0; flex: 1; }
.project-card-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.project-card h3 { margin: 2px 0 0; font-size: 18px; letter-spacing: -.02em; }
.project-card-top span { color: var(--soft); font: 600 11px/1 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: nowrap; }
.project-card p { min-height: 48px; margin: 12px 0 18px; color: var(--muted); font-size: 13px; }
.project-card b { color: var(--violet); font-size: 12px; }

.project-page { max-width: 980px; margin: auto; padding: 62px 32px 100px; }
.project-hero { padding: 18px 0 54px; border-bottom: 1px solid var(--line); }
.breadcrumb { display: flex; align-items: center; gap: 8px; min-width: 0; margin-bottom: 34px; color: var(--soft); font-size: 12px; white-space: nowrap; overflow: hidden; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span:last-child { overflow: hidden; text-overflow: ellipsis; }
.project-hero h1 { margin: 0; font-size: clamp(38px, 7vw, 62px); line-height: 1.08; letter-spacing: -.055em; }
.project-hero > p { max-width: 640px; margin: 19px 0 0; color: var(--muted); font-size: 16px; }
.chapter-section { padding-top: 44px; }
.section-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 42px; }
.section-card { position: relative; padding: 20px 44px 20px 20px; border: 1px solid var(--line); border-radius: 8px; }
.section-card:hover { border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); }
.section-card > div { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.section-card h2 { margin: 0; font-size: 16px; }
.section-card span { color: var(--soft); font: 600 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: nowrap; }
.section-card p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.section-card i { position: absolute; top: 50%; right: 18px; color: var(--soft); font-style: normal; transform: translateY(-50%); }
.section-card:hover i { color: var(--accent); }
.chapter-list { border-top: 1px solid var(--line); }
.chapter-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) 26px; gap: 18px; align-items: start; padding: 24px 8px; border-bottom: 1px solid var(--line); }
.chapter-row:hover h2, .chapter-row:hover > i { color: var(--accent); }
.chapter-number { padding-top: 4px; color: var(--soft); font: 500 12px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.chapter-meta { display: flex; gap: 8px; margin-bottom: 6px; }
.chapter-meta span { color: var(--accent); font: 600 10px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; }
.chapter-meta span + span { color: var(--soft); }
.chapter-row h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; transition: color .18s ease; }
.chapter-row p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.chapter-row > i { align-self: center; font-style: normal; transition: color .18s ease, transform .18s ease; }
.chapter-row:hover > i { transform: translateX(3px); }
.pagination { padding: 28px 0; }
.pagination ol { display: flex; gap: 5px; padding: 0; list-style: none; }
.pagination a, .pagination span { display: grid; min-width: 34px; height: 34px; padding: 0 8px; place-items: center; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
.pagination .current { color: #fff; background: var(--accent); border-color: var(--accent); }

.docs-shell { display: grid; grid-template-columns: 260px minmax(0, 1fr) 220px; max-width: 1440px; min-height: calc(100vh - var(--header-height)); margin: auto; }
.docs-sidebar { position: sticky; top: var(--header-height); height: calc(100vh - var(--header-height)); padding: 34px 24px 50px 32px; overflow-y: auto; border-right: 1px solid var(--line); }
.sidebar-project > a { color: var(--soft); font-size: 11px; font-weight: 600; }
.sidebar-project > a:hover { color: var(--accent); }
.sidebar-project h2 { margin: 16px 0 7px; font-size: 17px; letter-spacing: -.025em; }
.sidebar-project p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.chapter-nav { margin-top: 32px; }
.chapter-nav > span, .toc-card > span { display: block; margin-bottom: 10px; color: var(--soft); font: 700 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .12em; text-transform: uppercase; }
.docs-tree, .docs-tree ul { margin: 0; padding: 0; list-style: none; }
.docs-tree ul { margin: 3px 0 7px 10px; padding-left: 9px; border-left: 1px solid var(--line); }
.tree-section-link { display: block; margin: 2px 0; padding: 7px 9px; color: #465168; border-radius: 5px; font-size: 11px; font-weight: 700; }
.tree-section-link:hover, .tree-section-link.is-section-current { color: var(--violet); background: var(--lavender); }
.tree-article { display: block; padding: 6px 8px; color: var(--muted); border-radius: 5px; font-size: 11px; line-height: 1.35; }
.tree-article:hover { color: var(--ink); background: var(--panel); }
.tree-article.is-current { color: var(--violet); font-weight: 650; }
.doc-main { min-width: 0; }
.doc-article { max-width: var(--content); margin: 0 auto; padding: 52px 32px 100px; }
.doc-header { padding-bottom: 38px; border-bottom: 1px solid var(--line); }
.doc-header .breadcrumb { margin-bottom: 30px; }
.doc-kicker { display: flex; gap: 8px; margin-bottom: 13px; }
.doc-kicker span { padding: 3px 7px; color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, white); border: 1px solid color-mix(in srgb, var(--accent) 15%, white); border-radius: 4px; font: 650 9px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; }
.doc-header h1 { margin: 0; font-size: clamp(32px, 5vw, 46px); line-height: 1.15; letter-spacing: -.045em; }
.doc-lead { margin: 17px 0 0; color: var(--muted); font-size: 17px; }
.doc-updated { margin-top: 22px; color: var(--soft); font-size: 11px; }
.doc-content { padding-top: 32px; color: #354057; font-size: 15px; }
.doc-content > :first-child { margin-top: 0; }
.doc-content h2, .doc-content h3, .doc-content h4 { color: var(--ink); line-height: 1.35; letter-spacing: -.025em; }
.doc-content h2 { margin: 48px 0 16px; padding-top: 4px; font-size: 25px; }
.doc-content h3 { margin: 32px 0 12px; font-size: 19px; }
.doc-content h4 { margin: 25px 0 10px; font-size: 16px; }
.doc-content p, .doc-content ul, .doc-content ol { margin: 0 0 18px; }
.doc-content ul, .doc-content ol { padding-left: 23px; }
.doc-content li { margin: 6px 0; }
.doc-content a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px; }
.doc-content img { display: block; max-width: 100%; height: auto; margin: 26px auto; border: 1px solid var(--line); border-radius: 8px; }
.doc-content blockquote { margin: 24px 0; padding: 13px 18px; color: #526078; background: var(--panel); border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0; }
.doc-content blockquote p:last-child { margin-bottom: 0; }
.doc-content code { padding: 2px 5px; color: #7446c8; background: var(--lavender); border-radius: 4px; font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; }
.doc-content pre { position: relative; margin: 25px 0; padding: 19px 20px; overflow: auto; color: #d7deea; background: var(--code); border-radius: 8px; box-shadow: inset 0 1px rgba(255,255,255,.07); }
.doc-content pre code { padding: 0; color: inherit; background: none; font-size: 12px; }
.copy-code { position: absolute; top: 9px; right: 9px; padding: 4px 8px; color: #9ca7b8; background: #202b3d; border: 1px solid #344055; border-radius: 4px; font: 10px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; cursor: pointer; }
.doc-content table { width: 100%; margin: 24px 0; border-collapse: collapse; font-size: 13px; }
.doc-content th, .doc-content td { padding: 10px 12px; border: 1px solid var(--line); text-align: left; }
.doc-content th { color: var(--ink); background: var(--panel); }
.doc-pagination { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--line); }
.doc-pagination > div { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 7px; }
.doc-pagination > div:last-child { text-align: right; }
.doc-pagination span { display: block; margin-bottom: 4px; color: var(--soft); font-size: 9px; text-transform: uppercase; }
.doc-pagination a { color: var(--ink); font-size: 12px; font-weight: 650; }
.doc-pagination a:hover { color: var(--accent); }
.doc-pagination em { color: var(--soft); font-size: 11px; font-style: normal; }
.toc-sidebar { position: sticky; top: var(--header-height); height: calc(100vh - var(--header-height)); padding: 42px 30px 40px 20px; }
.toc-card nav a { display: block; padding: 5px 0 5px 10px; color: var(--muted); border-left: 1px solid var(--line); font-size: 11px; line-height: 1.45; }
.toc-card nav a:hover { color: var(--accent); border-color: var(--accent); }
.toc-card nav a.toc-sub { padding-left: 20px; }
.mobile-overlay { display: none; }

.profile-page { max-width: 800px; min-height: calc(100vh - 140px); margin: auto; padding: 64px 32px 110px; }
.profile-heading { display: flex; align-items: center; gap: 26px; padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.profile-heading .eyebrow { margin-bottom: 9px; }
.profile-heading h1 { margin: 0; font-size: clamp(38px, 7vw, 58px); line-height: 1.1; letter-spacing: -.05em; }
.profile-avatar { flex: 0 0 112px; width: 112px; height: 112px; padding: 4px; background: linear-gradient(145deg, #dce9ff, var(--lavender-line)); border-radius: 26px; box-shadow: 0 16px 34px rgba(93, 68, 151, .12); }
.profile-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; border: 3px solid #fff; border-radius: 22px; }
.profile-article .doc-content { padding-top: 30px; }
.not-found { min-height: calc(100vh - 130px); padding: 120px 24px; text-align: center; }
.not-found > span { color: var(--accent); font: 800 72px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.not-found h1 { margin: 20px 0 8px; }
.not-found p { margin: 0 0 25px; color: var(--muted); }
.empty-state { grid-column: 1 / -1; padding: 46px; color: var(--muted); background: var(--panel); border: 1px dashed #d9dde6; border-radius: 9px; text-align: center; }
.empty-state > span { color: var(--accent); font: 700 11px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.empty-state h3 { margin: 10px 0 4px; color: var(--ink); }
.empty-state p { margin: 0; font-size: 13px; }
.docs-hub-page { max-width: 980px; min-height: calc(100vh - 130px); margin: auto; padding: 70px 32px 110px; }
.docs-hub-hero { max-width: 660px; padding-bottom: 44px; }
.docs-hub-hero h1 { margin: 0; font-size: clamp(40px, 7vw, 64px); line-height: 1.06; letter-spacing: -.055em; }
.docs-hub-hero p { margin: 18px 0 0; color: var(--muted); font-size: 16px; }
.docs-hub { border-top: 1px solid var(--line); }
.hub-tree, .hub-tree ul { margin: 0; padding: 0; list-style: none; }
.hub-tree > .hub-node { border-bottom: 1px solid var(--line); }
.hub-node details > summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 19px 2px; cursor: pointer; list-style: none; }
.hub-node details > summary::-webkit-details-marker { display: none; }
.hub-node details > summary::before { content: "+"; width: 18px; color: var(--violet); font: 500 17px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.hub-node details[open] > summary::before { content: "−"; }
.hub-node details > summary span { flex: 1; font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.hub-node details > summary small, .hub-empty small { color: var(--soft); font: 600 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.hub-node details > ul { margin: 0 0 17px 20px; padding-left: 17px; border-left: 1px solid var(--line); }
.hub-node.depth-1 details > summary span, .hub-node.depth-2 details > summary span { font-size: 13px; }
.hub-node.depth-1 details > summary, .hub-node.depth-2 details > summary { padding: 11px 2px; }
.hub-article a, .hub-empty { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 9px 11px; color: var(--muted); border-radius: 5px; font-size: 12px; }
.hub-article a:hover, .hub-empty:hover { color: var(--accent); background: var(--panel); }
.hub-article small { color: var(--soft); font: 600 8px/1 ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; }
.site-footer { border-top: 1px solid var(--line); }
.site-footer > div { display: flex; max-width: 1120px; margin: auto; padding: 24px 32px; justify-content: space-between; gap: 20px; color: var(--soft); font-size: 10px; }

@media (max-width: 1120px) {
    .docs-shell { grid-template-columns: 230px minmax(0, 1fr); }
    .toc-sidebar { display: none; }
}
@media (max-width: 760px) {
    :root { --header-height: 58px; }
    .header-inner { padding: 0 18px; }
    .top-nav { margin-left: auto; }
    .top-nav .nav-projects { display: none; }
    .top-nav a { padding: 5px 8px; font-size: 12px; }
    .menu-toggle { display: block; }
    .home-hero { min-height: 330px; padding: 82px 22px 58px; }
    .home-hero p { font-size: 15px; }
    .projects-section, .project-page { padding-right: 20px; padding-left: 20px; }
    .section-heading { display: block; }
    .section-heading > p { margin-top: 12px; }
    .project-grid { grid-template-columns: 1fr; }
    .section-grid { grid-template-columns: 1fr; }
    .project-card { min-height: 0; padding: 20px; }
    .project-card p { min-height: 0; }
    .project-hero { padding-top: 6px; }
    .chapter-row { grid-template-columns: 28px minmax(0, 1fr) 18px; gap: 10px; padding: 20px 0; }
    .docs-shell { display: block; }
    .docs-sidebar { position: fixed; z-index: 60; top: var(--header-height); bottom: 0; left: 0; width: min(310px, 86vw); height: auto; padding: 28px 22px; background: #fff; transform: translateX(-102%); transition: transform .2s ease; }
    .menu-open .docs-sidebar { transform: translateX(0); }
    .mobile-overlay { position: fixed; z-index: 55; inset: var(--header-height) 0 0; display: block; visibility: hidden; opacity: 0; background: rgba(17, 24, 39, .32); transition: opacity .2s ease, visibility .2s ease; }
    .menu-open .mobile-overlay { visibility: visible; opacity: 1; }
    .menu-open { overflow: hidden; }
    .doc-article { padding: 38px 20px 76px; }
    .doc-header h1 { font-size: 34px; }
    .doc-lead { font-size: 15px; }
    .doc-content { font-size: 14px; }
    .doc-content h2 { margin-top: 40px; font-size: 22px; }
    .doc-content pre { margin-right: -20px; margin-left: -20px; border-radius: 0; }
    .doc-content table { display: block; overflow-x: auto; }
    .doc-pagination { grid-template-columns: 1fr; }
    .doc-pagination > div:last-child { text-align: left; }
    .profile-page { padding: 42px 20px 80px; }
    .profile-heading { align-items: flex-start; gap: 18px; }
    .profile-avatar { flex-basis: 78px; width: 78px; height: 78px; padding: 3px; border-radius: 20px; }
    .profile-avatar img { border-width: 2px; border-radius: 17px; }
    .docs-hub-page { padding: 48px 20px 80px; }
    .site-footer > div { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; }
}
