/* ==========================================================================
   有道翻译 官方网站 - style.css
   移动端优先；断点 768px / 1024px
   ========================================================================== */

:root {
  --c-primary: #052953;
  --c-primary-light: #007cc2;
  --c-accent: #f60;
  --c-text: #1a1a1a;
  --c-text-muted: #666;
  --c-text-faint: #999;
  --c-bg: #fff;
  --c-bg-alt: #f5f7fa;
  --c-border: #e6eaf0;
  --radius-card: 12px;
  --radius-btn: 8px;
  --radius-pill: 999px;
  --shadow-card: 0 2px 10px rgba(5, 41, 83, .06);
  --shadow-card-hover: 0 10px 28px rgba(5, 41, 83, .12);
  --font: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  --header-h: 56px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  color: var(--c-text);
  background: var(--c-bg);
}

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

a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-light); }

h1, h2, h3, h4 { margin: 0; color: var(--c-primary); line-height: 1.35; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 22px; font-weight: 600; }
h3 { font-size: 18px; font-weight: 600; color: var(--c-text); }
p { margin: 0; }

ul, ol { margin: 0; padding: 0; list-style: none; }

:focus-visible { outline: 2px solid var(--c-primary-light); outline-offset: 2px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 容器 / 区块 ---------- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.section { padding: 48px 0; }
.section--alt { background: var(--c-bg-alt); }

.section-head { text-align: center; max-width: 760px; margin: 0 auto 28px; }
.section-head p { margin-top: 10px; color: var(--c-text-muted); font-size: 14px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-btn);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s, transform .2s;
}
.btn:active { transform: translateY(1px); }

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

.btn-ghost { background: transparent; color: var(--c-primary); border-color: #cfd8e3; }
.btn-ghost:hover { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }

.btn-light { background: #fff; color: var(--c-primary); }
.btn-light:hover { background: #eaf2fa; color: var(--c-primary); }

.btn-outline-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .55); }
.btn-outline-light:hover { background: #fff; color: var(--c-primary); }

.btn-sm { padding: 8px 18px; font-size: 14px; }

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid transparent;
  transition: box-shadow .25s, border-color .25s;
}
.site-header.is-scrolled {
  box-shadow: 0 4px 16px rgba(5, 41, 83, .10);
  border-bottom-color: var(--c-border);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1200px;
  min-height: var(--header-h);
  margin: 0 auto;
  padding: 0 16px;
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 17px; font-weight: 700; color: var(--c-primary); }
.brand-sub { font-size: 11px; color: var(--c-text-faint); letter-spacing: .5px; }

.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0 9px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-btn);
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--c-primary);
  border-radius: 2px;
  transition: transform .25s, opacity .25s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-menu { display: flex; flex-direction: column; gap: 2px; }
.nav-menu a {
  display: block;
  padding: 10px 10px;
  font-size: 15px;
  font-weight: 700;
  color: #000;
  border-radius: var(--radius-btn);
}
.nav-menu a:hover { color: var(--c-primary); background: var(--c-bg-alt); }
.nav-menu a[aria-current="page"] { color: var(--c-primary); }

.nav-cta { display: none; }

/* 移动端抽屉：JS 可用时默认折叠 */
.js .nav-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  max-height: 0;
  overflow: hidden;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid var(--c-border);
  box-shadow: 0 12px 24px rgba(5, 41, 83, .10);
  transition: max-height .28s ease, padding .28s ease;
}
.js .nav-menu.is-open {
  max-height: 420px;
  padding: 8px 16px 16px;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 48px 0;
  color: #fff;
  background: radial-gradient(circle at 82% 12%, #0a3f77 0%, #052953 52%, #031d3b 100%);
}
.hero::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -160px;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: rgba(0, 124, 194, .28);
  filter: blur(10px);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; display: grid; gap: 32px; }
.hero h1 { color: #fff; }
.hero h1 .accent { color: #ffb27a; }
.hero-lead { margin-top: 14px; font-size: 15px; color: rgba(255, 255, 255, .82); max-width: 620px; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  margin: 24px 0;
  padding: 0;
}
.hero-stats li { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 20px; color: #fff; font-weight: 700; }
.hero-stats span { font-size: 13px; color: rgba(255, 255, 255, .68); }

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

/* ---------- 翻译面板模拟 UI（纯 CSS） ---------- */
.translator {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, .28);
  color: var(--c-text);
}
.translator-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.translator-tabs span {
  flex: 1;
  padding: 8px 4px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--c-text-muted);
  background: var(--c-bg-alt);
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.translator-tabs span.is-active { background: var(--c-primary); color: #fff; }

.translator-langs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 2px 12px;
  font-size: 13px;
  color: var(--c-text-muted);
  border-bottom: 1px dashed var(--c-border);
}
.translator-langs strong { color: var(--c-primary); font-size: 13px; }
.lang-swap { color: var(--c-primary-light); font-size: 15px; }

.translator-source {
  margin: 14px 0 10px;
  padding: 12px 14px;
  min-height: 74px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg-alt);
  border-radius: var(--radius-btn);
}
.translator-source .placeholder { color: var(--c-text-faint); }
.translator-caret {
  display: inline-block;
  width: 1px;
  height: 16px;
  margin-left: 2px;
  vertical-align: -3px;
  background: var(--c-primary-light);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.translator-result {
  padding: 14px;
  border: 1px solid #dbe6f2;
  border-radius: var(--radius-btn);
  background: #f8fbff;
}
.translator-result .tag {
  display: inline-block;
  padding: 2px 10px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--c-primary);
  background: rgba(0, 124, 194, .12);
  border-radius: var(--radius-pill);
}
.translator-result strong { display: block; font-size: 20px; color: var(--c-primary); font-weight: 700; }
.translator-result em { font-style: normal; font-size: 13px; color: var(--c-text-muted); }

.translator-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.translator-actions span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--c-text-muted);
  background: var(--c-bg-alt);
  border-radius: var(--radius-pill);
}
.translator-actions span.is-on { color: var(--c-accent); background: rgba(255, 102, 0, .10); }

