/* ============================================
   HTML5标准标签完整样式重置
   版本: 1.0.0
   设计理念: 现代扁平化设计，统一视觉风格
   ============================================ */

/* 1. 全局重置与基础变量 */
:root {
  /* 颜色系统 */
  --primary-color: #3498db;
  --primary-dark: #2980b9;
  --primary-light: #5dade2;
  --secondary-color: #2ecc71;
  --danger-color: #e74c3c;
  --warning-color: #f39c12;
  --info-color: #3498db;
  --dark-color: #2c3e50;
  --light-color: #ecf0f1;
  --gray-color: #95a5a6;
  --white-color: #ffffff;
  --black-color: #333333;
  
  /* 文字系统 */
  --text-primary: #2c3e50;
  --text-secondary: #7f8c8d;
  --text-muted: #bdc3c7;
  --text-light: #ecf0f1;
  
  /* 布局系统 */
  --border-radius: 6px;
  --border-radius-sm: 4px;
  --border-radius-lg: 8px;
  --border-radius-xl: 12px;
  --border-radius-round: 50%;
  
  /* 阴影系统 */
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 8px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 16px rgba(0,0,0,0.15);
  --shadow-inner: inset 0 2px 4px rgba(0,0,0,0.06);
  
  /* 间距系统 */
  --spacing-xs: 0.25rem;  /* 4px */
  --spacing-sm: 0.5rem;   /* 8px */
  --spacing-md: 1rem;     /* 16px */
  --spacing-lg: 1.5rem;   /* 24px */
  --spacing-xl: 2rem;     /* 32px */
  --spacing-xxl: 3rem;    /* 48px */
  
  /* 过渡动画 */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;
  
  /* 字体系统 */
  --font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --font-family-serif: Georgia, 'Times New Roman', Times, serif;
  --font-family-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;
  --font-family-base: var(--font-family-sans);
  
  /* 字号系统 */
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-xxl: 1.5rem;    /* 24px */
  --font-size-xxxl: 2rem;     /* 32px */
  
  /* 行高系统 */
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-loose: 1.75;
}

/* 2. 全局基础重置 */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  line-height: var(--line-height-normal);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background-color: var(--white-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  text-rendering: optimizeLegibility;
}

/* 3. 布局容器标签 */
main {
  display: block;
  padding: var(--spacing-lg);
  margin: 0 auto;
  max-width: 1200px;
  width: 100%;
}

header {
  display: block;
  background-color: var(--dark-color);
  color: var(--text-light);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--shadow-md);
}

footer {
  display: block;
  background-color: var(--dark-color);
  color: var(--text-light);
  padding: var(--spacing-lg);
  margin-top: var(--spacing-lg);
  text-align: center;
  border-top: 3px solid var(--primary-color);
}

nav {
  display: block;
  background-color: var(--light-color);
  padding: var(--spacing-md);
  border-radius: var(--border-radius);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
}

aside {
  display: block;
  background-color: var(--light-color);
  padding: var(--spacing-lg);
  border-radius: var(--border-radius);
  border-left: 4px solid var(--primary-color);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
}

section {
  display: block;
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  background-color: var(--white-color);
  border-radius: var(--border-radius);
  border: 1px solid #e0e0e0;
  box-shadow: var(--shadow-sm);
}

article {
  display: block;
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  background-color: var(--white-color);
  border-radius: var(--border-radius);
  border-left: 4px solid var(--secondary-color);
  box-shadow: var(--shadow-sm);
}

/* 4. 标题标签 */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-sans);
  font-weight: 600;
  line-height: var(--line-height-tight);
  color: var(--text-primary);
  margin-top: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

h1 {
  font-size: var(--font-size-xxxl);
  border-bottom: 3px solid var(--primary-color);
  padding-bottom: var(--spacing-sm);
}

h2 {
  font-size: var(--font-size-xxl);
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: var(--spacing-xs);
}

h3 {
  font-size: var(--font-size-xl);
  color: var(--dark-color);
}

h4 {
  font-size: var(--font-size-lg);
  color: var(--text-primary);
}

