/* ==========================================================================
   base.css — 设计变量、字体、重置、排版基线
   婚礼请柬 · 森系花艺
   ========================================================================== */

/* ---------- 字体 ----------
   霞鹜文楷 Screen（OFL 协议，可商用），由 tools/subset-font.mjs 子集化生成。
   下面的回退栈必须保留：即使忘记重跑子集化，缺字也只是回退到系统字体，
   不会出现豆腐块。 */
@font-face {
  font-family: "LXGW WenKai Screen";
  src: url("../fonts/wenkai-subset.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ---------- 色板 ---------- */
  --cream: #faf7f2;
  --beige: #f0e9df;
  --beige-deep: #e6dccd;
  --sage: #8a9a7b;
  --sage-soft: #a8b49b;
  --forest: #3e4a3a;
  --gold: #c9a961;
  --gold-soft: #ddc48d;
  --ink: #4a4238;
  --ink-soft: #7c7264;
  --line: rgba(74, 66, 56, 0.14);

  /* ---------- 字体栈 ---------- */
  --font-body: "LXGW WenKai Screen", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Heiti SC", sans-serif;

  /* ---------- 排版尺度（基准视口 375px，流式缩放） ---------- */
  --fs-xs: clamp(0.72rem, 3.1vw, 0.82rem);
  --fs-sm: clamp(0.84rem, 3.6vw, 0.94rem);
  --fs-base: clamp(0.95rem, 4vw, 1.06rem);
  --fs-lg: clamp(1.06rem, 4.7vw, 1.26rem);
  --fs-xl: clamp(1.35rem, 5.8vw, 1.65rem);
  --fs-2xl: clamp(1.7rem, 7.6vw, 2.3rem);
  --fs-name: clamp(2.05rem, 10.5vw, 3rem);

  /* ---------- 间距 ---------- */
  --gap-xs: 0.4rem;
  --gap-sm: 0.75rem;
  --gap-md: 1.25rem;
  --gap-lg: 2rem;
  --gap-xl: 3.25rem;

  /* ---------- 圆角与阴影 ---------- */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-soft: 0 6px 24px rgba(74, 66, 56, 0.08);
  --shadow-card: 0 10px 34px rgba(74, 66, 56, 0.1);

  /* ---------- 版心 ---------- */
  --shell: 480px;

  /* ---------- 由 JS 写入，兜底微信地址栏伸缩 ---------- */
  --vh: 1vh;
}

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

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

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background-color: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.85;
  letter-spacing: 0.02em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

/* 纸张质感：用两层极细的点阵替代 feTurbulence，移动端几乎零开销 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(74, 66, 56, 0.055) 0.5px, transparent 0.5px),
    radial-gradient(rgba(138, 154, 123, 0.05) 0.5px, transparent 0.5px);
  background-size: 3px 3px, 5px 5px;
  background-position: 0 0, 1px 2px;
}

/* 飘落花瓣层。
   层级必须高于 #main（z-index 2）：
   #main 设了 z-index 会创建层叠上下文，若花瓣低于它，
   封面照片（不透明）会把花瓣整片盖住——恰恰是在最显眼的首页。
   因此花瓣浮在内容之上，靠两点保证不干扰阅读：
     - pointer-events: none，永不影响点击与滑动；
     - 粒子小、透明度低，掠过文字只是一瞬。
   仍然低于相册放大层（200），放大看图时不会有花瓣干扰。 */
.petals {
  position: fixed;
  inset: 0;
  z-index: 150;
  pointer-events: none;
}

h1,
h2,
h3,
p,
figure,
blockquote {
  margin: 0;
}

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

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

img {
  height: auto;
  border-style: none;
}

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

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

/* 内联 SVG 图形库不占位 */
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ---------- 版心 ---------- */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 48px;
  padding: 0.7em 1.5em;
  border-radius: 999px;
  font-size: var(--fs-sm);
  letter-spacing: 0.06em;
  transition: transform 0.18s ease, box-shadow 0.18s ease,
    background-color 0.18s ease, color 0.18s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background-color: var(--sage);
  color: #fff;
  box-shadow: 0 6px 18px rgba(138, 154, 123, 0.34);
}

.btn--primary:active {
  box-shadow: 0 3px 10px rgba(138, 154, 123, 0.3);
}

.btn--ghost {
  border: 1px solid var(--line);
  color: var(--ink-soft);
  background-color: rgba(255, 255, 255, 0.5);
}

/* ---------- 无障碍 ---------- */
:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 3px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 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;
  }
}
