/* 波斯文献协作研究平台 基础样式
   目标：低装饰、适合长时阅读的学术界面，公开站与内部区共用。
   波斯文与中文混排时，方向与字体分别处理。 */

:root {
  --ink: #24211d;
  --ink-soft: #4f4a43;
  --muted: #6f685e;
  --line: #cec5b7;
  --line-soft: #e3ddd3;
  --paper: #f5f1e9;
  --panel: #fffdf8;
  --panel-soft: #eee9df;
  --accent: #713b38;
  --accent-soft: #eee3dc;
  --accent-ink: #4f2725;
  --lapis: #28586d;
  --lapis-ink: #193e4e;
  --lapis-soft: #e2ebec;
  --turquoise: #2f7773;
  --gold: #a77d3c;
  --gold-soft: #e7d9b9;
  --warn-bg: #fff6df;
  --warn-line: #dcc27a;
  --warn-ink: #765316;
  --error-bg: #fbecec;
  --error-line: #dda9a9;
  --error-ink: #8c2f2f;
  --ok-bg: #edf6f0;
  --ok-line: #aed0ba;
  --ok-ink: #2d6540;

  --radius: 2px;
  --radius-sm: 2px;
  --shadow-sm: none;
  --shadow-md: 0 4px 18px rgba(40, 44, 48, .08);
  --focus: #1a5fb4;          /* 键盘焦点环。比 --accent 亮，细线上也看得见 */

  --sans: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  --serif: "Source Han Serif SC", "Songti SC", Georgia, "Times New Roman", serif;

  /* 波斯文字体栈。**全站唯一一份**，输入框与正文都用它，避免同一页面上
     正文和文本框字形不一致。顺序是「专为波斯文设计的字体 → 系统自带的
     阿拉伯字母字体 → 通用衬线」。Tahoma 排在靠前，因为它在 Windows 上
     必定存在，且阿拉伯字母的 Naskh 形态比 Segoe UI 稳，缺字形的情况最少。
     不引入外部字体文件：慢网络下宁可字形朴素，也不让整页等字体。 */
  --fa: "Vazirmatn", "Noto Naskh Arabic", "Iranian Sans", "B Nazanin",
        Tahoma, "Segoe UI", "Times New Roman", serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 18% 12%, rgba(167, 125, 60, .045) 0 1px, transparent 1.5px),
    radial-gradient(circle at 78% 68%, rgba(40, 88, 109, .035) 0 1px, transparent 1.5px);
  background-size: 23px 23px, 31px 31px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.72;
  min-height: 100vh;
}

.app-body { border-top: 0; }

/* 版面宽度。W7 由 880px 放宽到 1120px：13 英寸笔记本（1280px 逻辑宽）
   下 1120 + 两侧各 24px 内边距 = 1168，小于 1280，既不出现横向滚动，
   也不再让表格挤成窄条。正文类的长文本另有 46em 限宽，所以放宽外框
   不会把行拉长到难读。 */
.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* 宽版版面。给左右分栏与并排对比的页面用：研读工作台、审核页、
   ​版本对比页、冲突页、PDF 阅读器。这些页面在 1120px 下会把每一栏
   压得太窄。
   **这个类必须定义在 site.css 里**：W7 之前它只写在 reader.css，
   而 reader.css 只有工作台与阅读器两页引入，于是另外三个用了
   wrap-wide 的页面一直没有拿到宽版样式，而且没人发现——
   样式失效不会报错。上限取 1440px 而不是 none：超宽屏上让正文
   拉满整屏同样难读。 */
.wrap-wide { max-width: 1440px; }

a { color: var(--accent); text-decoration: none; text-underline-offset: .18em; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.35; letter-spacing: .01em; }
h1 { font-size: clamp(1.8rem, 2.6vw, 2.35rem); margin: 0 0 1rem; }
h2 { font-size: 1.26rem; margin: 0 0 .75rem; }
h3 { font-size: 1.05rem; margin: 0 0 .5rem; }

p { margin: 0 0 .9rem; }

.muted { color: var(--muted); font-size: .92rem; }

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 12px;
  top: 12px;
  background: var(--panel);
  padding: 8px 12px;
  border: 1px solid var(--line);
}

/* ---------- 页头页脚 ---------- */

.site-header,
.app-header {
  position: relative;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.site-header::before,
.app-header::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg,
    var(--lapis) 0 35%, var(--gold) 35% 43%, var(--accent) 43% 64%,
    var(--gold) 64% 70%, var(--turquoise) 70% 100%);
}

