 .pagefind-ui {
    --pagefind-ui-scale: 0.75;
    --pagefind-ui-primary: #ff8c00 ;
    --pagefind-ui-text: black;
    --pagefind-ui-border: slategrey;
    --pagefind-ui-border-width: 1px;
    --pagefind-ui-border-radius: 0.25rem;
    --pagefind-ui-font: sans-serif;

    width: 50%;
    transition: width 0.25s ease, transform 0.25s ease;
  }
    /* 聚焦到搜索框或者搜索框文字时生效 */
.pagefind-ui.expanded {
    width: 86%;
    transform: translateX(-18%);
}

/* 给结果标题和摘要里的高亮文字加下划线 */
.pagefind-ui .pagefind-ui__result-link mark,
.pagefind-ui .pagefind-ui__result-excerpt mark,
.pagefind-ui .pagefind-ui__highlight {
  background-color: transparent !important;
  color: #ff8c00          !important;
  text-decoration: underline;            /* 加下划线 */
  text-decoration-color: #ff8c00;        /* 下划线颜色跟文字一致 */
}
  .pagefind-ui .pagefind-ui__drawer:not(.pagefind-ui__hidden) {
    position: absolute;
    left: 0;
    right: 0;
    margin-top: 0px;
    z-index: 9999;
    padding: 0 2em 1em;
    box-shadow:
      0 10px 10px -5px rgba(0, 0, 0, 0.2),
      0 2px 2px 0 rgba(0, 0, 0, 0.1);
    border-bottom-right-radius: var(--pagefind-ui-border-radius);
    border-bottom-left-radius: var(--pagefind-ui-border-radius);
    background-color: var(--pagefind-ui-background);

    max-height: 75vh;       /* 最多占视口高度的75% */
    overflow-y: auto;       /* 超出时显示滚动条 */
  }

  /* （可选）给滚动条加点样式 */
.pagefind-ui .pagefind-ui__drawer:not(.pagefind-ui__hidden)::-webkit-scrollbar {
  width: 8px;
}
.pagefind-ui .pagefind-ui__drawer:not(.pagefind-ui__hidden)::-webkit-scrollbar-thumb {
  background: var(--pagefind-ui-border);
  border-radius: 4px;
}

  .pagefind-ui .pagefind-ui__result-link {
    color: var(--pagefind-ui-primary);
  }

  .pagefind-ui .pagefind-ui__result-excerpt {
    color: var(--pagefind-ui-text);
  }

/* 桌面端默认隐藏手机搜索相关元素 */
 .search-icon-btn { 
  display: none; 
}

 .mobile-search-overlay {
  display: none;
}  

