/* ============================================================
   微电海讯 电子产品工作室 — 界面优化样式
   品牌色：深海蓝渐变  #043c52 → #1971cf → #2980B9
   ============================================================ */

:root {
  --brand-1: #043c52;
  --brand-2: #1971cf;
  --brand-3: #2980B9;
  --accent: #ff8a00;          /* 强调色(CTA) */
  --ink: #1f2937;             /* 正文 */
  --muted: #6b7280;           /* 次要文字 */
  --bg: #f7f9fc;
  --card: #ffffff;
  --line: #e5e9f0;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(4, 60, 82, .08);
  --shadow-lg: 0 16px 48px rgba(4, 60, 82, .16);
  --nav-h: 72px;
}

/* ---------- 主题切换按钮 ---------- */
.theme-toggle {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background .2s, transform .15s;
  line-height: 1;
}
.theme-toggle:hover { background: rgba(255, 255, 255, .12); }
.theme-toggle:active { transform: scale(.92); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* 移动端汉堡菜单打开时按钮也正常显示 */
@media (max-width: 768px) {
  .theme-toggle { font-size: 22px; padding: 10px; }
}

/* ---------- 暗黑模式 ---------- */
/* 方式一：自动跟随系统 */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --card: #161b22;
    --ink: #e6edf3;
    --muted: #8b949e;
    --line: #30363d;
    --shadow: 0 6px 24px rgba(0, 0, 0, .4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
  }
  /* 浅色硬编码颜色覆盖 */
  .nav { background: rgba(13, 17, 23, .94); }
  .hero-text h1 { color: #fff; }
  .hero-text p { color: #b0bac8; }
  .section-title { color: #e6edf3; }
  .section-sub { color: #8b949e; }
  .hero-badges span { color: #c9d1d9; }
  .card-info h3 { color: #e6edf3; }
  .card-info p { color: #8b949e; }
  .about p { color: #c9d1d9; }
  .contact p { color: #c9d1d9; }
  .contact .contact-row a { border-color: #30363d; color: #c9d1d9; }
  .download-list a { background: #161b22; color: #c9d1d9; border-color: #30363d; }
  footer p { color: #8b949e; }
  #toTop { background: #21262d; color: #c9d1d9; }
  #toTop:hover { background: #30363d; }
  .card:hover { background: #21262d; border-color: var(--brand-2); }
  .card:hover .card-info p { color: #8b949e; }
  .detail-hero h1 { color: #e6edf3; }
  .detail-hero .meta { color: #8b949e; }
  .section-title { color: #e6edf3; }
  .back { color: #58a6ff; }
}

/* 方式二：手动切换（给 <html> 加 .dark 类）*/
html.dark {
  --bg: #0d1117;
  --card: #161b22;
  --ink: #e6edf3;
  --muted: #8b949e;
  --line: #30363d;
  --shadow: 0 6px 24px rgba(0, 0, 0, .4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
}
html.dark .nav { background: rgba(13, 17, 23, .94); }
html.dark .hero-text h1 { color: #fff; }
html.dark .hero-text p { color: #b0bac8; }
html.dark .section-title { color: #e6edf3; }
html.dark .section-sub { color: #8b949e; }
html.dark .hero-badges span { color: #c9d1d9; }
html.dark .card-info h3 { color: #e6edf3; }
html.dark .card-info p { color: #8b949e; }
html.dark .about p { color: #c9d1d9; }
html.dark .contact p { color: #c9d1d9; }
html.dark .contact .contact-row a { border-color: #30363d; color: #c9d1d9; }
html.dark .download-list a { background: #161b22; color: #c9d1d9; border-color: #30363d; }
html.dark footer p { color: #8b949e; }
html.dark #toTop { background: #21262d; color: #c9d1d9; }
html.dark #toTop:hover { background: #30363d; }
html.dark .card:hover { background: #21262d; border-color: var(--brand-2); }
html.dark .card:hover .card-info p { color: #8b949e; }
html.dark .detail-hero h1 { color: #e6edf3; }
html.dark .detail-hero .meta { color: #8b949e; }
html.dark .back { color: #58a6ff; }

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

/* ---------- 导航栏 ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(24px, 5vw, 64px);
  background: rgba(4, 60, 82, .92);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 16px rgba(0, 0, 0, .12);
}

.logo {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.logo::before {
  content: "";
  width: 12px; height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #ffd34d);
  box-shadow: 0 0 0 4px rgba(255, 138, 0, .18);
}

.nav ul {
  list-style: none;
  display: flex;
  gap: 34px;
  align-items: center;
}

.nav ul a:not(.cta) {
  color: #fff;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  opacity: .82;
  position: relative;
  padding: 6px 0;
  transition: opacity .25s;
}
.nav ul a:not(.cta)::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 0; height: 2px;
  background: var(--accent);
  transition: width .28s ease;
}
.nav ul a:not(.cta):hover { opacity: 1; }
.nav ul a:not(.cta):hover::after { width: 100%; }

.nav ul .cta {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  padding: 9px 20px;
  border-radius: 999px;
  transition: transform .25s, box-shadow .25s;
}
.nav .cta:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(255, 138, 0, .4); }

/* 汉堡按钮 */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle span {
  width: 26px; height: 3px;
  border-radius: 2px;
  background: #fff;
  transition: .3s;
}
.nav-toggle.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  background:
    linear-gradient(180deg,
      rgba(3, 26, 38, 0) 0%,
      rgba(3, 26, 38, .34) 22%,
      rgba(3, 26, 38, .62) 46%,
      rgba(3, 26, 38, .30) 68%,
      rgba(3, 42, 62, .68) 100%),
    linear-gradient(90deg,
      rgba(3, 26, 38, .30) 0%,
      rgba(3, 26, 38, 0) 42%,
      rgba(3, 26, 38, 0) 62%,
      rgba(3, 26, 38, .30) 100%),
    url('hero-bg.png?v=4') 50% 22%/cover no-repeat;
  color: #fff;
  padding: clamp(120px, 18vh, 220px) clamp(24px, 5vw, 64px) clamp(90px, 14vh, 170px);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-text { max-width: 760px; margin: 0 auto; }

.hero-text h1 {
  font-size: clamp(30px, 5vw, 52px);
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1.2;
  background: linear-gradient(90deg, #fff 30%, #bfe0ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 14px;
}

.hero-text p {
  font-size: clamp(15px, 2vw, 18px);
  opacity: .85;
  font-weight: 300;
  letter-spacing: 1px;
}

.hero-badges {
  margin-top: 26px;
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
}
.hero-badges span {
  border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .08);
  backdrop-filter: blur(4px);
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 1px;
  white-space: nowrap;
}

/* Hero 向下滚动提示 */
.scroll-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,.7);
  font-size: 28px;
  text-decoration: none;
  animation: bounceDown 2s ease-in-out infinite;
  transition: color .25s;
}
.scroll-hint:hover { color: #fff; }
@keyframes bounceDown {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(10px); }
}

/* ---------- 区块 ---------- */
section { scroll-margin-top: calc(var(--nav-h) + 16px); }

.works, .about, .contact {
  padding: clamp(60px, 8vh, 96px) clamp(24px, 5vw, 64px);
  max-width: 1440px;
  margin: 0 auto;
}

.section-title {
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 800;
  margin-bottom: 12px;
  position: relative;
}
.section-title::after {
  content: "";
  display: block;
  width: 64px; height: 4px;
  border-radius: 2px;
  margin-top: 14px;
  background: linear-gradient(90deg, var(--brand-2), var(--accent));
}
.section-sub {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 44px;
  max-width: 560px;
}

/* ---------- 产品网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: clamp(20px, 3vw, 32px);
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .35s ease, box-shadow .35s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  border: 1px solid transparent;
}
.card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: var(--line);
}

.card-cover {
  position: relative;
  width: 100%;
  height: 250px;
  background: #eef2f7;
  overflow: hidden;
}
.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-cover::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(4, 42, 58, .35));
  opacity: 0;
  transition: opacity .35s;
  pointer-events: none;
  z-index: 1;
}
.card:hover .card-cover::before { opacity: 1; }

/* 产品卡片标签 */
.card-tags {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  gap: 6px;
}
.card-tags span {
  background: rgba(4, 60, 82, .75);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: .5px;
}

.card-info {
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-info h3 {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 4px;
}
.card-info p {
  color: var(--muted);
  font-size: 13px;
}
.card-arrow {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #eef3f8;
  color: var(--brand-2);
  display: grid;
  place-items: center;
  font-size: 16px;
  transition: background .3s, transform .3s;
}
.card:hover .card-arrow { background: var(--brand-2); color: #fff; transform: translateX(2px); }

/* ---------- 关于 / 联系 ---------- */
.about, .contact {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-top: 24px;
}
.about p, .contact p {
  font-size: 17px;
  color: #46505f;
  max-width: 720px;
  margin-bottom: 12px;
}
.about .about-item {
  margin: 4px 0 4px 6px;
  line-height: 1.95;
}

.contact .contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 8px;
}
.contact .contact-row a,
.contact .contact-row span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  color: #46505f;
  text-decoration: none;
  transition: border-color .25s, color .25s;
}
.contact .contact-row a:hover { border-color: var(--brand-2); color: var(--brand-2); }

.contact .cta-big {
  display: inline-block;
  margin-top: 24px;
  padding: 13px 30px;
  background: linear-gradient(135deg, #ff5a00, #ff8a00);
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 8px 22px rgba(255, 138, 0, .35);
  transition: transform .25s, box-shadow .25s;
}
.contact .cta-big:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(255, 138, 0, .45); }

/* 微信号 */
.wx-chip { border-color: #27ae60 !important; color: #1e7e34 !important; }
.copy-wx {
  margin-left: 6px;
  padding: 2px 12px;
  font-size: 12px;
  border: 1px solid #27ae60;
  background: #fff;
  color: #1e7e34;
  border-radius: 999px;
  cursor: pointer;
  transition: all .2s;
}
.copy-wx:hover, .copy-wx.copied { background: #27ae60; color: #fff; }

/* 可咨询范围 */
.contact-scope { margin: 6px 0 4px; font-size: 15px; }

/* ---------- Footer ---------- */
footer {
  text-align: center;
  padding: 42px 24px;
  background: #101c2b;
  color: #9aa7b8;
  font-size: 14px;
  margin-top: 60px;
}
footer p + p { margin-top: 8px; }

/* ============================================================
   产品详情页
   ============================================================ */
.detail-hero {
  background:
    radial-gradient(900px 300px at 15% -20%, rgba(255, 255, 255, .12), transparent 60%),
    linear-gradient(135deg, #042a3a 0%, var(--brand-1) 40%, var(--brand-2) 90%, var(--brand-3) 100%);
  color: #fff;
  padding: clamp(40px, 7vh, 72px) clamp(24px, 5vw, 64px);
}

.detail-hero .back {
  color: #fff;
  text-decoration: none;
  opacity: .82;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 22px;
  transition: opacity .25s;
}
.detail-hero .back:hover { opacity: 1; }

.detail-hero h1 {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: 1px;
}
.detail-hero .meta { opacity: .85; margin-top: 10px; font-size: 14px; }

.gallery {
  padding: clamp(32px, 6vh, 56px) clamp(24px, 5vw, 64px);
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 28px;
}
.gallery img {
  width: 100%;
  border-radius: 12px;
  box-shadow: var(--shadow);
  cursor: zoom-in;
  background: #fff;
  transition: transform .3s, box-shadow .3s;
  animation: fadeIn .6s ease;
}
.gallery img:hover { transform: scale(1.02); box-shadow: var(--shadow-lg); }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* 资料下载 */
.download-section {
  padding: 8px clamp(24px, 5vw, 64px) 48px;
  max-width: 1440px;
  margin: 0 auto;
}
.download-section .section-title { margin-bottom: 20px; }
.download-list { list-style: none; }
.download-list li { margin-bottom: 12px; }
.download-list a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: var(--brand-2);
  font-size: 15px;
  font-weight: 500;
  transition: all .25s;
}
.download-list a:hover { border-color: var(--brand-2); box-shadow: var(--shadow); transform: translateY(-2px); }

/* ============================================================
   灯箱 Lightbox
   ============================================================ */
.lightbox {
  position: fixed; inset: 0;
  z-index: 1000;
  background: rgba(8, 16, 24, .92);
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .28s;
}
.lightbox.show { opacity: 1; visibility: visible; }

.lb-stage {
  max-width: 92vw;
  max-height: 86vh;
  text-align: center;
}
.lb-img {
  max-width: 92vw;
  max-height: 78vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.lb-caption {
  color: #cfd8e3;
  font-size: 13px;
  margin-top: 12px;
}

.lb-close {
  position: absolute; top: 18px; right: 22px;
  background: none; border: 0;
  color: #fff; font-size: 40px; line-height: 1;
  cursor: pointer; opacity: .8;
  transition: opacity .2s, transform .2s;
}
.lb-close:hover { opacity: 1; transform: rotate(90deg); }

.lb-prev, .lb-next {
  position: absolute; top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, .1);
  border: 0; color: #fff;
  font-size: 28px;
  width: 52px; height: 52px;
  border-radius: 50%;
  cursor: pointer;
  transition: background .2s;
}
.lb-prev { left: 20px; }
.lb-next { right: 20px; }
.lb-prev:hover, .lb-next:hover { background: rgba(255, 255, 255, .25); }

body.lb-open { overflow: hidden; }

/* ============================================================
   返回顶部
   ============================================================ */
#toTop {
  position: fixed;
  right: 26px; bottom: 30px;
  z-index: 200;
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 0;
  background: var(--brand-2);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(25, 113, 207, .4);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: all .3s;
}
#toTop.show { opacity: 1; visibility: visible; transform: none; }
#toTop:hover { background: var(--brand-1); }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 900px) {
  .nav-toggle { display: flex; }
  .nav ul {
    position: absolute;
    top: var(--nav-h); left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: rgba(4, 42, 58, .97);
    backdrop-filter: blur(10px);
    padding: 8px 24px 20px;
    box-shadow: 0 16px 30px rgba(0, 0, 0, .25);
    max-height: 0;
    overflow: hidden;
    transition: max-height .35s ease;
  }
  .nav ul.open { max-height: 420px; }
  .nav ul li { width: 100%; }
  .nav ul li a { display: block; padding: 14px 0; font-size: 17px; }
  .nav .cta { margin-top: 10px; text-align: center; }
}

@media (max-width: 768px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
  .card-cover { height: 170px; }
  .card-info { padding: 14px 16px; }
  .card-info h3 { font-size: 15px; }
  .card-info p { font-size: 12px; }
  .card-arrow { width: 28px; height: 28px; }
  .gallery { grid-template-columns: 1fr; gap: 20px; }
  .hero-badges { flex-wrap: wrap; }
  .hero-badges span { font-size: 12px; padding: 6px 14px; }
  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }
}