/* ==========================================================================
   Siligoo - 深色科技风样式表
   设计原则：深色背景 + 青/蓝点缀 + 玻璃拟态卡片 + 完全响应式
   修改主题色只需改下方 :root 里的 CSS 变量
   ========================================================================== */

:root {
  /* 主题色变量 —— 一处修改，全局生效 */
  --bg-0: #070b16;          /* 最深背景 */
  --bg-1: #0a0e1a;          /* 主背景 */
  --bg-2: #111827;          /* 卡片背景 */
  --bg-3: #1a2236;          /* 卡片悬停/输入框 */
  --border: #243049;        /* 边框 */
  --text: #e8edf5;          /* 主文字 */
  --text-dim: #9aa7bd;      /* 次要文字 */
  --text-muted: #6b7891;    /* 弱化文字 */
  --accent: #3b82f6;        /* 主点缀色 蓝 */
  --accent-2: #06b6d4;      /* 副点缀色 青 */
  --accent-glow: rgba(59, 130, 246, 0.4);
  --radius: 12px;
  --radius-sm: 8px;
  --maxw: 1180px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- 基础重置 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB",
    sans-serif;
  background: var(--bg-1);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* 背景氛围光晕 */
body::before {
  content: "";
  position: fixed;
  top: -200px; left: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(59,130,246,0.12), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: "";
  position: fixed;
  bottom: -200px; right: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(6,182,212,0.10), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; transition: color var(--transition); }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }

/* 视图容器 */
.view { min-height: calc(100vh - 200px); position: relative; z-index: 1; }

/* ==========================================================================
   导航栏
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10, 14, 26, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.site-header.scrolled { background: rgba(10, 14, 26, 0.95); }
.nav-wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; letter-spacing: 0.5px; }
.brand-logo { width: 36px; height: 36px; object-fit: contain; }
.main-nav { display: flex; gap: 8px; }
.main-nav a {
  padding: 8px 16px; border-radius: var(--radius-sm);
  color: var(--text-dim); font-weight: 500; font-size: 0.95rem;
  transition: all var(--transition);
}
.main-nav a:hover { color: var(--text); background: var(--bg-3); }
.main-nav a.active { color: var(--accent-2); background: rgba(6,182,212,0.1); }

.nav-right { display: flex; align-items: center; gap: 16px; }
.lang-switch { display: flex; align-items: center; gap: 4px; }
.lang-btn {
  padding: 4px 8px; font-size: 0.85rem; font-weight: 600;
  color: var(--text-muted); border-radius: 6px; transition: all var(--transition);
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active { color: var(--accent-2); background: rgba(6,182,212,0.12); }
.lang-sep { color: var(--text-muted); }

.menu-toggle { display: none; flex-direction: column; gap: 5px; padding: 8px; }
.menu-toggle span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: all var(--transition); }
.menu-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ==========================================================================
   按钮
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 28px; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.95rem;
  transition: all var(--transition); cursor: pointer; white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 28px var(--accent-glow); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent-2); color: var(--accent-2); background: rgba(6,182,212,0.06); }

/* ==========================================================================
   主页 Hero
   ========================================================================== */
.hero {
  padding: 100px 0 80px; text-align: center;
  position: relative; overflow: hidden;
}
.hero-eyebrow {
  display: inline-block; padding: 6px 16px; border-radius: 100px;
  background: rgba(6,182,212,0.1); border: 1px solid rgba(6,182,212,0.3);
  color: var(--accent-2); font-size: 0.82rem; font-weight: 600;
  margin-bottom: 24px; letter-spacing: 0.5px;
}
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 800;
  background: linear-gradient(135deg, #fff 30%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 20px; line-height: 1.15;
}
.hero p.hero-sub {
  font-size: clamp(1rem, 2vw, 1.2rem); color: var(--text-dim);
  max-width: 640px; margin: 0 auto 36px;
}
.hero-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* 主页 - 亮点 */
.section { padding: 72px 0; }
.section-head { text-align: center; margin-bottom: 48px; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: 12px; }
.section-head p { color: var(--text-dim); max-width: 560px; margin: 0 auto; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.feature-card {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; transition: all var(--transition);
}
.feature-card:hover { border-color: var(--accent-2); transform: translateY(-4px); box-shadow: var(--shadow); }
.feature-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(6,182,212,0.15));
  color: var(--accent-2); font-size: 1.5rem; margin-bottom: 16px;
}
.feature-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.feature-card p { color: var(--text-dim); font-size: 0.92rem; }

