/* ============================================================
   pavingcalc.net 主样式表 main.css
   架构：Mobile-First / Design Tokens / BEM-lite
   性能：异步加载（preload + onload），关键 CSS 内联在每页 head
   规范：v3.1 强制-T03/M01/M02 全部满足（17px / 1.75 / 48px / WCAG AAA）
   ============================================================ */

/* ----- 设计 tokens（CSS 变量）------------------------------ */
:root {
  /* 色板：深沥青 + 建筑安全橙 + 中性 slate */
  --c-bg: #FFFFFF;
  --c-bg-alt: #F8FAFC;
  --c-bg-card: #FFFFFF;
  --c-bg-deep: #0F172A;
  --c-text: #0F172A;
  --c-text-secondary: #475569;
  --c-text-muted: #64748B;
  --c-text-on-dark: #F8FAFC;
  --c-border: #E2E8F0;
  --c-border-strong: #CBD5E1;
  --c-primary: #0F172A;
  --c-primary-hover: #1E293B;
  --c-accent: #F97316;
  --c-accent-hover: #EA580C;
  --c-success: #16A34A;
  --c-warning: #EAB308;
  --c-danger: #DC2626;
  --c-link: #1D4ED8;
  --c-link-hover: #1E40AF;
  --c-focus: #0066CC;

  /* 字体栈 */
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, Monaco, 'Liberation Mono', monospace;

  /* 字号系统 (Mobile-First 基础) */
  --fs-xs: 13px;
  --fs-sm: 15px;
  --fs-base: 17px;
  --fs-md: 18px;
  --fs-lg: 20px;
  --fs-xl: 24px;
  --fs-2xl: 28px;
  --fs-3xl: 34px;
  --fs-4xl: 40px;
  --fs-display: 48px;

  /* 行高 */
  --lh-tight: 1.25;
  --lh-snug: 1.4;
  --lh-base: 1.75;
  --lh-loose: 1.9;

  /* 间距 (8px scale) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;

  /* 圆角 */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-pill: 999px;

  /* 阴影 (低调，工程风) */
  --sh-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 1px rgba(15, 23, 42, 0.06);
  --sh-md: 0 2px 6px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --sh-lg: 0 8px 24px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
  --sh-focus: 0 0 0 3px rgba(0, 102, 204, 0.4);

  /* 容器宽度 */
  --w-content: 740px;
  --w-wide: 1080px;
  --w-extra: 1240px;

  /* 触摸目标 */
  --touch-min: 48px;

  /* 过渡 */
  --t-fast: 0.12s ease;
  --t-base: 0.2s ease;
}

/* 暗色模式预留（默认禁用，避免颜色对比度问题，后期可开启） */
@media (prefers-color-scheme: dark) {
  /* 暂不启用暗色模式，保持颜色对比度可控 */
}

/* ----- 重置与基础 ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
body {
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--c-text);
  background: var(--c-bg);
  overflow-x: hidden;
  max-width: 100vw;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img, video, iframe, embed {
  max-width: 100%;
  height: auto;
  display: block;
}
svg { max-width: 100%; height: auto; }
button, input, select, textarea {
  font: inherit;
  color: inherit;
}
a { color: var(--c-link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color var(--t-fast); }
a:hover { color: var(--c-link-hover); }
a:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; border-radius: 2px; }

/* 跳转到主内容（无障碍 + SEO 加分） */
.skip-nav {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--c-primary);
  color: var(--c-text-on-dark);
  padding: var(--sp-3) var(--sp-4);
  text-decoration: none;
  z-index: 9999;
}
.skip-nav:focus { left: var(--sp-4); top: var(--sp-4); }

