/*
 * compat.css — 撤销 Bootstrap reboot 的元素级样式，按布局保留两种元素基线：
 * 公共页 / 首页只有全局 `* { margin: 0; padding: 0 }`；门户 / 认证页带标题、段落、列表的默认间距。
 * 选择器均以 :where() 限定布局，特异性只有元素级（0,0,1）：能覆盖 reboot，但永远让位于页面自身的类选择器。
 * 没有类的元素也落在字阶上：标题用 --t-* 令牌，粗体 / 表头用 600（不出现 700 和 bolder）。
 */

/* ---------- 共同部分：标题落到字阶，撤销 reboot 的标题颜色与列表缩进 ---------- */
:where(body) h1 { font: var(--t-page-title); }
:where(body) h2 { font: var(--t-headline); }
:where(body) h3 { font: var(--t-title); }
:where(body) :is(h4, h5, h6) { font: var(--t-body-strong); }
:where(body) :is(h1, h2, h3, h4, h5, h6) { color: inherit; }
:where(body) :is(b, strong, th) { font-weight: 600; }
:where(body) :is(ol, ul) { padding-left: 0; }
:where(body) label { display: revert; }
:where(body) svg { vertical-align: revert; }
/* reboot 开启了全站平滑滚动；这里保持浏览器默认的即时滚动 */
:root { scroll-behavior: auto; }

/* ---------- 公共页 / 首页：无 antd reset，仅 `*` 归零 ---------- */
:where(.layout-public, .layout-bare) :is(h1, h2, h3, h4, h5, h6) {
  margin: 0;
  font-weight: 600;
}
:where(.layout-public, .layout-bare) :is(p, ol, ul, dl, dd, blockquote, figure, pre) { margin: 0; }
:where(.layout-public, .layout-bare) dt { font-weight: 600; }
:where(.layout-public, .layout-bare) small { font: var(--t-caption); }
/* reboot 让表单控件继承字体；公共页的裸控件也继承正文字阶，组件类自行设置字阶 */
:where(.layout-public, .layout-bare) :is(button, input, select, optgroup, textarea) { font: inherit; }

/* ---------- 门户 / 认证页：标题、段落、列表默认间距；置于公共页规则之后以便覆盖 ---------- */
:where(.layout-portal, .layout-auth) :is(h1, h2, h3, h4, h5, h6) {
  margin: 0 0 0.5em;
  font-weight: 500;
}
:where(.layout-portal, .layout-auth) p { margin: 0 0 1em; }
:where(.layout-portal, .layout-auth) :is(ol, ul, dl) { margin: 0 0 1em; }
:where(.layout-portal, .layout-auth) :is(ol ol, ul ul, ol ul, ul ol) { margin-bottom: 0; }
:where(.layout-portal, .layout-auth) dt { font-weight: 500; }
:where(.layout-portal, .layout-auth) dd { margin: 0 0 0.5em; }
:where(.layout-portal, .layout-auth) :is(blockquote, figure, pre) { margin: 0 0 1em; }
:where(.layout-portal, .layout-auth) small { font: var(--t-caption); }

/* ---------- 手机端：可输入控件不小于 16px，否则 iOS Safari / 微信聚焦时会放大页面 ---------- */
@media (max-width: 768px) {
  input:not([type='checkbox']):not([type='radio']):not([type='range']):not([type='button']):not([type='submit']),
  select,
  textarea { font-size: max(16px, 1em) !important; }
}
