/* Reset + 全局元素基线。 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--color-text);
}

h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }

p {
  margin: 0;
  color: var(--color-text-soft);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--trans-fast);
}

a:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

input,
select,
textarea {
  font: inherit;
  color: var(--color-text);
  background: var(--color-surface-sunken);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  width: 100%;
  outline: none;
  transition: border-color var(--trans-fast), box-shadow var(--trans-fast), background var(--trans-fast);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-muted);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--color-border-strong);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
  background: var(--color-surface);
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

textarea {
  min-height: 96px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
}

label {
  display: block;
  margin-bottom: var(--sp-2);
  color: var(--color-text-soft);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}

pre, code {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
}

pre {
  margin: 0;
  padding: var(--sp-3);
  background: var(--color-surface-sunken);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  color: var(--color-text-soft);
  line-height: var(--lh-normal);
}

hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: var(--sp-4) 0;
}

::selection {
  background: var(--color-primary-soft-hover);
  color: var(--color-text);
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

.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;
}

.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -48px;
  z-index: var(--z-toast);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--color-text);
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-md);
  transition: top var(--trans-fast);
}

.skip-link:focus {
  top: var(--sp-4);
}

@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;
  }
}
