/* ==========================================================================
   Devnors 数据 · 公开站样式
   对齐 Devnors 主仓「最小设计系统」(design-language.mdc / ui-design.mdc)：
   - 22 变量、克制美学（Linear / Notion / Vercel）
   - 3 档灰阶 + 单一品牌色 #1F53FF；业务层零阴影，靠 border 定边界
   - 字号严格 5 档：24(2xl) / 20(xl) / 16(base) / 14(sm) / 12(xs)（+10 仅装饰）
     · 禁用 11/13/15 等档外字号（对齐 design-language 第 1 节）
   - 图标严格 4 档：12 / 16 / 20 / 36
   - 字重 bold/semibold/medium；圆角 lg/full
   - 深色模式经 html.dark 切换，语义变量一一映射（主仓 app.css 同源色值）
   - H5：navbar 52→60、px-4 md:px-6、iOS 输入 16px、tap-highlight、safe-area
   本站不引 Tailwind/构建，用语义 class + CSS 变量落地同一套原子。
   ========================================================================== */

:root {
  --navbar-h: 52px;      /* H5 默认 52，md 起 60（对齐主仓 --navbar-h / --navbar-h-md） */
  --radius: 0.5rem;
  --pad-x: 16px;         /* 容器内边距：px-4，md 起 px-6=24 */

  /* 背景层次（浅色：页面底 → 表面 → 卡片） */
  --bg: #f8fafc;         /* slate-50 */
  --surface: #f1f5f9;    /* slate-100 */
  --card: #ffffff;

  /* 3 档灰阶（对齐 design-language：900 标题+正文 / 700 可点图标 / 500 辅助） */
  --ink: #0f172a;        /* slate-900 */
  --icon: #334155;       /* slate-700 */
  --muted: #64748b;      /* slate-500 */
  --faint: #cbd5e1;      /* slate-300：空状态插画 */

  /* 边框（静态 200 / 弱分隔 100 / hover 300） */
  --border: #e2e8f0;     /* slate-200 */
  --border-weak: #f1f5f9;/* slate-100 */
  --border-strong: #cbd5e1;

  /* 品牌色（单一） */
  --primary: #1F53FF;
  --primary-hover: #0036E6;
  --primary-light: #EBF0FF;
  --primary-ink: #1F53FF;   /* 品牌色文字（浅底可读） */
  --ring: rgba(31, 83, 255, 0.4);

  --shadow-pop: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.05);
}

html.dark {
  /* 背景层次（Google AI Studio 风：底 #080808 → 卡片 #0f0f0f → 表面 #151515） */
  --bg: #080808;
  --surface: #151515;
  --card: #0f0f0f;

  --ink: #e8eaed;
  --icon: #9aa0a6;
  --muted: #71767b;
  --faint: #3c4043;

  --border: #252525;
  --border-weak: #1a1a1a;
  --border-strong: #303030;

  --primary: #1F53FF;
  --primary-hover: #4d78ff;
  --primary-light: #0E1A3D;
  --primary-ink: #A8B8FF;   /* 深底品牌色文字 */
  --ring: rgba(168, 184, 255, 0.4);

  --shadow-pop: 0 10px 15px -3px rgba(0,0,0,.7), 0 4px 6px -4px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ---------- 基础排版（对齐主仓 app.css body） ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: 'Inter', 'Noto Sans SC', system-ui, -apple-system,
    'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.006em;
  overflow-x: hidden;
}

a { color: var(--primary-ink); text-decoration: none; }
a:hover { color: var(--primary-hover); }

h1, h2, h3 { color: var(--ink); margin: 0; }
p { margin: 0; }

::selection { background: rgba(31, 83, 255, 0.16); }
html.dark ::selection { background: rgba(168, 184, 255, 0.25); color: #e8eaed; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 var(--pad-x); }

.muted { color: var(--muted); }
.tabular { font-variant-numeric: tabular-nums; }

/* 段落说明（如首页「为 AI 而建」理念）+ 行内代码 */
.section-note { max-width: 72ch; color: var(--muted); font-size: 14px; line-height: 1.75; margin: 0 0 16px; }
code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em; padding: 1px 5px; border-radius: 5px;
  background: var(--surface); border: 1px solid var(--border); color: var(--ink);
}
/* 机器接口清单：左侧接口 code、右侧说明；纯参考、不可点，避免误点进原始返回 */
.api-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.api-list li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px;
  padding: 10px 14px; background: var(--card);
  border: 1px solid var(--border); border-radius: 10px;
}
.api-list li > code { flex: none; }
.api-list li > span { color: var(--muted); font-size: 14px; }