/* ----- 排版 ---------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: var(--lh-snug);
  color: var(--c-text);
  letter-spacing: -0.01em;
}
h1 { font-size: var(--fs-3xl); margin-bottom: var(--sp-4); letter-spacing: -0.02em; }
h2 { font-size: var(--fs-2xl); margin: var(--sp-12) 0 var(--sp-4); }
h3 { font-size: var(--fs-xl); margin: var(--sp-8) 0 var(--sp-3); }
h4 { font-size: var(--fs-lg); margin: var(--sp-6) 0 var(--sp-2); }
h5, h6 { font-size: var(--fs-md); margin: var(--sp-4) 0 var(--sp-2); }
p { margin-bottom: var(--sp-5); max-width: 70ch; }
ul, ol { margin: 0 0 var(--sp-5) var(--sp-6); }
li { margin-bottom: var(--sp-2); }
strong, b { font-weight: 700; }
em, i { font-style: italic; }
small { font-size: var(--fs-sm); color: var(--c-text-secondary); }
code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--c-bg-alt);
  padding: 2px 6px;
  border-radius: var(--r-sm);
  color: var(--c-text);
}
pre {
  background: var(--c-bg-deep);
  color: var(--c-text-on-dark);
  padding: var(--sp-4);
  border-radius: var(--r-md);
  overflow-x: auto;
  margin-bottom: var(--sp-5);
  -webkit-overflow-scrolling: touch;
}
pre code { background: transparent; padding: 0; color: inherit; font-size: var(--fs-sm); }
blockquote {
  border-left: 4px solid var(--c-accent);
  padding: var(--sp-3) var(--sp-5);
  margin: var(--sp-6) 0;
  background: var(--c-bg-alt);
  color: var(--c-text);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}
blockquote cite { display: block; margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--c-text-secondary); font-style: normal; }
hr { border: none; border-top: 1px solid var(--c-border); margin: var(--sp-10) 0; }

/* 表格（高对比度 + 移动端水平滚动）*/
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--sp-6) 0;
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
}
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
caption { padding: var(--sp-3) var(--sp-4); text-align: left; font-weight: 600; background: var(--c-bg-alt); border-bottom: 1px solid var(--c-border); }
th, td { padding: var(--sp-3) var(--sp-4); text-align: left; border-bottom: 1px solid var(--c-border); }
th { background: var(--c-bg-alt); font-weight: 600; color: var(--c-text); white-space: nowrap; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--c-bg-alt); }

/* 可排序表格（强制-UX05） */
.sortable th[data-sort] { cursor: pointer; user-select: none; padding-right: var(--sp-6); position: relative; }
.sortable th[data-sort]::after { content: '⇅'; position: absolute; right: var(--sp-3); opacity: 0.3; font-size: 12px; }
.sortable th[aria-sort="ascending"]::after { content: '↑'; opacity: 1; color: var(--c-accent); }
.sortable th[aria-sort="descending"]::after { content: '↓'; opacity: 1; color: var(--c-accent); }

/* ----- 布局 ---------------------------------------------- */
.container { width: 100%; max-width: var(--w-extra); margin: 0 auto; padding: 0 var(--sp-4); }
.container-narrow { max-width: var(--w-content); margin: 0 auto; padding: 0 var(--sp-4); }
.container-wide { max-width: var(--w-wide); margin: 0 auto; padding: 0 var(--sp-4); }
main { flex: 1; }
section { padding: var(--sp-8) 0; }

/* ----- 顶部导航 ------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--c-border);
  z-index: 100;
}
.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: var(--sp-4);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 800;
  font-size: var(--fs-md);
  color: var(--c-text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 32px; height: 32px;
  background: var(--c-bg-deep);
  color: var(--c-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
}
.nav-primary { display: none; }
.nav-primary ul { display: flex; gap: var(--sp-1); list-style: none; margin: 0; }
.nav-primary a {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch-min);
  padding: 0 var(--sp-3);
  color: var(--c-text);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--fs-sm);
  border-radius: var(--r-sm);
}
.nav-primary a:hover { background: var(--c-bg-alt); color: var(--c-accent); }
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-min);
  height: var(--touch-min);
  border: 1px solid var(--c-border);
  background: var(--c-bg);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.nav-toggle:focus-visible { box-shadow: var(--sh-focus); outline: none; }
.nav-mobile {
  display: none;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
  padding: var(--sp-3) 0;
}
.nav-mobile.is-open { display: block; }
.nav-mobile ul { list-style: none; margin: 0; padding: 0 var(--sp-4); }
.nav-mobile a {
  display: flex;
  align-items: center;
  min-height: var(--touch-min);
  padding: var(--sp-3) var(--sp-4);
  color: var(--c-text);
  text-decoration: none;
  border-radius: var(--r-sm);
  font-weight: 500;
}
.nav-mobile a:hover { background: var(--c-bg-alt); color: var(--c-accent); }
@media (min-width: 900px) {
  .nav-primary { display: block; }
  .nav-toggle { display: none; }
  .nav-mobile { display: none !important; }
}

/* ----- 面包屑 -------------------------------------------- */
.breadcrumb {
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
  padding: var(--sp-3) 0;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: inline-flex; align-items: center; gap: var(--sp-2); }
