/*
Theme Name: Altarmala
Theme URI: https://altarmala.shop
Author: 案珠记 Altarmala
Author URI: https://altarmala.shop
Description: 案珠记 Altarmala 自建轻量「块优先」混合主题。外壳与商城用 PHP 模板可控渲染，首页主体与内容用区块编辑，二者通过 theme.json 共享同一套设计令牌。零页面构建器、零付费依赖、零第三方 CDN。
Version: 1.5.2
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: altarmala
Tags: custom-colors, custom-menu, featured-images, translation-ready, e-commerce, block-patterns
Requires PHP: 7.4
Requires at least: 6.4
WC requires at least: 8.0
WC tested up to: 9.9
*/

/* ==========================================================================
   Altarmala · 基础层：reset / 排版 / 容器 / 栅格 / 响应式
   设计令牌（CSS 变量）见 assets/css/base.css，与 theme.json 同步。
   v1.4.0：硬编码色值全部收编为令牌；字号走 --am-fs-* 七级阶梯。
   ========================================================================== */

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

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

body {
	margin: 0;
	background: var(--am-paper);
	color: var(--am-ink);
	font-family: var(--am-font-body);
	font-size: var(--am-fs-base);
	line-height: 1.7;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	/* P0-5：底部占位，避免固定悬浮的 WhatsApp 按钮 / 移动端 Tab 栏遮挡页脚内容 */
	padding-bottom: 80px;
}

h1, h2, h3, h4, h5, h6 {
	margin: 0 0 0.6em;
	font-family: var(--am-font-serif);
	font-weight: 600;
	line-height: 1.3;
	color: var(--am-primary);
}

h1 { font-size: var(--am-fs-2xl); }
h2 { font-size: var(--am-fs-xl); }
h3 { font-size: var(--am-fs-lg); }
h4 { font-size: var(--am-fs-md); }
h5 { font-size: var(--am-fs-base); }
h6 { font-size: var(--am-fs-sm); }

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

a {
	color: var(--am-gold-deep);
	text-decoration: none;
	transition: color var(--am-transition);
}
a:hover { color: var(--am-gold); }

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

ul, ol { margin: 0 0 1.1em; padding-left: 1.4em; }
li { margin-bottom: .35em; }

table { width: 100%; border-collapse: collapse; margin: 0 0 1.2em; }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--am-line); text-align: left; }
th { color: var(--am-primary); font-weight: 600; }

blockquote {
	margin: 0 0 1.2em;
	padding: 4px 0 4px 20px;
	border-left: 3px solid var(--am-gold-soft);
	color: var(--am-muted);
	font-style: normal;
}

hr {
	border: 0;
	border-top: 1px solid var(--am-line);
	margin: 32px 0;
}

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

/* ---------- 容器 ---------- */
.am-container {
	width: 100%;
	max-width: var(--am-container);
	margin: 0 auto;
	padding-left: var(--am-gutter);
	padding-right: var(--am-gutter);
}

.am-container--wide { max-width: 1360px; }
.am-container--narrow { max-width: 820px; }

/* ---------- 区块间距 ---------- */
.am-section { padding-top: var(--am-section-gap); padding-bottom: var(--am-section-gap); }
.am-section--tight { padding-top: 40px; padding-bottom: 40px; }
.am-section--ivory { background: var(--am-ivory); }
.am-section--deep { background: var(--am-primary-deep); color: var(--am-line-soft); }
.am-section--deep h1,
.am-section--deep h2,
.am-section--deep h3 { color: var(--am-paper); }

/* ---------- 栅格 ---------- */
.am-grid {
	display: grid;
	gap: var(--am-gutter);
}
.am-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.am-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.am-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.am-grid--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* ---------- 排版辅助 ---------- */
.am-eyebrow {
	font-size: var(--am-fs-sm);
	letter-spacing: .18em;
	text-transform: uppercase;
	color: var(--am-gold);
	margin-bottom: 12px;
}
.am-lead { font-size: var(--am-fs-md); color: var(--am-muted); }
.am-center { text-align: center; }
.am-section-title { margin-bottom: 8px; }
.am-section-sub { color: var(--am-muted); margin-bottom: 40px; }
.am-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;
}

/* ---------- 响应式（4 档断点，标题靠 --am-fs-* 变量降档，不逐条写死） ---------- */
@media (max-width: 899px) {
	.am-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.am-grid--5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.am-section-sub { margin-bottom: 32px; }
}

@media (max-width: 599px) {
	.am-grid--2,
	.am-grid--3 { grid-template-columns: minmax(0, 1fr); }
	/* 商品类四/五列栅格在手机端保持双列/三列，避免单列堆叠过长（如首页定制区 8 卡单列近 4600px） */
	.am-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.am-grid--5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	/* 让位给移动端底部 Tab 栏；含安全区，避免刘海屏最后一行被 Tab 栏盖住（P0-5：占位 80px） */
	body { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	* {
		transition-duration: .01ms !important;
		animation-duration: .01ms !important;
		scroll-behavior: auto !important;
	}
}

/* ---------- 打印 ---------- */
@media print {
	.am-header, .am-tabbar, .am-float-wa, .am-footer { display: none !important; }
}
