/* ==========================================================================
   华夏免费版官网 · 全站质感增强层 ui.css
   设计原则：保留暖米 + 青铜金主题，仅提升材质 / 层级 / 微动效（大厂克制风）
   覆盖策略：自定义类用 body 前缀提权，工具类用双类提权，变量用 html.light 提权
   ========================================================================== */

:root {
  --hx-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --hx-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- 1. 阴影体系：更柔、更透、近色环境阴影（不改动主题色相） ---------- */
html.light {
  --hx-shadow-1: 0 1px 2px rgba(60, 42, 26, 0.04), 0 2px 10px -3px rgba(60, 42, 26, 0.07);
  --hx-shadow-2: 0 3px 10px -2px rgba(60, 42, 26, 0.07), 0 14px 34px -10px rgba(60, 42, 26, 0.13);
  --hx-shadow-3: 0 6px 18px -4px rgba(60, 42, 26, 0.10), 0 30px 70px -18px rgba(60, 42, 26, 0.22);
}
html.dark {
  --hx-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.30), 0 2px 10px -3px rgba(0, 0, 0, 0.40);
  --hx-shadow-2: 0 3px 10px -2px rgba(0, 0, 0, 0.38), 0 14px 34px -10px rgba(0, 0, 0, 0.50);
  --hx-shadow-3: 0 6px 18px -4px rgba(0, 0, 0, 0.46), 0 30px 70px -18px rgba(0, 0, 0, 0.62);
}

/* body 前缀提权：页面底部内联 <style> 也能被覆盖 */
body .shadow-1 { box-shadow: var(--hx-shadow-1); }
body .shadow-2 { box-shadow: var(--hx-shadow-2); }
body .shadow-3 { box-shadow: var(--hx-shadow-3); }

/* ---------- 2. 环境氛围：极淡暖光铺底，消除区块割裂感 ---------- */
html.light body {
  background-image:
    radial-gradient(1100px 560px at 12% -8%, rgba(166, 124, 82, 0.07), transparent 62%),
    radial-gradient(960px 480px at 102% 2%, rgba(166, 124, 82, 0.055), transparent 58%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}
html.dark body {
  background-image:
    radial-gradient(1100px 560px at 12% -8%, rgba(200, 159, 116, 0.06), transparent 62%),
    radial-gradient(960px 480px at 102% 2%, rgba(200, 159, 116, 0.045), transparent 58%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}

/* ---------- 3. 全局细节：选区 / 焦点 / 滚动条 / 字体渲染 ---------- */
::selection {
  background: rgba(166, 124, 82, 0.20);
  color: inherit;
}
html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--hx-ring);
  outline-offset: 2px;
  border-radius: 6px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--hx-border);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--hx-muted-foreground);
  border: 3px solid transparent;
  background-clip: padding-box;
}

input, textarea, select {
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

/* ---------- 4. 导航栏：更强玻璃态 + 链接下划线滑入 ---------- */
nav.sticky {
  background-color: color-mix(in srgb, var(--hx-background) 80%, transparent) !important;
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  backdrop-filter: blur(18px) saturate(1.5);
}
nav a img { transition: transform 0.45s var(--hx-ease); }
nav a:hover img { transform: scale(1.04); }

@media (min-width: 1024px) {
  nav ul a[href]:not(.bg-primary) { position: relative; }
  nav ul a[href]:not(.bg-primary)::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 4px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--hx-primary), color-mix(in srgb, var(--hx-primary) 55%, transparent));
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.32s var(--hx-ease);
    pointer-events: none;
  }
  nav ul a[href]:not(.bg-primary):hover::after { transform: scaleX(1); }
}

/* ---------- 5. 主按钮：青铜金渐变 + 柔光 + 按压回弹（排除小标签 / 圆点） ---------- */
a.bg-primary,
button.bg-primary:not(.news-tab):not(.carousel-dot) {
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 46%),
    linear-gradient(135deg, #b7885c 0%, #a67c52 52%, #946b42 100%);
  box-shadow: 0 1px 2px rgba(60, 42, 26, 0.14), 0 8px 20px -8px rgba(166, 124, 82, 0.65);
  transition: transform 0.28s var(--hx-ease), box-shadow 0.28s var(--hx-ease), filter 0.28s ease, background-color 0.28s ease;
}
a.bg-primary:hover,
button.bg-primary:not(.news-tab):not(.carousel-dot):hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow: 0 2px 5px rgba(60, 42, 26, 0.16), 0 14px 30px -8px rgba(166, 124, 82, 0.7);
}
a.bg-primary:active,
button.bg-primary:not(.news-tab):not(.carousel-dot):active {
  transform: translateY(0) scale(0.98);
}
html.dark a.bg-primary,
html.dark button.bg-primary:not(.news-tab):not(.carousel-dot) {
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 48%),
    linear-gradient(135deg, #d7b187 0%, #c89f74 52%, #b38a5e 100%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 20px -8px rgba(200, 159, 116, 0.45);
}

