/* stock.css · 第三十九阶段 · 【金融 → 股票】列表页 + 详情页
 *
 * 设计取向：沿用站点既有的「米黄纸 + 衬线 + 细线」语言，不做卡片堆砌。
 *   · 结构靠 hairline 分隔与留白，不靠 border-radius 大卡片；
 *   · 颜色克制：涨(红)/跌(绿)只出现在数字与图表上，其余留给 --ink 与 --ink-faint；
 *   · 数字用 tabular-nums 对齐，避免跳动；
 *   · 所有颜色走 core.css 的 CSS 变量，暗色主题自动跟随。
 *
 * ⚠️ 涨跌色是中国习惯（涨红跌绿），和欧美相反 —— 写在 :root 里并给暗色主题
 *    一套提亮版本，避免在深底上对比度不足。
 */

:root {
  --stk-up: #b8563f;
  --stk-down: #5b8552;
  --stk-flat: #9c9384;
  --stk-hair: 1px solid var(--line);
}

html[data-theme-dark] {
  --stk-up: #e0907a;
  --stk-down: #93bc86;
  --stk-flat: #8b8478;
}

/* ============================ 列表页 + 详情页 共用骨架 ============================ */

.stk-sec {
  padding: 34px 0 30px;
  border-top: var(--stk-hair);
}
.stk-sec:first-of-type { border-top: 0; padding-top: 26px; }

.stk-sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.stk-sec-head h2 {
  font-family: var(--serif);
  font-size: 1.32rem;
  font-weight: 600;
  letter-spacing: .01em;
  margin: 0;
}
.stk-sec-note {
  font-size: .78rem;
  color: var(--ink-faint);
  letter-spacing: .02em;
}

.stk-disclaimer {
  margin: 30px 0 0;
  padding-top: 18px;
  border-top: var(--stk-hair);
  font-size: .76rem;
  line-height: 1.7;
  color: var(--ink-faint);
}

/* 骨架屏（首屏数据未到时） */
.stk-skel {
  display: inline-block;
  min-width: 88px;
  height: 15px;
  border-radius: 4px;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--ink) 7%, transparent),
    color-mix(in srgb, var(--ink) 13%, transparent),
    color-mix(in srgb, var(--ink) 7%, transparent));
  background-size: 200% 100%;
  animation: stk-shimmer 1.5s var(--ease) infinite;
}
.stk-skel-lg { min-width: 160px; height: 34px; }
@keyframes stk-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -100% 0; }
}

/* 预留位：虚线框只标注「这里以后会有东西」，不抢戏 */
.stk-slot-note {
  margin: 0;
  padding: 16px 18px;
  border: 1px dashed color-mix(in srgb, var(--ink) 18%, transparent);
  border-radius: var(--r-2, 4px);
  font-size: .84rem;
  line-height: 1.8;
  color: var(--ink-faint);
}

/* ============================ ① 列表页：搜索 ============================ */

.stk-search { padding-top: 26px; }
.stk-search-label {
  display: block;
  font-family: var(--serif);
  font-size: 1.32rem;
  font-weight: 600;
  margin-bottom: 14px;
}
.stk-search-box {
  display: flex;
  align-items: stretch;
  gap: 10px;
  max-width: 560px;
}
.stk-search-box input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--sans);
  font-size: 1rem;
  letter-spacing: .06em;
  padding: 13px 16px;
  color: var(--ink);
  background: var(--card);
  border: var(--stk-hair);
  border-radius: var(--r-2, 4px);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.stk-search-box input::placeholder { color: var(--ink-faint); letter-spacing: .04em; }
.stk-search-box input:focus {
  outline: none;
  border-color: var(--sage-deep);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sage) 22%, transparent);
}
.stk-search-box button {
  flex: none;
  font-family: var(--sans);
  font-size: .92rem;
  padding: 0 22px;
  color: var(--paper);
  background: var(--ink);
  border: 0;
  border-radius: var(--r-2, 4px);
  cursor: pointer;
  transition: transform .16s var(--ease), opacity .16s var(--ease);
}
.stk-search-box button:hover { transform: translateY(-1px); }
.stk-search-box button:active { transform: translateY(0); opacity: .88; }
.stk-search-hint {
  margin: 12px 0 0;
  font-size: .78rem;
  line-height: 1.75;
  color: var(--ink-faint);
  max-width: 620px;
}
.stk-search-msg {
  margin: 10px 0 0;
  font-size: .86rem;
  line-height: 1.7;
  color: var(--terra);
}
.stk-search-msg:empty { display: none; }

