/* ============================================================
   TP8 CMS · 源码站主题（source）— 基于「码源库 CodeSource」设计稿
   本文件只放 Tailwind 工具类覆盖不到的「组件级自定义样式」；
   布局/配色主要由 Tailwind + tailwind.config(brand) 驱动，
   暗黑模式靠 <html class="dark">，亮色靠 <html class="light">。
   ============================================================ */

/* ---------- Bootstrap Icons 字体图标（前台统一图标库） ---------- */
/* 字体图标靠 font-size 控制大小（width/height 对 <i> 无效），故将 Tailwind 尺寸类映射到字号 */
.bi { display: inline-block; line-height: 1; vertical-align: -0.125em; font-size: 1em; }
.bi.w-3 { font-size: .75rem; }
.bi.w-4 { font-size: 1rem; }
.bi.w-5 { font-size: 1.25rem; }
.bi.w-6 { font-size: 1.5rem; }
.bi.w-7 { font-size: 1.75rem; }
.bi.w-8 { font-size: 2rem; }
/* 颜色由 Tailwind 的 text-* 类控制（字形走 currentColor） */

/* ---------- 语言切换下拉（平滑动画 + 内容排版） ---------- */
.lang-menu {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(.96);
    transform-origin: top right;
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
    pointer-events: none;
}
.lang-menu.lang-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.lang-arrow {
    transition: transform .2s ease;
}
.lang-arrow.lang-open {
    transform: rotate(180deg);
}

