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

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

@media (hover: hover) {
  /* PC 端保留平滑滚动 */
  html {
    scroll-behavior: smooth;
  }
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  color: var(--color-text);
  background-color: transparent;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== 全局图片规则 ===== */
img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ★★★ 为所有内容图片预设宽高比，防止加载后高度突变导致滚动条跳跃 ★★★
   注意：必须配合 HTML 中的 width 和 height 属性才能生效，
   否则浏览器仍无法确定比例，建议在 <img> 上加上 width/height。 */
.value-path__content-image,
.influence__block-image,
.ai-explore__image,
.timeline-image,
.contact-image,
.project-card img,
.about-intro__badge,
.ai-avatar img,
.ai-trigger img {
  width: 100%;
  height: auto;
  aspect-ratio: attr(width) / attr(height); /* 优先使用 HTML 属性 */
  /* 若 HTML 未提供宽高，则使用以下后备比例（可根据实际图片比例调整） */
  /* 例如：aspect-ratio: 16 / 9; */
  /* 但为了通用，这里使用默认 auto，但那样不会预占位，所以强烈建议在 HTML 中添加宽高 */
}

/* 如果希望某些图片强制为特定比例，可单独覆盖，例如： */
/*
.value-path__content-image {
  aspect-ratio: 4 / 3;
}
*/

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

ul {
  list-style: none;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

.page-section {
  padding-block: var(--space-section-gap);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.field-tags__header .section-heading {
  margin-bottom: 0;
}

.section-heading__bar {
  flex-shrink: 0;
  width: 6px;
  height: 30px;
  background-color: var(--color-primary);
  border-radius: var(--radius-section-bar);
}

.section-heading__title {
  font-size: var(--font-size-section);
  font-weight: var(--font-weight-section);
  line-height: var(--line-height-section);
  color: var(--color-primary);
}

.section-heading__title--narrow {
  letter-spacing: 0;
}

/* ===== AI 助手面板 ===== */
.ai-trigger {
  position: fixed;
  right: 30px;
  bottom: 30px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 999;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
}
.ai-trigger img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.ai-trigger:hover {
  transform: rotate(-8deg) scale(1.05);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.15);
}

.ai-panel {
  position: fixed;
  right: 30px;
  bottom: 30px;
  width: 440px;
  height: 562px;
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid #3C8AFF;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  display: none;
  flex-direction: column;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
  animation: slideUp 0.3s ease;
  font-family: "PingFang SC", -apple-system, "Helvetica Neue", sans-serif;
}
.ai-panel.active {
  display: flex;
}

.ai-panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 50px;
  flex-shrink: 0;
  background: #ffffff;
  border-bottom: 1px solid #f0f0f0;
  z-index: 2;
}
.ai-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a !important;
  line-height: 1.2;
}
.ai-panel-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: #999;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.ai-panel-close:hover {
  color: #3C8AFF;
  background: rgba(60, 138, 255, 0.08);
}

.ai-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 16px 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ai-panel-profile {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 20px 0 20px;
  flex-shrink: 0;
}
.ai-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
}
.ai-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ai-profile-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ai-desc-line {
  font-size: 16px;
  color: #111 !important;
  line-height: 1.6;
  margin: 0;
}
.ai-desc-line .hi-tag {
  color: #3C8AFF !important;
  font-weight: 500;
  margin-right: 4px;
}

.ai-guide {
  font-size: 14px;
  font-weight: 400;
  color: #111111 !important;
  padding: 14px 20px 0 20px;
  flex-shrink: 0;
  line-height: 1.4;
}

.ai-panel-questions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 20px 0 20px;
  flex-shrink: 0;
}
.ai-q-btn {
  width: 100%;
  padding: 12px 18px;
  background: #f0f5ff;
  border: 1.5px solid #dce6ff;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 400;
  color: #111111 !important;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  text-align: left;
  line-height: 1.4;
}
.ai-q-btn:hover {
  background: #3c8aff;
  color: #ffffff !important;
  border-color: #3c8aff;
  transform: translateX(4px);
  box-shadow: 0 4px 14px rgba(60, 138, 255, 0.25);
}
.ai-q-btn:active {
  transform: scale(0.98);
}