/* 主页 - 精选产品 */
.featured-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; }

/* ==========================================================================
   通用卡片 & 产品卡片
   ========================================================================== */
.card {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: all var(--transition); position: relative;
}
.card:hover { border-color: var(--accent-2); transform: translateY(-4px); box-shadow: var(--shadow); }

.product-card { cursor: pointer; display: flex; flex-direction: column; }
.product-card .pc-img {
  aspect-ratio: 4 / 3; background: var(--bg-2);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  padding: 16px;
}
.product-card .pc-img img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform var(--transition); }
.product-card:hover .pc-img img { transform: scale(1.05); }
.product-card .pc-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.product-card .pc-cat {
  font-size: 0.75rem; font-weight: 600; color: var(--accent-2);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px;
}
.product-card .pc-name { font-size: 1.1rem; margin-bottom: 6px; }
.product-card .pc-tagline { color: var(--text-dim); font-size: 0.9rem; flex: 1; }

/* ==========================================================================
   产品列表页 - 筛选标签
   ========================================================================== */
.page-title { padding: 56px 0 8px; text-align: center; }
.page-title h1 { font-size: clamp(1.8rem, 3.5vw, 2.4rem); margin-bottom: 8px; }
.page-title p { color: var(--text-dim); }

.filter-bar {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  padding: 24px 0 40px;
}
.filter-btn {
  padding: 8px 20px; border-radius: 100px; font-size: 0.9rem; font-weight: 600;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text-dim);
  transition: all var(--transition);
}
.filter-btn:hover { color: var(--text); border-color: var(--accent-2); }
.filter-btn.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; padding-bottom: 64px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }

/* ==========================================================================
   产品详情页
   ========================================================================== */
.product-detail { padding: 48px 0 72px; }
.breadcrumb { display: flex; gap: 8px; align-items: center; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 24px; }
.breadcrumb a:hover { color: var(--accent-2); }
.breadcrumb .sep::before { content: "/"; }
.pd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.pd-image {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  aspect-ratio: 4 / 3; overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.pd-image img { width: 100%; height: 100%; object-fit: cover; }
.pd-info h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: 8px; }
.pd-cat { color: var(--accent-2); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; }
.pd-tagline { font-size: 1.1rem; color: var(--text-dim); margin-bottom: 24px; }
.pd-desc { color: var(--text-dim); margin-bottom: 32px; }
.pd-desc p { margin-bottom: 12px; }
.pd-desc h3 { color: var(--text); margin: 20px 0 8px; font-size: 1.1rem; }
.pd-desc ul { margin-left: 20px; margin-bottom: 12px; }

/* 规格表 */
.spec-table { width: 100%; border-collapse: collapse; margin-bottom: 32px; }
.spec-table th, .spec-table td {
  padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.92rem;
}
.spec-table th { color: var(--text-muted); font-weight: 500; width: 40%; }
.spec-table td { color: var(--text); }

