/**
 * 宋向元汝瓷官网 - 基础重置样式
 * 基于现代CSS最佳实践，针对汝瓷品牌定制
 */

/* ═══════════════════════════════════════════════════════════
   CSS重置与标准化
═══════════════════════════════════════════════════════════ */

/* 现代CSS重置 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--color-text);
  background-color: var(--color-yuebai);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ═══════════════════════════════════════════════════════════
   媒体元素
═══════════════════════════════════════════════════════════ */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  vertical-align: middle;
  border-style: none;
}

svg {
  overflow: hidden;
  vertical-align: middle;
}

/* ═══════════════════════════════════════════════════════════
   表单元素
═══════════════════════════════════════════════════════════ */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  outline: none;
}

button:focus-visible {
  outline: 2px solid var(--color-cuiqing);
  outline-offset: 2px;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--duration-normal) var(--ease-luxury);
}

a:focus-visible {
  outline: 2px solid var(--color-cuiqing);
  outline-offset: 2px;
}

textarea {
  resize: vertical;
}

label {
  display: inline-block;
}

/* ═══════════════════════════════════════════════════════════
   列表元素
═══════════════════════════════════════════════════════════ */
ul,
ol {
  list-style: none;
}

/* ═══════════════════════════════════════════════════════════
   表格元素
═══════════════════════════════════════════════════════════ */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* ═══════════════════════════════════════════════════════════
   排版元素
═══════════════════════════════════════════════════════════ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-body);
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--color-text);
}

h1 {
  font-size: var(--text-5xl);
  letter-spacing: var(--tracking-tight);
}

h2 {
  font-size: var(--text-4xl);
  letter-spacing: var(--tracking-tight);
}

h3 {
  font-size: var(--text-3xl);
}

h4 {
  font-size: var(--text-2xl);
}

h5 {
  font-size: var(--text-xl);
}

h6 {
  font-size: var(--text-lg);
}

p {
  margin-bottom: var(--space-4);
}

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

strong, b {
  font-weight: 600;
}

em, i {
  font-style: italic;
}

small {
  font-size: var(--text-sm);
}

/* ═══════════════════════════════════════════════════════════
   引用元素
═══════════════════════════════════════════════════════════ */
blockquote,
q {
  font-style: italic;
}

blockquote {
  border-left: 3px solid var(--color-gold);
  padding-left: var(--space-4);
  margin: var(--space-6) 0;
  color: var(--color-text-light);
}

blockquote cite {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  font-style: normal;
  color: var(--color-text-muted);
}

/* ═══════════════════════════════════════════════════════════
   代码元素
═══════════════════════════════════════════════════════════ */
code,
kbd,
samp {
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.9em;
}

code {
  background: var(--color-fenqing);
  padding: 0.125em 0.375em;
  border-radius: var(--radius-md);
}

pre {
  background: var(--color-bg-dark);
  color: var(--color-text-inverse);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

pre code {
  background: transparent;
  padding: 0;
}

/* ═══════════════════════════════════════════════════════════
   分割线
═══════════════════════════════════════════════════════════ */
hr {
  border: none;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    var(--color-sand),
    transparent
  );
  margin: var(--space-8) 0;
}

/* ═══════════════════════════════════════════════════════════
   辅助类
═══════════════════════════════════════════════════════════ */

/* 文字截断 */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 屏幕阅读器专用（视觉隐藏但可访问） */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* 书法字体（用于诗词、标题） */
.font-title {
  font-family: var(--font-title);
}

.font-body {
  font-family: var(--font-body);
}

.font-sans {
  font-family: var(--font-sans);
}

.font-number {
  font-family: var(--font-number);
}

/* 文本对齐 */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* 文本颜色 */
.text-gold { color: var(--color-text-gold); }
.text-tianqing { color: var(--color-tianqing-dark); }
.text-muted { color: var(--color-text-muted); }
.text-light { color: var(--color-text-light); }

/* 背景颜色 */
.bg-yuebai { background-color: var(--color-yuebai); }
.bg-cream { background-color: var(--color-cream); }
.bg-fenqing { background-color: var(--color-fenqing); }
.bg-dark { background-color: var(--color-bg-dark); }

/* 金色渐变文字（无障碍优化：加深金色确保对比度） */
.gradient-text {
  background: linear-gradient(135deg, var(--color-text-gold) 0%, var(--color-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 天青渐变文字 */
.gradient-tianqing {
  background: linear-gradient(135deg, var(--color-tianqing) 0%, var(--color-tianqing-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ═══════════════════════════════════════════════════════════
   无障碍：跳过导航链接
═══════════════════════════════════════════════════════════ */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--color-bg-dark);
  color: var(--color-text-inverse);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  z-index: 10000;
  text-decoration: none;
  transition: top var(--duration-fast) var(--ease-standard);
}

.skip-link:focus {
  top: var(--space-4);
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════
   无障碍：焦点样式
═══════════════════════════════════════════════════════════ */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--color-cuiqing);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════
   无障碍：高对比度模式支持
═══════════════════════════════════════════════════════════ */
@media (prefers-contrast: high) {
  :root {
    --color-text: #000000;
    --color-text-light: #333333;
    --color-text-muted: #666666;
  }
  
  a {
    text-decoration: underline;
  }
  
  button {
    border: 2px solid currentColor;
  }
}

/* ═══════════════════════════════════════════════════════════
   打印样式
═══════════════════════════════════════════════════════════ */
@media print {
  body {
    background: white;
    color: black;
  }
  
  header,
  footer,
  nav,
  .no-print {
    display: none !important;
  }
  
  a[href]::after {
    content: " (" attr(href) ")";
  }
}