.chat-container {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.message {
  max-width: 80%;
  padding: 12px;
  font-size: 14px;
  line-height: 20px;
  color: #111111;
  word-wrap: break-word;
  animation: fadeIn 0.3s ease;
}
.message.user {
  align-self: flex-end;
  background: rgba(253, 138, 37, 0.2);
  border-radius: 10px 10px 0 10px;
}
.message.ai {
  align-self: flex-start;
  background: #F5F5F5;
  border-radius: 10px 10px 10px 0;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: #F5F5F5;
  border-radius: 10px 10px 10px 0;
  align-self: flex-start;
  max-width: 80%;
}
.typing-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
  animation: pulse 1.4s infinite ease-in-out;
}
.typing-indicator .dot:nth-child(2) {
  animation-delay: 0.2s;
}
.typing-indicator .dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pulse {
  0%, 60%, 100% { transform: scale(0.8); opacity: 0.4; }
  30% { transform: scale(1.2); opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-panel-footer {
  flex-shrink: 0;
  width: 100%;
  padding: 12px 20px 16px 20px;
  background: rgba(231, 239, 251, 0.5);
  border-top: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
}

/* ★★★ 修改点 1：normal 状态 - 使用 border 替代 box-shadow ★★★ */
.ai-input-wrapper {
  position: relative;
  flex: 1;
  height: 44px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #F5F5F5;            /* 新增：normal 边框 */
  transition: border-color 0.2s ease;   /* 改为 border-color 过渡 */
  /* box-shadow 已移除 */
}

/* ★★★ 修改点 2：focus-within 状态 - 只改变边框颜色，无阴影 ★★★ */
.ai-input-wrapper:focus-within {
  border-color: #3C8AFF;                /* 聚焦时边框变蓝 */
  /* 原 box-shadow 已移除，无内阴影外阴影 */
}

.ai-panel-input {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
  padding: 0 50px 0 12px;
  font-family: "PingFang SC", -apple-system, "Helvetica Neue", sans-serif;
  font-size: 14px;
  color: #111 !important;
  line-height: 20px;
  outline: none;
  background: transparent;
}
.ai-panel-input::placeholder {
  color: rgba(17, 17, 17, 0.3) !important;
  font-weight: 400;
  font-size: 14px;
}
.ai-panel-input:hover {
  cursor: text;
}
.ai-panel-input:focus::placeholder {
  color: transparent;
}

.ai-panel-send {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ai-panel-send img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.ai-panel-send:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* ============================================================
   移动端适配
   ============================================================ */
@media (max-width: 768px) {
  /* ★★★ 滚动性能修复 ★★★ */
  body {
    -webkit-overflow-scrolling: touch; /* iOS 硬件加速 */
    overflow-y: auto; /* 明确垂直滚动 */
  }
}

@media (max-width: 520px) {
  .ai-panel {
    width: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
    right: 0;
    bottom: 0;
  }
  .ai-panel-body {
    padding: 0 0 12px 0;
  }
  .ai-title {
    font-size: 16px;
  }
  .ai-avatar {
    width: 40px;
    height: 40px;
  }
  .ai-desc-line {
    font-size: 13px;
  }
  .ai-q-btn {
    font-size: 13px;
    padding: 10px 16px;
  }
  .chat-container {
    padding: 10px 12px;
  }
  .ai-panel-footer {
    padding: 10px 16px 14px 16px;
  }
  .ai-input-wrapper {
    height: 40px;
  }
  .ai-panel-input {
    font-size: 13px;
    padding: 0 46px 0 12px;
  }
  .ai-panel-input::placeholder {
    font-size: 13px;
  }
  .ai-panel-send {
    right: 10px;
    width: 28px;
    height: 28px;
  }
  .ai-trigger {
    width: 64px;
    height: 64px;
    right: 16px;
    bottom: 16px;
  }
  .ai-panel-close {
    width: 28px;
    height: 28px;
    font-size: 18px;
  }
}