/*
 * 港股通市值门槛这一页的两张名单。只有这一页加载。
 *
 * 点标题旁那个标签换一张表。切开它们的是 `:target`，四张表的每一行都在 markup
 * 里。整套关在 `@supports` 里：不支持 `:has()` 的浏览器四张一起排开，一个字不缺。
 * `display: contents` 让标签挤在同一行、表占满下一行。`.page--find` 是 `fold.js`
 * 在查找栏打开时加上的，收起来的表是 `display: none`，Ctrl+F 搜不到。
 */

.ggt-tab { scroll-margin-top: 12px; }

@supports selector(:has(*)) {
  .ggt-switch {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px 16px;
    width: 100%;
    margin-top: 14px;
  }

  .ggt-item { display: contents; }

  .ggt-tab { order: 0; }

  .ggt-panel {
    order: 1;
    flex: 1 0 100%;
    /* flex item 默认 min-width 是表格的 min-content。窄窗口上它会把表撑出
       `.page`，`.co-scroll` 那条横向滚动就接不住。 */
    min-width: 0;
    display: none;
    margin-top: 8px;
  }

  /* 没有 hash 时露调出预测。标签顺序和表的顺序一样，调出在左。 */
  .ggt-switch:not(:has(.ggt-tab:target)) .ggt-item:has(#forecast_out) .ggt-panel { display: block; }

  .ggt-item:has(.ggt-tab:target) .ggt-panel { display: block; }

  .ggt-switch:not(:has(.ggt-tab:target)) #forecast_out,
  .ggt-tab:target {
    color: var(--primary);
    border-bottom-color: var(--primary);
  }

  /* 查找和打印把四张都摊开。特异性要压过上面「只露一张」那两条。 */
  .page--find .ggt-item,
  .page--find .ggt-panel { display: block; flex: none; order: 0; }

  .page--find .ggt-panel { margin-top: 0; }
}

@media print {
  .ggt-item,
  .ggt-panel { display: block; flex: none; order: 0; }

  .ggt-panel { margin-top: 0; }
}