/* 手机端搜索*/
@media (max-width: 768px) {
  /* 移动端，隐藏原来的 inline Search */
  .nav-right .pagefind-ui { display: none; }
  /* 只显示图标按钮 */
  .search-icon-btn { display: inline-flex; }

  /* 全屏搜索遮罩层 - 添加滑入动画 */
  .mobile-search-overlay {
    display: block;

    position: fixed;
    inset: 0;
    background: var(--bg-color);
    z-index: 2000;
    padding: 0;
    box-sizing: border-box;
    
    /* 确保完全覆盖 */
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    
    /* 初始状态：从右上角缩放为0，不可见 */
    transform: scale(0);
    transform-origin: top right;
    opacity: 0;
    visibility: hidden;
    
    /* 动画过渡效果 - 设置较慢的动画便于观察 */
    transition: 
      transform 0.8s cubic-bezier(0.25, 0.8, 0.25, 1),
      opacity 0.8s ease,
      visibility 0.8s ease;
  }
  
  /* 激活状态：完全展开到全屏 */
  body.mobile-search-active .mobile-search-overlay {
    transform: scale(1);
    opacity: 1;
    visibility: visible;
  }
  
  /* 顶部搜索栏区域 - 水平布局 */
  .mobile-search-header {
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem;
    background: var(--bg-color);
    border-bottom: 1px solid var(--divider-color);
    gap: 1rem;
    flex-shrink: 0;
    height: 46.19px;
    box-sizing: border-box;
    
    /* 添加头部区域的动画延迟 */
    transform: translateY(-20px);
    opacity: 0;
    transition: 
      transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) 0.2s,
      opacity 0.6s ease 0.2s;
  }
  
  /* 激活状态下的头部动画 */
  body.mobile-search-active .mobile-search-header {
    transform: translateY(0);
    opacity: 1;
  }
  
  /* 返回按钮样式 */
  .search-back-btn {
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--text-color);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: auto;
    height: auto;
    
    /* 添加按钮的动画效果 */
    transform: translateX(-20px);
    opacity: 0;
    transition: 
      transform 0.5s cubic-bezier(0.25, 0.8, 0.25, 1) 0.4s,
      opacity 0.5s ease 0.4s;
  }
  
  /* 激活状态下的返回按钮 */
  body.mobile-search-active .search-back-btn {
    transform: translateX(0);
    opacity: 1;
  }
  
  /* 搜索容器占满剩余空间 */
  .mobile-search-container {
    flex: 1;
    position: relative;
    overflow: visible;
    margin-bottom: 4px;
    
    /* 添加搜索框的动画效果 */
    transform: translateX(20px);
    opacity: 0;
    transition: 
      transform 0.5s cubic-bezier(0.25, 0.8, 0.25, 1) 0.3s,
      opacity 0.5s ease 0.3s;
  }
  
  /* 激活状态下的搜索容器 */
  body.mobile-search-active .mobile-search-container {
    transform: translateX(0);
    opacity: 1;
  }
  
  /* 搜索结果区域 */
  .mobile-search-results {
    flex: 1;
    overflow-y: auto;
    padding: 0;  /* 移除默认padding，避免显示空白区域 */
    background: var(--bg-color);
    border: none;  /* 确保没有边框 */
    
    /* 添加结果区域的动画效果 */
    transform: translateY(20px);
    opacity: 0;
    transition: 
      transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) 0.5s,
      opacity 0.6s ease 0.5s;
  }
  
  /* 激活状态下的搜索结果 */
  body.mobile-search-active .mobile-search-results {
    transform: translateY(0);
    opacity: 1;
  }
  
  /* 覆盖层的 Search 占满全宽 */
  .mobile-search-overlay .pagefind-ui {
    width: 100% !important;
    --pagefind-ui-scale: 0.75;
  }
  
  /* 搜索结果抽屉样式调整 */
  .mobile-search-overlay .pagefind-ui .pagefind-ui__drawer:not(.pagefind-ui__hidden) {
    position: absolute !important;
    top: calc(100% + 4px) !important;
    left: 0 !important;
    right: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    padding: 1rem !important;
    max-height: calc(100vh - 100px) !important;
    overflow-y: auto !important;
    box-shadow: none !important;
    background: var(--bg-color) !important;
    border: none !important;
    z-index: 1000;
    
    /* 添加抽屉的动画效果 */
    transform: translateY(-10px);
    opacity: 0;
    transition: 
      transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) 0.6s,
      opacity 0.4s ease 0.6s;
  }
  
  /* 激活状态下的搜索抽屉 */
  body.mobile-search-active .mobile-search-overlay .pagefind-ui .pagefind-ui__drawer:not(.pagefind-ui__hidden) {
    transform: translateY(0);
    opacity: 1;
  }
  
  /* 搜索输入框样式 */
  .mobile-search-overlay .pagefind-ui .pagefind-ui__form {
    background: var(--bg-color);
    border: 1px solid var(--divider-color);
    border-radius: 0.5rem;
    margin: 0;
    height: auto;
    position: relative;
    display: flex;
    align-items: center;
  }
  
  /* 隐藏搜索图标 */
  .mobile-search-overlay .pagefind-ui .pagefind-ui__search-input::before,
  .mobile-search-overlay .pagefind-ui .pagefind-ui__search-input::after {
    display: none !important;
  }
  
  /* 隐藏 Pagefind 默认的搜索图标 */
  .mobile-search-overlay .pagefind-ui .pagefind-ui__form::before,
  .mobile-search-overlay .pagefind-ui .pagefind-ui__form::after {
    display: none !important;
  }
  
  /* 更强制地隐藏搜索图标 */
  .mobile-search-overlay .pagefind-ui [data-pagefind-ui-search-icon] {
    display: none !important;
  }
  
  /* 隐藏可能存在的其他搜索相关图标 */
  .mobile-search-overlay .pagefind-ui svg {
    display: none !important;
  }
  
  /* 清除按钮样式*/
  .mobile-search-overlay .pagefind-ui .pagefind-ui__search-clear {
    position: absolute !important;
    right: 0.5rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: none !important;
    border: none !important;
    color: var(--text-color) !important;
    cursor: pointer !important;
    padding: 0.25rem !important;
    font-size: 1rem !important;
    z-index: 10 !important;
  }
  
  /* 确保搜索输入框高度合适 */
  .mobile-search-overlay .pagefind-ui .pagefind-ui__search-input {
    height: 32px;
    padding: 0.25rem 2.5rem 0.25rem 1rem;
    font-size: 1rem;
    border: none;
    background: transparent;
    color: var(--text-color);
    width: 100%;
    flex: 1;
  }
  
  /* 搜索结果项样式 */
  .mobile-search-overlay .pagefind-ui .pagefind-ui__result {
    border-bottom: 1px solid var(--divider-color);
    padding: 1rem 0;
    margin: 0;
    
    /* 添加结果项的动画效果 */
    transform: translateY(10px);
    opacity: 0;
    animation: slideInResult 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
  }
  
  .mobile-search-overlay .pagefind-ui .pagefind-ui__result:last-child {
    border-bottom: none;
  }
  
  /* 搜索结果项的动画关键帧 */
  @keyframes slideInResult {
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
  
  /* 为不同的结果项添加不同的动画延迟 */
  .mobile-search-overlay .pagefind-ui .pagefind-ui__result:nth-child(1) {
    animation-delay: 0.1s;
  }
  
  .mobile-search-overlay .pagefind-ui .pagefind-ui__result:nth-child(2) {
    animation-delay: 0.2s;
  }
  
  .mobile-search-overlay .pagefind-ui .pagefind-ui__result:nth-child(3) {
    animation-delay: 0.3s;
  }
  
  .mobile-search-overlay .pagefind-ui .pagefind-ui__result:nth-child(4) {
    animation-delay: 0.4s;
  }
  
  .mobile-search-overlay .pagefind-ui .pagefind-ui__result:nth-child(5) {
    animation-delay: 0.5s;
  }
}