/* ==========================================================================
   基础层：reset、字体、排版、工具类
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--td-font-family);
  font-size: var(--td-font-size-base);
  line-height: var(--bf-line-base);
  color: var(--td-text-color-primary);
  background: var(--td-bg-color-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, p, figure, ul, ol, dl, dd {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

a {
  color: var(--td-text-color-brand);
  text-decoration: none;
  transition: color var(--td-anim-duration-fast) var(--td-anim-ease-out);
}

a:hover {
  color: var(--td-brand-color-hover);
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

/* ---------- 排版工具类 ---------- */
.bf-page-title {
  font-size: var(--bf-font-size-page-title);
  line-height: var(--bf-line-page-title);
  font-weight: 600;
}

.bf-section-title {
  font-size: var(--bf-font-size-section);
  line-height: var(--bf-line-section);
  font-weight: 600;
}

.bf-text-secondary {
  color: var(--td-text-color-secondary);
}

.bf-text-placeholder {
  color: var(--td-text-color-placeholder);
}

.bf-text-brand {
  color: var(--td-text-color-brand);
}

.bf-text-small {
  font-size: var(--bf-font-size-small);
  line-height: var(--bf-line-small);
}

/* 行情数字：等宽、右对齐、红涨绿跌 */
.bf-num {
  font-family: var(--bf-font-number);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.bf-text-up {
  color: var(--bf-market-up-text);
}

.bf-text-down {
  color: var(--bf-market-down-text);
}

.bf-text-flat {
  color: var(--bf-market-flat);
}

.bf-align-right {
  text-align: right;
}

.bf-align-center {
  text-align: center;
}

.bf-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 布局工具类 ---------- */
.bf-flex {
  display: flex;
}

.bf-flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bf-flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.bf-flex-middle {
  display: flex;
  align-items: center;
}

.bf-flex-1 {
  flex: 1;
  min-width: 0;
}

.bf-wrap {
  flex-wrap: wrap;
}

.bf-gap-1 { gap: 4px; }
.bf-gap-2 { gap: 8px; }
.bf-gap-3 { gap: 12px; }
.bf-gap-4 { gap: 16px; }
.bf-gap-5 { gap: 24px; }
.bf-gap-6 { gap: 32px; }

.bf-mt-2 { margin-top: 8px; }
.bf-mt-3 { margin-top: 12px; }
.bf-mt-4 { margin-top: 16px; }
.bf-mt-5 { margin-top: 24px; }
.bf-mb-2 { margin-bottom: 8px; }
.bf-mb-3 { margin-bottom: 12px; }
.bf-mb-4 { margin-bottom: 16px; }
.bf-mb-5 { margin-bottom: 24px; }

.bf-hidden {
  display: none !important;
}

/* ---------- 滚动条（PC 端精细化） ---------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ---------- 焦点可见（可访问性硬性要求） ---------- */
:focus-visible {
  outline: 2px solid var(--td-brand-color);
  outline-offset: 2px;
}
