/* Kaiguap 小屋 - 暗色主题 */
:root {
    --bg: #0d0f14;
    --bg-soft: rgba(255,255,255,0.04);
    --bg-card: rgba(255,255,255,0.03);
    --text: #e8e8e8;
    --text-soft: #a0a0c0;
    --text-light: #666;
    --border: rgba(255,255,255,0.08);
    --accent: #ffd93d;
    --link: #4d9de0;
    --link-hover: #ffd93d;
    --code-bg: #1a1b26;
    --shadow: 0 2px 8px rgba(0,0,0,.3);
    --radius: 12px;
    --max-width: 1000px;
    --pink: #ff6b9d;
    --green: #6bcf7f;
    --purple: #c780fa;
    --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
                 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Source Code Pro",
                 Menlo, Consolas, "Liberation Mono", monospace;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

a { color: var(--link); text-decoration: none; transition: color .2s; }
a:hover { color: var(--link-hover); }

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

/* ===== Header ===== */
.site-header {
    position: sticky;
    top: 0;
    background: rgba(13,15,20,.88);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    overflow: visible;
}

.site-header-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 18px;
}

.brand {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    flex-shrink: 0;
    background: linear-gradient(90deg, #ff6b9d, #ffd93d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav {
    display: flex;
    gap: 2px;
    flex: 1;
    flex-wrap: nowrap;
    align-items: center;
    min-width: 0;
}

.nav a {
    padding: 5px 10px;
    border-radius: var(--radius);
    font-size: 13.5px;
    color: var(--text-soft);
    transition: all .15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav a:hover { background: var(--bg-soft); color: var(--text); }
.nav a.active { color: var(--accent); background: var(--bg-soft); }

/* ===== Nav dropdown (二次元 hover 下拉) ===== */
.nav-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.nav-dropdown > a {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.nav-dropdown > a .caret {
    font-size: 9px;
    transition: transform .15s;
    opacity: .55;
    display: inline-block;
}
.nav-dropdown:hover > a .caret,
.nav-dropdown:focus-within > a .caret { transform: rotate(180deg); }

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 200px;
    background: rgba(20,22,30,.95);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,.4);
    padding: 6px;
    display: none;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .12s ease, transform .12s ease;
    z-index: 110;
    pointer-events: none;
    backdrop-filter: blur(12px);
}

/* 用伪元素桥接 trigger 和 dropdown 之间的空隙,防止 hover 丢失 */
.nav-dropdown::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 8px;
}

.nav-dropdown:hover::after {
    /* 保持 hover 区域 */
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
    display: block;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* 小三角 */
.nav-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 24px;
    width: 8px;
    height: 8px;
    background: rgba(20,22,30,.95);
    border-left: 1px solid rgba(255,255,255,0.1);
    border-top: 1px solid rgba(255,255,255,0.1);
    transform: rotate(45deg);
}

.nav-dropdown-menu a {
    display: block;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13.5px;
    color: var(--text-soft);
    white-space: nowrap;
}
.nav-dropdown-menu a:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text);
}
.nav-dropdown-menu a .menu-icon {
    display: inline-block;
    margin-right: 8px;
    font-size: 14px;
}
.nav-dropdown-menu a .menu-desc {
    display: block;
    font-size: 11px;
    color: #666;
    margin-top: 2px;
    font-weight: normal;
}

/* 让二级菜单项有点层次 */
.nav-dropdown-menu .menu-item {
    display: flex;
    flex-direction: column;
}

.search {
    flex-shrink: 0;
}

.search input {
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.06);
    border-radius: 20px;
    padding: 5px 12px;
    font: inherit;
    font-size: 12.5px;
    width: 150px;
    outline: none;
    transition: all .2s;
    color: var(--text);
}

.search input:focus {
    border-color: var(--accent);
    background: rgba(255,255,255,0.1);
    width: 190px;
}

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

/* ===== Main ===== */
main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 32px 20px 60px;
}

.page-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-soft);
    margin-top: -20px;
    margin-bottom: 28px;
}

/* ===== Hub Card (分类总览页入口卡) ===== */
.hub-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 8px;
}

.hub-card {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    color: var(--text);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.hub-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,.3);
    border-color: rgba(255,255,255,0.15);
    color: var(--text);
}

.hub-card-icon {
    width: 100%;
    height: 140px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(255,107,157,0.1), rgba(255,217,61,0.1));
}

.hub-card-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hub-card-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.hub-card-body {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hub-card-title {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
    margin-bottom: 2px;
}

.hub-card-desc {
    font-size: 13.5px;
    color: var(--text-soft);
    line-height: 1.6;
    min-height: 2.6em;
}

.hub-card-arrow {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-soft);
    align-self: flex-start;
    transition: transform .2s ease, color .2s ease;
}

.hub-card:hover .hub-card-arrow {
    color: var(--text);
    transform: translateX(3px);
}

.hub-card--article .hub-card-arrow { color: var(--pink); }
.hub-card--schedule .hub-card-arrow { color: var(--link); }
.hub-card--article:hover .hub-card-arrow { color: var(--pink); }
.hub-card--schedule:hover .hub-card-arrow { color: var(--link); }

.hub-footnote {
    margin-top: 32px;
    font-size: 12.5px;
    color: var(--text-light);
    text-align: center;
}

@media (max-width: 600px) {
    .hub-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .hub-card-icon { height: 90px; }
}

/* ===== Anime poster (新番封面) ===== */
.poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px 6px 0 0;
    display: block;
}

