:root {
    --primary: #2563eb;
    --bg: #ffffff;
    --text: #1f2328;
    --body: #3d3d3d;
    --muted: #6e7781;
    --line: #e8e8e6;
    --hover: #fafaf9;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
    font-size: 16px;
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection {
    background: var(--primary);
    color: #fff;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    width: min(720px, calc(100% - 48px));
    margin: 0 auto;
}

/* 顶部导航 */
.site-header {
    border-bottom: 1px solid var(--line);
    background: var(--bg);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    height: 66px;
}

.brand {
    font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", SimSun, Georgia, serif;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.nav {
    display: flex;
    align-items: center;
    gap: 22px;
    font-size: 13.5px;
    color: var(--muted);
}

.nav a {
    transition: color 0.2s ease;
}

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

.nav-admin {
    color: var(--primary);
}

/* 首屏 */
.hero {
    padding: 84px 0 56px;
    border-bottom: 1px solid var(--line);
}

.avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 22px;
}

.hero h1 {
    margin: 0;
    font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", SimSun, Georgia, serif;
    font-size: clamp(30px, 4.6vw, 40px);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: 0.01em;
}

.hero-subtitle {
    margin: 14px 0 0;
    font-size: 14.5px;
    color: var(--muted);
    letter-spacing: 0.02em;
}

.hero-text {
    margin: 20px 0 0;
    max-width: 560px;
    font-size: 15.5px;
    line-height: 1.95;
    color: var(--body);
}

.hero-links {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 26px;
}

.text-link {
    font-size: 14px;
    color: var(--primary);
    transition: opacity 0.2s ease;
}

.text-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* 区块 */
.section {
    padding: 44px 0;
    border-bottom: 1px solid var(--line);
    scroll-margin-top: 24px;
}

.section:last-child {
    border-bottom: none;
}

.section-head {
    margin-bottom: 18px;
}

.section h2 {
    margin: 0;
    font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", SimSun, Georgia, serif;
    font-size: 21px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.section-subtitle {
    margin: 8px 0 0;
    font-size: 13.5px;
    color: var(--muted);
}

.prose {
    font-size: 15.5px;
    line-height: 1.95;
    color: var(--body);
}

.prose-tight {
    margin-bottom: 20px;
    font-size: 14.5px;
    color: var(--muted);
}

/* 项目列表 */
.project-list {
    display: grid;
    gap: 10px;
}

.project-row {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg);
    transition: background 0.22s ease, border-color 0.22s ease,
        box-shadow 0.22s ease, transform 0.22s ease;
}

.project-row::after {
    content: '';
    position: absolute;
    left: 0;
    top: 16px;
    bottom: 16px;
    width: 3px;
    border-radius: 999px;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.22s ease;
}

.project-row:hover {
    background: #f7f9fc;
    border-color: #d9e1ec;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.project-row:hover::after {
    opacity: 1;
}

/* 有演示图：左侧缩略图 + 信息 + 右侧操作 */
.project-row.has-thumb {
    display: grid;
    grid-template-columns: 128px minmax(0, 1fr) auto;
    grid-template-areas: "thumb info actions";
    align-items: center;
    gap: 18px;
}

.project-row.has-thumb .project-thumb {
    grid-area: thumb;
}

.project-row.has-thumb .project-info {
    grid-area: info;
}

.project-row.has-thumb .project-actions {
    grid-area: actions;
    justify-self: end;
}

.project-thumb {
    position: relative;
    display: block;
    width: 128px;
    aspect-ratio: 16 / 10;
    padding: 0;
    border: 0;
    border-radius: 9px;
    overflow: hidden;
    background: linear-gradient(135deg, #eef2f7, #e3e9f1);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
    font: inherit;
    color: inherit;
    cursor: zoom-in;
    -webkit-appearance: none;
    appearance: none;
}

.project-thumb-blur {
    position: absolute;
    inset: -12px;
    z-index: 0;
    background-size: cover;
    background-position: center;
    filter: blur(16px);
    transform: scale(1.08);
    opacity: 0.55;
    pointer-events: none;
}

.project-thumb img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: block;
    padding: 4px;
    object-fit: contain;
    object-position: center;
    opacity: 0;
    transition: opacity 0.24s ease, transform 0.3s ease;
}

.project-thumb img.is-loaded {
    opacity: 1;
}

.project-row:hover .project-thumb img.is-loaded {
    transform: scale(1.03);
}

.project-thumb::after {
    content: "查看演示";
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.46);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.project-thumb:hover::after,
.project-thumb:focus-visible::after {
    opacity: 1;
}

.project-thumb:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.project-thumb-count {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 3;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.62);
    color: #fff;
    font-size: 11px;
    line-height: 1.7;
    pointer-events: none;
}

.project-thumb.is-broken {
    display: none;
}

.project-info {
    display: block;
    min-width: 0;
}

.project-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.project-name {
    font-size: 15.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: color 0.2s ease;
}

.project-row:hover .project-name {
    color: var(--primary);
}

.project-category {
    font-size: 11.5px;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 1px 9px;
    line-height: 1.7;
}

.project-desc {
    display: block;
    margin-top: 4px;
    font-size: 13.5px;
    line-height: 1.75;
    color: var(--muted);
}

.project-more {
    display: inline;
    margin-left: 6px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--primary);
    font: inherit;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.project-more:hover,
.project-more:focus-visible {
    text-decoration-thickness: 2px;
    outline: none;
}

.project-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    font-size: 13px;
    color: var(--muted);
    transition: color 0.2s ease;
}

.project-arrow {
    display: inline-block;
    transition: transform 0.2s ease;
}

.project-row:hover .project-action {
    color: var(--primary);
}

.project-row:hover .project-arrow {
    transform: translateX(3px);
}

.project-actions {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    flex: none;
}

