/* ============================================================
   基础层：字体、重置、排版、按钮与通用组件
   ============================================================ */

/* —— 字体：子集化后体积可控，只加载站点真正用到的字符 —— */
@font-face {
  font-family: "Emis Serif";
  src: url("../assets/fonts/emis-serif.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Emis Hand";
  src: url("../assets/fonts/emis-hand.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Emis Mono";
  src: url("../assets/fonts/emis-mono.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Emis Roman";
  src: url("../assets/fonts/emis-roman.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

/* —— 重置 —— */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 110px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.78;
  letter-spacing: 0.012em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  font-synthesis-weight: none;
}

body.is-locked { overflow: hidden; }

h1, h2, h3, h4, p, figure, blockquote, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  padding: 0.15em 0.4em;
  border-radius: 6px;
  background: rgba(194, 58, 85, 0.07);
  color: var(--accent-ink);
}

::selection {
  background: rgba(246, 165, 184, 0.55);
  color: var(--crimson-ink);
}

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

/* —— 排版 —— */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.012em;
  text-wrap: balance;
}
em { font-style: normal; }

.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

/* Cormorant 默认用 oldstyle 数字，1 会被读成 I —— 大字号统一切 lining */
.fact strong,
.score-number strong,
.bar-val,
.compat-big b,
.live-big strong,
.live-card-val strong,
.stub-file strong,
.ring-num strong {
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1;
}

.hand {
  font-family: var(--font-hand);
  font-size: clamp(1.15rem, 1rem + 0.6vw, 1.4rem);
  color: var(--accent-ink);
  letter-spacing: 0.04em;
}

.wrap {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
  position: relative;
}

.section {
  position: relative;
  padding-block: var(--section-y);
  z-index: var(--z-content);
}

.skip-link {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 200;
  padding: 12px 18px;
  border-radius: var(--r-pill);
  background: var(--crimson);
  color: #fff;
  font-size: 0.9rem;
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus { top: 16px; }

/* —— 氛围层 —— */
.atmos {
  position: fixed;
  inset: 0;
  z-index: var(--z-atmos);
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% -10%, #fffaf6 0%, var(--cream) 45%, #fbeee8 100%);
}
.atmos-spot {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.85;
  will-change: transform;
}
.atmos-spot--rose {
  width: 52vw; height: 52vw;
  left: -14vw; top: -12vw;
  background: radial-gradient(circle, rgba(246, 165, 184, 0.45), rgba(246, 165, 184, 0) 68%);
  animation: drift-a 34s ease-in-out infinite;
}
.atmos-spot--amber {
  width: 44vw; height: 44vw;
  right: -10vw; top: 8vh;
  background: radial-gradient(circle, rgba(232, 176, 75, 0.26), rgba(232, 176, 75, 0) 70%);
  animation: drift-b 42s ease-in-out infinite;
}
.atmos-spot--blush {
  width: 70vw; height: 46vw;
  left: 20vw; bottom: -26vw;
  background: radial-gradient(circle, rgba(255, 214, 224, 0.5), rgba(255, 214, 224, 0) 70%);
  animation: drift-a 52s ease-in-out infinite reverse;
}
.atmos-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(139, 90, 60, 0.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(139, 90, 60, 0.045) 1px, transparent 1px);
  background-size: 96px 96px;
  mask-image: radial-gradient(120% 80% at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(120% 80% at 50% 0%, #000 20%, transparent 78%);
}

@keyframes drift-a {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(3vw, 2.5vh, 0) scale(1.08); }
}
@keyframes drift-b {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1.02); }
  50% { transform: translate3d(-3.4vw, 4vh, 0) scale(0.96); }
}

/* 颗粒：让大面积奶油白有纸感 */
.grain {
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* —— 滚动进度 —— */
.progress {
  position: fixed;
  left: 0; top: 0;
  height: 2px;
  width: 100%;
  z-index: 140;
  pointer-events: none;
  background: transparent;
}
.progress i {
  display: block;
  height: 100%;
  width: var(--p, 0%);
  background: linear-gradient(90deg, var(--rose), var(--crimson) 55%, var(--amber));
  box-shadow: 0 0 12px rgba(194, 58, 85, 0.55);
  transition: width 80ms linear;
}

/* —— 游标 —— */
.cursor {
  position: fixed;
  left: 0; top: 0;
  z-index: var(--z-cursor);
  pointer-events: none;
  display: none;
  opacity: 0;
  transition: opacity 200ms linear;
}
.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0; left: 0;
  border-radius: 50%;
  transform: translate3d(-50%, -50%, 0);
  will-change: transform;
}
.cursor-dot {
  width: 7px; height: 7px;
  background: var(--crimson);
  box-shadow: 0 0 14px rgba(194, 58, 85, 0.5);
}
.cursor-ring {
  width: 34px; height: 34px;
  border: 1px solid rgba(194, 58, 85, 0.4);
  transition: width 240ms var(--ease-spring), height 240ms var(--ease-spring),
              background-color 240ms var(--ease-out), border-color 240ms var(--ease-out);
}
.cursor.is-hover .cursor-ring {
  width: 58px; height: 58px;
  background: rgba(246, 165, 184, 0.14);
  border-color: rgba(194, 58, 85, 0.55);
}
.cursor.is-down .cursor-ring {
  width: 26px; height: 26px;
  background: rgba(194, 58, 85, 0.18);
}
@media (pointer: fine) {
  .cursor { display: block; }
  body.has-cursor,
  body.has-cursor a,
  body.has-cursor button,
  body.has-cursor summary { cursor: none; }
}

/* —— 按钮 —— */
.btn {
  --btn-h: 52px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--btn-h);
  padding: 0 22px;
  border-radius: var(--r-pill);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: transform var(--dur-base) var(--ease-spring),
              background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
  isolation: isolate;
  overflow: hidden;
}
.btn--sm { --btn-h: 40px; padding: 0 16px; font-size: 0.84rem; gap: 8px; }
.btn--lg { --btn-h: 60px; padding: 0 28px; font-size: 1rem; }
.btn:active { transform: scale(0.975); }