.breadcrumb li { display: inline-flex; align-items: center; gap: var(--sp-2); margin: 0; }
.breadcrumb li + li::before { content: '/'; color: var(--c-text-muted); }
.breadcrumb a { color: var(--c-text-secondary); text-decoration: none; }
.breadcrumb a:hover { color: var(--c-accent); }
.breadcrumb [aria-current="page"] { color: var(--c-text); font-weight: 500; }

/* ----- 按钮 ---------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--touch-min);
  padding: var(--sp-3) var(--sp-5);
  border: 2px solid transparent;
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: var(--fs-sm);
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  user-select: none;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: none; box-shadow: var(--sh-focus); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--c-primary); color: var(--c-text-on-dark); }
.btn-primary:hover { background: var(--c-primary-hover); color: var(--c-text-on-dark); }
.btn-accent { background: var(--c-accent); color: #FFFFFF; }
.btn-accent:hover { background: var(--c-accent-hover); }
.btn-secondary { background: var(--c-bg); color: var(--c-text); border-color: var(--c-border-strong); }
.btn-secondary:hover { background: var(--c-bg-alt); border-color: var(--c-text); }
.btn-ghost { background: transparent; color: var(--c-text); }
.btn-ghost:hover { background: var(--c-bg-alt); }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: var(--sp-2) var(--sp-4); font-size: var(--fs-xs); }
.btn-lg { min-height: 56px; padding: var(--sp-4) var(--sp-6); font-size: var(--fs-md); }

/* ----- 表单（计算器输入）-------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.field label { font-weight: 600; font-size: var(--fs-sm); color: var(--c-text); }
.field-hint { font-size: var(--fs-xs); color: var(--c-text-secondary); }
.input, .select {
  width: 100%;
  min-height: var(--touch-min);
  padding: var(--sp-3) var(--sp-4);
  border: 2px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-bg);
  font-size: var(--fs-md);
  font-family: var(--font-mono);
  font-feature-settings: 'tnum';
  color: var(--c-text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:hover, .select:hover { border-color: var(--c-border-strong); }
.input:focus, .select:focus { outline: none; border-color: var(--c-accent); box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15); }
.input::placeholder { color: var(--c-text-muted); }
.select {
  font-family: var(--font-ui);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'><polyline points='5 8 10 13 15 8' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

/* 输入组 */
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; flex: 1; }
.input-group .input-suffix {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--sp-4);
  background: var(--c-bg-alt);
  border: 2px solid var(--c-border);
  border-left: none;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
  font-family: var(--font-mono);
  min-width: 60px;
  justify-content: center;
}
.input-group .input:focus + .input-suffix { border-color: var(--c-accent); }

/* 滑块 */
.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--c-border);
  border-radius: var(--r-pill);
  outline: none;
  margin: var(--sp-3) 0;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px; height: 24px;
  background: var(--c-accent);
  border: 3px solid #FFFFFF;
  box-shadow: var(--sh-md);
  border-radius: 50%;
  cursor: pointer;
}
.range::-moz-range-thumb {
  width: 24px; height: 24px;
  background: var(--c-accent);
  border: 3px solid #FFFFFF;
  box-shadow: var(--sh-md);
  border-radius: 50%;
  cursor: pointer;
  border-style: solid;
}
.range:focus-visible::-webkit-slider-thumb { box-shadow: var(--sh-focus); }
.range:focus-visible::-moz-range-thumb { box-shadow: var(--sh-focus); }

