/* ==========================================================================
   claudechat.club · 质感层（Polish）
   --------------------------------------------------------------------------
   参考 console.modelgo.ai 的视觉系统提炼出来的高价值细节：
     1. 分层大标题（上部细、下部实）—— 比单一字重更有层次
     2. 卡片顶部 1px 高光（模拟玻璃边缘受光）
     3. 分段控件（segmented）—— ModelGo 的 tab 切换样式
     4. 统计数字用等宽字 + 字距收紧，读起来更"数据"
     5. 焦点环统一成主色 4px 柔光
   只做叠加增强，不覆盖任何布局规则。
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 分层大标题
   用法：<h1 class="display"><span class="display-top">前半句</span>
         <span class="display-em">加重部分</span></h1>
   -------------------------------------------------------------------------- */
.display {
  font-size: var(--fs-hero);
  line-height: var(--lh-tight);
  letter-spacing: -.035em;
  font-weight: 600;
  font-feature-settings: "ss01", "cv11";
}

.display .display-top {
  display: block;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: -.028em;
}

.display .display-em {
  display: block;
  font-weight: 650;
  color: var(--ink);
  letter-spacing: -.04em;
}

/* 主色渐变字：只用在关键词上，整段用会廉价 */
.grad-text {
  background: linear-gradient(
    118deg,
    color-mix(in oklab, var(--accent) 92%, #fff) 0%,
    var(--accent) 46%,
    var(--accent-text) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* --------------------------------------------------------------------------
   2. 玻璃卡片顶部高光
   ModelGo 的 tile 有一道能看出来的上边缘受光线
   -------------------------------------------------------------------------- */
.glass-edge {
  position: relative;
}

.glass-edge::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, #fff 55%, transparent) 22%,
    color-mix(in srgb, #fff 70%, transparent) 50%,
    color-mix(in srgb, #fff 55%, transparent) 78%,
    transparent
  );
  pointer-events: none;
  opacity: .8;
}

[data-theme="night"] .glass-edge::before { opacity: .22; }

/* hover 时一道扫光从左到右掠过（只对可点卡片） */
.sheen {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.sheen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(
    105deg,
    transparent 32%,
    color-mix(in srgb, #fff 22%, transparent) 48%,
    transparent 64%
  );
  transform: translateX(-110%);
  transition: transform .68s var(--ease-emphasized);
  pointer-events: none;
}

.sheen:hover::after { transform: translateX(110%); }

/* --------------------------------------------------------------------------
   3. 分段控件（segmented control）
   ModelGo 用 13px 圆角 + 内嵌白色滑块 + 1px 阴影
   -------------------------------------------------------------------------- */
.segmented {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-control);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.segmented > button,
.segmented > a {
  position: relative;
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-muted);
  padding: 7px 15px;
  border-radius: 10px;
  cursor: pointer;
  transition: color var(--dur-base) var(--ease-emphasized),
              background var(--dur-base) var(--ease-emphasized),
              box-shadow var(--dur-base) var(--ease-emphasized);
}

.segmented > button:hover,
.segmented > a:hover { color: var(--ink); }

.segmented > [aria-selected="true"],
.segmented > .is-active {
  background: var(--page);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px #0000000f, 0 1px 3px #0000000d;
}

/* --------------------------------------------------------------------------
   4. 数据数字
   -------------------------------------------------------------------------- */
.stat-num {
  font-family: var(--font-mono);
  font-size: clamp(1.75rem, 1.2rem + 1.4vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -.035em;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stat-num small {
  font-family: var(--font-sans);
  font-size: .42em;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-subtle);
  margin-left: 3px;
}

/* --------------------------------------------------------------------------
   5. 统一焦点环
   -------------------------------------------------------------------------- */
:where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 24%, transparent);
  border-radius: inherit;
}

/* --------------------------------------------------------------------------
   6. 输入框：对齐 ModelGo 的 modern-input
   -------------------------------------------------------------------------- */
.input,
.textarea,
.select {
  transition: box-shadow var(--dur-base) var(--ease-emphasized),
              border-color var(--dur-base) var(--ease-emphasized),
              background var(--dur-base) var(--ease-emphasized);
}

.input:hover,
.textarea:hover,
.select:hover {
  border-color: color-mix(in srgb, var(--ink) 20%, transparent);
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--page);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}

/* --------------------------------------------------------------------------
   7. 顶部导航：滚动后收窄并加深玻璃（JS 加 .is-scrolled）
   -------------------------------------------------------------------------- */
.site-header {
  transition: height var(--dur-base) var(--ease-emphasized),
              background var(--dur-base) var(--ease-emphasized),
              box-shadow var(--dur-base) var(--ease-emphasized);
}

.site-header.is-scrolled {
  background: var(--glass-veil-strong, var(--page));
  box-shadow: 0 1px 2px #1018280a, 0 6px 16px -6px #10182814;
}

/* --------------------------------------------------------------------------
   8. 减少动效偏好：全部关掉
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .sheen::after { display: none; }
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* --------------------------------------------------------------------------
   9. 进场上浮（配 js/polish.js 的 IntersectionObserver）
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .56s var(--ease-emphasized),
              transform .56s var(--ease-emphasized);
  will-change: opacity, transform;
}

.reveal.is-in {
  opacity: 1;
  transform: none;
}

/* 支持 reduced-motion 或 JS 未执行时不隐藏 */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}