.app-header { border-bottom: 1px solid var(--line); }

.header-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
  padding-bottom: 20px;
  flex-wrap: wrap;
}

.brand a {
  font-family: var(--serif);
  font-size: 1.32rem;
  font-weight: 600;
  color: var(--ink);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px 20px;
  font-size: .95rem;
  flex-wrap: wrap;
}

.site-nav .who { color: var(--ink-soft); }

.inline-form { display: inline; margin: 0; }

.link-btn {
  background: none;
  border: 0;
  padding: 4px 0;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

main.wrap { padding-top: 40px; padding-bottom: 64px; min-height: 66vh; }

.site-footer {
  position: relative;
  border-top: 1px solid var(--line);
  padding: 28px 0 42px;
  background: var(--paper);
}
.site-footer::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 50%;
  width: 112px;
  height: 3px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, var(--lapis) 0 32%, var(--gold) 32% 48%, var(--accent) 48% 68%, var(--turquoise) 68%);
}

.footer-line { font-family: var(--serif); margin: 0 0 .25rem; }
.footer-note { color: var(--muted); font-size: .86rem; margin: 0; }

/* ---------- 首页与内容块 ---------- */

.hero { margin-bottom: 36px; }
.public-home { max-width: 940px; margin: 0 auto; }
.hero-home {
  padding: 38px 0 48px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--line);
}
.hero-home h1 { max-width: 18em; margin: 0 0 22px; }
.lede { font-size: 1.08rem; color: var(--ink-soft); max-width: 48em; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.hero-actions { display: flex; align-items: center; gap: 14px 26px; flex-wrap: wrap; margin: 28px 0 0; }
.home-about-link { font-size: .92rem; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.section-heading h2 { margin: 0; }
.section-heading .eyebrow { margin: 0; font-size: .7rem; }
.publication-empty { padding: 26px 0 20px; }
.publication-empty p { margin-bottom: 6px; }

.entries {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.entries-stack { grid-template-columns: 1fr; }

.entries li {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.entry-label { font-weight: 600; }
.publication-list { gap: 0; margin-top: 16px; }
.publication-list li { border: 0; border-bottom: 1px solid var(--line-soft); border-radius: 0; background: transparent; padding: 18px 0; }
.entry-link { color: var(--accent); }
.entry-state { color: var(--muted); font-size: .85rem; }
.entry-state-open { color: var(--accent); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 28px);
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}

/* 内部研究区采用书目／档案目录式排版，不把每一块内容都装进卡片。 */
.app-body .panel {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 24px 0 4px;
  box-shadow: none;
}
.app-body .panel > h2:first-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.app-body .panel-quiet {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  padding: 22px;
}
.app-body .entries li {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  padding: 13px 0;
}

.panel > h2:first-child { padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
.panel-quiet { background: var(--panel-soft); box-shadow: none; }
.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 22px;
  text-align: center;
  color: var(--ink-soft);
  background: var(--panel-soft);
}
.empty-state p { margin: 0 0 .4rem; }

/* ---------- 正文与表格 ---------- */

.prose { max-width: 46em; }
.prose ul.plain { padding-left: 1.2em; }
.prose li { margin-bottom: .4rem; }

.rtl-note {
  font-family: var(--fa);
  direction: rtl;
  text-align: right;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 0;
  font-size: .94rem;
}
.table th, .table td {
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  padding: 11px 13px;
  text-align: left;
  vertical-align: top;
}
.table thead th { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; white-space: nowrap; }
.app-body .table thead th {
  background: transparent;
  border-top: 1px solid var(--ink-soft);
  border-bottom-color: var(--line);
  color: var(--ink-soft);
  font-size: .78rem;
  letter-spacing: .04em;
}
.table tbody tr:last-child > * { border-bottom: 0; }
.table tbody tr:hover { background: var(--panel-soft); }
.table td:first-child { white-space: nowrap; }

/* 窄屏的表格：让它自己横向滚动，而不是把整个页面撑宽。
   外层容器负责滚动，表格保持 min-width 以免列被压到不可读。
   凡是宽度可能超出一屏的表格，都应包在这个容器里。 */
.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 12px 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
}
.table-scroll .table { margin-bottom: 0; }
.table-scroll:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
/* 表格比屏幕宽时给个提示，告诉人可以左右拖 */
.table-scroll-hint {
  color: var(--muted);
  font-size: .84rem;
  margin: 0 0 14px;
}

/* ---------- 表单 ---------- */

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 1fr);
  align-items: stretch;
  max-width: 900px;
  margin: 24px auto 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}
