/**
 * BuildBarn 全站设计 token（单一真源 SSOT）。
 *
 * 所有 --bb-* 变量在本文件定义一次；其他 CSS/PHP 只允许引用（var(...)），不允许
 * 重复定义。换肤/调色只改这一处。
 *
 * 加载顺序（依赖链，见 buildbarn-header-rocket-compat.php）：
 *   bb-tokens -> bb-components -> porto-812 -> site-ui -> design-system-v2 -> 页面族
 *
 * 与旧 palette 的 bit-for-bit 兼容：前 ~30 行与 buildbarn-ai-visibility-site-ui.css
 * 顶部完全一致，不引入视觉变化。本文件新增的是间距/半径/阴影/字号/动效 token，
 * 让 Phase B 以后的组件和页面皮直接走统一节奏。
 */
html {
	color-scheme: only light;

	/* Palette（保持与 site-ui 完全一致） */
	--bb-brand-primary: #7a5b3f;
	--bb-brand-secondary: #9a7657;
	--bb-brand-accent: #a07a58;
	--bb-brand-accent-strong: #6c4f36;
	--bb-text-primary: #2e2118;
	--bb-text-secondary: #6c5645;
	--bb-text-muted: #8b7462;
	--bb-bg-page: #f3efe6;
	--bb-bg-card: #fbf8f1;
	--bb-bg-soft: #ece4d7;
	--bb-border-soft: #d8cbbf;
	--bb-border-strong: #c7b4a3;
	--bb-footer-bg: #5f4632;
	--bb-footer-text: #f7f0e8;
	--bb-footer-link: #f3e6d8;
	--bb-footer-link-hover: #ffffff;
	--bb-footer-muted: rgba(245, 245, 243, 0.78);
	--bb-footer-accent: #d2b293;
	--bb-footer-divider: rgba(255, 255, 255, 0.14);
	--bb-success: #3f6a50;
	--bb-warning: #8a6a3d;
	--bb-danger: #7d2626;
	--porto-primary-color: var(--bb-brand-primary);
	--porto-secondary-color: var(--bb-brand-secondary);

	/* Typography tokens（Phase A 新增：两轨 font stack + 模块化字号） */
	--bb-font-sans: "Plus Jakarta Sans", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--bb-font-display: "Fraunces", "Plus Jakarta Sans", Georgia, "Times New Roman", serif;
	--bb-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	--bb-fs-xs: 0.75rem;     /* 12px */
	--bb-fs-sm: 0.875rem;    /* 14px */
	--bb-fs-base: 1rem;      /* 16px */
	--bb-fs-lg: 1.125rem;    /* 18px */
	--bb-fs-xl: 1.375rem;    /* 22px */
	--bb-fs-2xl: 1.75rem;    /* 28px */
	--bb-fs-3xl: 2.25rem;    /* 36px */
	--bb-fs-4xl: clamp(2.5rem, 4.5vw, 3.75rem); /* hero */
	--bb-lh-tight: 1.15;
	--bb-lh-snug: 1.35;
	--bb-lh-normal: 1.55;
	--bb-lh-relaxed: 1.7;

	/* Spacing scale（clamp 让移动端自动缩紧） */
	--bb-space-1: 0.25rem;
	--bb-space-2: 0.5rem;
	--bb-space-3: 0.75rem;
	--bb-space-4: 1rem;
	--bb-space-5: 1.25rem;
	--bb-space-6: 1.5rem;
	--bb-space-8: 2rem;
	--bb-space-10: 2.5rem;
	--bb-space-12: 3rem;
	--bb-space-16: 4rem;
	--bb-space-section: clamp(2.75rem, 5vw, 5rem); /* section 间距，全站统一 */

	/* Radius */
	--bb-radius-xs: 4px;
	--bb-radius-sm: 8px;
	--bb-radius-md: 12px;
	--bb-radius-lg: 16px;
	--bb-radius-xl: 24px;
	--bb-radius-pill: 999px;

	/* Shadow（基色为暖棕 rgba(95,70,50,*)，不再用冷灰 rgba(42,42,42,*)） */
	--bb-shadow-xs: 0 1px 2px rgba(95, 70, 50, 0.08);
	--bb-shadow-sm: 0 4px 10px rgba(95, 70, 50, 0.08);
	--bb-shadow-md: 0 10px 22px rgba(95, 70, 50, 0.12);
	--bb-shadow-lg: 0 18px 38px rgba(95, 70, 50, 0.14);
	--bb-shadow-focus: 0 0 0 3px rgba(122, 91, 63, 0.26);

	/* Layout */
	--bb-container-max: 1320px;
	--bb-container-x: clamp(16px, 3vw, 32px);
	--bb-header-h-desktop: 72px;
	--bb-header-h-mobile: 56px;

	/* Motion（仅两档：微交互 / 布局） */
	--bb-ease: cubic-bezier(0.2, 0.7, 0.3, 1);
	--bb-dur-fast: 150ms;
	--bb-dur-base: 200ms;

	/* Focus ring（全站统一 a11y） */
	--bb-focus-ring: var(--bb-shadow-focus);

	/* Z-index scale */
	--bb-z-header: 100;
	--bb-z-drawer: 200;
	--bb-z-modal: 300;
	--bb-z-toast: 400;
}

/* 用户偏好：减少动效 —— Phase H 之前就让所有 transition 退化为瞬时，避免前庭敏感 */
@media (prefers-reduced-motion: reduce) {
	html {
		--bb-dur-fast: 0ms;
		--bb-dur-base: 0ms;
	}
}
