/* ============================================================
   站群工具站 —— 公共基础样式（所有站点共用）
   说明：
   1. 整站配色由 CSS 变量 --brand / --accent 驱动，构建时按站点配置注入；
   2. 明亮 / 暗黑主题通过 <html data-theme="light|dark"> 切换；
   3. 布局使用 Flexbox 与 Grid，配合响应式断点适配手机端。
   ============================================================ */

/* ---------- 主题变量：明亮模式（默认） ---------- */
:root {
  --brand: #3498db;          /* 主色（由站点配置注入，此处为兜底） */
  --accent: #2ecc71;         /* 强调色（由站点配置注入，此处为兜底） */
  --bg: #f5f7fa;             /* 页面背景 */
  --fg: #1f2933;             /* 主要文字 */
  --card: #ffffff;           /* 卡片背景 */
  --muted: #6b7280;          /* 次要文字 */
  --border: #e5e7eb;         /* 描边 */
  --radius: 14px;            /* 圆角 */
  --shadow: 0 6px 20px rgba(17, 24, 39, 0.06); /* 卡片阴影 */
  --max-width: 1080px;       /* 内容最大宽度 */
}

/* ---------- 主题变量：暗黑模式 ---------- */
[data-theme="dark"] {
  --bg: #0f1419;
  --fg: #e6e9ef;
  --card: #171d25;
  --muted: #98a2b3;
  --border: #242c37;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

/* ---------- 基础重置 ---------- */
* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

/* 通用容器：居中 + 左右留白 */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 18px;
}

/* ============================================================
   页头
   ============================================================ */
.site-header {
  position: sticky;               /* 吸顶，滚动时始终可见 */
  top: 0;
  z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(8px);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
}

/* 品牌区：Logo 方块 + 品牌名/标语 */
.brand { display: flex; align-items: center; gap: 10px; }

.brand__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.5px;
}

.brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.brand__name { font-size: 16px; font-weight: 700; }
.brand__tagline { font-size: 12px; color: var(--muted); }

/* 顶部工具导航 */
.site-nav { display: flex; flex-wrap: wrap; gap: 4px; }

.site-nav__link {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--muted);
  transition: background .18s, color .18s;
}

.site-nav__link:hover { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }
.site-nav__link.is-active { background: var(--brand); color: #fff; }

/* ============================================================
   页面主体
   ============================================================ */
.page { padding: 28px 18px 8px; }

/* ---------- 首页首屏 ---------- */
.hero {
  padding: 28px 24px;
  margin-bottom: 22px;
  border-radius: var(--radius);
  background: linear-gradient(135deg,
      color-mix(in srgb, var(--brand) 12%, transparent),
      color-mix(in srgb, var(--accent) 10%, transparent));
  border: 1px solid var(--border);
}

.hero__title { margin: 0 0 10px; font-size: 28px; line-height: 1.35; }
.hero__intro { margin: 0; font-size: 15px; color: var(--muted); }

/* ---------- 区块标题 ---------- */
.section-title { font-size: 18px; margin: 4px 0 16px; }

.tool-section { margin: 26px 0; }

/* ---------- 工具卡片网格（Grid 自适应） ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .18s, border-color .18s;
}

.tool-card:hover {
  transform: translateY(-3px);
  border-color: var(--brand);
}

.tool-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  color: var(--brand);
  font-weight: 700;
  font-size: 14px;
}

.tool-card__name { font-size: 16px; font-weight: 600; }
.tool-card__desc { font-size: 13px; color: var(--muted); }

/* ============================================================
   工具页
   ============================================================ */
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.breadcrumb__sep { margin: 0 6px; }
.breadcrumb__current { color: var(--fg); }

.tool-head { margin-bottom: 18px; }
.tool-head__title { margin: 0 0 6px; font-size: 26px; }
.tool-head__desc { margin: 0; color: var(--muted); font-size: 14px; }

/* 主体两栏：左侧工具，右侧广告；窄屏时纵向堆叠 */
.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}

.tool-main {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.tool-side { display: flex; flex-direction: column; gap: 14px; }

/* ============================================================
   通用表单控件（各工具模块复用）
   ============================================================ */
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 4px 0 6px;
  color: var(--fg);
}

.field-textarea,
.field-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}

.field-textarea:focus,
.field-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}

/* 按钮组 */
.field-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

.btn {
  padding: 9px 18px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--card);
  color: var(--fg);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background .18s, border-color .18s, transform .06s;
}

.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:active { transform: scale(0.97); }

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

.btn--primary:hover { background: color-mix(in srgb, var(--brand) 85%, #000); color: #fff; }

/* 提示信息 */
.field-msg { min-height: 20px; margin: 6px 0; font-size: 13px; color: var(--muted); }
.field-msg.is-ok { color: var(--accent); }
.field-msg.is-err { color: #e74c3c; }

/* 统计数字卡片（字数统计等工具使用） */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.stat-card {
  padding: 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  text-align: center;
}

.stat-card__value { font-size: 20px; font-weight: 700; color: var(--brand); }
.stat-card__label { font-size: 12px; color: var(--muted); }

/* ============================================================
   广告位
   ============================================================ */
.ad-slot {
  margin: 18px 0;
  padding: 8px;
  text-align: center;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px dashed var(--border);
}

.ad-slot--header { margin: 18px auto; max-width: var(--max-width); }

/* ============================================================
   页脚
   ============================================================ */
.site-footer {
  margin-top: 36px;
  padding: 26px 0 34px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  background: var(--card);
}

.site-footer__note { margin: 0 0 6px; }
.site-footer__copy { margin: 0; }

/* ============================================================
   响应式断点
   ============================================================ */
@media (max-width: 860px) {
  /* 工具页两栏在平板/手机上改为单栏，广告移到内容下方 */
  .tool-layout { grid-template-columns: 1fr; }
  .tool-side { flex-direction: row; flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .site-header__inner { flex-direction: column; align-items: flex-start; padding: 10px 0; gap: 8px; }
  /* 手机上导航横向可滚动，避免换行撑高页头 */
  .site-nav { width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .site-nav::-webkit-scrollbar { display: none; }
  .hero { padding: 20px 16px; }
  .hero__title { font-size: 22px; }
  .tool-head__title { font-size: 22px; }
}
