/* ============================================================
   JSEMI 设计系统 - base.css
   参考：扬杰电子工业风（深海军蓝 #1D3546 + 钢蓝 #437CA3）
   ============================================================ */

/* 设计 Token */
:root {
    --js-navy: #1D3546;          /* 主色：深海军蓝 */
    --js-navy-light: #2A4A60;
    --js-steel: #437CA3;         /* 辅色：钢蓝 */
    --js-steel-light: #5B92B8;
    --js-steel-dark: #356388;
    --js-red: #FF3448;           /* 强调：警示红/HOT */
    --js-success: #16845B;       /* 成功状态 */
    --js-focus-ring: rgba(67, 124, 163, 0.28);
    --js-error-ring: rgba(255, 52, 72, 0.16);
    --js-gray-bg: #F5F5F8;       /* 分段底色 */
    --js-gray-light: #FAFAFC;
    --js-border: #DBDDDF;
    --js-text: #231815;
    --js-text-2: #333333;
    --js-text-muted: #666666;
    --js-text-light: #999999;
    --js-white: #FFFFFF;
    --js-row-hover: #8B97A0;
    --js-shadow: 0 4px 20px rgba(29, 53, 70, 0.08);
    --js-shadow-hover: 0 8px 30px rgba(29, 53, 70, 0.15);
    --js-radius: 6px;
    --js-radius-lg: 10px;
    --js-max: 1480px;
    --js-header-h: 80px;
    --js-topbar-h: 38px;
    --js-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 重置 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: "MiSans", -apple-system, "Microsoft YaHei", "微软雅黑", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--js-text-2);
    background: var(--js-white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; transition: var(--js-transition); }
a:hover { color: var(--js-steel); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }
h1, h2, h3, h4, h5, h6 { font-weight: 600; color: var(--js-navy); line-height: 1.3; }

/* 统一交互状态：钢蓝焦点环、禁用降级与错误提示 */
:where(a, button, input, textarea, select, [tabindex]):focus-visible {
    outline: 2px solid var(--js-steel);
    outline-offset: 3px;
}
:where(input, textarea, select):focus-visible {
    outline: none;
    border-color: var(--js-steel);
    box-shadow: 0 0 0 3px var(--js-focus-ring);
}
:where(button, input, textarea, select):disabled,
:where(button, input, textarea, select)[aria-disabled="true"],
.js-btn.disabled,
.js-btn[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.55;
    box-shadow: none !important;
    transform: none !important;
    pointer-events: none;
}
:where(input, textarea, select).error,
:where(input, textarea, select).is-error,
:where(input, textarea, select)[aria-invalid="true"] {
    border-color: var(--js-red) !important;
    box-shadow: 0 0 0 3px var(--js-error-ring) !important;
}
.js-form-error,
.js-error-text {
    display: block;
    margin-top: 6px;
    color: var(--js-red);
    font-size: 12px;
    line-height: 1.5;
}

/* 主容器：.w1480 */
.w1480 {
    width: 90%;
    max-width: var(--js-max);
    margin: 0 auto;
}

/* 主体最小高度（保证页脚贴底） */
.js-body { display: flex; flex-direction: column; min-height: 100vh; }
.js-main { flex: 1 0 auto; }

/* ============================================================
   通用区块
   ============================================================ */
/* 区段底色由各区块按内容语义显式指定，不再靠 nth-child 机械交替 */
.js-section { padding: 80px 0; }

