/* ============================================================
 * site.css — 首页 / 模板画廊
 * ============================================================ */

:root {
  --ink: #101828;
  --ink-2: #475467;
  --ink-3: #7c8798;
  --line: #e5e9ef;
  --bg: #f7f8fa;
  --bg-2: #eef1f5;
  --accent: #1f4e79;
  --accent-dark: #173b5c;
  --accent-soft: #eaf1f8;
  --white: #fff;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 8px 24px rgba(16, 32, 64, .08);
  --shadow-lg: 0 18px 48px rgba(16, 32, 64, .14);
  --sans: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC",
    system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }

.wrap { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }
.wrap.narrow { width: min(820px, calc(100% - 48px)); }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: .18s ease;
  white-space: nowrap;
  background: none;
}
.btn.lg { height: 46px; padding: 0 24px; font-size: 15px; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 7px; }

.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(23, 59, 92, .28); }
.btn.primary:hover { background: var(--accent-dark); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(23, 59, 92, .22); }

.btn.ghost { border-color: #d5dce5; color: var(--ink); background: #fff; }
.btn.ghost:hover { border-color: #b9c4d2; background: #fbfcfd; }

.btn.light { background: #fff; color: var(--accent); }
.btn.light:hover { background: #f2f6fa; transform: translateY(-1px); }

.icon-btn {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  cursor: pointer; color: var(--ink-2); font-size: 13px;
}
.icon-btn:hover { background: var(--bg-2); }

/* ---------------- 导航 ---------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 28px; height: 64px; }

.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: .3px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-mark svg { width: 17px; height: 17px; }
.brand-text { font-size: 16px; }

.nav-links { display: flex; gap: 26px; margin-left: 8px; font-size: 14px; color: var(--ink-2); }
.nav-links a { transition: color .15s; }
.nav-links a:hover { color: var(--accent); }
.nav .btn.primary { margin-left: auto; }

/* ---------------- Hero ---------------- */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1100px 420px at 78% -10%, #e8eef6 0%, rgba(232, 238, 246, 0) 62%),
    radial-gradient(700px 300px at 8% 0%, #eef2f7 0%, rgba(238, 242, 247, 0) 70%);
  border-bottom: 1px solid var(--line);
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 56px;
  align-items: center;
  padding: 72px 0 76px;
}

.badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .3px;
}

.hero h1 {
  margin: 18px 0 0;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.24;
  letter-spacing: -.5px;
  font-weight: 700;
}
.lede {
  margin-top: 18px;
  max-width: 30em;
  font-size: 16px;
  color: var(--ink-2);
  line-height: 1.8;
}
.hero-actions { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.hero-points {
  display: flex; flex-wrap: wrap; gap: 8px 20px;
  margin-top: 26px;
  font-size: 13px;
  color: var(--ink-3);
}
.hero-points li { position: relative; padding-left: 14px; }
.hero-points li::before {
  content: ""; position: absolute; left: 0; top: .62em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent); opacity: .55;
}

.hero-stack { position: relative; height: 440px; }
.stack-card {
  position: absolute;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  outline: 1px solid rgba(16, 32, 64, .05);
}
.stack-card.a { width: 302px; top: 4px; left: 22px; transform: rotate(-2.4deg); }
.stack-card.b { width: 228px; top: 74px; left: 252px; transform: rotate(2.6deg); }

/* ---------------- 区块标题 ---------------- */
.section { padding: 78px 0; }
.section.alt { background: #fff; border-block: 1px solid var(--line); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
}
.section-head.center { justify-content: center; text-align: center; }
.section-head h2 {
  font-size: clamp(24px, 2.6vw, 30px);
  letter-spacing: -.3px;
  font-weight: 700;
}
.section-head p { margin-top: 10px; color: var(--ink-3); font-size: 14.5px; }
.link-arrow { font-size: 14px; color: var(--accent); font-weight: 600; white-space: nowrap; }
.link-arrow:hover { text-decoration: underline; }

/* ---------------- 模板卡片 ---------------- */
.tpl-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}
.tpl-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: .22s ease;
  display: flex;
  flex-direction: column;
}
.tpl-card:hover {
  border-color: #cfd9e4;
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.tpl-thumb {
  background: #f1f3f7;
  border-bottom: 1px solid var(--line);
  padding: 18px 18px 0;
  overflow: hidden;
}
.tpl-thumb .thumb-inner {
  position: relative;
  overflow: hidden;
  border-radius: 6px 6px 0 0;
  box-shadow: 0 4px 18px rgba(16, 32, 64, .10);
  background: #fff;
}
.tpl-thumb .thumb-inner > .doc,
.modal-body .thumb-inner > .doc,
.stack-card > .doc {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  box-shadow: none;
  min-height: 297mm;
}
.tpl-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 16px;
}
.tpl-info h3 { font-size: 15.5px; font-weight: 600; }
.tpl-info p { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.tpl-acts { display: flex; gap: 6px; flex: none; }

/* ---------------- 步骤 ---------------- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}
.steps li {
  position: relative;
  padding: 28px 26px 26px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.steps li::after {
  content: "";
  position: absolute;
  right: -14px; top: 50%;
  width: 7px; height: 7px;
  border-top: 1.5px solid #c9d2dd;
  border-right: 1.5px solid #c9d2dd;
  transform: rotate(45deg);
}
.steps li:last-child::after { display: none; }
.step-no {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
  opacity: .85;
}
.steps h3 { margin-top: 10px; font-size: 17px; }
.steps p { margin-top: 8px; font-size: 13.5px; color: var(--ink-2); line-height: 1.75; }

/* ---------------- 特性 ---------------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 26px;
}
.feature {
  padding: 26px 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.f-ico {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 16px;
  margin-bottom: 14px;
}
.feature h3 { font-size: 15.5px; }
.feature p { margin-top: 7px; font-size: 13.5px; color: var(--ink-2); line-height: 1.75; }

/* ---------------- FAQ ---------------- */
.faq { display: grid; gap: 10px; }
.faq details {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px 18px;
}
.faq details[open] { border-color: #d3dde8; box-shadow: var(--shadow-sm); }
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 13px 0;
  font-weight: 600;
  font-size: 14.5px;
  position: relative;
  padding-right: 26px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute; right: 0; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  font-weight: 400;
  font-size: 18px;
}
.faq details[open] summary::after { content: "−"; }
.faq details p {
  padding: 0 0 16px;
  color: var(--ink-2);
  font-size: 13.8px;
  line-height: 1.8;
}

/* ---------------- CTA ---------------- */
.cta { padding: 20px 0 84px; }
.cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 42px 44px;
  border-radius: 16px;
  background: linear-gradient(135deg, #1f4e79 0%, #2b6a9e 100%);
  color: #fff;
  box-shadow: 0 20px 44px rgba(23, 59, 92, .22);
}
.cta h2 { font-size: clamp(22px, 2.4vw, 27px); letter-spacing: -.3px; }
.cta p { margin-top: 8px; font-size: 14px; opacity: .82; }

/* ---------------- 页脚 ---------------- */
.footer { border-top: 1px solid var(--line); background: #fff; padding: 26px 0; }
.footer-inner {
  display: flex; justify-content: space-between; gap: 16px;
  font-size: 13px; color: var(--ink-3);
  flex-wrap: wrap;
}

/* ---------------- 模态框 ---------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal[hidden] { display: none; }
.modal-mask {
  position: absolute; inset: 0;
  background: rgba(16, 24, 40, .5);
  backdrop-filter: blur(3px);
}
.modal-card {
  position: relative;
  background: #fff;
  border-radius: 14px;
  width: min(980px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(16, 24, 40, .3);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.modal-head h3 { font-size: 15px; }
.modal-head-acts { display: flex; align-items: center; gap: 8px; }
.modal-body {
  padding: 24px;
  overflow: auto;
  background: #eef1f5;
}
.modal-body .thumb-inner {
  width: min(760px, 100%);
  margin: 0 auto;
  background: #fff;
  box-shadow: var(--shadow-lg);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 1024px) {
  .hero-inner { grid-template-columns: 1fr; padding: 56px 0 60px; gap: 40px; }
  .hero-stack { height: 400px; }
  .stack-card.a { width: 260px; left: 0; }
  .stack-card.b { width: 196px; left: 212px; top: 66px; }
  .tpl-grid { grid-template-columns: repeat(2, 1fr); }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .steps li::after { display: none; }
}

@media (max-width: 720px) {
  .wrap, .wrap.narrow { width: calc(100% - 32px); }
  .nav-inner { gap: 14px; height: 58px; }
  .nav-links { display: none; }
  .section { padding: 52px 0; }
  .hero-stack { display: none; }
  .tpl-grid { grid-template-columns: 1fr; gap: 18px; }
  .feature-grid { grid-template-columns: 1fr; }
  .cta-inner { flex-direction: column; align-items: flex-start; padding: 30px 24px; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .footer-inner { flex-direction: column; gap: 6px; }
}

/* ============================================================
 * 模板库：分类筛选 / 懒加载占位 / 水印 / 加载失败
 * ============================================================ */
.tpl-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 22px;
}
.tpl-filters button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13.5px;
  color: var(--ink-2, #3d4a5c);
  background: #fff;
  border: 1px solid var(--line, #e3e8ef);
  border-radius: 999px;
  cursor: pointer;
  transition: .16s ease;
}
.tpl-filters button:hover { border-color: #c3d2e2; color: var(--accent, #1f4e79); }
.tpl-filters button.on {
  background: var(--accent, #1f4e79);
  border-color: var(--accent, #1f4e79);
  color: #fff;
  font-weight: 600;
}
.tpl-filters em {
  font-style: normal;
  font-size: 11.5px;
  opacity: .65;
  font-variant-numeric: tabular-nums;
}

/* 缩略图占位：加载中的呼吸底色，避免 56 张同时渲染 */
.tpl-thumb .thumb-inner.is-loading,
.tpl-thumb .thumb-inner:empty {
  min-height: 300px;
  background: linear-gradient(100deg, #f4f6f9 30%, #eef1f6 50%, #f4f6f9 70%);
  background-size: 220% 100%;
  animation: thumb-shimmer 1.3s ease-in-out infinite;
}
@keyframes thumb-shimmer {
  from { background-position: 120% 0; }
  to   { background-position: -20% 0; }
}

.thumb-fail,
.thumb-wait,
.tpl-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  font-size: 13px;
  color: var(--ink-3, #7c8798);
}

@media (min-width: 1360px) {
  .tpl-grid { grid-template-columns: repeat(4, 1fr); gap: 22px; }
}