.translator-progress {
  margin-top: 14px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: #e8eef6;
  overflow: hidden;
}
.translator-progress i {
  display: block;
  width: 68%;
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--c-primary-light), #35b6f3);
}

/* ---------- 公告条 ---------- */
.notice {
  background: #eef4fa;
  border-left: 4px solid var(--c-accent);
}
.notice .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding-top: 12px;
  padding-bottom: 12px;
}
.notice-badge {
  flex: 0 0 auto;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--c-accent);
  border-radius: var(--radius-pill);
}
.notice h2 {
  flex: 1 1 100%;
  font-size: 14px;
  font-weight: 600;
  color: var(--c-primary);
  line-height: 1.6;
}
.notice-link { font-size: 13px; font-weight: 600; color: var(--c-primary); white-space: nowrap; }

/* ---------- 功能卡片 ---------- */
.grid { display: grid; gap: 16px; }

.feature-card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: var(--c-bg-alt);
  border: 1px solid transparent;
  border-radius: var(--radius-card);
  transition: transform .2s, box-shadow .2s, background-color .2s;
}
.feature-card:hover {
  transform: translateY(-3px);
  background: #fff;
  border-color: var(--c-border);
  box-shadow: var(--shadow-card-hover);
}
.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 12px;
  font-size: 22px;
  background: rgba(0, 124, 194, .12);
  border-radius: 10px;
}
.feature-card h3 { margin-bottom: 6px; }
.feature-card p { color: var(--c-text-muted); font-size: 14px; }
.card-link {
  margin-top: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--c-primary-light);
}

/* ---------- 对比表 ---------- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-card);
  border: 1px solid var(--c-border);
  background: #fff;
}
.compare-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 14px;
}
.compare-table th,
.compare-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
.compare-table thead th {
  font-size: 14px;
  font-weight: 700;
  color: var(--c-primary);
  background: var(--c-bg-alt);
}
.compare-table thead th:first-child { background: var(--c-primary); color: #fff; }
.compare-table tbody th {
  font-weight: 600;
  color: var(--c-primary);
  background: var(--c-bg-alt);
}
.compare-table tbody tr:nth-child(even) td { background: #fbfcfe; }
.compare-table .is-self { color: var(--c-accent); font-weight: 700; }
.table-hint { margin-top: 10px; font-size: 12px; color: var(--c-text-faint); }

/* ---------- 资讯卡片 ---------- */
.news-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  transition: transform .2s, box-shadow .2s;
}
.news-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card-hover); }
.news-thumb {
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  background: linear-gradient(135deg, #052953, #007cc2);
  color: #fff;
}
.news-body { display: flex; flex-direction: column; flex: 1; padding: 16px; }
.news-meta { font-size: 12px; color: var(--c-text-faint); margin-bottom: 6px; }
.news-body h3 { font-size: 17px; margin-bottom: 6px; }
.news-body h3 a { color: var(--c-text); }
.news-body h3 a:hover { color: var(--c-primary-light); }
.news-body p { font-size: 14px; color: var(--c-text-muted); }
.news-body .card-link { margin-top: auto; padding-top: 12px; }

/* ---------- 评价卡片 ---------- */
.review-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  background: var(--c-bg-alt);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.stars { color: var(--c-accent); letter-spacing: 2px; font-size: 15px; }
.review-card blockquote {
  margin: 0;
  font-size: 14px;
  line-height: 1.75;
  color: var(--c-text);
}
.review-user { display: flex; align-items: center; gap: 10px; margin-top: auto; }
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: var(--c-primary-light);
  border-radius: 50%;
}
.review-user b { display: block; font-size: 14px; color: var(--c-text); }
.review-user small { font-size: 12px; color: var(--c-text-faint); }

/* ---------- FAQ ---------- */
.faq { max-width: 840px; margin: 0 auto; display: grid; gap: 12px; }
.faq-item {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  font-size: 15px;
  font-weight: 700;
  color: var(--c-primary);
  cursor: pointer;
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--c-primary); }
.faq-item summary::after {
  content: "+";
  flex: 0 0 auto;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  color: var(--c-primary-light);
  transition: transform .2s;
}
.faq-item[open] summary::after { content: "–"; }
.faq-item .faq-answer { padding: 0 18px 16px; font-size: 14px; color: var(--c-text-muted); }

