/* ==========================================================================
   酷夫子 CoolTeacher · 前台样式
   PRD 6.4 兼容性：Chrome / Edge / Firefox / Safari 最新两个大版本，PC/平板/手机自适应
   ========================================================================== */

:root {
    --brand: #2563eb;
    --brand-dark: #1d4ed8;
    --brand-soft: #eff4ff;
    --ink: #0f172a;
    --ink-soft: #334155;
    --muted: #64748b;
    --bg: #f7f8fb;
    --surface: #ffffff;
    --border: #e5e8ef;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow-md: 0 6px 24px rgba(15, 23, 42, .08);
    --shadow-lg: 0 18px 48px rgba(15, 23, 42, .12);
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", -apple-system,
        BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    color: var(--brand-dark);
}

/* ── 顶部导航 ───────────────────────────────────────────── */
.site-header {
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 1030;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand), #60a5fa);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
}

.brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    object-fit: cover;
}

.brand-text {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--ink);
    letter-spacing: .01em;
}

.navbar .nav-link {
    color: var(--ink-soft);
    font-size: .95rem;
    padding: .5rem .85rem;
    border-radius: 8px;
    transition: background .18s ease, color .18s ease;
}

.navbar .nav-link:hover {
    background: var(--brand-soft);
    color: var(--brand-dark);
}

.navbar .nav-link.active {
    color: var(--brand);
    font-weight: 600;
    background: var(--brand-soft);
}

.navbar-toggler {
    border-color: var(--border);
}

/* ── 页脚 ──────────────────────────────────────────────── */
.site-footer {
    background: #0f172a;
    color: #cbd5e1;
    border-top: 1px solid #1e293b;
}

.site-footer .fw-semibold {
    color: #fff;
}

.site-footer .text-muted,
.site-footer .text-muted.small {
    color: #94a3b8 !important;
}

.footer-link {
    color: #cbd5e1;
    font-size: .9rem;
}

.footer-link:hover {
    color: #fff;
}

/* 备案号：工信部备案系统链接 */
.icp-link {
    color: #94a3b8;
    font-size: .85rem;
    transition: color .15s ease;
}

.icp-link:hover {
    color: #fff;
}

/* ── 通用区块 ───────────────────────────────────────────── */
.page-hero {
    background: linear-gradient(150deg, #eef3ff 0%, #f8fafc 55%, #eef7ff 100%);
    border-bottom: 1px solid var(--border);
    padding: 3rem 0 2.5rem;
}

.page-hero h1 {
    font-size: clamp(1.6rem, 1.1rem + 2vw, 2.35rem);
    font-weight: 700;
    letter-spacing: -.01em;
}

.page-hero .lead {
    color: var(--ink-soft);
    max-width: 46rem;
}

.section {
    padding: 3rem 0;
}

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.section-head h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
}

.section-head .section-sub {
    color: var(--muted);
    font-size: .92rem;
    margin: .25rem 0 0;
}

.section-more {
    font-size: .92rem;
    white-space: nowrap;
}

.card-surface {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

/* ── 首页 Hero ─────────────────────────────────────────── */
.hero {
    background: linear-gradient(150deg, #eef3ff 0%, #f8fafc 50%, #eaf4ff 100%);
    border-bottom: 1px solid var(--border);
    padding: 4rem 0 3.5rem;
}

.hero-avatar {
    width: 128px;
    height: 128px;
    border-radius: 32px;
    object-fit: cover;
    border: 4px solid #fff;
    box-shadow: var(--shadow-md);
}

.hero-avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 128px;
    height: 128px;
    border-radius: 32px;
    background: linear-gradient(135deg, var(--brand), #60a5fa);
    color: #fff;
    font-size: 3rem;
    font-weight: 700;
    box-shadow: var(--shadow-md);
}

.hero h1 {
    font-size: clamp(1.75rem, 1.1rem + 2.4vw, 2.6rem);
    font-weight: 700;
    letter-spacing: -.02em;
}

.hero .hero-sub {
    color: var(--ink-soft);
    font-size: 1.05rem;
    max-width: 42rem;
}

.hero-actions .btn {
    border-radius: 10px;
    padding: .6rem 1.25rem;
    font-weight: 500;
}

.stat-chip {
    display: inline-flex;
    align-items: baseline;
    gap: .4rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: .35rem .9rem;
    font-size: .85rem;
    color: var(--ink-soft);
    box-shadow: var(--shadow-sm);
}

.stat-chip strong {
    color: var(--brand);
    font-size: 1rem;
}

/* ── 时间轴（成长经历） ──────────────────────────────────── */
.timeline {
    position: relative;
    padding-left: 1.75rem;
}

.timeline::before {
    content: "";
    position: absolute;
    left: .45rem;
    top: .6rem;
    bottom: .6rem;
    width: 2px;
    background: linear-gradient(180deg, var(--brand), #dbeafe);
    border-radius: 2px;
}

.timeline-year {
    position: relative;
    margin: 2.25rem 0 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand-dark);
}

.timeline-year::before {
    content: "";
    position: absolute;
    left: -1.75rem;
    top: .45rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-soft);
}

.timeline-item {
    position: relative;
    margin-bottom: 1rem;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -1.6rem;
    top: 1.5rem;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--brand);
}

