/* Load after every page theme. Text uses the OS font; artwork is not changed. */
/* Layered important rules outrank legacy unlayered font shorthand overrides. */
@layer dh-system-typography {
:root {
  --dh-system-font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  --dh-text-weight: 400;
  --dh-heading-weight: 600;
}
html body,
html body :where(h1,h2,h3,h4,h5,h6,p,div,span,a,label,small,strong,b,em,i,ul,ol,li,dl,dt,dd,table,th,td,section,header,footer,nav,main,aside,article,form,fieldset,legend,button,input,select,textarea,option,summary,dialog,time,output,text,tspan) {
  font-family: var(--dh-system-font) !important;
  font-style: normal !important;
  font-weight: var(--dh-text-weight) !important;
}
html body ::before, html body ::after {
  font-family: var(--dh-system-font) !important;
  font-style: normal !important;
}
html body { font-weight: var(--dh-text-weight); }
/* Explicit levels avoid template-specific 300/650/750 and serif numerals. */
html body :where(p,span,a,label,small,li,dt,dd,td,input,select,textarea,option,time,output) {
  font-weight: var(--dh-text-weight) !important;
}
html body :where(h1,h2,h3,h4,h5,h6,th,legend,strong,b,button,[role="button"]) {
  font-weight: var(--dh-heading-weight) !important;
}
/* Keep numeric glyph widths consistent without replacing the system font. */
html body .dh-quantity {
  font-variant-numeric: lining-nums tabular-nums !important;
  overflow-wrap: anywhere;
}
/* A sentence in a dialog must not switch font/weight halfway through. */
html body .dh-feedback-result,
html body .dh-feedback-result * {
  font-weight: var(--dh-text-weight) !important;
  font-style: normal !important;
}
html body button :where(span,a),
html body :where(h1,h2,h3,h4,h5,h6,strong,b,[role="button"]) span { font-weight: inherit !important; }
}

/* iOS Safari zooms the whole page when a focused form control is smaller than 16px. */
@media (max-width: 767px) {
  html body :where(
    input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="image"]),
    select,
    textarea
  ) {
    font-size: 16px !important;
  }
}

/*
 * 焦点样式统一处理。
 * 触摸/鼠标操作后，关闭弹窗会把焦点还给触发元素（例如首页快捷入口），iOS 会把它画成蓝框/蓝线；
 * 指针操作时统一不显示浏览器默认焦点框，键盘 Tab 导航时仍给出品牌色焦点环。
 */
html:not(.dh-keyboard) :focus:not(html) {
  outline: none !important;
}
html.dh-keyboard :is(a, button, input, select, textarea, summary, [tabindex], [contenteditable]):focus-visible {
  outline: 2px solid #c8944a !important;
  outline-offset: 2px;
}