.login-intro {
  padding: clamp(28px, 4vw, 44px);
  color: var(--ink);
  background: var(--panel-soft);
  border-right: 1px solid var(--line);
}
.login-intro h1 { font-size: 1.65rem; margin: 20px 0; }
.login-intro > p:not(.eyebrow) { color: var(--ink-soft); max-width: 34em; }
.login-back { display: inline-block; margin-top: 24px; font-size: .88rem; }
.login-box { min-width: 0; padding: clamp(28px, 4vw, 44px); }
.login-box h2 { font-size: 1.55rem; }
.login-note { margin-bottom: 24px; }
.login-submit { width: 100%; margin-top: 4px; }

.form { margin-top: 16px; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  margin-bottom: 4px;
  font-size: .88rem;
  font-weight: 650;
  color: var(--ink-soft);
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--panel);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 3px solid rgba(26, 95, 180, .22);
  border-color: var(--accent);
  outline-offset: 0;
}

.field-help { color: var(--muted); font-size: .85rem; margin: 4px 0 0; }
.field-error { color: #8c2f2f; font-size: .88rem; margin: 4px 0 0; }
.errorlist { color: #8c2f2f; font-size: .88rem; margin: 4px 0 0; padding-left: 1.1em; }

/* 一组单选或复选按钮用 fieldset + legend，不用 label。
   label 的 for 只能指向一个控件，指不到一组；把组标题写成 label
   会让读屏软件读出一个对不上的标签。 */
.field-group {
  border: 0;
  padding: 0;
  margin: 0 0 14px;
}
.field-group legend {
  padding: 0;
  margin-bottom: 4px;
  font-size: .92rem;
  color: var(--ink-soft);
}
.field-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.field-group li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.field-group li label { margin: 0; }

/* 复选框与标签要挨在一起：通用输入样式 width:100% 会把勾选框拉成一条横线 */
.field-checkbox {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.field-checkbox input[type="checkbox"] { width: auto; margin: 0; }
.field-checkbox label { display: inline; margin: 0; }
.field-checkbox .field-help { flex-basis: 100%; margin-top: 0; }

/* 校验值与对象键很长，允许在任意位置断行，免得撑破表格 */
.breakable { word-break: break-all; }

/* ---------- 检索与目录 ---------- */

.search-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  max-width: 520px;
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}
/* 每组「标签 + 控件」。七个筛选区共用这一份，不给哪一页单写一套。
   标签在上、控件在下，且标签文字必须真实可见——不用隐藏标签或 aria-label 顶替。 */
.search-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 160px;
  min-width: 0;
}
.search-field > label {
  font-weight: 500;
  font-size: .9rem;
  color: var(--ink-soft);
}
/* 筛选区里的文本框统一外观：`page` 这类 `type="text"` 与检索框长得一样，
   否则底对齐之后高矮不一会让标签看着像挂错了地方。 */
.search-form input[type="search"],
.search-form input[type="text"] {
  flex: 1;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--panel);
}
.search-form select {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--panel);
}
/* 包进 .search-field 后，控件在纵向排布，横向的 flex 伸展与 size 属性都不再适用 */
.search-field > input,
.search-field > select {
  width: 100%;
  flex: none;
}
/* 数字资源页多一个等级下拉，需要比默认宽度更宽松一些 */
.search-form-wide { max-width: 780px; }

/* 波斯文原文字段：右起、专用字体，避免与中文混排时方向错乱 */
.fa {
  font-family: var(--fa);
  font-size: 1.05rem;
  line-height: 1.9;
}

.pid {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: .85rem;
  background: var(--panel-soft);
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--ink-soft);
}

.formset td:first-child { white-space: nowrap; }
.formset input[type="text"],
.formset input[type="url"],
.formset select {
  width: 100%;
  min-width: 6em;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
  font-size: .9rem;
  background: var(--panel);
}

.edit-link { margin-left: 10px; font-size: .9rem; }
.cancel-link { margin-left: 14px; font-size: .92rem; }

