/* ─────────────────────────────────────────────────────────
   星屑手帐 · base
   ───────────────────────────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-color: var(--c-line-strong) var(--c-paper);
  overflow-x: clip;
  overscroll-behavior-x: none;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--c-paper);
  color: var(--c-ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-x: none;
}

@supports not (overflow: clip) {
  html,
  body {
    overflow-x: hidden;
  }
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background-image: var(--noise);
  opacity: 0.22;
  mix-blend-mode: multiply;
}

::selection {
  background: var(--c-ink);
  color: var(--c-cream);
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a,
button,
[role="button"] {
  touch-action: manipulation;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
h4 {
  font-weight: 500;
  line-height: 1.2;
  text-wrap: balance;
}

:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 4px;
  border-radius: 2px;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 10000;
  padding: 12px 20px;
  background: var(--c-ink);
  color: var(--c-cream);
  border-radius: var(--radius-sm);
  transition: top var(--dur-fast) var(--ease-out);
}

.skip-link:focus {
  top: 16px;
}

.container {
  width: min(calc(100% - var(--gutter) * 2), var(--container));
  margin-inline: auto;
}

.container--narrow {
  width: min(calc(100% - var(--gutter) * 2), var(--container-narrow));
  margin-inline: auto;
}

.section {
  padding-block: clamp(64px, 10vw, 128px);
}

.section--tight {
  padding-block: clamp(40px, 6vw, 72px);
}

.display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.005em;
}

.eyebrow,
.label-en {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-size: var(--text-2xs);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-muted);
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: currentColor;
  opacity: 0.65;
}

.lede {
  font-size: clamp(1.0625rem, 1.4vw, 1.1875rem);
  line-height: 1.9;
  color: var(--c-ink-soft);
}

.muted {
  color: var(--c-muted);
}

.hand {
  font-family: var(--font-display);
  letter-spacing: 0.04em;
}

.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
}

.icon--sm {
  width: 16px;
  height: 16px;
}

.icon--lg {
  width: 24px;
  height: 24px;
}

hr {
  border: 0;
  border-top: 1px solid var(--c-line);
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

/* 统一动效 */
.reveal {
  opacity: 1;
}

.js .reveal:not(.is-visible) {
  opacity: 0;
  transform: translateY(22px);
}

.js .reveal {
  transition:
    opacity 700ms var(--ease-out),
    transform 700ms var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

/* 原生跨页过渡（支持的浏览器自动启用） */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 320ms;
  animation-timing-function: var(--ease-out);
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 11px;
}

::-webkit-scrollbar-track {
  background: var(--c-paper);
}

::-webkit-scrollbar-thumb {
  background: var(--c-line-strong);
  border: 3px solid var(--c-paper);
  border-radius: 999px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .js .reveal:not(.is-visible) {
    opacity: 1;
    transform: none;
  }
}

/* ── 移动端稳定性 ───────────────────────────────────────────
   iOS 会放大 font-size < 16px 的输入框，造成整页左右位移；
   统一到 16px，既防自动缩放，也保留可读性。 */
@media (max-width: 760px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  textarea,
  select,
  .input,
  .textarea,
  .select {
    font-size: 16px;
  }
}