/* 搜索命中：一条可点的结果行 */
.stk-hit {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 560px;
  margin-top: 14px;
  padding: 14px 16px;
  border: var(--stk-hair);
  border-radius: var(--r-2, 4px);
  background: var(--card);
  text-decoration: none;
  color: inherit;
  transition: transform .16s var(--ease), box-shadow .16s var(--ease);
}
.stk-hit:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); }
.stk-hit-name { font-family: var(--serif); font-size: 1.05rem; font-weight: 600; }
.stk-hit-code {
  font-size: .8rem;
  letter-spacing: .08em;
  color: var(--ink-faint);
}
.stk-hit-price { margin-left: auto; font-variant-numeric: tabular-nums; font-size: .95rem; }

/* ============================ ② 指数条 ============================ */

.stk-indices {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.stk-index {
  flex: 0 0 auto;
  min-width: 168px;
  padding-right: 16px;
  border-right: var(--stk-hair);
}
.stk-index:last-child { border-right: 0; }
.stk-index-name {
  display: block;
  font-size: .76rem;
  letter-spacing: .04em;
  color: var(--ink-faint);
  margin-bottom: 6px;
  white-space: nowrap;
}
.stk-index-value {
  display: block;
  font-family: var(--serif);
  font-size: 1.34rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.stk-index-pct {
  display: block;
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
  margin-top: 3px;
}

/* ============================ ③ 热门标的 ============================ */

.stk-hot {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0 26px;
  border-top: var(--stk-hair);
}
.stk-hot-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 13px 2px;
  border-bottom: var(--stk-hair);
  text-decoration: none;
  color: inherit;
  transition: padding-left .2s var(--ease), background .2s var(--ease);
}
.stk-hot-row:hover {
  padding-left: 8px;
  background: color-mix(in srgb, var(--ink) 3%, transparent);
}
.stk-hot-name { font-family: var(--serif); font-size: 1rem; font-weight: 600; }
.stk-hot-code {
  font-size: .76rem;
  letter-spacing: .09em;
  color: var(--ink-faint);
}
.stk-hot-go { margin-left: auto; color: var(--ink-faint); transition: transform .2s var(--ease); }
.stk-hot-row:hover .stk-hot-go { transform: translateX(4px); color: var(--sage-deep); }

/* ============================ ④ 详情页 Header ============================ */

.stk-head {
  padding: 30px 0 8px;
  animation: stk-rise .5s var(--ease) both;
}
@keyframes stk-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.stk-eyebrow {
  margin: 0 0 10px;
  font-size: .72rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.stk-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  font-family: var(--serif);
  font-size: clamp(1.7rem, 4.2vw, 2.5rem);
  font-weight: 600;
  line-height: 1.2;
}
.stk-ticker {
  font-family: var(--sans);
  font-size: .82rem;
  letter-spacing: .12em;
  font-weight: 500;
  padding: 4px 11px;
  border: var(--stk-hair);
  border-radius: 999px;
  color: var(--ink-soft);
}
.stk-quote {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}
.stk-price {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 6vw, 3.1rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stk-change {
  font-size: 1.02rem;
  font-variant-numeric: tabular-nums;
  padding: 3px 11px;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 12%, transparent);
}
.stk-quote.up { color: var(--stk-up); }
.stk-quote.down { color: var(--stk-down); }
.stk-quote.flat { color: var(--ink-soft); }
.stk-quote .stk-price, .stk-quote .stk-change { color: inherit; }
.stk-quote.up .stk-price, .stk-quote.down .stk-price { color: inherit; }

.stk-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 30px;
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: var(--stk-hair);
}
.stk-facts > div { display: flex; align-items: baseline; gap: 8px; }
.stk-facts dt { font-size: .76rem; color: var(--ink-faint); }
.stk-facts dd {
  margin: 0;
  font-size: .9rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.stk-note {
  margin: 14px 0 0;
  font-size: .74rem;
  color: var(--ink-faint);
}
.stk-lead { margin: 14px 0 0; color: var(--ink-soft); line-height: 1.8; }

/* ============================ ⑤ 区间切换 ============================ */

.stk-ranges {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  padding: 3px;
  border: var(--stk-hair);
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 3%, transparent);
}
.stk-range {
  font-family: var(--sans);
  font-size: .78rem;
  letter-spacing: .04em;
  padding: 6px 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.stk-range:hover { color: var(--ink); }
.stk-range[aria-selected="true"] {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

/* ============================ ⑥ 图表容器 ============================ */

.stk-chart-wrap { position: relative; }
.stk-chart {
  height: 340px;
  transition: opacity .22s var(--ease);
}
.stk-chart--sm { height: 260px; }
.stk-chart.is-swapping { opacity: 0; }
.stk-chart-meta {
  min-height: 20px;
  margin-top: 8px;
  font-size: .76rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.stk-chart-note {
  margin: 10px 0 0;
  font-size: .74rem;
  color: var(--ink-faint);
}
.stk-chart-msg {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 160px;
  font-size: .86rem;
  color: var(--ink-faint);
  border: 1px dashed color-mix(in srgb, var(--ink) 16%, transparent);
  border-radius: var(--r-2, 4px);
}

/* ============================ ⑦ 指标网格（估值 / 财务 / 公司） ============================ */

.stk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0 30px;
  margin: 0;
  border-top: var(--stk-hair);
}
.stk-grid--wide { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.stk-cell {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 2px;
  border-bottom: var(--stk-hair);
  transition: padding-left .18s var(--ease);
}
.stk-cell:hover { padding-left: 6px; }
.stk-cell dt {
  font-size: .8rem;
  color: var(--ink-faint);
  white-space: nowrap;
  transition: transform .18s var(--ease);
}
.stk-cell:hover dt { transform: translateY(-1px); }
.stk-cell dd {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.stk-cell dd.up { color: var(--stk-up); }
.stk-cell dd.down { color: var(--stk-down); }
.stk-cell dd.muted { color: var(--ink-faint); font-family: var(--sans); font-size: .86rem; font-weight: 400; }
.stk-cell dd a { color: var(--sage-deep); text-decoration: none; border-bottom: 1px solid currentColor; }

.stk-profile-text {
  margin: 0 0 22px;
  font-size: .92rem;
  line-height: 1.95;
  color: var(--ink-soft);
  max-width: 74ch;
}
.stk-profile-text:empty { display: none; }

/* ============================ ⑧ AI 商业模式 ============================ */

.stk-ai-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.stk-ai-note::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mustard);
  animation: stk-pulse 2.4s var(--ease) infinite;
}
@keyframes stk-pulse {
  0%, 100% { opacity: .35; transform: scale(.85); }
  50% { opacity: 1; transform: scale(1); }
}
.stk-bm {
  columns: 2;
  column-gap: 40px;
}
.stk-bm-block {
  break-inside: avoid;
  margin: 0 0 22px;
}
.stk-bm-block h3 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 7px;
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 600;
}
.stk-bm-no {
  font-family: var(--sans);
  font-size: .68rem;
  letter-spacing: .1em;
  color: var(--ink-faint);
}
.stk-bm-block p {
  margin: 0;
  font-size: .88rem;
  line-height: 1.9;
  color: var(--ink-soft);
}
.stk-bm-block p + p { margin-top: 7px; }

/* ============================ ⑨ 进入视口动画 ============================ */

.stk-sec[data-stk-reveal] {
  opacity: 0;
  transform: translateY(14px);
}
.stk-sec[data-stk-reveal].stk-in {
  opacity: 1;
  transform: none;
  transition: opacity .55s var(--ease), transform .55s var(--ease);
}

/* ============================ 响应式 ============================ */

@media (max-width: 860px) {
  .stk-bm { columns: 1; }
  .stk-chart { height: 300px; }
  .stk-chart--sm { height: 230px; }
}
@media (max-width: 600px) {
  .stk-sec { padding: 26px 0 22px; }
  .stk-search-box { max-width: none; }
  .stk-search-box input { font-size: .92rem; padding: 12px 13px; }
  .stk-search-box button { padding: 0 16px; }
  .stk-hot { grid-template-columns: 1fr; gap: 0; }
  .stk-grid, .stk-grid--wide { grid-template-columns: 1fr; }
  .stk-cell dd { font-size: 1.04rem; }
  .stk-chart { height: 260px; }
  .stk-chart--sm { height: 210px; }
  .stk-facts { gap: 8px 20px; }
}

/* 尊重「减少动态效果」偏好：只保留必要状态，不做位移与脉冲 */
@media (prefers-reduced-motion: reduce) {
  .stk-head { animation: none; }
  .stk-sec[data-stk-reveal] { opacity: 1; transform: none; }
  .stk-sec[data-stk-reveal].stk-in { transition: none; }
  .stk-ai-note::before { animation: none; opacity: 1; }
  .stk-skel { animation: none; }
  .stk-chart { transition: none; }
}