.js-section-head { text-align: center; max-width: 800px; margin: 0 auto 50px; }
/* eyebrow：编辑式小标注，不靠极致字间距制造模板感，靠前置短破折号建立栏目归属 */
.js-section-tag {
    display: inline-block;
    font-size: 13px;
    letter-spacing: 0.5px;
    color: var(--js-steel);
    font-weight: 600;
    margin-bottom: 14px;
}
.js-section-tag::before {
    content: '— ';
    color: var(--js-steel);
    margin-right: 2px;
}
/* 标题靠字号 + 字重建立层级，不再加装饰下划线 */
.js-section-title {
    font-size: 36px;
    color: var(--js-navy);
    margin-bottom: 14px;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.js-section-desc { color: var(--js-text-muted); font-size: 15px; }
.js-section-head .js-section-more,
.js-section-more {
    display: inline-block;
    color: var(--js-steel);
    font-size: 14px;
    font-weight: 500;
    margin-top: 10px;
}
.js-section-more:hover { color: var(--js-navy); }
/* 当 more 与 title 同行时右对齐 */
.js-section-head.with-more {
    display: flex; align-items: flex-end; justify-content: space-between;
    text-align: left; max-width: 100%; flex-wrap: wrap; gap: 16px;
}

/* ============================================================
   按钮
   ============================================================ */
.js-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: var(--js-steel);
    color: #fff;
    border-radius: var(--js-radius);
    font-size: 15px;
    font-weight: 500;
    transition: var(--js-transition);
    border: 1px solid var(--js-steel);
}
.js-btn:hover { background: var(--js-navy); border-color: var(--js-navy); color: #fff; }
.js-btn:focus-visible { outline-offset: 3px; }
.js-btn:disabled,
.js-btn.disabled,
.js-btn[aria-disabled="true"] { background: var(--js-row-hover); border-color: var(--js-row-hover); color: #fff; }
.js-btn-outline {
    background: transparent;
    color: var(--js-navy);
    border-color: var(--js-navy);
}
.js-btn-outline:hover { background: var(--js-navy); color: #fff; }

/* ============================================================
   产品卡片
   ============================================================ */
.js-product-card {
    display: block;
    background: #fff;
    border: 1px solid var(--js-border);
    border-radius: var(--js-radius);
    overflow: hidden;
    transition: border-color 0.25s ease;
    height: 100%;
}
/* hover 仅单一反馈：边框变钢蓝 + 底部 datasheet 式高光线，不做位移与图片放大 */
.js-product-card:hover,
.js-product-card:focus-visible { border-color: var(--js-steel); }
.js-product-card:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--js-focus-ring); }
.js-product-card-img {
    position: relative;
    aspect-ratio: 4 / 3;
    background: var(--js-gray-bg);
    overflow: hidden;
}
.js-product-card-img img { width: 100%; height: 100%; object-fit: cover; }
.js-product-card-img::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
    background: var(--js-steel); transform: scaleX(0); transform-origin: left;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.js-product-card:hover .js-product-card-img::after,
.js-product-card:focus-visible .js-product-card-img::after { transform: scaleX(1); }
.js-product-card-placeholder {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    color: var(--js-text-light); font-size: 48px;
}
.js-product-card-body { padding: 18px 20px; }
.js-product-card-body h3 {
    font-size: 16px; color: var(--js-navy); margin-bottom: 6px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.js-product-card-model { font-size: 13px; color: var(--js-steel); font-weight: 600; margin-bottom: 8px; }
.js-product-card-intro {
    font-size: 13px; color: var(--js-text-muted);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; line-height: 1.5; min-height: 39px;
}
.js-product-tag {
    position: absolute; top: 10px; left: 10px;
    padding: 2px 8px; border-radius: 3px;
    font-size: 11px; font-weight: 700; color: #fff; letter-spacing: 1px;
}
.js-product-tag-hot { background: var(--js-red); }
.js-product-tag-new { background: var(--js-steel); }

/* ============================================================
   新闻卡片
   ============================================================ */
.js-news-card {
    display: block;
    background: #fff;
    border: 1px solid var(--js-border);
    border-radius: var(--js-radius);
    overflow: hidden;
    transition: border-color 0.25s ease;
    height: 100%;
}
.js-news-card:hover,
.js-news-card:focus-visible { border-color: var(--js-steel); }
.js-news-card:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--js-focus-ring); }
.js-news-card-img { aspect-ratio: 16 / 10; background: var(--js-gray-bg); overflow: hidden; }
.js-news-card-img img { width: 100%; height: 100%; object-fit: cover; }
.js-news-card-body { padding: 18px 20px; }
.js-news-card-date { font-size: 13px; color: var(--js-steel); display: block; margin-bottom: 8px; }
.js-news-card-body h3 {
    font-size: 16px; color: var(--js-navy); margin-bottom: 8px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.js-news-card-body p { font-size: 13px; color: var(--js-text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ============================================================
   网格布局（响应式栅格）
   ============================================================ */
.js-home-cats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.js-home-apps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.js-home-new-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.js-home-news-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }

/* ============================================================
   工具类
   ============================================================ */
.text-center { text-align: center; }
.text-muted { color: var(--js-text-muted); }
.mt-20 { margin-top: 20px; }
.mt-40 { margin-top: 40px; }
.mb-20 { margin-bottom: 20px; }
.clearfix::after { content: ''; display: table; clear: both; }

/* 文字截断 */
.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; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* 返回顶部 */
.js-backtop {
    position: fixed; right: 30px; bottom: 40px;
    width: 46px; height: 46px;
    background: var(--js-navy); color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; z-index: 998;
    opacity: 0; visibility: hidden; transition: var(--js-transition);
}
.js-backtop.show { opacity: 1; visibility: visible; }
.js-backtop:hover { background: var(--js-steel); color: #fff; transform: translateY(-3px); }

/* WOW 动画兜底（若库未加载） */
.wow { visibility: visible; }
.js-wow-visible { visibility: visible !important; }

/* common.js 动态状态样式统一留在 CSS，避免运行时重复注入 */
.js-header-scrolled { box-shadow: 0 4px 16px rgba(29, 53, 70, 0.1); }
.js-toast {
    position: fixed; top: 30px; left: 50%;
    max-width: min(90%, 560px); padding: 14px 28px;
    transform: translate(-50%, -20px);
    background: var(--js-navy); color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--js-radius); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    font-size: 14px; line-height: 1.5; text-align: center;
    z-index: 3000; opacity: 0; visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
    pointer-events: none;
}
.js-toast-in {
    opacity: 1; visibility: visible; transform: translate(-50%, 0);
    transition-delay: 0s;
}
.js-toast-success { background: var(--js-success); }
.js-toast-info { background: var(--js-steel); }
.js-toast-error,
.js-toast-danger { background: var(--js-red); }

/* 富文本内容样式 */
.js-rich-content, .js-home-about-content { min-width: 0; line-height: 1.8; color: var(--js-text-2); overflow-wrap: anywhere; }
.js-rich-content p, .js-home-about-content p { margin-bottom: 1em; }
.js-rich-content img { max-width: 100%; border-radius: var(--js-radius); margin: 1em 0; }
.js-rich-content iframe,
.js-rich-content video,
.js-rich-content embed,
.js-rich-content object { max-width: 100%; }
.js-rich-content table {
    width: 100%; max-width: 100%; margin: 1.2em 0;
    border-collapse: collapse; display: block; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.js-rich-content th,
.js-rich-content td { min-width: 120px; padding: 10px 12px; border: 1px solid var(--js-border); text-align: left; }
.js-rich-content th { background: var(--js-gray-bg); color: var(--js-navy); font-weight: 600; }
.js-rich-content pre { max-width: 100%; overflow-x: auto; padding: 16px; background: var(--js-gray-bg); border-radius: var(--js-radius); }
.js-rich-content a { color: var(--js-steel); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.js-rich-content ul, .js-rich-content ol { margin: 1em 0 1em 1.5em; }
.js-rich-content ul li { list-style: disc; }
.js-rich-content ol li { list-style: decimal; }
.js-rich-content h2, .js-rich-content h3 { margin: 1.2em 0 0.6em; }