/* ---------- 6. 可点击卡片：浮起 + 金边 + 箭头位移 ---------- */
a.shadow-1, a.shadow-2 {
  transition:
    transform 0.42s var(--hx-ease),
    box-shadow 0.42s var(--hx-ease),
    border-color 0.32s ease;
  will-change: transform;
}
a.shadow-1:hover, a.shadow-2:hover {
  transform: translateY(-4px);
  border-color: rgba(166, 124, 82, 0.45);
  box-shadow: var(--hx-shadow-3);
}
a.shadow-1:active, a.shadow-2:active { transform: translateY(-1px) scale(0.995); }

a [class*="chevron-right"] { transition: transform 0.32s var(--hx-ease); }
a:hover [class*="chevron-right"] { transform: translateX(4px); }

/* 左侧快捷面板：箭头轻推 */
aside li [class*="chevron-right"] { transition: transform 0.32s var(--hx-ease); }
aside li a:hover [class*="chevron-right"] { transform: translateX(4px); }

/* ---------- 7. 区块标题：短金色渐变装饰线 ---------- */
@media (min-width: 768px) {
  .text-center > h2 {
    letter-spacing: 0.01em;
    position: relative;
    display: inline-block;
  }
  .text-center > h2::after {
    content: "";
    display: block;
    width: 44px;
    height: 3px;
    margin: 14px auto 0;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, var(--hx-primary) 55%, transparent);
  }
}

/* ---------- 8. 新闻 / 列表行：文字滑入 ---------- */
#news-panels li a,
aside li a,
.faq-item,
.service-contact,
[class*="news-panel"] li a {
  transition-property: color, background-color, border-color, transform, box-shadow;
  transition-duration: 0.3s;
  transition-timing-function: var(--hx-ease);
}
#news-panels li a:hover { transform: translateX(3px); }
#news-panels li a { display: flex; }

/* 新闻标签切换 */
.news-tab { transition: background-color 0.28s ease, color 0.28s ease, transform 0.2s var(--hx-ease); }
.news-tab:active { transform: scale(0.95); }

/* ---------- 9. 轮播圆点：弹性指示 ---------- */
.carousel-dot { transition: width 0.4s var(--hx-ease-spring), background-color 0.3s ease, opacity 0.3s ease; }

/* ---------- 10. FAQ 手风琴：描边反馈 ---------- */
.faq-item { transition: border-color 0.3s ease, box-shadow 0.3s ease; }
.faq-item:hover { border-color: rgba(166, 124, 82, 0.4); }
.faq-item.is-open {
  border-color: rgba(166, 124, 82, 0.55);
  box-shadow: var(--hx-shadow-1);
}
.faq-chevron { transition: transform 0.35s var(--hx-ease); }

/* ---------- 11. 详情页排版升级 ---------- */
.article-body {
  font-size: 16px;
  line-height: 1.95;
  letter-spacing: 0.012em;
}
.article-body > p { margin: 0 0 1.2em; }
.article-body > p:first-child { margin-top: 0.4em; }
.article-body h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 1.8em 0 0.8em;
  padding-left: 12px;
  border-left: 3px solid var(--hx-primary);
  line-height: 1.5;
}
.article-body h3 {
  font-size: 1.12rem;
  font-weight: 600;
  margin: 1.6em 0 0.7em;
}
.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: var(--hx-shadow-2);
  margin: 16px 0;
}
.article-body a {
  color: var(--hx-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(166, 124, 82, 0.35);
  transition: text-decoration-color 0.25s ease, color 0.25s ease;
}
.article-body a:hover { text-decoration-color: var(--hx-primary); }
.article-body strong, .article-body b { font-weight: 700; }
.article-body table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 16px 0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--hx-shadow-1);
  font-size: 14.5px;
}
.article-body th {
  background: var(--hx-muted);
  font-weight: 600;
  white-space: nowrap;
}
.article-body th, .article-body td {
  border: 1px solid var(--hx-border);
  padding: 9px 13px;
  line-height: 1.7;
}
.article-body tr:nth-child(even) td { background: rgba(166, 124, 82, 0.045); }
.article-body ul, .article-body ol { margin: 0 0 1.2em; padding-left: 1.5em; }
.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }
.article-body li { margin-bottom: 0.45em; }
.article-body blockquote {
  margin: 16px 0;
  padding: 12px 18px;
  border-left: 3px solid var(--hx-primary);
  background: var(--hx-muted);
  border-radius: 0 10px 10px 0;
  color: var(--hx-muted-foreground);
}

/* 详情页大标题节奏 */
article > h1 { line-height: 1.4; letter-spacing: 0.01em; }

/* 面包屑 */
[aria-label="面包屑"] a { transition: color 0.25s ease; }
[aria-label="面包屑"] a:hover { color: var(--hx-primary); }

/* ---------- 12. 搜索结果 / 匹配高亮 ---------- */
.search-match {
  background: rgba(166, 124, 82, 0.14) !important;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

/* ---------- 13. 动效降级：尊重系统设置 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
