/* ══════════════════════════════════════════════════════════════
   site.css —— 全站的苹果式排版、动效与响应式层
   叠在 wordbook.css（插件原样式）与 app.css（组件）之上，只做增强不改结构。
   断点照搬 apple.com：≥1069 桌面 / 735–1068 平板 / ≤734 手机。
   ══════════════════════════════════════════════════════════════ */

:root {
  --ease: cubic-bezier(0.28, 0.11, 0.32, 1);       /* apple.com 的主缓动 */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --r-lg: 18px;
  --shadow-rest: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lift: 0 10px 34px rgba(0, 0, 0, 0.09);
  --thumb: #ffffff;
  --bar-h: 64px;
}


/* ---------- 色彩主题：每个项目一组三色渐变 ---------- */

:root { --g1: #0071e3; --g2: #7a5af8; --g3: #e0457b; }
.theme-quant  { --g1: #1db954; --g2: #00b3c7; --g3: #0a7cff; }
.theme-flight { --g1: #0096ff; --g2: #5856ff; --g3: #b24dff; }
.theme-words  { --g1: #8b5cf6; --g2: #d946ef; --g3: #ff3d7f; }
.theme-news   { --g1: #ff8a00; --g2: #ff4d2e; --g3: #ff2d6f; }
.theme-diary  { --g1: #f58529; --g2: #dd2a7b; --g3: #8134af; }   /* Instagram 的橙→品红→紫 */
.theme-vault  { --g1: #d4a012; --g2: #b7791f; --g3: #5b4a2e; }   /* 金 → 古铜 → 深褐，保险柜的质感 */
.theme-server { --g1: #14b8a6; --g2: #0ea5e9; --g3: #6366f1; }   /* 青 → 天蓝 → 靛，机房指示灯的冷色 */


.grad, .hero .eyebrow, .cover .eyebrow, .h-hero .eyebrow {
  background-image: linear-gradient(92deg, var(--g1) 0%, var(--g2) 52%, var(--g3) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.hero .eyebrow, .cover .eyebrow, .h-hero .eyebrow { display: inline-block; }

/* 标题背后缓慢漂移的三色光晕 */
.glow {
  position: absolute;
  z-index: -1;
  inset: -40% -30%;
  pointer-events: none;
  background:
    radial-gradient(34% 42% at 30% 48%, color-mix(in srgb, var(--g1) 24%, transparent), transparent 70%),
    radial-gradient(32% 40% at 70% 40%, color-mix(in srgb, var(--g2) 20%, transparent), transparent 70%),
    radial-gradient(28% 34% at 52% 74%, color-mix(in srgb, var(--g3) 16%, transparent), transparent 70%);
  animation: glowDrift 16s var(--ease-io) infinite alternate;
}
@keyframes glowDrift {
  from { transform: translate3d(-4%, -1%, 0) scale(1); }
  to { transform: translate3d(4%, 3%, 0) scale(1.1); }
}
.hero { position: relative; isolation: isolate; }
#app { overflow-x: clip; }

html { -webkit-text-size-adjust: 100%; }
body { text-rendering: optimizeLegibility; }
::selection { background: rgba(0, 113, 227, 0.22); }

/* ---------- 顶栏 ---------- */

.topnav-inner { max-width: 1180px; height: 48px; }
.wordmark { font-size: 15px; letter-spacing: 0.14em; }
.topnav .tabs { margin: 0 auto; }

/* ---------- 语言切换 ---------- */

.lang-pick { position: relative; }
.lang-btn { display: inline-flex; align-items: center; gap: 5px; }
.lang-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  min-width: 150px; padding: 6px; border-radius: 14px;
  display: flex; flex-direction: column;
  background: var(--bg);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.14), 0 0 0 1px var(--hairline);
  animation: modIn 0.25s var(--ease-out);
}
.lang-menu[hidden] { display: none; }
.lang-menu button {
  text-align: left; border: 0; background: none; cursor: pointer;
  padding: 9px 12px; border-radius: 9px; font: inherit; font-size: 14px; color: var(--text);
}
.lang-menu button:hover { background: var(--fill); }
.lang-menu button.active { color: var(--accent); font-weight: 600; }
.h-langs { margin: 0 auto 26px; width: fit-content; max-width: 100%; }

/* ---------- 分段控件：滑块跟着选中项走 ---------- */

.tabs.has-thumb, .seg.has-thumb { position: relative; isolation: isolate; }
.has-thumb > .thumb {
  position: absolute;
  top: 0; left: 0;
  z-index: -1;
  border-radius: 6px;
  background: var(--thumb);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  transition: transform 0.42s var(--ease-out), width 0.42s var(--ease-out),
              height 0.42s var(--ease-out), opacity 0.2s var(--ease);
  pointer-events: none;
}
.seg.has-thumb > .thumb { border-radius: 980px; }
.has-thumb .tab.active, .has-thumb .seg-btn.active {
  background: transparent !important;
  box-shadow: none !important;
}
.tab, .seg-btn { transition: color 0.25s var(--ease); }

/* ---------- 首屏标题 ---------- */

.hero { padding: 84px 0 40px; }
.eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  margin-bottom: 10px;
}
.hero h1 {
  font-size: 56px;
  font-weight: 700;
  line-height: 1.07;
  letter-spacing: -0.025em;
  margin-bottom: 14px;
}
.hero h1, .hero-sub { text-wrap: balance; }
.hero-sub {
  font-size: 21px;
  line-height: 1.38;
  letter-spacing: 0.011em;
  max-width: 660px;
  margin: 0 auto;
}

.page { max-width: 720px; }
.tabs-wrap { display: flex; justify-content: center; }
.tabs-wrap .tabs { max-width: 100%; }

/* ---------- 卡片与统计块 ---------- */

.card {
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-rest);
  transition: box-shadow 0.4s var(--ease), transform 0.4s var(--ease), border-color 0.3s var(--ease);
}
.metric {
  border-radius: var(--r-lg);
  border-color: transparent;
  background: var(--fill);
  padding: 20px 22px;
  transition: transform 0.45s var(--ease-out), box-shadow 0.45s var(--ease-out);
}
@media (hover: hover) {
  .metric:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
  .card.lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
}
.metric .v { font-size: 34px; letter-spacing: -0.02em; margin-top: 10px; }
.metric .k { letter-spacing: 0.08em; }

.card-head h2 { font-size: 17px; letter-spacing: -0.01em; }

/* ---------- 按钮与输入 ---------- */

.btn {
  border-radius: 980px;
  padding: 8px 18px;
  transition: transform 0.2s var(--ease), background 0.25s var(--ease), border-color 0.25s var(--ease), opacity 0.25s var(--ease);
}
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn-sm { padding: 6px 13px; }
.btn-link {
  appearance: none; border: 0; background: none; padding: 0;
  color: var(--accent); font: inherit; cursor: pointer;
}
.btn-link:hover { text-decoration: underline; }

.inp { border-radius: 12px; transition: border-color 0.2s var(--ease), box-shadow 0.25s var(--ease); }
.inp:focus { box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.16); }

input[type="checkbox"] { accent-color: var(--accent); width: 17px; height: 17px; }

/* 大号搜索框，苹果官网搜索页那种 */
.search-xl { position: relative; }
.search-xl .inp {
  font-size: 19px;
  padding: 15px 20px 15px 50px;
  border-radius: 14px;
  background: var(--bg);
}
.search-xl svg {
  position: absolute;
  left: 18px; top: 50%;
  width: 19px; height: 19px;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

/* ---------- 列表行 ---------- */

.hit { transition: background 0.25s var(--ease); }
@media (hover: hover) {
  .hit:hover { background: var(--fill); }
}
.news-title {
  color: var(--text);
  text-decoration: none;
  font-size: 16px;
  line-height: 1.45;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.news-title:hover { color: var(--accent); }
.news-sum {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  padding-top: 5px;
}
.news-meta {
  font-size: 12px;
  color: var(--text-secondary);
  padding-top: 7px;
  font-family: var(--mono);
}

.chip-group { margin-bottom: 18px; }
.chip-group:last-child { margin-bottom: 0; }
label.chip { font-family: inherit; font-size: 13px; user-select: none; transition: border-color 0.2s var(--ease), background 0.2s var(--ease); }
label.chip:has(input:checked) { border-color: var(--accent); background: rgba(0, 113, 227, 0.08); }

/* 复习进度条：插件里是块级元素，这里的 span 默认行内，宽度不生效 */
.stat-bar-track { display: block; }
.stat-bar-fill {
  display: block;
  background: linear-gradient(90deg, var(--g1), var(--g2) 60%, var(--g3));
  transform-origin: left center;
  transition: transform 1.1s var(--ease-out) 0.2s;
}
.stat-row.reveal .stat-bar-fill { transform: scaleX(0); }
.stat-row.reveal.in .stat-bar-fill { transform: none; }

.foot-note a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- 滚动渐入 ---------- */

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.85s var(--ease-out), transform 0.85s var(--ease-out);
  will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: none; }

@keyframes modIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.mod-enter { animation: modIn 0.55s var(--ease-out); }

/* ---------- 骨架屏 ---------- */

.skel-wrap { padding: 16px 18px; }
.skel { padding: 12px 0; border-bottom: 1px solid var(--hairline); }
.skel:last-child { border-bottom: 0; }
.skel i {
  display: block;
  height: 12px;
  border-radius: 6px;
  margin: 7px 0;
  background: linear-gradient(90deg, var(--fill) 0%, var(--hairline) 50%, var(--fill) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
.skel i:nth-child(1) { width: 72%; height: 15px; }
.skel i:nth-child(2) { width: 94%; }
.skel i:nth-child(3) { width: 38%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- 手机底部标签栏（默认隐藏）---------- */

.bottombar { display: none; }

/* ══════════════ 平板 735–1068 ══════════════ */
@media (max-width: 1068px) {
  .hero { padding: 64px 0 32px; }
  .hero h1 { font-size: 48px; }
  .hero-sub { font-size: 19px; }
  .page-wide { padding: 0 28px 110px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  #stg-layout { grid-template-columns: 1fr !important; }
  #stg-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
  #stg-list .preset { flex: 0 0 auto; min-width: 170px; margin-bottom: 0; }
}

/* ══════════════ 手机 ≤734 ══════════════ */
@media (max-width: 734px) {
  :root { --r-lg: 14px; }

  .topnav-inner { height: 44px; padding: 0 16px; }
  .topnav .tabs { display: none; }
  .topnav-right #status-badge { display: none; }
  .topnav-right .btn { padding: 5px 12px; font-size: 12px; min-height: 30px; }

  .bottombar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 50;
    height: calc(var(--bar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, 0.86);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--hairline);
  }
  .bottombar button {
    flex: 1;
    appearance: none; border: 0; background: none;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    font: inherit; font-size: 10.5px;
    color: var(--text-secondary);
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s var(--ease);
  }
  .bottombar button svg { width: 24px; height: 24px; transition: transform 0.3s var(--ease-out); }
  .bottombar button span { max-width: 100%; padding: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bottombar button.active { color: var(--accent); }
  .bottombar button.active svg { transform: translateY(-1px) scale(1.06); }
  .bottombar button:active svg { transform: scale(0.9); }

  body { padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom)); }

  .page, .page-wide { padding: 0 16px 40px; }
  .hero { padding: 36px 0 22px; }
  .hero h1 { font-size: 34px; letter-spacing: -0.02em; }
  .hero-sub { font-size: 16px; }
  .eyebrow { font-size: 12px; }

  /* iOS 输入框字号小于 16px 会自动放大页面 */
  .inp, select.inp, #gate input { font-size: 16px !important; }
  .btn { min-height: 38px; }
  .search-xl .inp { font-size: 17px; padding: 13px 16px 13px 44px; }
  .search-xl svg { left: 15px; }

  .metric { padding: 15px 16px; }
  .metric .v { font-size: 25px; }
  .grid { gap: 10px; }
  .card-head { padding: 12px 15px; }
  .card-body { padding: 15px; }
  .hit { padding-left: 15px !important; padding-right: 15px !important; }

  #chart { height: 240px !important; }
  #w-chart { height: 150px !important; }

  /* 量化子标签横向滑动，不换行 */
  .tabs-wrap .tabs {
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 0 16px !important;
  }
  .tabs-wrap .tabs::-webkit-scrollbar { display: none; }
  .tabs-wrap .tabs .tab { flex: 0 0 auto; }

  /* 保存栏抬到底部标签栏上面 */
  .savebar {
    bottom: calc(var(--bar-h) + env(safe-area-inset-bottom));
    padding: 10px 0;
    margin: 0 -16px;
    padding-left: 16px; padding-right: 16px;
  }
  .savebar .sec { display: none; }
  /* 没勾选时发送栏收起，勾了才从底部滑出来 */
  #nw-bar { transition: transform 0.45s var(--ease-out), opacity 0.3s var(--ease); }
  #nw-bar.idle { transform: translateY(110%); opacity: 0; pointer-events: none; }
  #nw-result-meta { flex-basis: 100%; order: 5; }

  .scroll-x {
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
    mask-image: linear-gradient(90deg, #000 88%, transparent);
  }

  .list-toolbar { flex-wrap: wrap; gap: 8px; }
  .list-toolbar .inp { max-width: none !important; flex: 1 1 100%; }
  .seg { overflow-x: auto; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }

  .field-grid { grid-template-columns: 1fr !important; }
}



/* ---------- 减少动态效果 ---------- */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  .mod-enter { animation: none; }
  .has-thumb > .thumb, .metric, .card, .btn { transition: none !important; }
  .skel i { animation: none; }
  .glow { animation: none; }
  .stat-bar-fill { transform: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

a.entry-sentence-tag { color: inherit; text-decoration: none; }
a.entry-sentence-tag:hover { color: var(--accent); }