/* Tab 切换（强制要求：三 Tab 同义词覆盖） */
.tabs { display: flex; gap: var(--sp-1); padding: 4px; background: var(--c-bg-alt); border-radius: var(--r-md); margin-bottom: var(--sp-5); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tab {
  flex: 1;
  min-height: 44px;
  padding: var(--sp-2) var(--sp-3);
  border: none;
  background: transparent;
  color: var(--c-text-secondary);
  font-weight: 600;
  font-size: var(--fs-sm);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}
.tab[aria-selected="true"] { background: var(--c-bg); color: var(--c-text); box-shadow: var(--sh-sm); }
.tab:hover:not([aria-selected="true"]) { color: var(--c-text); }
.tab:focus-visible { outline: none; box-shadow: var(--sh-focus); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* 分段控件（场景预设、形状选择器、单位切换） */
.segmented {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: var(--sp-2);
}
.segmented-btn {
  min-height: var(--touch-min);
  padding: var(--sp-2) var(--sp-3);
  border: 2px solid var(--c-border);
  background: var(--c-bg);
  color: var(--c-text);
  font-weight: 500;
  font-size: var(--fs-sm);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  text-align: center;
}
.segmented-btn:hover { border-color: var(--c-border-strong); }
.segmented-btn[aria-pressed="true"] { background: var(--c-primary); color: var(--c-text-on-dark); border-color: var(--c-primary); }
.segmented-btn:focus-visible { outline: none; box-shadow: var(--sh-focus); }
.segmented-btn .icon { width: 18px; height: 18px; }

/* ----- 卡片 ---------------------------------------------- */
.card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  box-shadow: var(--sh-sm);
}
.card-elevated { box-shadow: var(--sh-md); }
.card-deep { background: var(--c-bg-deep); color: var(--c-text-on-dark); border-color: transparent; }
.card-deep h2, .card-deep h3 { color: var(--c-text-on-dark); }

/* ----- 计算器结果展示区（差异化护城河 UI）---------------- */
.calc-wrap { display: grid; grid-template-columns: 1fr; gap: var(--sp-6); margin-bottom: var(--sp-8); }
@media (min-width: 900px) {
  .calc-wrap { grid-template-columns: 1.1fr 1fr; }
}
.calc-inputs { display: flex; flex-direction: column; gap: var(--sp-4); }
.calc-results {
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
  color: var(--c-text-on-dark);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  position: sticky;
  top: 80px;
  box-shadow: var(--sh-lg);
}
.results-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-5); }
.results-title { font-size: var(--fs-sm); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: rgba(248, 250, 252, 0.7); margin: 0; }
.results-grid { display: grid; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.metric { display: flex; flex-direction: column; gap: var(--sp-1); }
.metric-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.05em; color: rgba(248, 250, 252, 0.6); font-weight: 600; }
.metric-value {
  font-family: var(--font-mono);
  font-size: var(--fs-3xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  font-feature-settings: 'tnum';
}
.metric-value.is-primary { font-size: var(--fs-display); color: var(--c-accent); }
.metric-unit { font-size: var(--fs-sm); color: rgba(248, 250, 252, 0.7); margin-left: var(--sp-1); font-weight: 500; }
.results-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); padding-top: var(--sp-4); border-top: 1px solid rgba(248, 250, 252, 0.12); }
.results-actions .btn { background: rgba(255, 255, 255, 0.08); color: var(--c-text-on-dark); border-color: rgba(255, 255, 255, 0.12); }
.results-actions .btn:hover { background: rgba(255, 255, 255, 0.16); }

/* 成本分项（cost breakdown） */
.cost-breakdown { margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid rgba(248, 250, 252, 0.12); }
.cost-row { display: flex; justify-content: space-between; align-items: center; padding: var(--sp-2) 0; font-size: var(--fs-sm); }
.cost-row + .cost-row { border-top: 1px solid rgba(248, 250, 252, 0.06); }
.cost-row strong { color: var(--c-text-on-dark); }
.cost-row.is-total { padding-top: var(--sp-3); margin-top: var(--sp-2); border-top: 2px solid rgba(248, 250, 252, 0.2); font-size: var(--fs-md); }