/* ---------- 顶部导航（glass） ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
html.dark .site-header {
  background: rgba(12, 12, 12, 0.9);
  border-bottom-color: #1c1c1c;
}
.header-inner {
  display: flex; align-items: center; gap: 20px;
  min-height: var(--navbar-h);
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--ink); font-weight: 600; font-size: 14px; white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.brand .brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius);
  background: var(--primary-light); color: var(--primary-ink);
}
.brand .brand-sub { color: var(--ink); font-weight: 600; font-size: 14px; }

.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: var(--radius);
  color: var(--icon); font-size: 14px; font-weight: 500;
  transition: background-color .15s, color .15s;
}
.site-nav a:hover { color: var(--primary-ink); background: var(--surface); }
.site-nav a.active { color: var(--primary-ink); background: var(--primary-light); font-weight: 600; }

.header-tail { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.nav-search { position: relative; display: none; }
.nav-search .search-ico {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
.nav-search input { width: 220px; padding-left: 34px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--card);
  color: var(--icon); cursor: pointer; transition: color .15s, border-color .15s, background-color .15s;
}
.icon-btn:hover { color: var(--primary-ink); border-color: var(--border-strong); }
.icon-btn:active { transform: scale(0.96); }
.theme-toggle .ico-moon { display: none; }
html.dark .theme-toggle .ico-sun { display: none; }
html.dark .theme-toggle .ico-moon { display: inline-flex; }

/* 登录/注册/账号态（账号沿用 Devnors 主站） */
.header-tail .btn { gap: 5px; }
.account-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 9999px;
  font-size: 12px; font-weight: 500; color: var(--muted);
  border: 1px solid var(--border); background: var(--surface);
}
.account-chip .icon { color: var(--primary-ink); }

/* ---------- 面包屑 ---------- */
.breadcrumb {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  padding-top: 16px; font-size: 12px; color: var(--muted);
}
.breadcrumb a { color: var(--muted); display: inline-flex; align-items: center; }
.breadcrumb a:hover { color: var(--primary-ink); }
.breadcrumb .sep { color: var(--faint); display: inline-flex; }
.breadcrumb .current { color: var(--ink); font-weight: 500; }

/* ---------- 主体 ---------- */
main.container { padding-top: 20px; padding-bottom: 48px; min-height: calc(100vh - var(--navbar-h) - 200px); }

/* icon 通用（跟随字色，垂直居中） */
.icon { display: inline-block; vertical-align: middle; flex: none; }

/* ---------- Hero（首页/数据集首页营销区，白名单大字） ---------- */
.hero { padding: 28px 0 24px; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; margin-bottom: 16px; border-radius: 9999px;
  background: var(--primary-light); color: var(--primary-ink);
  font-size: 12px; font-weight: 500;
}
.hero h1 {
  font-size: clamp(24px, 4vw, 40px); font-weight: 700;
  letter-spacing: -0.025em; line-height: 1.2;
}
.hero .lede {
  margin-top: 14px; max-width: 640px;
  font-size: 16px; line-height: 1.7; color: var(--muted);
}

/* 搜索框（hero） */
.hero-search { display: flex; gap: 8px; margin-top: 24px; max-width: 560px; }
.hero-search .search-wrap { position: relative; flex: 1; }
.hero-search .search-ico {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
.hero-search .search-wrap input { padding-left: 38px; }

/* ---------- 表单控件（对齐主仓 .input-base） ---------- */
.input-base {
  width: 100%; padding: 10px 12px; font-size: 14px;
  color: var(--ink); background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.input-base::placeholder { color: var(--muted); }
.input-base:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }

/* ---------- 按钮（4 变体 × 对齐 ui-design 尺寸） ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; font-size: 14px; font-weight: 600; line-height: 1;
  border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
  font-family: inherit;
}
.btn:active { transform: scale(0.98); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-secondary { background: var(--card); border-color: var(--border); color: var(--ink); }
.btn-secondary:hover { background: var(--surface); border-color: var(--border-strong); color: var(--ink); }
.btn-ghost { color: var(--icon); background: transparent; }
.btn-ghost:hover { background: var(--surface); color: var(--ink); }

/* ---------- 章节标题 ---------- */
.section { margin-top: 40px; }
.section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.section-head .icon { color: var(--icon); }
.section-head h2 { font-size: 16px; font-weight: 600; }
.section-head .count-note { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 500; }

/* ---------- 指标卡（MetricCard） ---------- */
.metric-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 24px; }
.metric {
  display: flex; align-items: center; gap: 12px;
  padding: 16px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.metric .m-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius);
  background: var(--primary-light); color: var(--primary-ink); flex: none;
}
.metric .m-val { font-size: 20px; font-weight: 700; letter-spacing: -0.025em; color: var(--ink); font-variant-numeric: tabular-nums; }
.metric .m-label { font-size: 14px; color: var(--muted); font-weight: 500; margin-top: 2px; }