.timeline-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.timeline-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: #c7d7fe;
}

.timeline-date {
    font-size: .82rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.timeline-title {
    font-size: 1.08rem;
    font-weight: 600;
    color: var(--ink);
    margin: .15rem 0 .4rem;
    display: block;
}

.timeline-title:hover {
    color: var(--brand);
}

.timeline-summary {
    color: var(--ink-soft);
    font-size: .93rem;
    margin-bottom: .5rem;
}

/* ── 卡片墙（关注技术 / 在线工具） ────────────────────────── */
.tech-grid,
.tool-grid,
.work-grid {
    display: grid;
    gap: 1.1rem;
}

.tech-grid,
.tool-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
}

.work-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}

.tech-card,
.tool-card,
.work-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    height: 100%;
}

.tech-card:hover,
.tool-card:hover,
.work-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: #c7d7fe;
}

.tech-card-body,
.tool-card-body {
    padding: 1.15rem 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--brand-soft);
    font-size: 1.35rem;
    margin-bottom: .75rem;
}

.tech-name,
.tool-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: .35rem;
    display: block;
}

.tech-name:hover,
.tool-name:hover {
    color: var(--brand);
}

.card-desc {
    color: var(--ink-soft);
    font-size: .92rem;
    flex: 1;
    margin-bottom: .75rem;
}

.proficiency {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-size: .82rem;
    color: var(--muted);
}

.proficiency-bar {
    flex: 1;
    height: 6px;
    background: #eef2f7;
    border-radius: 999px;
    overflow: hidden;
}

.proficiency-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--brand), #60a5fa);
    border-radius: 999px;
}

.work-cover {
    aspect-ratio: 16 / 9;
    width: 100%;
    object-fit: cover;
    background: #eef2f7;
}

.work-cover-placeholder {
    aspect-ratio: 16 / 9;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef3ff, #e6f0ff);
    color: #93b4f7;
    font-size: 2.25rem;
}

.work-card-body {
    padding: 1.1rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.work-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    font-size: .8rem;
    color: var(--muted);
    margin-top: auto;
    padding-top: .75rem;
}

/* ── 徽章 / 标签 ────────────────────────────────────────── */
.chip {
    display: inline-block;
    padding: .18rem .6rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: var(--ink-soft);
    font-size: .78rem;
    line-height: 1.5;
    border: 1px solid transparent;
}

.chip-brand {
    background: var(--brand-soft);
    color: var(--brand-dark);
}

.chip-outline {
    background: #fff;
    border-color: var(--border);
}

.chip-dot::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    margin-right: .35rem;
    vertical-align: middle;
}

.status-developing {
    background: #fff7ed;
    color: #c2410c;
}

.status-released {
    background: #ecfdf5;
    color: #047857;
}

.status-discontinued {
    background: #f1f5f9;
    color: #475569;
}

/* ── 筛选条 ────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    padding: .9rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.filter-bar .filter-label {
    font-size: .85rem;
    color: var(--muted);
    margin-right: .25rem;
}

.filter-link {
    padding: .22rem .7rem;
    border-radius: 999px;
    font-size: .84rem;
    color: var(--ink-soft);
    border: 1px solid var(--border);
    background: #fff;
}

.filter-link:hover {
    border-color: #c7d7fe;
    color: var(--brand-dark);
}

.filter-link.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

/* ── 详情页正文（Markdown 渲染结果） ─────────────────────── */
.prose {
    font-size: 1.02rem;
    color: var(--ink-soft);
    word-wrap: break-word;
    overflow-wrap: break-word;
    /* 防止内部宽元素（代码块、表格）把页面撑出横向滚动条 */
    max-width: 100%;
    min-width: 0;
}

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

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
    color: var(--ink);
    font-weight: 700;
    margin: 2rem 0 .9rem;
    line-height: 1.4;
}