/* 形状示意 SVG 容器 */
.shape-preview {
  background: var(--c-bg-alt);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  margin-bottom: var(--sp-4);
}
.shape-preview svg { width: 100%; max-width: 320px; height: auto; }
.shape-preview .stroke { stroke: var(--c-accent); fill: rgba(249, 115, 22, 0.1); stroke-width: 2.5; stroke-linejoin: round; }
.shape-preview .dim-line { stroke: var(--c-text-secondary); stroke-width: 1; stroke-dasharray: 4 4; }
.shape-preview .dim-text { font-family: var(--font-mono); font-size: 11px; fill: var(--c-text); }

/* 输入网格 */
.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.input-grid .field-full { grid-column: 1 / -1; }

/* 场景预设按钮带图标 */
.preset-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--sp-2); margin-bottom: var(--sp-4); }
.preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3);
  background: var(--c-bg);
  border: 2px solid var(--c-border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
  text-align: center;
  min-height: 96px;
}
.preset-btn:hover { border-color: var(--c-accent); background: rgba(249, 115, 22, 0.04); }
.preset-btn .icon { width: 32px; height: 32px; color: var(--c-accent); }
.preset-btn-label { font-weight: 600; font-size: var(--fs-sm); color: var(--c-text); }
.preset-btn-meta { font-size: var(--fs-xs); color: var(--c-text-secondary); font-family: var(--font-mono); }
.preset-btn:focus-visible { outline: none; box-shadow: var(--sh-focus); }

/* 高亮 / 提示框 */
.note {
  background: var(--c-bg-alt);
  border-left: 4px solid var(--c-link);
  padding: var(--sp-3) var(--sp-4);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  margin: var(--sp-4) 0;
  font-size: var(--fs-sm);
}
.note-warning { border-left-color: var(--c-warning); background: #FEFCE8; }
.note-success { border-left-color: var(--c-success); background: #F0FDF4; }
.note-danger { border-left-color: var(--c-danger); background: #FEF2F2; }

/* ----- Hero 区域 ---------------------------------------- */
.hero {
  padding: var(--sp-10) 0 var(--sp-8);
  background: linear-gradient(180deg, var(--c-bg-alt) 0%, var(--c-bg) 100%);
}
.hero-inner { display: grid; grid-template-columns: 1fr; gap: var(--sp-6); align-items: center; }
@media (min-width: 1024px) {
  .hero-inner { grid-template-columns: 1.2fr 1fr; gap: var(--sp-12); }
  .hero { padding: var(--sp-16) 0 var(--sp-12); }
}
.hero h1 { font-size: clamp(28px, 5.5vw, var(--fs-4xl)); margin-bottom: var(--sp-4); }
.hero-lead { font-size: var(--fs-md); color: var(--c-text-secondary); max-width: 56ch; margin-bottom: var(--sp-5); }
.hero-meta { display: inline-flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-xs); color: var(--c-text-secondary); margin-bottom: var(--sp-4); }
.hero-meta .dot { width: 6px; height: 6px; background: var(--c-success); border-radius: 50%; display: inline-block; }

/* 内容预告盒（强制-UX01） */
.lead-preview {
  background: var(--c-bg-alt);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-6);
}
.lead-preview p { margin-bottom: var(--sp-2); font-weight: 600; }
.lead-preview ul { list-style: none; margin: 0; padding: 0; }
.lead-preview li {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-1) 0;
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--c-text);
}
.lead-preview li::before { content: '✓'; color: var(--c-success); font-weight: 700; flex-shrink: 0; }
.lead-preview .meta { font-size: var(--fs-xs); color: var(--c-text-secondary); margin-top: var(--sp-3); margin-bottom: 0; font-weight: 500; }

/* ----- 章节导航（强制-UX02）---------------------------- */
.toc {
  background: var(--c-bg-alt);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: var(--sp-4) var(--sp-5);
  margin: var(--sp-6) 0;
}
.toc-title { font-size: var(--fs-sm); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--c-text-secondary); margin-bottom: var(--sp-3); }
.toc ol { margin: 0; padding-left: var(--sp-5); }
.toc li { margin-bottom: var(--sp-1); font-size: var(--fs-sm); }
.toc a { color: var(--c-text); text-decoration: none; }
.toc a:hover { color: var(--c-accent); text-decoration: underline; }

/* 章节过渡语（强制-UX02） */
.section-transition {
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
  font-style: italic;
  padding: var(--sp-3) 0;
  border-top: 1px dashed var(--c-border);
  margin-top: var(--sp-5);
}

