/**
 * SP低空履约平台 - 样式重置
 * 重置浏览器默认样式，建立一致的基础
 * 
 * Requirements: 1.1
 */

/* ========================================
 * Box Sizing 重置
 * ======================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ========================================
 * 根元素重置
 * ======================================== */

html {
  /* 防止字体大小调整 */
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  
  /* 平滑滚动 */
  scroll-behavior: smooth;
  
  /* 字体渲染优化 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  
  /* 基础字体大小 */
  font-size: 16px;
  line-height: 1.5;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  
  /* 使用设计令牌 */
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-secondary);
  
  /* 文字渲染 */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========================================
 * 边距和内边距重置
 * ======================================== */

h1, h2, h3, h4, h5, h6,
p, blockquote, pre,
dl, dd, ol, ul,
figure, hr,
fieldset, legend {
  margin: 0;
  padding: 0;
}

/* ========================================
 * 列表重置
 * ======================================== */

ol, ul {
  list-style: none;
}

/* ========================================
 * 标题重置
 * ======================================== */

h1, h2, h3, h4, h5, h6 {
  font-size: inherit;
  font-weight: inherit;
}

/* ========================================
 * 链接重置
 * ======================================== */

a {
  color: inherit;
  text-decoration: none;
  background-color: transparent;
}

a:hover {
  text-decoration: none;
}

/* 可访问性：保留焦点样式 */
a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ========================================
 * 按钮重置
 * ======================================== */

button {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  cursor: pointer;
  
  /* 移除默认样式 */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* ========================================
 * 输入框重置
 * ======================================== */

input,
textarea,
select {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  
  /* 移除默认样式 */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* 移除数字输入框的上下箭头 */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* 移除搜索框的清除按钮 */
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
}

/* 文本域不可调整大小（除非明确允许） */
textarea {
  resize: vertical;
}

/* 占位符样式 */
::placeholder {
  color: var(--color-text-hint);
  opacity: 1;
}

/* ========================================
 * 表格重置
 * ======================================== */

table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

th {
  text-align: left;
  font-weight: var(--font-weight-medium);
}

/* ========================================
 * 媒体元素重置
 * ======================================== */

img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  border-style: none;
}

svg {
  overflow: hidden;
  vertical-align: middle;
}

/* ========================================
 * 表单元素重置
 * ======================================== */

fieldset {
  border: none;
  min-width: 0;
}

legend {
  display: table;
  max-width: 100%;
  white-space: normal;
}

label {
  display: inline-block;
}

/* ========================================
 * 其他元素重置
 * ======================================== */

hr {
  border: none;
  border-top: 1px solid var(--color-divider);
  height: 0;
  overflow: visible;
}

pre {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-sm);
  overflow: auto;
}

code,
kbd,
samp {
  font-family: var(--font-family-mono);
  font-size: 1em;
}

abbr[title] {
  border-bottom: none;
  text-decoration: underline dotted;
}

b,
strong {
  font-weight: var(--font-weight-semibold);
}

small {
  font-size: 80%;
}

sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sub {
  bottom: -0.25em;
}

sup {
  top: -0.5em;
}

/* ========================================
 * 选择文本样式
 * ======================================== */

::selection {
  background-color: var(--color-primary-light);
  color: var(--color-text-inverse);
}

::-moz-selection {
  background-color: var(--color-primary-light);
  color: var(--color-text-inverse);
}

/* ========================================
 * 滚动条样式（Webkit 浏览器）
 * ======================================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-tertiary);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-disabled);
}

/* ========================================
 * 隐藏元素
 * ======================================== */

[hidden] {
  display: none !important;
}

/* 仅对屏幕阅读器可见 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========================================
 * 减少动画（无障碍）
 * ======================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