/* ---------- 玻璃拟态卡片 ---------- */
.glass-effect {
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}
.dark .glass-card {
    background: rgba(19, 26, 43, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.light .glass-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* ---------- 英雄区背景光晕 ---------- */
.hero-gradient {
    background: radial-gradient(circle at 50% 50%, rgba(124, 58, 237, 0.15) 0%, rgba(0, 212, 255, 0.05) 50%, transparent 100%);
}

/* ---------- 卡片悬浮 ---------- */
.card-hover:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ---------- 自定义滚动条 ---------- */
.custom-scrollbar::-webkit-scrollbar { width: 6px; height: 6px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #7c3aed; border-radius: 10px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }

/* ---------- 淡入动画 ---------- */
.fade-in { animation: fadeIn 0.5s ease-out forwards; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 多行截断（与 Tailwind line-clamp 互补，兼容旧内核） ---------- */
.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- 正文排版（content_html 为 Markdown 渲染出的原生 HTML） ---------- */
.prose-source { color: #475569; line-height: 1.85; font-size: 1rem; }
.dark .prose-source { color: #cbd5e1; }
.prose-source h1, .prose-source h2, .prose-source h3, .prose-source h4 {
    color: #0f172a; font-weight: 700; margin: 1.6em 0 .6em; line-height: 1.3;
}
.dark .prose-source h1, .dark .prose-source h2, .dark .prose-source h3, .dark .prose-source h4 { color: #f8fafc; }
.prose-source h1 { font-size: 1.7rem; }
.prose-source h2 { font-size: 1.4rem; padding-bottom: .3em; border-bottom: 1px solid rgba(148,163,184,.25); }
.prose-source h3 { font-size: 1.18rem; }
.prose-source p { margin: 1em 0; }
.prose-source a { color: #06b6d4; text-decoration: underline; text-underline-offset: 3px; }
.prose-source a:hover { color: #7c3aed; }
.prose-source ul, .prose-source ol { margin: 1em 0; padding-left: 1.5em; }
.prose-source ul { list-style: disc; }
.prose-source ol { list-style: decimal; }
.prose-source li { margin: .4em 0; }
.prose-source img { max-width: 100%; border-radius: 12px; margin: 1.2em 0; border: 1px solid rgba(148,163,184,.2); }
.prose-source blockquote {
    margin: 1.2em 0; padding: .6em 1.1em; border-left: 4px solid #7c3aed;
    background: rgba(124,58,237,.07); border-radius: 0 10px 10px 0; color: #64748b;
}
.dark .prose-source blockquote { color: #94a3b8; }
.prose-source code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: rgba(148,163,184,.18); padding: .15em .4em; border-radius: 6px; font-size: .88em;
}
.prose-source pre {
    background: #0d1117; color: #c9d1d9; padding: 1.1em 1.2em; border-radius: 14px;
    overflow-x: auto; margin: 1.3em 0; font-size: .86rem; line-height: 1.6;
}
.prose-source pre code { background: transparent; padding: 0; color: inherit; }
.prose-source table { width: 100%; border-collapse: collapse; margin: 1.3em 0; font-size: .92rem; }
.prose-source th, .prose-source td { border: 1px solid rgba(148,163,184,.25); padding: .55em .8em; text-align: left; }
.prose-source th { background: rgba(148,163,184,.12); font-weight: 600; }
.prose-source hr { border: none; border-top: 1px solid rgba(148,163,184,.25); margin: 2em 0; }

/* ---------- 品牌页：英雄区网格背景 ---------- */
.hero-grid {
    background-image:
        linear-gradient(rgba(0,212,255,.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(124,58,237,.07) 1px, transparent 1px);
    background-size: 42px 42px;
}

/* ---------- 品牌页：浮动光球 ---------- */
.orb {
    filter: blur(70px);
    animation: orbFloat 8s ease-in-out infinite;
}
@keyframes orbFloat {
    50% { transform: translateY(-18px) translateX(12px); }
}

/* ---------- 品牌页：入场揭示动画 ---------- */
.reveal {
    animation: revealUp .65s ease-out both;
}
@keyframes revealUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: none; }
}

/* ---------- 品牌页：悬浮轻浮动（装饰用） ---------- */
.animate-float {
    animation: floatY 3s ease-in-out infinite;
}
@keyframes floatY {
    0%   { transform: translateY(0); }
    50%  { transform: translateY(-10px); }
    100% { transform: translateY(0); }
}

/* ---------- 源码市场：筛选侧边栏吸顶 ---------- */
.sticky-sidebar {
    position: sticky;
    top: 130px;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

/* ---------- 源码市场详情：主图浏览器样机 ---------- */
.preview-image-container { position: relative; }
.browser-mockup {
    background: #0d1117;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, .2);
    box-shadow: 0 18px 40px -20px rgba(0, 0, 0, .5);
}
.browser-header {
    display: flex;
    gap: 7px;
    padding: 11px 13px;
    background: #161b22;
    border-bottom: 1px solid rgba(148, 163, 184, .15);
}
.browser-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.browser-content { display: flex; height: 320px; background: #0d1117; }
.mock-sidebar {
    width: 84px; flex: none;
    background: #11161f;
    padding: 14px 12px;
    display: flex; flex-direction: column; gap: 12px;
    border-right: 1px solid rgba(148, 163, 184, .1);
}
.mock-nav-item { height: 11px; border-radius: 4px; background: rgba(148, 163, 184, .28); }
.mock-main { flex: 1; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.mock-topbar { height: 20px; border-radius: 6px; background: rgba(148, 163, 184, .18); width: 80%; }
.mock-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mock-card { height: 70px; border-radius: 10px; background: rgba(148, 163, 184, .12); }
@media (max-width: 640px) { .browser-content { height: 220px; } .mock-sidebar { display: none; } }

/* ---------- 源码市场详情：缩略图按钮 ---------- */
.thumb-btn { cursor: pointer; }
.thumb-btn.ring-2 { box-shadow: 0 0 0 2px #00d4ff; }

/* ---------- 源码市场详情：部署步骤卡 ---------- */
.dark .deploy-step-card { background: rgba(124, 58, 237, .08); border: 1px solid rgba(124, 58, 237, .14); }
.light .deploy-step-card { background: rgba(124, 58, 237, .05); border: 1px solid rgba(124, 58, 237, .12); }

/* ---------- 源码市场详情：相关推荐卡悬浮 ---------- */
.source-card { transition: border-color .3s, transform .3s; }
.source-card:hover { border-color: rgba(0, 212, 255, .35); transform: translateY(-4px); }


/* ---------- 云服务器页：轮播 Banner ---------- */
.cloud-carousel-item {
    opacity: 0;
    transition: opacity .8s ease-in-out;
    position: absolute;
    inset: 0;
    z-index: 0;
}
.cloud-carousel-item.active { opacity: 1; z-index: 10; }
.cloud-dot { transition: background-color .3s ease; }
.cloud-dot.active { background: rgba(255, 255, 255, .9); }

/* ---------- 云服务器页：FAQ 折叠 ---------- */
.faq-item .faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease-out, padding .3s ease;
}
.faq-item.active .faq-answer {
    max-height: 500px;
    padding-bottom: 1.5rem;
}
.faq-item.active .faq-icon { transform: rotate(180deg); }

/* ---------- 河狸敲代码动画（页头 + 关于页共用） ---------- */
@keyframes beaver-breathe {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-3px); }
}
@keyframes beaver-glow {
    0%, 100% { filter: drop-shadow(0 0 3px rgba(0,212,255,.30)); }
    50%      { filter: drop-shadow(0 0 9px rgba(0,212,255,.65)); }
}
@keyframes beaver-paw {
    0%   { transform: translateY(-2px) scaleY(1); }
    42%  { transform: translateY(2.6px) scaleY(.84); }
    56%  { transform: translateY(2.6px) scaleY(.92); }
    100% { transform: translateY(-2px) scaleY(1); }
}
@keyframes beaver-key {
    0%, 40% { transform: translateY(0); }
    54%     { transform: translateY(1.6px); }
    100%    { transform: translateY(0); }
}
@keyframes beaver-cursor {
    0%, 45% { opacity: 1; }
    50%, 100% { opacity: 0; }
}
@keyframes beaver-code {
    0%   { opacity: 0; transform: translateX(-10px); }
    100% { opacity: .85; transform: translateX(0); }
}
@keyframes beaver-scan {
    0%   { transform: translateY(0);    opacity: 0; }
    20%  { opacity: .85; }
    80%  { opacity: .85; }
    100% { transform: translateY(60px); opacity: 0; }
}
@keyframes beaver-spark {
    0%   { opacity: 0; transform: translateY(0) scale(.3); }
    30%  { opacity: 1; transform: translateY(-6px) scale(1); }
    100% { opacity: 0; transform: translateY(-15px) scale(.4); }
}
@keyframes beaver-float-in {
    0%   { opacity: 0; transform: translateY(16px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* 容器：呼吸浮动 + 入场 */
.beaver-float { animation: beaver-float-in .8s ease-out both, beaver-breathe 5s ease-in-out .8s infinite; }
.beaver-glow  { animation: beaver-glow 4s ease-in-out infinite; }

/* 分层视差（呼吸错速） */
.layer-screen { animation: beaver-breathe 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.layer-beaver { animation: beaver-breathe 5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.layer-key    { animation: beaver-breathe 4.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

/* 爪 / 键 / 光标 / 代码 / 扫描光 / 星点 */
.paw-l { animation: beaver-paw .42s cubic-bezier(.45,.05,.55,.95) infinite; transform-box: fill-box; transform-origin: top center; }
.paw-r { animation: beaver-paw .42s cubic-bezier(.45,.05,.55,.95) infinite .21s; transform-box: fill-box; transform-origin: top center; }
.key   { animation: beaver-key .42s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.cursor { animation: beaver-cursor 1.1s steps(1) infinite; }
.code-line { animation: beaver-code .5s both ease-out; transform-box: fill-box; transform-origin: left center; }
.cl1 { animation-delay: .2s; }
.cl2 { animation-delay: .6s; }
.cl3 { animation-delay: 1s; }
.scan  { animation: beaver-scan 3.2s linear infinite; }
.spark { animation: beaver-spark .84s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.s2 { animation-delay: .28s; }
.s3 { animation-delay: .56s; }

@media (prefers-reduced-motion: reduce) {
    .beaver-float, .beaver-glow, .layer-screen, .layer-beaver, .layer-key,
    .paw-l, .paw-r, .key, .cursor, .code-line, .scan, .spark { animation: none; }
    .code-line { opacity: .85; }
    .cursor { opacity: 1; }
    .scan, .spark { opacity: 0; }
}

/* ---------- 关于页：屏幕终端（真实代码逐字打印） ---------- */
.term-wrap { width:100%; height:100%; box-sizing:border-box; padding:7px 8px; overflow:hidden; }
.term-pre { margin:0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; font-size:6.5px; line-height:1.5; color:#cbd5e1; white-space:pre-wrap; word-break:break-word; }
.term-code { color:#7dd3fc; }
.term-cursor { color:#00d4ff; animation: term-blink 1s steps(1) infinite; }
@keyframes term-blink { 0%,49%{opacity:1} 50%,100%{opacity:0} }
@media (prefers-reduced-motion: reduce){ .term-cursor{ animation:none; opacity:1; } }
/* ---------- 页头小 logo 迷你终端（打字效果） ---------- */
#header-term { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 2.6px; fill: #7dd3fc; }

/* ---------- 右下角联系面板：样式已统一迁移至 /static/css/chat.css（.contact-panel，主题无关，source/default 共用） ---------- */

/* ---------- 客户评价：横向无缝滚动墙（多国语言演示数据） ---------- */
.reviews-marquee {
    position: relative;
    overflow: hidden;
    padding: 6px 0;
    /* 左右渐隐遮罩，营造「流动」的延伸感 */
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 7%, #000 93%, transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 7%, #000 93%, transparent 100%);
}
.reviews-track {
    display: flex;
    gap: 24px;
    width: max-content;
    animation: reviews-scroll 65s linear infinite;
    will-change: transform;
}
/* 鼠标悬停暂停，方便看清/复制 */
.reviews-marquee:hover .reviews-track { animation-play-state: paused; }
@keyframes reviews-scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}
.review-card {
    flex: 0 0 auto;
    width: 340px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 22px;
    padding: 26px 24px;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(6px);
    transition: border-color .25s ease, transform .25s ease, background .25s ease;
}
.review-card:hover {
    border-color: rgba(0,212,255,0.45);
    background: rgba(0,212,255,0.06);
    transform: translateY(-4px);
}
.review-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.review-avatar {
    width: 46px; height: 46px; flex: 0 0 auto;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 18px;
    box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.review-avatar.c1 { background: linear-gradient(135deg,#06b6d4,#8b5cf6); }
.review-avatar.c2 { background: linear-gradient(135deg,#8b5cf6,#ec4899); }
.review-avatar.c3 { background: linear-gradient(135deg,#06b6d4,#3b82f6); }
.review-avatar.c4 { background: linear-gradient(135deg,#f59e0b,#ef4444); }
.review-avatar.c5 { background: linear-gradient(135deg,#10b981,#06b6d4); }
.review-name { color: #fff; font-weight: 700; font-size: 15px; display:flex; align-items:center; gap:6px; }
.review-flag { font-size: 16px; line-height: 1; }
.review-role { color: #94a3b8; font-size: 12px; margin-top: 2px; }
.review-stars { color: #fbbf24; font-size: 15px; letter-spacing: 2px; margin-bottom: 12px; }
.review-text { color: #cbd5e1; font-size: 14px; line-height: 1.7; flex: 1; font-style: italic; }
.review-service {
    margin-top: 16px; padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.review-service-label { color: #64748b; font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; }
.review-service-name { display: block; color: #22d3ee; font-size: 13px; font-weight: 700; margin-top: 3px; }
@media (prefers-reduced-motion: reduce) {
    .reviews-track { animation: none; flex-wrap: wrap; justify-content: center; }
}

/* ---------- 云服务器页：浅色主题适配（<html class="light"> 时生效） ---------- */
.light .cloud-dot.active { background: rgba(15, 23, 42, .9); }
.light .review-card {
    background: rgba(15, 23, 42, .03);
    border-color: rgba(15, 23, 42, .06);
}
.light .review-card:hover {
    border-color: rgba(0, 212, 255, .45);
    background: rgba(0, 212, 255, .06);
}
.light .review-name { color: #0f172a; }
.light .review-role { color: #64748b; }
.light .review-text { color: #475569; }
.light .review-service { border-top-color: rgba(15, 23, 42, .08); }