/* ---------- 按钮 ----------
   三个层级，含义固定，不得混用：
     .btn          主操作。一个界面区域里只该有一个（保存、提交、发布）。
     .btn-quiet    次要操作。查看、进入、筛选、并列的备选动作。
     .btn-danger   不可逆或对外的操作。撤下、作废、删除。
   链接式的动作一律用 .link-btn，不使用按钮外观。
   触屏热区：三个按钮的最小高度都定在 44px，符合手指点击的最小尺寸。 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  background: var(--lapis);
  color: #fff;
  border: 1px solid var(--lapis);
  border-radius: 1px;
  padding: 9px 21px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}
.btn:hover { background: var(--lapis-ink); border-color: var(--lapis-ink); text-decoration: none; }
.btn:active { background: var(--lapis-ink); }

/* 次要按钮：描边式。W7 之前这个类在 11 个模板里被使用，样式表里却
   没有定义，于是所有次要操作都渲染成了与主操作一模一样的蓝色实心块，
   界面上分不出「保存」和「看历史」。这一条就是补这个缺口。 */
.btn-quiet {
  background: var(--panel);
  color: var(--accent);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn-quiet:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-quiet:active { background: var(--accent-soft); }

/* 危险按钮：对外发布、撤下、作废一类。默认仍是描边式，
   只在悬停时显色，免得页面上一眼望去全是红块。 */
.btn-danger {
  background: var(--panel);
  color: var(--error-ink);
  border: 1px solid var(--error-line);
}
.btn-danger:hover {
  background: var(--error-bg);
  border-color: var(--error-ink);
  color: var(--error-ink);
}

.btn[disabled],
.btn-quiet[disabled],
.btn-danger[disabled] {
  opacity: .5;
  cursor: not-allowed;
}
.btn[disabled]:hover { background: var(--accent); border-color: var(--accent); }

/* 键盘焦点。用 :focus-visible 而不是 :focus，鼠标点击时不画环，
   键盘 Tab 时必定可见。 */
.btn:focus-visible,
.btn-quiet:focus-visible,
.btn-danger:focus-visible,
.link-btn:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* 提示条。类名跟 Django messages 的 tag 一一对应：
   debug / info / success / warning / error。
   **必须五个都定义**：base.html 写的是 alert-{{ message.tags }}，
   少一个就意味着一整类消息渲染成没有底色的裸文本。W7 之前
   alert-warning 与 alert-info 恰好缺着，凡是 messages.warning()
   发出的提示（例如「没有可删除的段落」）全都没有样式。
   alert-warn 保留为别名，因为模板里可能有人手写这个短名。 */
.alert {
  border-radius: var(--radius-sm);
  padding: 12px 15px;
  margin-bottom: 12px;
  font-size: .94rem;
  border-left: 3px solid transparent;
}
.alert-debug,
.alert-info {
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-left-color: var(--accent);
}
.alert-success {
  background: var(--ok-bg);
  border: 1px solid var(--ok-line);
  border-left-color: var(--ok-ink);
}
.alert-warning,
.alert-warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-left-color: var(--warn-ink);
  color: var(--warn-ink);
}
.alert-error {
  background: var(--error-bg);
  border: 1px solid var(--error-line);
  border-left-color: var(--error-ink);
  color: var(--error-ink);
}
/* 提示条里的链接跟随提示色，否则蓝字压在同色底上会发闷 */
.alert-warning a,
.alert-warn a,
.alert-error a { color: inherit; text-decoration: underline; }

/* ---------- 错误页 ---------- */

/* 错误页已经带站内页头，所以不再用 padding-top 把内容顶下去；
   只限一下正文宽度，让「常见原因」那几条不至于拉成一整行。 */
.error-page { max-width: 46em; }
.error-page .prose { margin: 0 0 .9rem; }

/* ---------- 响应式 ---------- */

@media (max-width: 720px) {
  .entries { grid-template-columns: 1fr; }
  body { font-size: 15px; }
  h1 { font-size: 1.5rem; }
}

/* ---------- W4 研读场次与段落用到的通用类 ---------- */

/* 一行并列的按钮或链接。 */
.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0;
}

/* 纵向排列的表单。Django 的 form.as_p 会在每个字段外面套一个 <p>，
   这里把 p 当作字段容器来排，不再另外包一层 div。 */
.stack-form > * { max-width: 680px; }
.stack-form p { margin: 0 0 14px; }
.stack-form label { display: block; font-weight: 500; font-size: .9rem; margin-bottom: 4px; }
.stack-form input[type="text"],
.stack-form input[type="number"],
.stack-form input[type="date"],
.stack-form input[type="search"],
.stack-form select,
.stack-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--panel);
  color: var(--ink);
}
.stack-form .helptext {
  display: block;
  font-size: .82rem;
  color: var(--muted);
  margin-top: 4px;
}