.btn--solid {
  color: #fff7f4;
  background: linear-gradient(135deg, #cf425e 0%, var(--crimson) 55%, #b03250 100%);
  box-shadow: var(--shadow-accent), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.btn--solid::after {
  /* 扫光：hover 时从左侧掠过 */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.34) 48%, transparent 62%);
  transform: translateX(-120%);
  transition: transform 780ms var(--ease-out);
}
.btn--solid:hover { box-shadow: 0 26px 58px -22px rgba(194, 58, 85, 0.6), inset 0 1px 0 rgba(255,255,255,.32); }
.btn--solid:hover::after { transform: translateX(120%); }

.btn--ghost {
  color: var(--ink);
  border: 1px solid var(--hairline-strong);
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
}
.btn--ghost:hover {
  border-color: var(--crimson);
  color: var(--accent-ink);
  background: rgba(255, 255, 255, 0.78);
  transform: translateY(-2px);
}

.btn-label { line-height: 1.1; }
.btn-sub {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  opacity: 0.72;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.35);
  line-height: 1.2;
}
.btn-arrow { transition: transform var(--dur-base) var(--ease-spring); }
.btn:hover .btn-arrow { transform: translateY(2px); }

/* —— 药丸标签 —— */
.chip {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 13px;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink-soft);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  transition: transform var(--dur-base) var(--ease-spring),
              background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out);
}
.chip:hover {
  transform: translateY(-3px);
  border-color: rgba(194, 58, 85, 0.4);
  background: #fff;
  color: var(--accent-ink);
  box-shadow: var(--shadow-1);
}

/* —— 状态点 —— */
.pulse {
  position: relative;
  display: inline-flex;
  width: 8px; height: 8px;
  flex: none;
}
.pulse i {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.pulse::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(194, 58, 85, 0.45);
  animation: ping 2.4s var(--ease-out) infinite;
}
.pulse--ok i { background: var(--ok); }
.pulse--ok::after { border-color: rgba(79, 125, 85, 0.45); }
@keyframes ping {
  0% { transform: scale(0.6); opacity: 0.9; }
  70%, 100% { transform: scale(1.9); opacity: 0; }
}

/* —— 入场：只动 opacity / transform —— */
[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 720ms var(--ease-out), transform 720ms var(--ease-out);
  transition-delay: var(--delay, 0ms);
}
[data-reveal].is-in { opacity: 1; transform: none; }

/* —— 分组标题 —— */
.sec-head { margin-bottom: clamp(40px, 5vw, 72px); }
.sec-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: 22px;
}
.sec-label .num { color: var(--accent); }
.sec-label i { flex: 1; height: 1px; background: var(--hairline); max-width: 88px; }
.sec-head-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(24px, 5vw, 80px);
  align-items: end;
}
.sec-head h2 {
  font-size: var(--fs-h2);
  line-height: 1.06;
  letter-spacing: -0.02em;
}
.sec-head h2 em { color: var(--accent); position: relative; }
.sec-lead {
  font-size: var(--fs-lead);
  line-height: 1.85;
  color: var(--text-muted);
  max-width: 46ch;
  padding-bottom: 6px;
  text-wrap: pretty;
}

/* —— Toast —— */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 24px);
  z-index: var(--z-toast);
  padding: 12px 22px;
  border-radius: var(--r-pill);
  background: rgba(58, 42, 33, 0.94);
  color: #fff6f1;
  font-size: 0.86rem;
  letter-spacing: 0.03em;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-spring);
  box-shadow: 0 18px 40px -18px rgba(58, 42, 33, 0.6);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* —— 降级 —— */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
  .cursor { display: none !important; }
}
