/* ============================================
   基础样式 Base
   ============================================ */

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

html, body {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(ellipse 70% 50% at 15% 0%, rgba(246, 226, 154, .22), transparent 60%),
    radial-gradient(ellipse 60% 45% at 88% 12%, rgba(242, 181, 190, .20), transparent 62%),
    radial-gradient(ellipse 55% 40% at 50% 100%, rgba(185, 207, 177, .18), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
}

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

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

::selection { background: var(--blush-soft); color: var(--ink); }

/* 纸张颗粒质感（仅首页叠奶油纸时生效，Bliss 背景下关闭） */
.home-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: .35;
  background-image:
    radial-gradient(rgba(120, 100, 72, .12) .5px, transparent .6px),
    radial-gradient(rgba(120, 100, 72, .08) .5px, transparent .6px);
  background-size: 7px 7px, 11px 11px;
  background-position: 0 0, 3px 5px;
  mix-blend-mode: multiply;
}

/* 焦点可见性 */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--mist);
  outline-offset: 3px;
  border-radius: 4px;
}

/* 跳转链接（无障碍） */
.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 1000;
  background: var(--ink);
  color: var(--cream);
  padding: 8px 16px;
  border-radius: var(--r-pill);
  transition: top var(--dur-fast) var(--ease-out);
  font-size: var(--fs-sm);
}
.skip-link:focus { top: 12px; }

/* 应用根节点 */
.app-root {
  min-height: 100vh;
  min-height: 100svh;
  padding-top: var(--menu-bar-h);
  outline: none;
}

/* 页面通用容器 */
.page {
  min-height: calc(100vh - var(--menu-bar-h));
  min-height: calc(100svh - var(--menu-bar-h));
  animation: pageIn var(--dur-med) var(--ease-out);
  background-image: var(--bg-bliss);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  position: relative;
}

/* Bliss 背景上叠加奶油色半透明遮罩，保证文字对比度 */
.page::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--bliss-overlay);
}

/* 首页：不用 Bliss，保留奶油纸 + 颗粒 */
.home-page {
  background-image: none;
  background-color: var(--cream);
}
.home-page::after { display: none; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 减少动态偏好 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* 工具类 */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.text-mute { color: var(--ink-mute); }
.text-faint { color: var(--ink-faint); }
.handwrite { font-family: var(--font-hand); }