/* 修改历史与只读展示里的内容块。pre-wrap 保住原件里的换行。 */
.history-text {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  white-space: pre-wrap;
  line-height: 1.9;
}
.history-text[dir="rtl"] {
  font-family: var(--fa);
  font-size: 1.05rem;
  line-height: 2;
}

.warn-text { color: #8a5a00; }

/* ---------- 审核、意见与队列（W5） ---------- */

.stack > section,
.stack > header { margin-bottom: 26px; }

.page-head h1 { margin-bottom: 4px; }
.page-head .actions { margin-top: 6px; }

/* 需要人做决定的一块，用左侧色条与其余面板分开 */
.panel-accent {
  border-left: 3px solid var(--accent);
}

.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--accent-soft);
  font-size: .78rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.badge-warn {
  border-color: var(--warn-line);
  background: var(--warn-bg);
  color: #8a5a00;
}

.issue-body { max-width: 26rem; }

/* ---------- W6：冻结成果与公开快照 ---------- */

/* 推荐引用格式。用衬线体与左侧色条把它与正文分开，
   因为这一句是要求使用者原样抄下来的。 */
.citation {
  font-family: var(--serif);
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  padding: 10px 14px;
  margin: 0;
}

/* 公开成果页的逐段正文。段间用细横线分隔，第一段不画线，
   免得正文开头多出一条悬空的边。 */
.result-segment {
  border-top: 1px solid var(--line-soft);
  padding-top: 16px;
  margin-top: 18px;
}
.result-segment:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}
.result-segment h3 { margin: 0 0 8px; }
.result-segment h4 {
  margin: 14px 0 6px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--muted);
}
.result-segment .history-text { margin: 0; }

/* ==================== W7：可用性与无障碍 ==================== */

/* ---------- 无障碍辅助 ---------- */

/* 只给读屏软件看的文字。用于给图标按钮、缩略标题补一段说明，
   以及给跳转链接的目标区块加可读标题。 */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 键盘焦点。策略是按元素角色分别画环，而不是一条 :focus 通配：
   通配会同时命中鼠标点击，让页面到处闪边框。
   这里兜住所有原生可聚焦元素，按钮类在前文单独给了更强的环。 */
a:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* 内部区的跳转链接与公开站共用同一个类，但内部区页头更高，
   焦点时落点要往下让开页头，所以单独调一次。 */
.app-header ~ main .skip-link:focus { top: 12px; }

/* ---------- 排版防线 ---------- */

/* 长串（对象键、校验值、URL、波斯文长词）一律允许断行，
   任何页面都不该因为一个长串出现横向滚动条。 */
main, .site-footer, .app-header {
  overflow-wrap: break-word;
}
.breakable,
.pid {
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* 正文阅读列。外框在 13 英寸屏上放宽到 1120px 是为了表格，
   但连续文字仍然限在 46em 左右，一行太长眼睛会回行困难。 */
.measure { max-width: 46em; }

/* ---------- 页面标题与动作区 ---------- */

/* 详情页统一的头部：标题、副信息、动作按钮三件套。
   低于 560px 时按钮铺满一行，指头点得到。 */
.page-head h1 { margin-bottom: 6px; }
.page-head .page-sub {
  color: var(--muted);
  font-size: .9rem;
  margin: 0 0 8px;
  max-width: 68em;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0 20px;
}
.page-actions .link-btn { min-height: 44px; display: inline-flex; align-items: center; }

/* ---------- 空状态 ---------- */

/* 空状态不只是「暂无数据」四个字。凡是空的地方都要回答
   「为什么会空」与「下一步做什么」，所以正文与动作按钮分开排。 */
.empty-state { text-align: left; }
.empty-state h2,
.empty-state h3 { margin-bottom: 6px; }
.empty-state p { max-width: 42em; }
.empty-state .empty-next {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- 内部区导航 ---------- */

/* 导航分主次两档。主档是每天要用的页面，正常字色；次档是偶尔查的
   目录与账号动作，字色淡一档。分组靠 .nav-sep 的竖线，不靠间距，
   这样折行之后分组关系仍然看得出来。 */
.app-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 16px;
  padding-bottom: 14px;
}
.app-brand {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  column-gap: 14px;
}
.app-brand .workspace-mark {
  grid-column: 1 / -1;
  color: var(--lapis);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .16em;
}
.app-brand > a { font-size: 1.22rem; letter-spacing: .025em; }
.account-strip {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 16px;
  flex-wrap: wrap;
  font-size: .86rem;
  color: var(--muted);
}
.account-strip .who { display: inline-flex; align-items: center; gap: 8px; }
.account-name { color: var(--ink-soft); font-weight: 600; }
.account-role {
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  font-size: .76rem;
}
.app-nav-band {
  border-top: 1px solid var(--line-soft);
  background:
    linear-gradient(90deg, rgba(40, 88, 109, .035), transparent 24%, transparent 76%, rgba(47, 119, 115, .035)),
    var(--paper);
}
.app-nav {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 52px;
  overflow: visible;
  flex-wrap: wrap;
}
.nav-key {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 12px;
  border-radius: 0;
  color: var(--ink-soft);
  font-weight: 600;
  white-space: nowrap;
}
.nav-key:hover { background: transparent; color: var(--accent); text-decoration: none; }
.nav-quiet { color: var(--muted); }

.nav-sep {
  width: 1px;
  height: 18px;
  background: var(--line);
  flex: 0 0 auto;
}

/* 当前页。读屏软件念「当前页」，视觉上是加深的字色加一条底线。
   只靠颜色不够，所以同时改了字重。 */
.site-nav [aria-current="page"] {
  color: var(--lapis);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--gold);
}