h5 {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  font-weight: 500;
}

h6 {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* 5. 文本内容标签 */
p {
  margin-bottom: var(--spacing-md);
  line-height: var(--line-height-normal);
}

blockquote {
  margin: var(--spacing-lg) 0;
  padding: var(--spacing-lg);
  background-color: var(--light-color);
  border-left: 4px solid var(--primary-color);
  border-radius: var(--border-radius);
  font-style: italic;
  color: var(--text-secondary);
}

blockquote p:last-child {
  margin-bottom: 0;
}

cite {
  display: block;
  margin-top: var(--spacing-sm);
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-style: normal;
  text-align: right;
}

pre {
  display: block;
  font-family: var(--font-family-mono);
  font-size: var(--font-size-sm);
  background-color: #2c3e50;
  color: var(--text-light);
  padding: var(--spacing-lg);
  border-radius: var(--border-radius);
  overflow-x: auto;
  margin: var(--spacing-lg) 0;
  line-height: var(--line-height-normal);
  white-space: pre;
  word-wrap: normal;
  tab-size: 2;
}

code {
  font-family: var(--font-family-mono);
  font-size: 0.9em;
  padding: 0.2em 0.4em;
  background-color: var(--light-color);
  color: var(--danger-color);
  border-radius: var(--border-radius-sm);
}

kbd {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-sm);
  padding: 0.2em 0.6em;
  background-color: var(--dark-color);
  color: var(--white-color);
  border-radius: var(--border-radius-sm);
  box-shadow: var(--shadow-sm);
  border: 1px solid #1a252f;
}

mark {
  background-color: #fff3cd;
  color: var(--black-color);
  padding: 0.1em 0.3em;
  border-radius: var(--border-radius-sm);
}

/* 6. 列表标签 */
ul, ol {
  margin-left: var(--spacing-xl);
  margin-bottom: var(--spacing-lg);
}

ul {
  list-style-type: disc;
}

ol {
  list-style-type: decimal;
}

li {
  margin-bottom: var(--spacing-sm);
  line-height: var(--line-height-normal);
}

ul ul, ol ul {
  list-style-type: circle;
  margin-top: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

ul ul ul, ol ul ul {
  list-style-type: square;
}

dl {
  margin-bottom: var(--spacing-lg);
}

dt {
  font-weight: 600;
  color: var(--text-primary);
  margin-top: var(--spacing-md);
}

dd {
  margin-left: var(--spacing-xl);
  color: var(--text-secondary);
  margin-bottom: var(--spacing-sm);
}

/* 7. 表格标签 */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--spacing-lg);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

caption {
  caption-side: bottom;
  padding: var(--spacing-md);
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  text-align: center;
  background-color: var(--light-color);
}

thead {
  background-color: var(--dark-color);
  color: var(--text-light);
}

tbody {
  background-color: var(--white-color);
}

tfoot {
  background-color: var(--light-color);
  font-weight: 500;
}

th, td {
  padding: var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

th {
  font-weight: 600;
  text-transform: uppercase;
  font-size: var(--font-size-sm);
  letter-spacing: 1px;
}

tr:hover {
  background-color: rgba(52, 152, 219, 0.05);
}

/* 8. 表单标签 */
form {
  display: block;
  padding: var(--spacing-lg);
  background-color: var(--white-color);
  border-radius: var(--border-radius);
  border: 1px solid #e0e0e0;
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
}

fieldset {
  border: 2px solid var(--light-color);
  border-radius: var(--border-radius);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

legend {
  padding: 0 var(--spacing-sm);
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--font-size-lg);
}

label {
  display: block;
  margin-bottom: var(--spacing-xs);
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
}

input, textarea, select {
  display: block;
  width: 100%;
  padding: var(--spacing-md);
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  background-color: var(--white-color);
  border: 2px solid #e0e0e0;
  border-radius: var(--border-radius);
  transition: all var(--transition-fast);
  margin-bottom: var(--spacing-md);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

input[type="checkbox"],
input[type="radio"] {
  display: inline-block;
  width: auto;
  margin-right: var(--spacing-sm);
  margin-bottom: 0;
  vertical-align: middle;
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: var(--line-height-normal);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232c3e50' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--spacing-md) center;
  background-size: 16px;
  padding-right: var(--spacing-xl);
  appearance: none;
}

/* 9. 按钮与交互标签 */
button,
input[type="button"],
input[type="submit"],
input[type="reset"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md) var(--spacing-xl);
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--white-color);
  background-color: var(--primary-color);
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  user-select: none;
  line-height: 1;
  min-height: 44px;
  box-shadow: var(--shadow-sm);
}

button:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
input[type="reset"]:hover {
  background-color: var(--primary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

button:active,
input[type="button"]:active,
input[type="submit"]:active,
input[type="reset"]:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

button:focus-visible,
input[type="button"]:focus-visible,
input[type="submit"]:focus-visible,
input[type="reset"]:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* 按钮变体 */
button.primary {
  background-color: var(--primary-color);
}

button.secondary {
  background-color: var(--secondary-color);
}

button.danger {
  background-color: var(--danger-color);
}

button.warning {
  background-color: var(--warning-color);
}

button.outline {
  background-color: transparent;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
}

button.outline:hover {
  background-color: var(--primary-color);
  color: var(--white-color);
}

/* 10. 链接标签 */
a {
  color: var(--primary-color);
  text-decoration: none;
  transition: all var(--transition-fast);
  border-bottom: 1px solid transparent;
}

a:hover {
  color: var(--primary-dark);
  border-bottom-color: var(--primary-color);
}

a:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  border-radius: var(--border-radius-sm);
}

/* 11. 媒体标签 */
figure {
  display: block;
  margin: var(--spacing-lg) 0;
  text-align: center;
}

figcaption {
  margin-top: var(--spacing-sm);
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-style: italic;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
}

picture {
  display: block;
}

video {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--border-radius);
  background-color: var(--black-color);
  box-shadow: var(--shadow-md);
}

audio {
  width: 100%;
  margin: var(--spacing-lg) 0;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
}

canvas {
  display: block;
  background-color: var(--light-color);
  border-radius: var(--border-radius);
  border: 2px dashed var(--gray-color);
  margin: var(--spacing-lg) 0;
}

/* 12. 语义标签 */
address {
  font-style: normal;
  padding: var(--spacing-md);
  background-color: var(--light-color);
  border-radius: var(--border-radius);
  border-left: 4px solid var(--info-color);
  margin-bottom: var(--spacing-lg);
}

time {
  font-weight: 500;
  color: var(--text-secondary);
  background-color: var(--light-color);
  padding: 0.2em 0.6em;
  border-radius: var(--border-radius-sm);
  font-size: var(--font-size-sm);
}

meter {
  width: 100%;
  height: 20px;
  border-radius: var(--border-radius);
  overflow: hidden;
  background-color: var(--light-color);
  margin: var(--spacing-md) 0;
}

meter::-webkit-meter-bar {
  background: none;
  background-color: var(--light-color);
}

meter::-webkit-meter-optimum-value {
  background-color: var(--secondary-color);
}

meter::-webkit-meter-suboptimum-value {
  background-color: var(--warning-color);
}

meter::-webkit-meter-even-less-good-value {
  background-color: var(--danger-color);
}

progress {
  width: 100%;
  height: 8px;
  border-radius: var(--border-radius);
  overflow: hidden;
  background-color: var(--light-color);
  margin: var(--spacing-md) 0;
}

progress::-webkit-progress-bar {
  background-color: var(--light-color);
  border-radius: var(--border-radius);
}

progress::-webkit-progress-value {
  background-color: var(--primary-color);
  border-radius: var(--border-radius);
}

progress::-moz-progress-bar {
  background-color: var(--primary-color);
  border-radius: var(--border-radius);
}