.project-demo {
    display: inline-flex;
    align-items: center;
    padding: 5px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    line-height: 1.6;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.project-demo:hover,
.project-demo:focus-visible {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--hover);
    outline: none;
}

/* 联系方式 */
.link-list {
    border-top: 1px solid var(--line);
}

.link-row {
    display: flex;
    align-items: baseline;
    gap: 16px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--line);
    transition: background 0.2s ease;
}

.link-row:hover {
    background: var(--hover);
}

.link-name {
    font-size: 15px;
    font-weight: 600;
    flex: none;
    min-width: 72px;
}

.link-host {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-row:hover .project-arrow {
    transform: translateX(3px);
}

/* 页脚 */
.site-footer {
    padding: 36px 0 44px;
    border-top: 1px solid var(--line);
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.8;
}

.filings {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 18px;
}

.filings a,
.filings span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.filings a:hover {
    color: var(--primary);
}

.police img {
    width: 14px;
    height: 14px;
    opacity: 0.75;
}

.copyright {
    margin: 0;
}

/* 空状态 */
.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 24px 0;
}

.empty-state h1 {
    margin: 0 0 8px;
    color: var(--text);
    font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", SimSun, Georgia, serif;
    font-size: 22px;
}

.empty-state p {
    margin: 0 0 16px;
    font-size: 14px;
}

.empty-hint {
    color: var(--muted);
    font-size: 13.5px;
    padding: 16px 4px;
}

.error-code {
    margin: 0;
    font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", SimSun, Georgia, serif;
    font-size: 56px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

/* 项目演示弹窗 */
.gallery-open {
    overflow: hidden;
}

.gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

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

.gallery-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 15, 20, 0.84);
    backdrop-filter: blur(6px);
    animation: gallery-fade 0.2s ease both;
}

.gallery-panel {
    position: relative;
    width: min(960px, 100%);
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #fff;
}

.gallery-head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.gallery-title {
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.gallery-close {
    width: 36px;
    height: 36px;
    flex: none;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease;
}

.gallery-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.gallery-stage {
    position: relative;
    width: 100%;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-image {
    max-width: 100%;
    max-height: 72vh;
    width: auto;
    height: auto;
    border-radius: 12px;
    background: #0f1217;
    object-fit: contain;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.25s ease;
    -webkit-user-select: none;
    user-select: none;
}

.gallery-image.is-loaded {
    opacity: 1;
}

.gallery-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.65);
    pointer-events: none;
}

.gallery-loading[hidden] {
    display: none;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    width: 44px;
    height: 44px;
    transform: translateY(-50%);
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.gallery-nav:hover {
    background: rgba(255, 255, 255, 0.24);
}

.gallery-nav[hidden] {
    display: none;
}

.gallery-prev {
    left: -6px;
}

.gallery-next {
    right: -6px;
}

.gallery-caption {
    max-width: 64ch;
    margin: 0;
    font-size: 13.5px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.78);
    text-align: center;
}

.gallery-caption:empty {
    display: none;
}

.gallery-footer {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
}

/* 项目详情弹窗 */
.detail-panel {
    position: relative;
    z-index: 1;
    width: min(560px, 100%);
    max-height: min(80vh, 720px);
    overflow-y: auto;
    padding: 30px 32px;
    border-radius: 16px;
    background: var(--bg);
    color: var(--text);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
    animation: detail-rise 0.22s ease both;
}

.detail-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.detail-close:hover,
.detail-close:focus-visible {
    background: #e5e7eb;
    color: #111827;
    outline: none;
}

.detail-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding-right: 38px;
}

.detail-title {
    margin: 0;
    font-size: 19px;
    line-height: 1.5;
}

.detail-category {
    font-size: 11.5px;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 1px 9px;
    line-height: 1.7;
}

.detail-category[hidden] {
    display: none;
}

.detail-content {
    margin: 16px 0 0;
    font-size: 14.5px;
    line-height: 1.85;
    color: var(--body);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

@keyframes detail-rise {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

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

@media (max-width: 640px) {
    .container {
        width: calc(100% - 40px);
    }

    .header-inner {
        height: 58px;
    }

    .nav {
        gap: 14px;
        font-size: 13px;
    }

    .hero {
        padding: 48px 0 28px;
    }

    .section {
        padding: 30px 0;
    }

    .section-head {
        margin-bottom: 14px;
    }

    .project-row {
        gap: 12px;
        padding: 14px;
    }

    .project-row::after {
        top: 14px;
        bottom: 14px;
    }

    .project-desc {
        font-size: 13px;
    }

    .project-action {
        font-size: 12.5px;
    }

    .project-actions {
        gap: 10px;
    }

    .project-row.has-thumb {
        grid-template-columns: 96px minmax(0, 1fr);
        grid-template-areas:
            "thumb info"
            "thumb actions";
        align-items: start;
        column-gap: 12px;
        row-gap: 10px;
    }

    .project-row.has-thumb .project-thumb {
        width: 96px;
        height: 100%;
        min-height: 88px;
        align-self: stretch;
        aspect-ratio: auto;
    }

    .project-row.has-thumb .project-actions {
        justify-self: start;
    }

    .project-demo {
        padding: 4px 11px;
        font-size: 12.5px;
    }

    .gallery-modal {
        padding: 14px;
    }

    .detail-panel {
        max-height: 84vh;
        padding: 24px 20px;
    }

    .detail-title {
        font-size: 17px;
    }

    .gallery-image {
        max-height: 64vh;
    }

    .gallery-nav {
        width: 38px;
        height: 38px;
        font-size: 22px;
    }

    .gallery-prev {
        left: 2px;
    }

    .gallery-next {
        right: 2px;
    }

    .gallery-footer {
        font-size: 11.5px;
    }
}