.app-nav [aria-current="page"] {
  color: var(--lapis-ink);
  background: transparent;
  box-shadow: inset 0 -2px 0 var(--gold);
}
.app-nav [aria-current="page"]:hover { color: var(--lapis-ink); background: transparent; }
.nav-more { position: relative; margin-left: 0; }
.nav-admin { margin-left: auto; }
.nav-more summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: .92rem;
  cursor: pointer;
  list-style: none;
}
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more summary::after { content: "⌄"; color: var(--muted); line-height: 1; }
.nav-more[open] summary { background: var(--panel); color: var(--accent); }
.nav-more.is-current summary { background: var(--accent-soft); color: var(--accent); }
.nav-more-menu {
  position: absolute;
  z-index: 20;
  right: 0;
  top: calc(100% + 7px);
  display: grid;
  grid-template-columns: repeat(2, minmax(116px, 1fr));
  gap: 4px;
  min-width: 300px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  box-shadow: var(--shadow-md);
}
.nav-more-menu a { padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink-soft); }
.nav-more-menu a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.nav-cluster .nav-more-menu,
.nav-admin .nav-more-menu { grid-template-columns: 1fr; min-width: 210px; }
.nav-cluster .nav-more-menu { right: auto; left: 0; }

/* ---------- 研究首页：检索优先、目录式入口 ---------- */