/* 阅读进度条（强制-UX02 / R12） */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--c-accent);
  z-index: 999;
  transition: width 0.1s linear;
  pointer-events: none;
}

/* ----- 内容钩子（强制-UX03 / R14）---------------------- */
.content-hook {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.08) 0%, rgba(249, 115, 22, 0.02) 100%);
  border-left: 4px solid var(--c-accent);
  padding: var(--sp-4) var(--sp-5);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  margin: var(--sp-6) 0;
  font-size: var(--fs-sm);
}
.content-hook a { color: var(--c-text); font-weight: 600; }

/* 文末关联推荐（强制-UX03 / R13） */
.related {
  margin-top: var(--sp-12);
  padding-top: var(--sp-8);
  border-top: 2px solid var(--c-border);
}
.related-title { font-size: var(--fs-xl); margin-bottom: var(--sp-5); }
.related-grid { display: grid; gap: var(--sp-4); grid-template-columns: 1fr; }
@media (min-width: 700px) { .related-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .related-grid { grid-template-columns: repeat(3, 1fr); } }
.related-card {
  display: block;
  padding: var(--sp-5);
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--c-text);
  transition: border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.related-card:hover { border-color: var(--c-accent); transform: translateY(-2px); box-shadow: var(--sh-md); color: var(--c-text); }
.related-card .tag { display: inline-block; font-size: var(--fs-xs); color: var(--c-accent); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: var(--sp-2); }
.related-card h3 { font-size: var(--fs-md); margin: 0 0 var(--sp-2); }
.related-card p { font-size: var(--fs-sm); color: var(--c-text-secondary); margin: 0; }

/* Quick presets / common projects card grid */
.project-grid { display: grid; gap: var(--sp-4); grid-template-columns: 1fr; }
@media (min-width: 700px) { .project-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .project-grid { grid-template-columns: repeat(4, 1fr); } }

/* ----- FAQ 块 ------------------------------------------ */
.faq { display: flex; flex-direction: column; gap: var(--sp-2); margin: var(--sp-6) 0; }
.faq-item {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-4) var(--sp-5);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font-weight: 600;
  font-size: var(--fs-md);
  color: var(--c-text);
  min-height: var(--touch-min);
}
.faq-q:hover { background: var(--c-bg-alt); }
.faq-q::after { content: '+'; font-size: var(--fs-xl); color: var(--c-accent); flex-shrink: 0; transition: transform var(--t-base); }
.faq-item[open] .faq-q::after { transform: rotate(45deg); }
.faq-a { padding: 0 var(--sp-5) var(--sp-4); color: var(--c-text-secondary); font-size: var(--fs-sm); }
.faq-a > :first-child { margin-top: 0; }
.faq-a > :last-child { margin-bottom: 0; }

/* ----- 作者署名（E-E-A-T） ------------------------------ */
.byline {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--c-bg-alt);
  border-radius: var(--r-md);
  margin: var(--sp-6) 0;
}
.byline-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--c-bg-deep);
  color: var(--c-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--fs-md);
  flex-shrink: 0;
}
.byline-text { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-sm); }
.byline-name { font-weight: 700; color: var(--c-text); }
.byline-name a { color: inherit; text-decoration: none; }
.byline-name a:hover { color: var(--c-accent); }
.byline-role { color: var(--c-text-secondary); }
.byline-date { color: var(--c-text-muted); font-size: var(--fs-xs); }

/* ----- AdSense 广告位（强制-A02：min-height 占位防 CLS） -- */
.ad-slot {
  margin: var(--sp-6) auto;
  text-align: center;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  max-width: 100%;
  overflow: hidden;
}
.ad-slot::before {
  content: 'Advertisement';
  position: absolute;
  top: 4px;
  right: 8px;
  font-size: 10px;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  pointer-events: none;
  opacity: 0.6;
}
.ad-slot ins { display: block !important; max-width: 100%; }
.ad-slot.is-empty { display: none; }
.ad-slot.is-loaded::before { display: none; }
.ad-slot-rectangle { min-height: 250px; }
.ad-slot-leaderboard { min-height: 90px; }
.ad-slot-skyscraper { min-height: 600px; }