.prose h2 {
    font-size: 1.35rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--border);
}

.prose h3 {
    font-size: 1.15rem;
}

.prose p {
    margin-bottom: 1.1rem;
}

.prose ul,
.prose ol {
    margin-bottom: 1.1rem;
    padding-left: 1.5rem;
}

.prose li {
    margin-bottom: .4rem;
}

.prose blockquote {
    border-left: 3px solid var(--brand);
    background: var(--brand-soft);
    margin: 1.25rem 0;
    padding: .85rem 1.1rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--ink-soft);
}

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

.prose code {
    background: #f1f5f9;
    color: #be185d;
    padding: .15rem .4rem;
    border-radius: 6px;
    font-size: .9em;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.prose pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 1rem 1.15rem;
    border-radius: var(--radius-sm);
    /* 只在代码块内部横向滚动，且不超出正文列宽 */
    overflow-x: auto;
    max-width: 100%;
    margin-bottom: 1.25rem;
    font-size: .88rem;
    line-height: 1.7;
    tab-size: 4;
    /* 细滚动条：默认滚动条压在深色块上非常突兀 */
    scrollbar-width: thin;
    scrollbar-color: #475569 #1e293b;
}

.prose pre::-webkit-scrollbar {
    height: 8px;
}

.prose pre::-webkit-scrollbar-track {
    background: #1e293b;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.prose pre::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

.prose pre::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.prose pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.prose img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: .5rem 0;
}

/* 宽表格改为块级 + 内部横向滚动，避免撑破页面（Markdown 表格在手机上尤其容易超宽） */
.prose table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    margin-bottom: 1.25rem;
    font-size: .93rem;
    scrollbar-width: thin;
}

.prose table::-webkit-scrollbar {
    height: 8px;
}

.prose table::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.prose th,
.prose td {
    border: 1px solid var(--border);
    padding: .55rem .75rem;
    text-align: left;
}

.prose th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--ink);
}

.prose hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

/* ── 详情页布局 ────────────────────────────────────────── */
.detail-title {
    font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem);
    font-weight: 700;
    letter-spacing: -.01em;
    word-break: break-word;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--muted);
    font-size: .88rem;
    margin-top: .75rem;
}

.detail-cover {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
    gap: .9rem;
}

.gallery figure {
    margin: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface);
}

.gallery img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
}

.gallery figcaption {
    padding: .5rem .7rem;
    font-size: .82rem;
    color: var(--muted);
}

.file-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.file-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .7rem 0;
    border-bottom: 1px dashed var(--border);
}

.file-list li:last-child {
    border-bottom: 0;
}

.sidebar-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.sidebar-card h3 {
    font-size: .95rem;
    font-weight: 700;
    margin-bottom: .85rem;
    color: var(--ink);
}

.detail-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.detail-nav a {
    max-width: 48%;
    font-size: .92rem;
}

/* ── 空状态 / 分页 ──────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 4rem 1.5rem;
    color: var(--muted);
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.empty-state .empty-icon {
    font-size: 2.5rem;
    margin-bottom: .75rem;
}

.pager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.pager a,
.pager span {
    min-width: 40px;
    padding: .4rem .75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--ink-soft);
    font-size: .9rem;
    text-align: center;
}

.pager .current {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.pager .disabled {
    opacity: .5;
    pointer-events: none;
}

/* ── 响应式 ────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .navbar-collapse {
        padding-top: .75rem;
    }

    .navbar .nav-link {
        padding: .6rem .75rem;
    }
}

@media (max-width: 767.98px) {
    .section {
        padding: 2rem 0;
    }

    .hero {
        padding: 2.5rem 0 2rem;
    }

    .hero-avatar,
    .hero-avatar-placeholder {
        width: 96px;
        height: 96px;
        border-radius: 24px;
        font-size: 2.25rem;
    }

    .section-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .detail-nav {
        flex-direction: column;
    }

    .detail-nav a {
        max-width: 100%;
    }
}