/* ---------- 卡片网格（数据集卡片） ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card {
  display: block; padding: 20px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); transition: border-color .15s;
}
a.card:hover { border-color: color-mix(in srgb, var(--primary) 35%, transparent); }
.card .card-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius);
  background: var(--primary-light); color: var(--primary-ink); margin-bottom: 14px;
}
.card h3 { font-size: 16px; font-weight: 600; color: var(--ink); }
.card .card-desc { margin-top: 6px; font-size: 14px; color: var(--muted); line-height: 1.6; }
.card .card-foot {
  margin-top: 14px; display: inline-flex; align-items: center; gap: 4px;
  font-size: 14px; font-weight: 500; color: var(--primary-ink);
}

/* ---------- Chips（分面/标签） ---------- */
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; font-size: 14px; font-weight: 500;
  color: var(--ink); background: var(--card);
  border: 1px solid var(--border); border-radius: 9999px;
  transition: border-color .15s, color .15s, background-color .15s;
}
.chip:hover { color: var(--primary-ink); border-color: color-mix(in srgb, var(--primary) 35%, transparent); background: var(--surface); }
.chip .count {
  font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
  padding-left: 6px; border-left: 1px solid var(--border);
}
/* 「更多」原生折叠（零 JS）：summary 伪装成 chip、去掉默认三角；展开时该项占满整行，
   其余年份在下方以 chip 流式铺开 */
.chip-more > summary { list-style: none; cursor: pointer; user-select: none; }
.chip-more > summary::-webkit-details-marker { display: none; }
.chip-more > summary::after { content: "▾"; margin-left: 2px; color: var(--muted); font-size: 12px; }
.chip-more[open] > summary::after { content: "▴"; }
.chip-more-panel { margin-top: 12px; }
.chip-list > li:has(> .chip-more[open]) { flex-basis: 100%; }

/* 分面分组 */
.facet-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.facet-card {
  padding: 18px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.facet-card .fc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.facet-card .fc-head .icon { color: var(--icon); }
.facet-card .fc-head h3 { font-size: 14px; font-weight: 600; }

/* ---------- 实体列表 ---------- */
.entity-list { list-style: none; margin: 0; padding: 0; }
.entity-row { padding: 16px 0; border-bottom: 1px solid var(--border-weak); }
.entity-row:last-child { border-bottom: 0; }
.entity-row .entity-title { font-size: 16px; font-weight: 600; color: var(--ink); line-height: 1.5; }
.entity-row .entity-title:hover { color: var(--primary-ink); }
.entity-row .entity-meta {
  display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px;
  font-size: 12px; color: var(--muted);
}
.entity-row .entity-meta span { display: inline-flex; align-items: center; gap: 4px; }
.entity-row .excerpt { margin-top: 6px; font-size: 14px; color: var(--muted); line-height: 1.6; }

/* ---------- 详情页 ---------- */
.entity-detail { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.entity-detail > h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.3; }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; font-size: 12px; font-weight: 500;
  border-radius: 9999px; border: 1px solid var(--border);
  color: var(--icon); background: var(--surface);
}
.tag:hover { color: var(--primary-ink); border-color: color-mix(in srgb, var(--primary) 35%, transparent); }
.tag .icon { color: var(--muted); }