.workspace-welcome { padding: 10px 0 4px; }
.workspace-welcome h1 { margin-bottom: 5px; font-size: clamp(1.65rem, 2.5vw, 2.15rem); }
.workspace-welcome .page-sub { color: var(--muted); margin: 0; }
.catalogue-gateway {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, .72fr) minmax(360px, 1.28fr);
  gap: 18px 44px;
  align-items: end;
  margin: 16px 0 8px;
  padding: 34px 34px 30px;
  border: 1px solid var(--gold);
  background:
    linear-gradient(135deg, rgba(40, 88, 109, .055), transparent 34%),
    linear-gradient(315deg, rgba(47, 119, 115, .05), transparent 28%),
    var(--panel);
  box-shadow:
    inset 0 0 0 4px var(--panel),
    inset 0 0 0 5px rgba(167, 125, 60, .42);
}
.catalogue-gateway-copy h2 {
  margin-bottom: 7px;
  font-size: clamp(1.45rem, 2vw, 1.82rem);
}
.catalogue-gateway-copy p:last-child { color: var(--ink-soft); margin: 0; max-width: 34em; }
.catalogue-search label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: .84rem;
  font-weight: 650;
}
.catalogue-search-row { display: flex; align-items: stretch; }
.catalogue-search-row input {
  min-width: 0;
  flex: 1;
  min-height: 50px;
  padding: 10px 14px;
  border: 1px solid var(--lapis);
  border-right: 0;
  border-radius: 1px 0 0 1px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
}
.catalogue-search-row input:focus {
  position: relative;
  z-index: 1;
  outline: 3px solid rgba(26, 95, 180, .22);
  outline-offset: 0;
}
.catalogue-search-row .btn { min-height: 50px; padding-inline: 26px; }
.catalogue-browse {
  grid-column: 2;
  display: flex;
  gap: 10px 24px;
  flex-wrap: wrap;
  font-size: .88rem;
}
.catalogue-browse a::after { content: " →"; }
.catalogue-page-head { margin-bottom: 22px; }
.catalogue-search-page { max-width: 760px; }
.catalogue-browse-page {
  grid-column: auto;
  max-width: 760px;
  margin: 12px 0 34px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.search-help {
  max-width: 760px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}
.search-help h2 { font-size: 1.12rem; }
.search-help p { color: var(--ink-soft); }
.search-result-summary {
  margin: 0 0 28px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
}

.research-doors {
  margin: 12px 0 38px;
  border-bottom: 1px solid var(--line);
}
.research-door {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 15px 12px 15px 16px;
  border-top: 1px solid var(--line-soft);
  border-left: 3px solid transparent;
  color: var(--ink);
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}
.research-door:first-child { border-top: 0; }
.research-door:nth-child(1) { border-left-color: var(--lapis); }
.research-door:nth-child(2) { border-left-color: var(--turquoise); }
.research-door:nth-child(3) { border-left-color: var(--gold); }
.research-door:hover { background: rgba(255, 253, 248, .7); color: var(--accent); text-decoration: none; }
.research-door-no {
  color: var(--accent);
  font-family: var(--serif);
  font-size: .9rem;
}
.research-door-copy { display: flex; flex-direction: column; gap: 2px; }
.research-door-copy strong { font-family: var(--serif); font-size: 1.12rem; font-weight: 600; }
.research-door-copy small { color: var(--muted); font-size: .86rem; }
.research-door-arrow { color: var(--accent); font-size: 1.15rem; padding-right: 4px; }

.section-rule {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 0 0 8px;
}
.section-rule::before {
  content: "";
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  transform: rotate(45deg) scale(.58);
  border: 2px solid var(--gold);
  box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 5px var(--lapis);
}
.section-rule .eyebrow { margin: 0; }
.section-rule h2 { margin: 0; font-size: 1.42rem; }
.task-panel { border-top: 2px solid var(--ink-soft) !important; }
.secondary-panel { color: var(--ink-soft); }

/* ---------- 研读场次进度 ---------- */
.progress-cell { min-width: 128px; }
.mini-progress,
.progress-track {
  display: block;
  overflow: hidden;
  background: var(--line-soft);
  border-radius: 999px;
}
.mini-progress { width: 76px; height: 5px; margin: 5px 0 2px; }
.mini-progress > span,
.progress-track > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.progress-summary { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.progress-number { display: flex; align-items: baseline; gap: 12px; margin: 0; }
.progress-number strong { color: var(--accent); font-family: var(--serif); font-size: 2rem; line-height: 1; }
.progress-number span,
.progress-breakdown { color: var(--muted); font-size: .88rem; }
.progress-breakdown { margin: 0; }
.progress-track { height: 9px; margin-top: 16px; }

.site-nav a { padding: 4px 0; }

/* ---------- 编号步骤（上手指引） ---------- */

/* 步骤列表用有序列表的语义，序号单独占一列。
   序号用 .step-no 显示而不是 list-style，是为了让长段落在窄屏
   折行时文字对齐在序号右侧，而不是绕到序号下面。 */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
}
.step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--line-soft);
}
.step:first-child { border-top: 0; padding-top: 4px; }
.step-no {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: .95rem;
}
.step-body h3 { margin: 4px 0 6px; font-size: 1.02rem; }
.step-body p { margin: 0 0 .6rem; }
.step-hint {
  color: var(--muted);
  font-size: .88rem;
  border-left: 2px solid var(--line);
  padding-left: 10px;
}

/* ---------- 术语表 ---------- */

.terms {
  margin: 8px 0 0;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 18px;
}
.terms dt { font-weight: 600; }
.terms dd { margin: 0; color: var(--ink-soft); }
@media (max-width: 640px) {
  .terms { grid-template-columns: 1fr; gap: 2px; }
  .terms dd { margin-bottom: 10px; }
}

/* 键盘按键。上手指引里要提到 Ctrl+S 这类组合键，
   用等宽字体加描边，与正文区分开。 */
kbd {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: .86em;
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
}

/* ---------- 响应式：三档 ---------- */

