/* tslang 站点补充样式（原站内联 CSS 已完整保留，这里只加中文站交互与细节修正） */

/* ---------- 搜索浮层 ---------- */
#tslang-search[hidden] { display: none !important; }
#tslang-search {
  position: fixed;
  inset: 0;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}
.tslang-search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 40, 66, 0.55);
  backdrop-filter: blur(2px);
}
.tslang-search-panel {
  position: relative;
  margin: 8vh auto 0;
  width: min(760px, calc(100vw - 32px));
  max-height: 76vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  color: #222;
}
.tslang-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid #e5e5e5;
  color: #3178c6;
}
.tslang-search-box input {
  flex: 1;
  border: 0;
  outline: 0;
  font-size: 17px;
  color: #222;
  background: transparent;
}
.tslang-search-box kbd {
  border: 1px solid #d0d7de;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  color: #666;
  background: #f6f8fa;
}
#tslang-search-results {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
}
#tslang-search-results li a {
  display: block;
  padding: 10px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: #222;
}
#tslang-search-results li a:hover,
#tslang-search-results li a:focus {
  background: #eef4fb;
}
.tslang-search-title { display: block; font-weight: 600; color: #1c4f8f; }
.tslang-search-snippet { display: block; font-size: 13px; color: #555; margin-top: 3px; line-height: 1.45; }
.tslang-search-hint { padding: 18px; color: #777; font-size: 14px; list-style: none; }
.tslang-search-empty { padding: 24px; text-align: center; color: #777; }
html.tslang-search-open, body.tslang-search-open { overflow: hidden; }

/* ---------- 代码复制按钮 ---------- */
pre.shiki { position: relative; }
.tslang-copy {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  padding: 3px 10px;
  font-size: 12px;
  line-height: 1.6;
  color: #fff;
  background: #3178c6;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
  font-family: inherit;
}
pre.shiki:hover .tslang-copy,
.tslang-copy:focus { opacity: 1; }
.tslang-copy-done { background: #16a34a; }
@media (hover: none) { .tslang-copy { opacity: 1; } }

/* ---------- 移动端侧栏 ---------- */
/* 官网用 #sidebar.show 控制抽屉（margin-left: -800px -> 0 + visibility），这里只补 body 滚动锁 */
@media (max-width: 800px) {
  body.tslang-sidebar-lock { overflow: hidden; }
}

/* ---------- 文档正文细节 ---------- */
#handbook-content .markdown h2 { border-bottom: 0; }
#handbook-content .markdown table { border-collapse: collapse; width: 100%; margin: 1rem 0; }
#handbook-content .markdown table th,
#handbook-content .markdown table td { border: 1px solid var(--border-color, #e3e3e3); padding: 6px 10px; }
#handbook-content .markdown table th { background: var(--inline-code-background-color, #f2f2f2); text-align: left; }
#handbook-content .markdown img { max-width: 100%; height: auto; }

/* 站内搜索页（无结果时） */
body.tslang-notice { padding: 2rem; font-family: system-ui, sans-serif; }

/* 代码示例 data-lsp 悬浮类型提示 */
.tslang-lsp {
  position: fixed;
  z-index: 100000;
  max-width: min(560px, calc(100vw - 16px));
  padding: 6px 10px;
  border: 1px solid #c8c8c8;
  border-radius: 3px;
  background: #fff;
  color: #111;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  font-family: var(--code-font, Menlo, Monaco, Consolas, monospace);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  pointer-events: none;
}
html.dark-theme .tslang-lsp {
  background: #1f1f1f;
  color: #f2f2f2;
  border-color: #555;
}
[lsp], data-lsp { border-bottom: solid 2px transparent; }
[lsp]:hover, data-lsp:hover { border-bottom-color: lightgrey; }

/* 首页用户评价轮播：非当前页隐藏（JS 未加载时也只显示第一页） */
#m-stories .slides > * { transition: opacity 0.2s ease; }

/* 首页「逐步采用」滚动分步：隐藏每步自带标题，改用顶部 blurb */
#index-2 #adopt-gradually-content.fancy-scroll .adopt-step > .adopt-step-content > p { display: none; }
#index-2 #adopt-gradually-content.fancy-scroll .adopt-step { transition: opacity 0.25s ease; }
#index-2 #adopt-gradually-content.fancy-scroll #adopt-step-blurb { font-weight: 600; text-align: center; }
#index-2 .next-headline-button.playing svg { transform: scale(0.75); }

/* 翻译署名 */
#handbook-content .tslang-attribution a { color: #3178c6; }

/* 首页 Hero：Try TypeScript Now 选择面板 */
#index-2 > .blue.headline > .container > .cta { display: none; }
#index-2 > .blue.headline > .container.tslang-cta-open > .cta { display: block; }
#index-2 > .blue.headline > .container.tslang-cta-open > *:not(.cta) { display: none !important; }

/* 移动端 CTA：避免返回按钮与标题重叠（官方移动端是另一套媒体浏览布局，这里做响应式降级） */
@media (max-width: 800px) {
  #index-2 > .blue.headline > .container > .cta { padding-bottom: 2rem; }
  #index-2 > .blue.headline > .container > .cta .transparent-button {
    position: static;
    display: inline-flex;
    margin: 1rem 1rem 0.5rem;
  }
  #index-2 > .blue.headline > .container > .cta h2 {
    padding: 0 1rem;
    font-size: 2rem;
    line-height: 1.3;
  }
  #index-2 > .blue.headline > .container > .cta .cta-redirects { padding: 0 1rem; }
  #index-2 > .blue.headline > .container > .cta .call-to-action { width: 100%; }
}

/* 页脚链接过长时避免互相重叠 */
#site-footer ul li { overflow-wrap: anywhere; }
#site-footer ul li a { display: inline-block; max-width: 100%; }

/* 页脚免责声明 */
.tslang-disclaimer {
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  margin-top: 1.5rem;
  padding: 1rem 1rem 1.5rem;
  text-align: center;
  font-size: 12px;
  line-height: 1.7;
  color: #e6f0fa;
}
.tslang-disclaimer p { margin: 0; }
.tslang-disclaimer a { color: #fff; text-decoration: underline; }
@media (max-width: 800px) {
  .tslang-disclaimer { padding-bottom: 2rem; }
}