.pd-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* 产品详情页 - 单栏文档流（图文混排） */
.product-detail-body { font-size: 1rem; }
.product-detail-body h1 {
  font-size: clamp(1.7rem, 3.2vw, 2.3rem); margin-bottom: 16px;
  background: linear-gradient(135deg, #fff 30%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.product-detail-body h2 {
  font-size: 1.35rem; margin: 40px 0 16px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border); color: var(--text);
}
.product-detail-body h3 { font-size: 1.1rem; margin: 24px 0 10px; color: var(--text); }
/* 图片：圆角卡片化，限制最大宽度并居中；多图并排时自动换行 */
.product-detail-body img {
  display: block; max-width: 100%; height: auto; margin: 16px auto;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-2);
}
/* 小尺寸产品图（如 300x300 缩略图）不要撑满，按原始尺寸附近显示，并允许并排 */
.product-detail-body img[src*="-300x300"],
.product-detail-body img[src*="150x150"] {
  display: inline-block; max-width: 280px; margin: 8px; vertical-align: top;
}
.product-detail-body p { margin: 16px 0; }
/* 嵌入视频（YouTube iframe / 本地 video）居中显示，并在窄屏自动缩小 */
.product-detail-body iframe,
.product-detail-body video,
.product-detail-body embed {
  display: block; max-width: 100%; margin: 20px auto;
  border: none; border-radius: var(--radius);
}
/* 表格：卡片化容器。默认内容自然换行（手机端不溢出）；表格过宽时整体横向滚动 */
.product-detail-body table {
  width: 100%; border-collapse: collapse; margin: 20px 0;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  display: block; overflow-x: auto;        /* 仅在真正超宽时才横向滚动 */
}
.product-detail-body table th, .product-detail-body table td {
  padding: 12px 18px; border-bottom: 1px solid var(--border); text-align: left; font-size: 0.92rem;
  vertical-align: top; white-space: normal; word-break: break-word;   /* 内容自动换行 */
}
.product-detail-body table th { background: var(--bg-3); color: var(--text-muted); font-weight: 600; }
.product-detail-body table tr:last-child td { border-bottom: none; }
.product-detail-body ul, .product-detail-body ol { margin: 12px 0 12px 1.6em; }
.product-detail-body li { margin-bottom: 6px; }

/* ==========================================================================
   下载页
   ========================================================================== */
.download-table-wrap { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 64px; }
.download-table { width: 100%; border-collapse: collapse; }
.download-table th {
  padding: 16px; text-align: left; background: var(--bg-3);
  font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 600;
}
.download-table td { padding: 16px; border-top: 1px solid var(--border); font-size: 0.92rem; }
.download-table tr:hover td { background: rgba(6,182,212,0.04); }
.dl-type { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.dl-type::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2);
}
.dl-type.t-manual::before { background: #a78bfa; }
.dl-type.t-firmware::before { background: #fbbf24; }
.dl-type.t-software::before { background: #34d399; }
.dl-type.t-datasheet::before { background: var(--accent-2); }
.dl-link { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-2); font-weight: 600; }
.dl-link:hover { text-decoration: underline; }
.dl-meta { color: var(--text-muted); font-size: 0.85rem; }

/* ==========================================================================
   联系页
   ========================================================================== */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; padding-bottom: 72px; }
.contact-info-card {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px;
}
.contact-item { display: flex; gap: 16px; margin-bottom: 24px; }
.contact-item:last-child { margin-bottom: 0; }
.ci-icon { flex-shrink: 0; width: 44px; height: 44px; border-radius: 10px; background: rgba(6,182,212,0.12); color: var(--accent-2); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.ci-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.ci-value { font-weight: 500; word-break: break-word; }
.ci-value a:hover { color: var(--accent-2); }

.contact-form { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 0.9rem; color: var(--text-dim); }
.form-group input, .form-group textarea {
  width: 100%; padding: 12px 16px; background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-family: inherit; font-size: 0.95rem; transition: border var(--transition);
}
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--accent-2); }
.form-group textarea { resize: vertical; min-height: 120px; }
.form-note { font-size: 0.82rem; color: var(--text-muted); margin-top: 12px; }

/* ==========================================================================
   页脚
   ========================================================================== */