/* 中屏（13 英寸笔记本竖屏、平板横屏）：收紧内边距，网格由三列降两列。 */
@media (max-width: 1024px) {
  .wrap { padding: 0 20px; }
  .entries { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entries-stack { grid-template-columns: 1fr; }
  .nav-more { margin-left: 0; }
  .nav-admin { margin-left: auto; }
}

/* 窄屏（平板竖屏、手机横屏）。 */
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  body { font-size: 15px; }
  h1 { font-size: 1.5rem; }
  .entries { grid-template-columns: 1fr; }
  .hero-home { padding: 14px 0 32px; }
  .login-layout { grid-template-columns: 1fr; margin-top: 0; }
  .login-intro { padding: 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .login-intro h1 { max-width: none; }
  .app-header-top { align-items: flex-start; flex-direction: column; gap: 10px; }
  .account-strip { justify-content: flex-start; }
  .app-nav {
    padding-top: 7px;
    padding-bottom: 7px;
    min-height: 54px;
    overflow: visible;
    flex-wrap: wrap;
  }
  .catalogue-gateway { grid-template-columns: 1fr; gap: 20px; padding: 28px 24px 24px; }
  .catalogue-browse { grid-column: 1; }
  .nav-key,
  .nav-more summary { min-height: 36px; padding: 6px 10px; font-size: .9rem; }
  .nav-more { position: static; margin-left: 0; }
  .nav-more-menu { left: 16px; right: 16px; top: 100%; min-width: 0; }
  .progress-summary { align-items: flex-start; flex-direction: column; gap: 8px; }
  .page-actions { flex-direction: column; align-items: stretch; }
  .page-actions .btn,
  .page-actions .btn-quiet,
  .page-actions .btn-danger { width: 100%; }
}

/* 手机竖屏。表格一律进滚动容器；按钮铺满；文本框字号锁在 16px，
   因为 iOS Safari 在小于 16px 的输入框上会自动放大整页。 */
@media (max-width: 560px) {
  .wrap { padding: 0 14px; }
  main.wrap { padding-top: 28px; padding-bottom: 44px; }
  .panel { padding: 18px; }
  .table { font-size: .88rem; }
  .table th, .table td { padding: 6px 8px; }
  .table td:first-child { white-space: normal; }
  .field input,
  .field select,
  .field textarea,
  .stack-form input,
  .stack-form select,
  .stack-form textarea,
  .search-form input[type="search"],
  .search-form input[type="text"],
  .search-form select {
    font-size: 16px;
  }
  /* 窄屏一律单列：每组「标签 + 控件」各占一行，自然换行且仍可操作。
     .search-form 的 flex-wrap 已提到基础规则，这里只把每组压成整行。 */
  .search-field { flex-basis: 100%; }
  .header-inner { padding-top: 12px; padding-bottom: 12px; }
  .app-brand { display: block; }
  .account-strip .who { flex-basis: 100%; }
  .catalogue-search-row { flex-direction: column; gap: 8px; }
  .catalogue-search-row input { border-right: 1px solid var(--lapis); }
  .catalogue-search-row .btn { width: 100%; }
  .research-door { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .hero-actions .btn { width: 100%; }
  .progress-number { align-items: flex-start; flex-direction: column; gap: 4px; }
}

/* 触屏设备：把热区再抬一档。检测的是输入方式而不是屏宽，
   因为触摸屏笔记本也需要大一点的按钮。 */
@media (hover: none) and (pointer: coarse) {
  .btn,
  .btn-quiet,
  .btn-danger { min-height: 48px; }
  .site-nav a,
  .link-btn { padding: 6px 2px; }
  .table th, .table td { padding: 10px; }
}

/* 大屏投影。投影时观众离得远，字号与行距都要抬一档，
   同时把正文列宽收回来，免得一行横跨整个幕布。 */
@media (min-width: 1440px) {
  body { font-size: 17px; }
  .prose,
  .lede,
  .measure { max-width: 44em; }
}

/* 打印。读书班常有人把清单打出来对，白底黑字去掉交互物。 */
@media print {
  .site-nav,
  .app-header,
  .site-footer,
  .page-actions,
  .skip-link,
  .wb-actions,
  .reader-toolbar { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .panel { border-color: #999; break-inside: avoid; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; color: #555; }
}

/* 尊重系统的「减少动态效果」设置。本平台几乎没有动画，
   但把过渡关掉是零成本的正确做法。 */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