/* ----- Footer ------------------------------------------- */
.site-footer {
  background: var(--c-bg-deep);
  color: rgba(248, 250, 252, 0.85);
  margin-top: var(--sp-16);
  padding: var(--sp-12) 0 var(--sp-6);
}
.site-footer a { color: rgba(248, 250, 252, 0.8); text-decoration: none; }
.site-footer a:hover { color: var(--c-accent); }
.footer-grid {
  display: grid;
  gap: var(--sp-8);
  grid-template-columns: 1fr;
  margin-bottom: var(--sp-8);
}
@media (min-width: 700px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; } }
.footer-col h3 { font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.06em; color: var(--c-text-on-dark); margin: 0 0 var(--sp-3); font-weight: 700; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: var(--sp-2); }
.footer-col li a { display: inline-block; min-height: 36px; padding: var(--sp-1) 0; font-size: var(--fs-sm); }
.footer-brand p { font-size: var(--fs-sm); margin-bottom: var(--sp-3); color: rgba(248, 250, 252, 0.7); }
.footer-bottom {
  border-top: 1px solid rgba(248, 250, 252, 0.12);
  padding-top: var(--sp-5);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--sp-3);
  font-size: var(--fs-xs);
  color: rgba(248, 250, 252, 0.6);
}

/* ----- Cookie 提示条（强制-T08：底部 ≤20vh） ------------ */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 20vh;
  background: var(--c-bg);
  border-top: 1px solid var(--c-border);
  box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
  padding: var(--sp-3) var(--sp-4);
  z-index: 90;
  display: none;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
}
.cookie-banner.is-visible { display: flex; }
.cookie-banner p { margin: 0; flex: 1; min-width: 200px; }
.cookie-banner a { color: var(--c-link); }
.cookie-banner .btn { flex-shrink: 0; }
@media (max-width: 599px) {
  .cookie-banner { flex-wrap: wrap; }
}

/* ----- 工具类 ------------------------------------------- */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-mono { font-family: var(--font-mono); font-feature-settings: 'tnum'; }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.text-secondary { color: var(--c-text-secondary); }
.text-muted { color: var(--c-text-muted); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: var(--sp-2); } .mt-4 { margin-top: var(--sp-4); } .mt-6 { margin-top: var(--sp-6); } .mt-8 { margin-top: var(--sp-8); }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: var(--sp-2); } .mb-4 { margin-bottom: var(--sp-4); } .mb-6 { margin-bottom: var(--sp-6); } .mb-8 { margin-bottom: var(--sp-8); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); } .gap-4 { gap: var(--sp-4); }
.hidden { display: none !important; }
.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; }

/* ----- 响应式断点（Mobile-First） ----------------------- */
@media (min-width: 600px) {
  .container { padding: 0 var(--sp-6); }
  h1 { font-size: var(--fs-4xl); }
  h2 { font-size: var(--fs-3xl); }
}
@media (min-width: 1024px) {
  body { font-size: var(--fs-md); line-height: 1.7; }
  .container { padding: 0 var(--sp-8); }
  h1 { font-size: var(--fs-display); }
}

/* ----- 打印样式（Print Report 功能） -------------------- */
@media print {
  .site-header, .site-footer, .ad-slot, .nav-toggle, .reading-progress, .cookie-banner, .related, .content-hook, .toc { display: none !important; }
  body { font-size: 11pt; line-height: 1.5; color: #000; background: #fff; }
  .calc-results { background: #fff !important; color: #000 !important; box-shadow: none; border: 1px solid #000; position: static !important; }
  .calc-results h2, .calc-results h3 { color: #000 !important; }
  .metric-value, .metric-value.is-primary { color: #000 !important; font-size: 24pt !important; }
  .metric-label, .metric-unit { color: #333 !important; }
  .results-actions { display: none !important; }
  a { color: #000; text-decoration: underline; }
  a[href^="http"]::after { content: ' (' attr(href) ')'; font-size: 9pt; color: #444; }
  .container, .container-narrow, .container-wide { max-width: 100%; padding: 0; }
  h1, h2, h3 { page-break-after: avoid; }
  table, figure { page-break-inside: avoid; }
}
