/**
 * 印创软件官网 · 基础样式
 * 设计基调：克制的 SaaS 风格 —— 单一主色、大量留白、极轻阴影
 * 内容区块样式见 sections.css
 */

:root {
  /* 主色与状态色 */
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eff4ff;
  --success: #16a34a;

  /* 中性色阶 */
  --ink: #0f172a;
  --text: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --line-soft: #eef2f7;
  --bg: #ffffff;
  --bg-alt: #f8fafc;

  /* 尺寸与阴影 */
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, .06);
  --header-h: 64px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.3;
}

p {
  margin: 0;
}

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

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

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

/* hidden 属性优先级高于元素默认 display，避免未配置的区块露出空占位 */
[hidden] {
  display: none !important;
}

/* ========== 布局容器 ========== */
.container {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
}

.container-narrow {
  width: min(760px, calc(100% - 48px));
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}

.btn-lg {
  height: 46px;
  padding: 0 24px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-dark);
}

.btn-outline {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.btn-outline:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.btn-ghost {
  color: var(--text);
}

.btn-ghost:hover {
  color: var(--brand);
}

/* ========== 顶部导航 ========== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.nav {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 600;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.brand-text small {
  color: var(--faint);
  font-size: 12px;
}

.nav-links {
  display: flex;
  gap: 28px;
  margin-right: auto;
  font-size: 14px;
}

.nav-links a {
  color: var(--muted);
  transition: color .18s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--ink);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 移动端菜单按钮 */
.nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 16px;
  height: 1.5px;
  margin: 3px auto;
  background: var(--ink);
  transition: transform .2s ease, opacity .2s ease;
}

.nav-toggle.is-open span:nth-child(1) {
  transform: translateY(4.5px) rotate(45deg);
}

.nav-toggle.is-open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.is-open span:nth-child(3) {
  transform: translateY(-4.5px) rotate(-45deg);
}

/* ========== 页脚 ========== */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-alt);
  padding: 28px 0;
  font-size: 13px;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-brand strong {
  color: var(--ink);
  font-size: 14px;
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: 18px;
}

.footer-meta a:hover {
  color: var(--brand);
}

/* ========== 全局提示条 ========== */
.toast {
  position: fixed;
  top: 84px;
  right: 24px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 320px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  animation: toast-in .22s ease;
}

.toast-success {
  background: var(--success);
}

.toast-error {
  background: #dc2626;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* ========== 入场动画 ========== */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .5s ease, transform .5s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* 管理端预览：内容必须一直可见，入场动画在编辑器里只会碍事 */
.is-preview .reveal {
  opacity: 1;
  transform: none;
  transition: none;
}

/*
  预览态下导航栏不吸顶：编辑器里 iframe 自身不滚动（高度撑到内容全高、由外层容器滚），
  sticky 会把导航钉在页面最顶端，滚下去之后就看不见了，与真实浏览的观感对不上。
  组件的悬停高亮与工具条样式见 blocks.css。
*/
.is-preview .site-header {
  position: static;
}

/* ========== 响应式：导航折叠 ========== */
@media (max-width: 860px) {
  .container {
    width: calc(100% - 32px);
  }

  .nav-toggle {
    display: block;
  }

  .brand-text small {
    display: none;
  }

  .nav-links {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 8px 16px 16px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    display: none;
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav-links a {
    padding: 12px 4px;
    border-bottom: 1px solid var(--line-soft);
  }

  .nav-actions {
    margin-left: auto;
  }

  .nav-actions .btn-ghost {
    display: none;
  }
}
