/* =====================================================================
   基础：重置、排版、纸纹、滚动条
   ===================================================================== */

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

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

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  /* Cormorant Garamond 默认是旧式数字，单个 1/2 会缩成 x 高度而几乎看不见。
     全局强制等高数字，任何用到 --font-en 的地方都不用再单独处理。 */
  font-variant-numeric: lining-nums;
  transition: background var(--dur-slow) var(--ease-out),
              color var(--dur-slow) var(--ease-out);
}

/* ---------- 纸纹 / 微光 背景 ---------- */
/* 浅色：极淡噪点，模拟宣纸纤维 */
/* 深色：径向微光 + 星点 */
.atmos {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.atmos::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='180' height='180' filter='url(%23n)' opacity='1'/></svg>");
  opacity: var(--paper-noise);
  mix-blend-mode: multiply;
}

:root[data-theme='dark'] .atmos::before {
  mix-blend-mode: screen;
}

.atmos::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: var(--glow);
  background:
    radial-gradient(60% 45% at 78% -6%, rgba(245, 158, 11, .16), transparent 70%),
    radial-gradient(46% 38% at 12% 4%,  rgba(30, 58, 138, .34), transparent 72%),
    radial-gradient(70% 55% at 50% 110%, rgba(232, 200, 122, .09), transparent 70%);
  transition: opacity var(--dur-slow) var(--ease-out);
}

/* ---------- 排版 ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-zh);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: .01em;
}

.deva {
  font-family: var(--font-deva);
  line-height: 1.9;
}

.num, .en {
  font-family: var(--font-en);
  font-variant-numeric: lining-nums;
  letter-spacing: .02em;
}

code, .mono { font-family: var(--font-mono); }

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

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

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

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

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

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

/* ---------- 工具类 ---------- */
.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;
}

.stack   { display: flex; flex-direction: column; }
.row     { display: flex; align-items: center; }
.wrap    { flex-wrap: wrap; }
.grow    { flex: 1; min-width: 0; }
.center  { justify-content: center; }
.between { justify-content: space-between; }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); } .gap-4 { gap: var(--sp-4); }
.gap-5 { gap: var(--sp-5); } .gap-6 { gap: var(--sp-6); }
.mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); } .mt-5 { margin-top: var(--sp-5); }
.mt-6 { margin-top: var(--sp-6); }
.muted   { color: var(--text-2); }
.faint   { color: var(--text-3); }
.tiny    { font-size: 12px; }
.small   { font-size: 13px; }
.bold    { font-weight: 700; }
.tc      { text-align: center; }
.hide    { display: none !important; }

/* ---------- 首屏 / 致命提示 ---------- */
.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--sp-6);
  text-align: center;
}

.boot-card {
  max-width: 520px;
  padding: var(--sp-7);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}

.boot-card h1 { font-size: 22px; margin-bottom: var(--sp-3); }
.boot-card p  { color: var(--text-2); margin-bottom: var(--sp-3); }
.boot-card code {
  display: block;
  margin-top: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 13px;
  text-align: left;
  user-select: all;
}