/* 13. 交互标签 */
details {
  margin-bottom: var(--spacing-md);
  border: 1px solid #e0e0e0;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

summary {
  padding: var(--spacing-md);
  background-color: var(--light-color);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-left: var(--spacing-xl);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

summary:hover {
  background-color: #e3e9f0;
}

summary::before {
  content: "▶";
  position: absolute;
  left: var(--spacing-md);
  transition: transform var(--transition-fast);
  font-size: 0.8em;
}

details[open] > summary::before {
  transform: rotate(90deg);
}

details > *:not(summary) {
  padding: var(--spacing-md);
  border-top: 1px solid #e0e0e0;
}

dialog {
  border: 1px solid #e0e0e0;
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-xl);
  background-color: var(--white-color);
  box-shadow: var(--shadow-lg);
  max-width: 600px;
  width: 90%;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
}

dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.5);
}

/* 14. 内联语义标签 */
small {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  display: inline-block;
}

strong, b {
  font-weight: 600;
  color: var(--text-primary);
}

em, i {
  font-style: italic;
  color: var(--text-secondary);
}

u {
  text-decoration: underline;
  text-decoration-color: var(--primary-color);
  text-underline-offset: 0.2em;
}

s, del {
  text-decoration: line-through;
  color: var(--text-muted);
}

ins {
  text-decoration: underline;
  background-color: rgba(46, 204, 113, 0.1);
  color: var(--secondary-color);
  padding: 0.1em 0.2em;
  border-radius: var(--border-radius-sm);
}

sub, sup {
  font-size: var(--font-size-xs);
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sup {
  top: -0.5em;
}

sub {
  bottom: -0.25em;
}

q {
  quotes: "\\201C" "\\201D" "\\2018" "\\2019";
  font-style: italic;
  color: var(--text-secondary);
}

q::before {
  content: open-quote;
}

q::after {
  content: close-quote;
}

abbr[title] {
  text-decoration: underline dotted;
  cursor: help;
  border-bottom: 1px dotted var(--gray-color);
}

dfn {
  font-style: italic;
  font-weight: 500;
  border-bottom: 1px dashed var(--gray-color);
  padding-bottom: 1px;
}

var {
  font-family: var(--font-family-mono);
  font-style: italic;
  color: var(--danger-color);
  background-color: var(--light-color);
  padding: 0.1em 0.4em;
  border-radius: var(--border-radius-sm);
}

samp {
  font-family: var(--font-family-mono);
  background-color: var(--light-color);
  color: var(--dark-color);
  padding: 0.2em 0.4em;
  border-radius: var(--border-radius-sm);
  border: 1px solid #ddd;
}

/* 15. 其他标签 */
hr {
  border: none;
  border-top: 2px solid var(--light-color);
  margin: var(--spacing-xl) 0;
  width: 100%;
}

wbr {
  display: inline-block;
}

br {
  display: block;
  content: "";
  margin-top: 0.5em;
}

/* 16. 辅助功能 */
[hidden] {
  display: none !important;
}

[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  border-radius: var(--border-radius-sm);
}

/* 17. 打印样式 */
@media print {
  *,
  *::before,
  *::after {
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  a,
  a:visited {
    text-decoration: underline;
  }
  
  abbr[title]::after {
    content: " (" attr(title) ")";
  }
  
  pre {
    white-space: pre-wrap !important;
  }
  
  thead {
    display: table-header-group;
  }
  
  tr,
  img {
    page-break-inside: avoid;
  }
  
  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }
  
  h2,
  h3 {
    page-break-after: avoid;
  }
}

/* 18. 响应式设计 */
@media (max-width: 768px) {
  :root {
    --spacing-lg: 1rem;
    --spacing-xl: 1.5rem;
    --font-size-xxl: 1.25rem;
    --font-size-xxxl: 1.5rem;
  }
  
  h1 { font-size: var(--font-size-xxxl); }
  h2 { font-size: var(--font-size-xxl); }
  h3 { font-size: var(--font-size-xl); }
  
  main, section, article, aside {
    padding: var(--spacing-md);
  }
  
  table {
    display: block;
    overflow-x: auto;
  }
}

@media (max-width: 480px) {
  :root {
    --spacing-md: 0.75rem;
    --spacing-lg: 1rem;
    --font-size-base: 0.9375rem;
  }
  
  ul, ol {
    margin-left: var(--spacing-lg);
  }
}
