/* ===== CSS Variables ===== */
:root {
  /* Colors */
  --color-bg: #f8f9fa;
  --color-surface: #ffffff;
  --color-dark: #1a1f2e;
  --color-accent: #00b894;
  --color-accent-hover: #00a381;
  --color-link: #2563eb;
  --color-heading: #1a1f2e;
  --color-body: #4b5563;
  --color-spec: #111827;
  --color-border: #e5e7eb;
  --color-tag-bg: #00b894;
  --color-tag-text: #ffffff;

  /* Typography */
  --font-sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", "Consolas", "Courier New", monospace;

  /* Spacing */
  --space-section: 80px;
  --space-card-gap: 24px;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;

  /* Shadow */
  --shadow-card: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-card-hover: 0 4px 12px rgba(0,0,0,0.12);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-body);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--color-heading);
  font-weight: 700;
  line-height: 1.3;
}

h1 { font-size: 2.5rem; }     /* 40px */
h2 { font-size: 1.75rem; }    /* 28px */
h3 { font-size: 1.25rem; }    /* 20px */
h4 { font-size: 1rem; }

a { color: var(--color-link); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

/* ===== Container ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== Section spacing ===== */
.section {
  padding: var(--space-section) 0;
}

.section-header {
  text-align: center;
  margin-bottom: 48px;
}

.section-header h2 {
  font-size: 1.75rem;
  color: var(--color-heading);
  margin-bottom: 12px;
}

.section-header p {
  color: var(--color-body);
  max-width: 600px;
  margin: 0 auto;
}

/* ===== Navigation ===== */
.navbar {
  background: var(--color-dark);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 64px;
  display: flex;
  align-items: center;
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
}

.navbar-brand:hover { text-decoration: none; color: #fff; }

.nav-links { display: flex; list-style: none; gap: 32px; }

.nav-links a {
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: #fff;
  text-decoration: none;
}

.nav-cta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-cta a {
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
}

.nav-cta .btn-wechat {
  background: var(--color-accent);
  color: #fff;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: background 0.2s;
}

.nav-cta .btn-wechat:hover {
  background: var(--color-accent-hover);
  text-decoration: none;
}

/* Mobile nav */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  margin: 5px 0;
  transition: 0.3s;
}

@media (max-width: 768px) {
  .nav-links, .nav-cta { display: none; }
  .nav-toggle { display: block; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--color-dark);
    padding: 20px;
    gap: 16px;
  }
  .nav-links.open ~ .nav-cta {
    display: flex;
    position: absolute;
    top: calc(64px + 200px);
    left: 0;
    right: 0;
    background: var(--color-dark);
    padding: 0 20px 20px;
  }
}

/* ===== Hero ===== */
.hero {
  background: var(--color-dark);
  padding: 120px 0 80px;
  position: relative;
  overflow: hidden;
}

/* Oscilloscope grid texture */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 48px;
}

.hero-text { flex: 1; }

.hero-text h1 {
  font-size: 2.8rem;
  color: #fff;
  margin-bottom: 16px;
}

.hero-text p {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.7);
  margin-bottom: 32px;
  max-width: 480px;
}

.hero-buttons { display: flex; gap: 16px; }

.hero-image { flex: 1; text-align: right; }

.hero-image img { max-height: 320px; border-radius: var(--radius-md); }

@media (max-width: 768px) {
  .hero-content { flex-direction: column; text-align: center; }
  .hero-text h1 { font-size: 2rem; }
  .hero-text p { max-width: 100%; }
  .hero-buttons { justify-content: center; }
  .hero-image { text-align: center; }
  .hero-image img { max-height: 200px; }
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 12px 28px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  text-decoration: none;
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.3);
}

.btn-outline:hover {
  border-color: #fff;
  text-decoration: none;
  color: #fff;
}

.btn-outline-dark {
  background: transparent;
  color: var(--color-heading);
  border: 2px solid var(--color-border);
}

.btn-outline-dark:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  text-decoration: none;
}

