/* ===================================================================
   光影工场 · 主样式表 - site.css
=================================================================== */
:root {
    --primary:        #2563eb;
    --primary-light:  #3b82f6;
    --primary-dark:   #1d4ed8;
    --accent:         #7c3aed;
    --bg-body:        #f8fafc;
    --bg-card:        #ffffff;
    --bg-section:     #f1f5f9;
    --bg-canvas:      #f8f9fa;
    --text-main:      #1e293b;
    --text-muted:     #64748b;
    --text-link:      #2563eb;
    --border:         #e2e8f0;
    --navbar-bg:      #ffffff;
    --navbar-text:    #1e293b;
    --footer-bg:      #1e293b;
    --footer-text:    #94a3b8;
    --tag-bg:         #dbeafe;
    --tag-color:      #1d4ed8;
    --hero-bg:        linear-gradient(135deg, #1e40af 0%, #7c3aed 100%);
    --hero-text:      #ffffff;
    --code-bg:        #f1f5f9;
    --radius:         8px;
    --shadow:         0 2px 16px rgba(0,0,0,.08);
    --shadow-hover:   0 8px 32px rgba(37,99,235,.18);
}
*,*::before,*::after{box-sizing:border-box}
html{scroll-behavior:smooth}
body{background:var(--bg-body);color:var(--text-main);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Microsoft YaHei',sans-serif;font-size:15px;line-height:1.7;transition:background .3s,color .3s}
a{color:var(--text-link);text-decoration:none}
a:hover{color:var(--primary-dark)}

/* Ads */
.ad-placeholder{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;background:repeating-linear-gradient(45deg,#f0f0f0,#f0f0f0 5px,#e8e8e8 5px,#e8e8e8 10px);border:2px dashed #ccc;border-radius:var(--radius);color:#888;font-size:11px;cursor:pointer;gap:2px}
.ad-placeholder .ad-label{font-weight:700;font-size:13px;color:#555}
.ad-placeholder .ad-size{font-family:monospace;color:#999}
.ad-placeholder .ad-price{color:var(--primary);font-weight:600}
.ad-slot{overflow:hidden}
.mobile-sticky-ad{position:fixed;bottom:0;left:0;right:0;z-index:1050;background:var(--bg-card);border-top:1px solid var(--border);text-align:center;padding:4px}
.ad-close-btn{position:absolute;top:2px;right:8px;background:none;border:none;font-size:1.2rem;cursor:pointer;color:#666;line-height:1}

/* Navbar */
.site-navbar{background:var(--navbar-bg);border-bottom:1px solid var(--border);box-shadow:0 1px 8px rgba(0,0,0,.06);z-index:1000}
.site-navbar .navbar-nav .nav-link{color:var(--navbar-text)!important;font-weight:500;padding:.5rem .8rem;border-radius:6px;transition:background .15s}
.site-navbar .navbar-nav .nav-link:hover{background:var(--bg-section)}
.site-navbar .dropdown-menu{border:1px solid var(--border);box-shadow:var(--shadow);border-radius:var(--radius)}
.site-navbar .dropdown-item{color:var(--text-main)}
.site-navbar .dropdown-item:hover{background:var(--bg-section)}

/* Mega Menu - 两级分类菜单：一级垂直列表，悬停后右侧展开二三级网格 */
.cat-dropdown{position:relative}
.site-navbar .cat-menu{
    min-width:220px;
    padding:.4rem 0;
    border:1px solid var(--border);
    box-shadow:0 8px 20px rgba(0,0,0,.12);
    border-radius:var(--radius);
}
.cat-l1-item{position:relative}
.cat-l1-link{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:.5rem .9rem;
    font-size:.9rem;
    color:var(--text-main);
}
.cat-l1-link:hover,
.cat-l1-item:hover > .cat-l1-link{
    background:var(--bg-section);
    color:var(--primary);
}
.cat-arrow{
    font-size:.7rem;
    color:var(--text-muted);
    margin-left:.5rem;
}
.cat-l1-item:hover .cat-arrow{color:var(--primary)}

/* 二三级面板：紧贴一级列表右侧，与"在线课程"那行对齐 */
.cat-panel{
    display:none;
    position:absolute;
    top:0;
    left:100%;
    min-width:640px;
    max-width:780px;
    padding:1rem 1.25rem;
    background:var(--navbar-bg);
    border:1px solid var(--border);
    border-radius:var(--radius);
    box-shadow:0 12px 28px rgba(0,0,0,.15);
    z-index:1050;
}
.cat-l1-item:hover > .cat-panel,
.cat-l1-item:focus-within > .cat-panel{display:block}

.cat-panel-head{
    display:flex;
    align-items:baseline;
    gap:.6rem;
    padding-bottom:.6rem;
    margin-bottom:.7rem;
    border-bottom:1px solid var(--border);
}
.cat-panel-title{
    font-size:1rem;
    font-weight:700;
    color:var(--primary);
    text-decoration:none;
}
.cat-panel-title:hover{opacity:.85}
.cat-panel-sub{font-size:.75rem;color:var(--text-muted)}

.cat-panel-grid{
    display:grid;
    grid-template-columns:repeat(2, 1fr);
    gap:.7rem 1.25rem;
}
.cat-l2-block{min-width:0}
.cat-l2-title{
    display:block;
    font-weight:600;
    font-size:.85rem;
    color:var(--text-main);
    text-decoration:none;
    margin-bottom:.25rem;
    padding-bottom:.15rem;
    border-bottom:1px dashed var(--border);
}
.cat-l2-title:hover{color:var(--primary)}
.cat-l3-list{
    display:flex;
    flex-wrap:wrap;
    gap:.15rem .5rem;
}
.cat-l3-list a{
    font-size:.76rem;
    color:var(--text-muted);
    text-decoration:none;
    padding:1px 5px;
    border-radius:3px;
    transition:all .12s;
}
.cat-l3-list a:hover{
    color:#fff;
    background:var(--primary);
}

@media (max-width: 991.98px){
    .cat-panel{
        position:static;
        min-width:auto;
        max-width:none;
        box-shadow:none;
        border:none;
        padding:.5rem .75rem .5rem 1.5rem;
    }
    .cat-panel-grid{grid-template-columns:1fr}
    .cat-arrow{display:none}
}
.brand-icon{color:var(--primary);font-size:1.4rem;margin-right:4px}
.brand-name{font-size:1.2rem;font-weight:800;color:var(--text-main);letter-spacing:-.5px}

/* Breadcrumb */
.site-breadcrumb{background:var(--bg-section);border-bottom:1px solid var(--border)}
.breadcrumb-item a{color:var(--text-link)}
.breadcrumb-item.active{color:var(--text-muted)}

/* Hero */
.hero-section{background:var(--hero-bg);color:var(--hero-text);padding:3rem 0}
.hero-title{font-size:clamp(2rem,5vw,3.5rem);font-weight:900;line-height:1.15;margin-bottom:.75rem}
.hero-subtitle{font-size:1.1rem;opacity:.9;margin-bottom:1.5rem}
.hero-tags{display:flex;flex-wrap:wrap;gap:.5rem}
.tag-chip{display:inline-block;padding:.3rem .8rem;border-radius:20px;background:rgba(255,255,255,.15);color:white;font-size:.8rem;border:1px solid rgba(255,255,255,.3);transition:background .2s}
.tag-chip:hover{background:rgba(255,255,255,.3);color:white}
.knowledge-graph-demo{position:relative;display:flex;flex-wrap:wrap;gap:12px;justify-content:center;align-items:center;padding:2rem}
.kg-node{padding:.4rem .9rem;border-radius:20px;background:rgba(255,255,255,.15);color:white;border:1px solid rgba(255,255,255,.4);font-size:.85rem;animation:float 3s ease-in-out infinite}
.kg-node:nth-child(2n){animation-delay:1.5s}.kg-node:nth-child(3n){animation-delay:.8s}
@keyframes float{0%,100%{transform:translateY(0)}50%{transform:translateY(-6px)}}

/* Sections */
.section-block{padding:2rem 0}
.bg-section{background:var(--bg-section)}
.section-title{font-size:1.4rem;font-weight:700;color:var(--text-main);margin-bottom:1.25rem;display:flex;align-items:center;gap:.5rem}
.section-title::after{content:'';flex:1;height:2px;background:linear-gradient(90deg,var(--primary),transparent);margin-left:.5rem}
.more-link{font-size:.85rem;font-weight:400;color:var(--text-link);margin-left:auto}
.cat-section-title{font-size:1.15rem;font-weight:700;color:var(--text-main);margin-bottom:1rem;padding-bottom:.5rem;border-bottom:2px solid var(--primary);display:flex;justify-content:space-between;align-items:center}
.cat-tabs{display:flex;gap:.5rem;flex-wrap:wrap}
.cat-tab{padding:.35rem .85rem;border-radius:20px;font-size:.85rem;font-weight:500;background:var(--bg-card);border:1px solid var(--border);color:var(--text-main);transition:all .15s}
.cat-tab:hover,.cat-tab.active{background:var(--primary);border-color:var(--primary);color:white}

/* Category cards */
.category-card{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:1.25rem .75rem;border-radius:var(--radius);gap:.5rem;background:var(--bg-card);border:1px solid var(--border);transition:box-shadow .2s,transform .2s;min-height:90px}
.category-card:hover{box-shadow:var(--shadow-hover);transform:translateY(-2px)}
.cat-icon{font-size:2rem}.cat-name{font-size:.8rem;font-weight:600;color:var(--text-main);text-align:center}

/* Course cards */
.course-card{background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius);padding:1.25rem;display:flex;flex-direction:column;gap:.5rem;transition:box-shadow .2s,transform .2s;color:var(--text-main)}
.course-card:hover{box-shadow:var(--shadow-hover);transform:translateY(-2px)}
.course-cat-tag{font-size:.75rem;color:var(--primary);font-weight:600}
.course-title{font-size:1rem;font-weight:700;color:var(--text-main);line-height:1.4}
.course-subtitle-sm{font-size:.8rem}
.course-footer{padding-top:.5rem;border-top:1px solid var(--border)}
.level-badge{background:var(--tag-bg);color:var(--tag-color);font-size:.75rem;font-weight:600}
.course-card-mini{padding:.65rem .85rem;border-radius:6px;border:1px solid var(--border);background:var(--bg-card);margin-bottom:.5rem;transition:border-color .15s}
.course-card-mini:hover{border-color:var(--primary)}
.course-title-link{font-weight:600;color:var(--text-main);font-size:.9rem}
.course-title-link:hover{color:var(--primary)}
.course-meta{font-size:.75rem;margin-top:.2rem}

/* Article cards */
.article-card{background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius);padding:1rem;transition:box-shadow .2s}
.article-card:hover{box-shadow:var(--shadow-hover)}
.article-card-mini{padding:.6rem 0;border-bottom:1px solid var(--border)}
.article-card-mini:last-child{border-bottom:none}
.article-title-link{font-weight:600;color:var(--text-main);font-size:.92rem}
.article-title-link:hover{color:var(--primary)}

/* Tags */
.tag-sm{display:inline-block;padding:.15rem .55rem;border-radius:12px;background:var(--tag-bg);color:var(--tag-color);font-size:.75rem;font-weight:500;margin:2px;transition:background .15s}
.tag-sm:hover{background:var(--primary);color:white}
.tag-list,.tag-cloud{display:flex;flex-wrap:wrap;gap:4px}

/* Lab cards */
.lab-card{display:flex;flex-direction:column;align-items:flex-start;background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius);padding:1rem;transition:box-shadow .2s,transform .2s;color:var(--text-main);height:100%}
.lab-card:hover{box-shadow:var(--shadow-hover);transform:translateY(-2px)}
.lab-icon{font-size:1.75rem;color:var(--primary);margin-bottom:.35rem}
.lab-title{font-size:.9rem;font-weight:600;line-height:1.3;margin-bottom:.4rem}
.lab-type{font-size:.7rem;font-weight:600;padding:.15rem .5rem;border-radius:10px;display:inline-block;margin-top:auto}
.badge-interactive{background:#d1fae5;color:#065f46}
.badge-placeholder{background:#f3f4f6;color:#6b7280}
.placeholder-lab{opacity:.65}

/* Sidebar */
.sidebar-widget{background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius);padding:1rem}
.widget-title{font-size:.95rem;font-weight:700;color:var(--text-main);margin-bottom:.75rem;padding-bottom:.5rem;border-bottom:2px solid var(--primary)}
.sidebar-list{list-style:none;padding:0;margin:0}
.sidebar-list li{padding:.35rem 0;border-bottom:1px solid var(--border);font-size:.88rem}
.sidebar-list li:last-child{border-bottom:none}
.sidebar-list a{color:var(--text-main)}
.sidebar-list a:hover{color:var(--primary)}
.hot-list{padding-left:1.5rem;margin:0}
.hot-list li{padding:.25rem 0;font-size:.88rem}
.hot-list a{color:var(--text-main)}
.hot-list a:hover{color:var(--primary)}

/* Detail pages */
.card-block,.content-block{background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius);padding:1.5rem}
.block-title{font-size:1.15rem;font-weight:700;margin-bottom:1rem;color:var(--text-main)}
.course-page-title{font-size:clamp(1.4rem,3vw,2rem);font-weight:800;line-height:1.3}
.cat-badge{background:var(--primary);color:white;font-size:.8rem}
.sub-cat-badge{background:var(--accent);color:white;font-size:.8rem}
.dep-list{list-style:none;padding:0}
.dep-list li{padding:.3rem 0}
.dep-list a{color:var(--text-link);font-weight:500}
.outline-container .chapter-title{font-weight:700;padding:.5rem .75rem;background:var(--bg-section);border-left:3px solid var(--primary);border-radius:0 4px 4px 0;margin-bottom:.5rem}
.outline-container .section-item{padding:.25rem .75rem .25rem 1.5rem;font-size:.88rem;border-bottom:1px solid var(--border)}
.outline-container .section-item:last-child{border-bottom:none}

/* Markdown */
.markdown-body h2{font-size:1.3rem;font-weight:700;margin:1.5rem 0 .75rem;padding-bottom:.3rem;border-bottom:1px solid var(--border)}
.markdown-body h3{font-size:1.1rem;font-weight:700;margin:1.25rem 0 .5rem}
.markdown-body h4{font-size:1rem;font-weight:600;margin:1rem 0 .4rem}
.markdown-body p{margin-bottom:.85rem}
.markdown-body ul,.markdown-body ol{padding-left:1.5rem;margin-bottom:.85rem}
.markdown-body li{margin-bottom:.25rem}
.markdown-body code{background:var(--code-bg);padding:.15rem .35rem;border-radius:4px;font-size:.88em}
.markdown-body pre{background:var(--code-bg);padding:1rem;border-radius:var(--radius);overflow-x:auto;margin-bottom:1rem}
.markdown-body pre code{background:none;padding:0}
.markdown-body blockquote{border-left:3px solid var(--primary);padding:.5rem 1rem;background:var(--bg-section);margin:1rem 0;border-radius:0 var(--radius) var(--radius) 0}
.markdown-body table{width:100%;border-collapse:collapse;margin-bottom:1rem}
.markdown-body th,.markdown-body td{padding:.5rem .75rem;border:1px solid var(--border)}
.markdown-body th{background:var(--bg-section);font-weight:600}
.markdown-body img{max-width:100%;border-radius:var(--radius)}

/* Article */
.article-page-title{font-size:clamp(1.3rem,3vw,2rem);font-weight:800;line-height:1.3}
.prev-next-link{color:var(--text-link);font-weight:500;max-width:45%;font-size:.9rem}
.prev-next-link:hover{color:var(--primary-dark)}

/* Lab pages */
.lab-panel{background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius);padding:1.5rem}
.lab-page-header{background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius);padding:1.5rem}
.lab-page-title{font-size:clamp(1.3rem,3vw,1.8rem);font-weight:800}
.lab-toolbar{background:var(--bg-section);border-radius:var(--radius);padding:.75rem 1rem}
.btn-xs{padding:.15rem .5rem;font-size:.75rem}
.placeholder-lab-content{background:var(--bg-section);border:2px dashed var(--border);border-radius:var(--radius)}
.typing-display{background:var(--bg-section);border:2px solid var(--border);min-height:80px;border-radius:var(--radius);letter-spacing:.05em}
.typing-display .char-correct{color:#22c55e}
.typing-display .char-error{color:#ef4444;text-decoration:underline}
.typing-display .char-pending{color:var(--text-muted)}
.typing-display .char-current{border-bottom:2px solid var(--primary)}

/* Footer */
.site-footer{background:var(--footer-bg);color:var(--footer-text)}
.footer-heading{font-size:.95rem;font-weight:700;color:#e2e8f0;margin-bottom:.75rem}
.footer-links{list-style:none;padding:0;margin:0}
.footer-links li{padding:.2rem 0}
.footer-links a{color:var(--footer-text);font-size:.875rem;transition:color .15s}
.footer-links a:hover{color:white}
.social-icon{color:var(--footer-text);font-size:1.2rem;margin-right:.5rem;transition:color .15s}
.social-icon:hover{color:white}
.friend-links{display:flex;flex-wrap:wrap;gap:6px}
.friend-link-item{display:inline-block;padding:.2rem .5rem;background:rgba(255,255,255,.08);border-radius:4px;color:var(--footer-text);font-size:.8rem;transition:background .15s}
.friend-link-item:hover{background:rgba(255,255,255,.2);color:white}

@media(max-width:768px){
  .hero-section{padding:2rem 0}.hero-title{font-size:1.8rem}.section-title{font-size:1.1rem}
  .card-block,.content-block,.lab-panel{padding:1rem}
  body{padding-bottom:60px}
}