/* ===== Post Card (首页文章列表) ===== */
.post-card {
    display: flex;
    gap: 20px;
    padding: 24px 20px;
    margin-bottom: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    transition: transform .2s, box-shadow .2s, border-color .2s;
}

.post-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    border-color: rgba(255,255,255,0.12);
}

.post-card:last-child { margin-bottom: 0; }

.post-card-cover {
    flex-shrink: 0;
    width: 160px;
    height: 100px;
    background: var(--bg-soft);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}

.post-card:hover .post-card-cover img {
    transform: scale(1.05);
}

.post-card-cover-fallback {
    font-size: 32px;
    color: var(--text-light);
}

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

.post-card-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
}

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

.post-card-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 8px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.post-card-meta .dot { color: var(--text-light); }

.post-card-meta a { color: var(--text-soft); }

.post-card-excerpt {
    font-size: 13px;
    color: var(--text-soft);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== 文章正文页 ===== */
.post {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 40px 20px 60px;
}

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

.post-title {
    font-size: 26px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 12px;
    color: var(--text);
    background: linear-gradient(90deg, #ff6b9d, #ffd93d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.post-meta {
    font-size: 13px;
    color: var(--text-soft);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.post-meta .dot { color: var(--text-light); }
.post-meta a { color: var(--text-soft); }

.post-cover {
    width: 100%;
    max-height: 360px;
    object-fit: cover;
    border-radius: 16px;
    margin-bottom: 28px;
    background: var(--bg-soft);
}

.post-content {
    font-size: 15.5px;
    line-height: 1.85;
    color: #c0c0d0;
    word-wrap: break-word;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
    color: var(--text);
    margin: 1.6em 0 .8em;
    font-weight: 600;
    line-height: 1.4;
}

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

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

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

.post-content a {
    color: var(--link);
    border-bottom: 1px solid rgba(77,157,224,.3);
}
.post-content a:hover {
    border-bottom-color: var(--link);
}

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

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

.post-content blockquote {
    border-left: 3px solid var(--accent);
    background: rgba(255,217,61,0.06);
    padding: 12px 18px;
    margin: 1.2em 0;
    color: var(--text-soft);
    border-radius: 0 var(--radius) var(--radius) 0;
}

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

.post-content code {
    font-family: var(--font-mono);
    font-size: .9em;
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--pink);
}

.post-content pre {
    background: #1a1b26;
    color: #cdd6f4;
    padding: 16px 18px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 1.2em 0;
    font-size: 13px;
    line-height: 1.6;
    border: 1px solid var(--border);
}

.post-content pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
    border-radius: 0;
}

.post-content img {
    margin: 1.2em auto;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,.3);
}

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

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

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

.post-content th { background: var(--bg-soft); font-weight: 600; }

/* ===== Post footer / nav ===== */
.post-footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-soft);
}

.post-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 16px;
}

.post-nav-item {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: background .15s, border-color .15s;
}

.post-nav-item:hover { background: var(--bg-soft); border-color: rgba(255,255,255,0.12); }

.post-nav-label { font-size: 12px; color: var(--text-light); display: block; margin-bottom: 4px; }
.post-nav-item.next { text-align: right; }

/* ===== 分页 ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
    align-items: center;
    font-size: 14px;
}

.pagination a, .pagination span {
    padding: 6px 12px;
    border-radius: 12px;
    color: var(--text-soft);
}

.pagination a:hover { background: var(--bg-soft); color: var(--text); }
.pagination .current { background: var(--accent); color: #0d0f14; }
.pagination .disabled { color: var(--text-light); cursor: not-allowed; }

/* ===== 归档页 ===== */
.archive-group {
    margin-bottom: 32px;
}

.archive-year {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

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

.archive-item {
    display: flex;
    gap: 16px;
    padding: 10px 0;
    font-size: 14px;
    align-items: baseline;
    border-bottom: 1px dashed transparent;
}

.archive-item:hover { border-bottom-color: var(--border); }

.archive-date {
    color: var(--text-light);
    font-family: var(--font-mono);
    font-size: 12px;
    flex-shrink: 0;
    width: 90px;
}

.archive-item a { flex: 1; color: var(--text-soft); }
.archive-item a:hover { color: var(--accent); }

/* ===== Footer ===== */
.site-footer {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-light);
    font-size: 12px;
    border-top: 1px solid var(--border);
    margin-top: 60px;
}

.site-footer .heart { color: var(--pink); }
.site-footer a { color: var(--text-soft); }
.site-footer a:hover { color: var(--accent); }

/* ===== 404 / 搜索结果 ===== */
.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-soft);
}

.search-result { margin-bottom: 28px; }

.highlight { background: rgba(255,217,61,0.2); padding: 0 2px; border-radius: 2px; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .nav a { padding: 5px 8px; font-size: 13px; }
    .search input { width: 120px; }
    .search input:focus { width: 160px; }
}

@media (max-width: 700px) {
    .site-header-inner { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
    .nav { order: 3; flex-basis: 100%; justify-content: center; flex-wrap: wrap; overflow: visible; }
    .nav a { font-size: 13px; }
    .search input { width: 100%; max-width: 240px; }
    .search input:focus { width: 100%; max-width: 280px; }
}

@media (max-width: 600px) {
    .post-card { flex-direction: column; gap: 12px; padding: 16px; }
    .post-card-cover { width: 100%; height: 160px; }
    .post-card-title { font-size: 16px; }
    .post-title { font-size: 22px; }
    main { padding: 20px 14px 40px; }
    .post { padding: 24px 14px 40px; }
    .post-nav { flex-direction: column; }
    .archive-date { width: 70px; font-size: 11px; }
}