.site-footer {
  background: var(--bg-0); border-top: 1px solid var(--border);
  padding: 56px 0 24px; margin-top: auto; position: relative; z-index: 1;
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.footer-brand .brand-name { font-size: 1.3rem; font-weight: 800; margin-bottom: 12px; display: block; }
.footer-tagline { color: var(--text-dim); font-size: 0.9rem; max-width: 280px; }
.footer-col h4 { font-size: 0.95rem; margin-bottom: 16px; color: var(--text); }
.footer-col a { display: block; color: var(--text-dim); font-size: 0.9rem; margin-bottom: 10px; }
.footer-col a:hover { color: var(--accent-2); }
.footer-social a { display: inline-block; margin-right: 12px; color: var(--text-dim); }
.footer-bottom { padding-top: 24px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.85rem; text-align: center; }

/* ==========================================================================
   返回顶部
   ========================================================================== */
.back-to-top {
  position: fixed; right: 24px; bottom: 24px; z-index: 50;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
  font-size: 1.3rem; line-height: 1; opacity: 0; visibility: hidden;
  transition: all var(--transition); box-shadow: var(--shadow);
}
.back-to-top.show { opacity: 1; visibility: visible; }
.back-to-top:hover { background: var(--accent); border-color: var(--accent); transform: translateY(-2px); }

/* ==========================================================================
   Markdown 渲染区域通用样式（产品描述/主页正文）
   ========================================================================== */
.md-body { color: var(--text-dim); line-height: 1.75; }
.md-body h1, .md-body h2, .md-body h3 { color: var(--text); margin: 1.4em 0 0.6em; }
.md-body p { margin-bottom: 0.8em; }
.md-body ul, .md-body ol { margin: 0.5em 0 0.8em 1.5em; }
.md-body li { margin-bottom: 0.3em; }
.md-body strong { color: var(--text); }
.md-body a { color: var(--accent-2); }
.md-body a:hover { text-decoration: underline; }
.md-body code { background: var(--bg-3); padding: 2px 6px; border-radius: 4px; font-size: 0.88em; }
.md-body blockquote { border-left: 3px solid var(--accent); padding-left: 16px; margin: 1em 0; color: var(--text-muted); }

/* ==========================================================================
   动画
   ========================================================================== */
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.view > * { animation: fadeUp 0.4s ease both; }

/* 加载指示器 */
.loader { text-align: center; padding: 80px 0; color: var(--text-muted); }
.loader::after { content: ""; display: inline-block; width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent-2); border-radius: 50%; animation: spin 0.8s linear infinite; margin-left: 10px; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 860px) {
  .pd-grid, .contact-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .menu-toggle { display: flex; }
  .main-nav {
    position: fixed; top: 68px; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--bg-0); border-bottom: 1px solid var(--border);
    padding: 16px 24px; transform: translateY(-150%); transition: transform var(--transition);
  }
  .main-nav.open { transform: translateY(0); }
  .main-nav a { padding: 14px 8px; border-bottom: 1px solid var(--border); }
  .main-nav a:last-child { border-bottom: none; }
  .hero { padding: 64px 0 48px; }
  .section { padding: 48px 0; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .container { padding: 0 18px; }
  /* Mobile: download table horizontal scroll */
  .download-table-wrap { overflow-x: auto; }
  .download-table { min-width: 560px; }
  /* Mobile: product detail tables — smaller padding, ensure full visibility */
  .product-detail-body table { margin: 16px 0; }
  .product-detail-body table th,
  .product-detail-body table td { padding: 10px 12px; font-size: 0.86rem; }
  /* Mobile: side-by-side small product images stack to avoid overflow */
  .product-detail-body img[src*="-300x300"],
  .product-detail-body img[src*="150x150"],
  .product-detail-body img[src*="-218x300"],
  .product-detail-body img[src*="-300x222"] {
    display: block; max-width: 85%; margin: 10px auto;
  }
}