.meta-grid {
  display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px;
  margin: 24px 0; padding: 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.meta-grid dt { font-size: 12px; color: var(--muted); font-weight: 500; align-self: center; }
.meta-grid dd { margin: 0; font-size: 14px; color: var(--ink); align-self: center; }

.entity-detail section { margin-top: 24px; }
.entity-detail section h2 {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 600; margin-bottom: 8px;
}
.entity-detail section h2 .icon { color: var(--icon); }

/* 阅读区（prose，text-base 1.75） */
.prose { font-size: 16px; line-height: 1.75; color: var(--ink); }
.prose p { margin: 0.5em 0; }

.law-list { margin: 8px 0 0; padding-left: 20px; }
.law-list li { font-size: 16px; line-height: 1.75; margin: 4px 0; }

/* 裁判文书全文：保留原文换行/段落 */
.prose-fulltext { white-space: pre-wrap; word-break: break-word; }

/* 登录墙（对齐 ui-design LoginRequired：卡片 + Lock + 标题 + 描述 + Primary 按钮） */
.login-wall {
  margin-top: 24px; padding: 32px 24px; text-align: center;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--primary-light);
}
.login-wall .lw-ico { color: var(--primary-ink); display: inline-flex; margin-bottom: 8px; }
.login-wall .lw-title { font-size: 16px; font-weight: 600; color: var(--ink); }
.login-wall p { margin: 6px auto 0; max-width: 420px; font-size: 14px; color: var(--muted); line-height: 1.7; }
.login-wall .lw-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }

.source { margin-top: 20px; font-size: 12px; }
.source a {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--muted); text-decoration: none;
}
.source a:hover { color: var(--primary-ink); text-decoration: underline; }
.source .icon { color: inherit; }

.related { margin-top: 40px; }

/* ---------- 空状态（EmptyState：36 图标 slate-300） ---------- */
.empty { padding: 48px 16px; text-align: center; }
.empty .empty-ico { color: var(--faint); display: inline-flex; margin-bottom: 8px; }
.empty h2, .empty .empty-title { font-size: 16px; font-weight: 600; color: var(--ink); }
.empty p { font-size: 14px; color: var(--muted); margin-top: 4px; }
.empty .btn { margin-top: 16px; }
.error-page { padding-top: 64px; }
.error-page .code { font-size: 48px; font-weight: 700; letter-spacing: -0.025em; color: var(--ink); line-height: 1.1; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 28px; }
.pager .pager-cur { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.note { text-align: center; margin-top: 12px; font-size: 12px; }

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0; margin-top: 40px;
  background: var(--card);
}
.site-footer .foot-top { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); font-size: 14px; }
.site-footer .foot-top .icon { color: var(--primary-ink); }
.site-footer p { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.6; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 16px; }
.footer-nav a { font-size: 14px; color: var(--icon); font-weight: 500; }
.footer-nav a:hover { color: var(--primary-ink); }

/* ==========================================================================
   响应式 —— H5 优先，md(≥768) 升级（对齐主仓 px-4 md:px-6 / navbar 52→60）
   ========================================================================== */
@media (min-width: 768px) {
  :root { --navbar-h: 60px; --pad-x: 24px; }
  .nav-search { display: block; }
  main.container { padding-top: 24px; }
  .hero { padding: 40px 0 32px; }
}

@media (max-width: 640px) {
  .header-inner { gap: 12px; }
  .site-nav { display: none; }
  .hero-search { flex-direction: column; }
  .meta-grid { grid-template-columns: 1fr; gap: 4px 0; padding: 16px; }
  .meta-grid dt { margin-top: 10px; }
  .meta-grid dt:first-of-type { margin-top: 0; }
  .entity-detail { padding: 20px; }
  .metric-row { grid-template-columns: 1fr 1fr; }
}

/* ==========================================================================
   H5 专项（对齐主仓 app.css 移动端优化，仅窄屏生效）
   ========================================================================== */

/* iOS Safari 输入字号 <16px 会自动缩放 → 窄屏统一 16px，避免聚焦抖动 */
@media (max-width: 767px) {
  input, select, textarea { font-size: 16px; }
  /* 长表格/宽内容横向滚动而非撑破布局 */
  .meta-grid { overflow-x: auto; }
}

/* 触摸设备：消除系统点击高亮 + 统一按下反馈（透明度微降） */
@media (hover: none) and (pointer: coarse) {
  a, button, [role="button"], label, summary { -webkit-tap-highlight-color: transparent; }
  a:active, button:not([disabled]):active { opacity: 0.7; transition: opacity 0.06s ease-out; }
}

/* safe-area：底部固定/页脚留白（刘海屏/手势条） */
@supports (padding: env(safe-area-inset-bottom)) {
  .site-footer { padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)); }
}

/* 降低动效偏好：去交互位移 */
@media (prefers-reduced-motion: reduce) {
  .btn:active, .icon-btn:active { transform: none; }
}