/* ===== Category Cards (首页分类导航) ===== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-card-gap);
}

.category-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.category-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-accent);
  text-decoration: none;
}

.category-card .cat-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.category-card h3 {
  font-size: 1rem;
  color: var(--color-heading);
}

@media (max-width: 768px) {
  .category-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .category-grid { grid-template-columns: 1fr; }
}

/* ===== Product Cards (产品列表) ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-card-gap);
}

.product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.product-card:hover {
  box-shadow: var(--shadow-card-hover);
  text-decoration: none;
}

.product-card-img {
  background: #f0f1f3;
  padding: 24px;
  text-align: center;
}

.product-card-img img {
  max-height: 180px;
  margin: 0 auto;
}

.product-card-body {
  padding: 20px;
}

.product-card .tag {
  display: inline-block;
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 100px;
  margin-bottom: 8px;
}

.product-card h3 {
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.product-card .specs {
  font-size: 0.9rem;
  color: var(--color-body);
  line-height: 1.6;
}

@media (max-width: 992px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .product-grid { grid-template-columns: 1fr; }
}

/* ===== Product Detail ===== */
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

.product-gallery {
  background: #f0f1f3;
  border-radius: var(--radius-md);
  padding: 40px;
  text-align: center;
}

.product-gallery img {
  max-height: 320px;
  margin: 0 auto;
}

.product-info h1 {
  font-size: 2rem;
  margin-bottom: 4px;
}

.product-info .tag {
  display: inline-block;
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 100px;
  margin-bottom: 16px;
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
}

.spec-table th,
.spec-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.spec-table th {
  background: #f0f1f3;
  color: var(--color-body);
  font-weight: 500;
  font-size: 0.9rem;
  width: 35%;
  white-space: nowrap;
}

.spec-table td {
  color: var(--color-spec);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}

.detail-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 24px;
  margin-top: 48px;
}

.detail-tab {
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-body);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  transition: color 0.2s, border-color 0.2s;
}

.detail-tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.detail-panel { display: none; }
.detail-panel.active { display: block; }

@media (max-width: 768px) {
  .product-detail { grid-template-columns: 1fr; }
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  padding: 100px 0 24px;
  font-size: 0.9rem;
  color: var(--color-body);
}

.breadcrumb a { color: var(--color-link); }
.breadcrumb span { color: var(--color-body); }

/* ===== Download Table ===== */
.download-list { list-style: none; }

.download-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.download-item .file-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.download-item .file-name { font-weight: 600; color: var(--color-heading); }
.download-item .file-size { font-size: 0.85rem; color: var(--color-body); }

/* ===== Footer ===== */
.footer {
  background: var(--color-dark);
  color: rgba(255,255,255,0.7);
  padding: 60px 0 30px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer h4 {
  color: #fff;
  font-size: 1rem;
  margin-bottom: 16px;
}

.footer a { color: rgba(255,255,255,0.6); font-size: 0.9rem; }
.footer a:hover { color: #fff; text-decoration: none; }

.footer-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
}

.footer-links { list-style: none; }
.footer-links li { margin-bottom: 8px; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 24px;
  text-align: center;
  font-size: 0.85rem;
}

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
}

/* ===== Stats Bar (首页数据指标) ===== */
.stats-bar {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: 32px 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  text-align: center;
}

.stat-item .stat-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-heading);
}

.stat-item .stat-label {
  font-size: 0.85rem;
  color: var(--color-body);
  margin-top: 4px;
}

@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Sidebar (产品中心) ===== */
.layout-sidebar {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 40px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 84px;
}

.sidebar h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-body);
  margin-bottom: 12px;
}

.sidebar-nav { list-style: none; }

.sidebar-nav a {
  display: block;
  padding: 8px 12px;
  border-left: 3px solid transparent;
  color: var(--color-body);
  font-size: 0.9rem;
  transition: all 0.15s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: var(--color-accent);
  border-left-color: var(--color-accent);
  text-decoration: none;
  font-weight: 600;
}

@media (max-width: 768px) {
  .layout-sidebar { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .sidebar-nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .sidebar-nav a { border-left: none; border-bottom: 2px solid transparent; }
  .sidebar-nav a.active { border-bottom-color: var(--color-accent); }
}

/* ===== About page ===== */
.about-content {
  max-width: 720px;
  margin: 0 auto;
  font-size: 1rem;
  line-height: 1.8;
}

.contact-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 40px;
}

.contact-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 28px;
  text-align: center;
}

.contact-card .contact-icon {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.contact-card h4 { margin-bottom: 8px; }

@media (max-width: 640px) {
  .contact-cards { grid-template-columns: 1fr; }
}

/* ===== Utility ===== */
.text-center { text-align: center; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