/* ---------- 底部 CTA ---------- */
.cta-banner {
  padding: 48px 0;
  color: #fff;
  background: linear-gradient(120deg, #052953, #0a4a86 60%, #007cc2);
  text-align: center;
}
.cta-banner h2 { color: #fff; }
.cta-banner p { margin-top: 10px; color: rgba(255, 255, 255, .82); font-size: 14px; }
.cta-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
}

/* ---------- Footer ---------- */
.site-footer { background: var(--c-primary); color: rgba(255, 255, 255, .72); padding: 40px 0 0; }
.footer-grid { display: grid; gap: 28px; }
.footer-brand img { width: 36px; height: 36px; border-radius: 8px; }
.footer-brand .brand-name { color: #fff; }
.footer-brand p { margin-top: 12px; font-size: 13px; color: rgba(255, 255, 255, .62); max-width: 260px; }
.footer-col h3 { font-size: 14px; color: #fff; margin-bottom: 12px; }
.footer-col ul { display: grid; gap: 8px; }
.footer-col a { font-size: 13px; color: rgba(255, 255, 255, .72); }
.footer-col a:hover { color: #fff; }
.socials { display: flex; gap: 10px; }
.socials span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  font-size: 15px;
  color: #fff;
  background: rgba(255, 255, 255, .12);
  border-radius: 50%;
}
.copyright {
  margin-top: 32px;
  padding: 16px 0;
  font-size: 12px;
  text-align: center;
  color: rgba(255, 255, 255, .55);
  border-top: 1px solid rgba(255, 255, 255, .14);
}

/* ---------- 子页面通用 ---------- */
.page-hero {
  padding: 40px 0;
  color: #fff;
  background: linear-gradient(120deg, #052953, #0a4a86 70%, #007cc2);
}
.page-hero h1 { color: #fff; font-size: 26px; }
.page-hero p { margin-top: 10px; font-size: 14px; color: rgba(255, 255, 255, .82); max-width: 720px; }
.breadcrumb { margin-bottom: 12px; font-size: 12px; color: rgba(255, 255, 255, .68); }
.breadcrumb a { color: rgba(255, 255, 255, .88); }
.breadcrumb span { margin: 0 6px; }

.article { max-width: 820px; margin: 0 auto; }
.article h2 { font-size: 20px; margin: 28px 0 10px; }
.article h3 { font-size: 17px; margin: 22px 0 8px; }
.article p { margin-bottom: 12px; color: #333; font-size: 15px; }
.article ul { display: grid; gap: 8px; margin: 0 0 14px; padding-left: 0; }
.article ul li {
  position: relative;
  padding-left: 18px;
  font-size: 15px;
  color: #333;
}
.article ul li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 11px;
  width: 6px;
  height: 6px;
  background: var(--c-primary-light);
  border-radius: 50%;
}
.article-meta { font-size: 13px; color: var(--c-text-faint); margin-bottom: 18px; }
.article-note {
  margin: 22px 0;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--c-primary);
  background: #eef4fa;
  border-left: 3px solid var(--c-primary-light);
  border-radius: 0 var(--radius-btn) var(--radius-btn) 0;
}
.back-link { display: inline-block; margin-top: 24px; font-size: 14px; font-weight: 600; }

.list-cards { display: grid; gap: 16px; }
.download-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}
.download-card h2 { font-size: 17px; }
.download-card p { font-size: 13px; color: var(--c-text-muted); margin-top: 4px; }

/* ---------- 响应式：768px ---------- */
@media (min-width: 768px) {
  body { font-size: 16px; }
  h1 { font-size: 34px; }
  h2 { font-size: 25px; }
  h3 { font-size: 19px; }
  .container { padding: 0 24px; }
  .section { padding: 64px 0; }
  .hero { padding: 72px 0; }
  .hero-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid { gap: 20px; }
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature-card { padding: 24px; }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-hero { padding: 56px 0; }
  .page-hero h1 { font-size: 32px; }
}

/* ---------- 响应式：1024px ---------- */
@media (min-width: 1024px) {
  h1 { font-size: 40px; }
  h2 { font-size: 28px; }
  h3 { font-size: 20px; }
  .section { padding: 88px 0; }
  .hero { padding: 96px 0; }
  .hero-inner { grid-template-columns: 58% 42%; align-items: center; gap: 40px; }
  .hero-stats strong { font-size: 24px; }

  /* 导航完整展开 */
  .nav-toggle { display: none; }
  .js .nav-menu,
  .nav-menu {
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    max-height: none;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    overflow: visible;
  }
  .js .nav-menu.is-open { padding: 0; }
  .nav-menu a { padding: 8px 10px; font-size: 15.5px; }
  .nav-menu a:hover { background: transparent; }
  .nav-cta { display: inline-flex; }

  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid { gap: 24px; }
  .feature-card { padding: 28px; }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
  .nav-container { padding: 0 24px; }
  .translator { padding: 20px; }
  .translator-result strong { font-size: 22px; }
}
