/* Bi-weekly AI 小课堂 —— 全站唯一样式表（v3）
   风格：纸面极简。单色墨水 + 发丝线，衬线正文，
   无卡片、无彩色标签、无 JS。布局用 CSS Grid。
   注意：/assets/ 有 30 天 CDN 缓存，修改请递增文件名版本。
   v3：新增首页 CVE 滚动列表样式。 */

:root {
  --ink: #1f1f1c;
  --ink-soft: #54544d;
  --ink-faint: #8b8b82;
  --paper: #fcfcfa;
  --wash: #f4f4ef;
  --line: #e5e5de;
  --line-strong: #c8c8bf;
  --link: #2f4f7e;
  --link-hover: #1a3763;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0 auto;
  padding: 2.5em 1.6em 4em;
  max-width: 64em;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Times New Roman", "Songti SC", "STSong", "SimSun", serif;
  font-size: 1.0625em;
  line-height: 1.75;
  color: var(--ink);
  background: var(--paper);
}

::selection {
  background: #e8e6da;
}

/* ---------- 链接 ---------- */

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--link) 45%, transparent);
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover {
  color: var(--link-hover);
  text-decoration-color: var(--link-hover);
}

a:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

/* ---------- 页眉 ---------- */

header.site-header {
  border-bottom: 2px solid var(--ink);
  padding-bottom: 1em;
  margin-bottom: 1.8em;
}

header.site-header h1 {
  font-size: 1.7em;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 0.25em;
  letter-spacing: 0.01em;
}

header.site-header p.site-subtitle {
  margin: 0;
  font-size: 0.82em;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}

/* ---------- 导航 ---------- */

/* 窄屏（手机）默认布局：纵向流，导航是上下发丝线夹住的横向链接栏 */
nav.site-nav {
  margin: 0 0 2em;
  padding: 0.55em 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

nav.site-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

nav.site-nav li {
  display: inline;
  margin-right: 1.4em;
  white-space: nowrap;
  line-height: 2;
}

nav.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

nav.site-nav a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

nav.site-nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  border-bottom: 1px solid var(--ink);
}

nav.site-nav .nav-note {
  color: var(--ink-faint);
  font-size: 0.85em;
}

/* ---------- 正文标题 ---------- */

main h2 {
  font-size: 1.22em;
  font-weight: 600;
  margin: 2.2em 0 0.6em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--line-strong);
  letter-spacing: 0.02em;
}

main h3 {
  font-size: 1.02em;
  font-weight: 600;
  margin: 1.6em 0 0.4em;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

main p {
  margin: 0.7em 0;
}

/* ---------- 下一讲（首页焦点块） ---------- */

section.next-lecture {
  margin: 0 0 0.5em;
  padding: 0.2em 0 0.2em 1.2em;
  border-left: 2px solid var(--ink);
}

section.next-lecture h2 {
  border-bottom: none;
  margin: 0.4em 0 0.6em;
  padding-bottom: 0;
}

/* ---------- 状态文字：保持行内纯文字，仅字重与灰度区分 ---------- */

.status {
  font-size: 0.85em;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  white-space: nowrap;
}

.status-next {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- 表格：学术横线式（booktabs），无竖线 ---------- */

.table-scroll {
  overflow-x: auto;
  margin: 1em 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9em;
  line-height: 1.6;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}

th, td {
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 0.55em 0.8em;
  text-align: left;
  vertical-align: top;
}

thead th {
  border-bottom: 1px solid var(--ink);
  font-size: 0.82em;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
  background: none;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: var(--wash);
}

td time, time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- 列表 ---------- */

ul, ol {
  padding-left: 1.5em;
}

li {
  margin-bottom: 0.2em;
}

ul.link-list {
  padding-left: 1.3em;
}

ul.link-list li {
  margin-bottom: 0.9em;
}

/* 条目的补充说明：次级灰 */
.entry-desc {
  font-size: 0.88em;
  color: var(--ink-soft);
}

p.entry-desc {
  margin: 0.5em 0;
}

/* ---------- 代码 ---------- */

code {
  font-family: "SF Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: 0.86em;
  background: var(--wash);
  padding: 0.1em 0.35em;
  border-radius: 2px;
}

a code {
  background: none;
  padding: 0;
}

/* ---------- CVE 滚动列表（首页底部，数据每日自动更新） ---------- */

/* 标题行：左侧区块名，右侧 "CVSS Severity" 栏目标签（仿 NVD 版式） */
h2.cve-feed-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1em;
}

h2.cve-feed-title .cve-severity-label {
  font-size: 0.62em;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  white-space: nowrap;
}

/* 滚动框本体：限高 + 内部纵向滚动，纯 CSS 无 JS */
.cve-feed {
  max-height: 26em;
  overflow-y: auto;
  border: 1px solid var(--line);
  padding: 0.2em 1em;
  font-size: 0.9em;
  line-height: 1.65;
}

.cve-entry {
  padding: 0.7em 0;
  border-bottom: 1px solid var(--line);
}

.cve-entry:last-child {
  border-bottom: none;
}

/* 分数：右浮动纯文字徽章（不用彩色，守全站单色原则） */
.cve-entry .cve-score {
  float: right;
  margin-left: 1em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 0.85em;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.cve-entry .cve-published {
  margin-top: 0.15em;
  font-size: 0.82em;
  color: var(--ink-faint);
}

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

footer.site-footer {
  margin-top: 4em;
  padding-top: 0.8em;
  border-top: 1px solid var(--line);
  font-size: 0.8em;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
}

footer.site-footer a {
  color: var(--ink-soft);
}

/* ---------- 宽屏：左侧边栏导航 + 右侧内容 ---------- */

@media (min-width: 44em) {
  body {
    display: grid;
    grid-template-columns: 13.5em 1fr;
    grid-template-areas:
      "header header"
      "nav main"
      "footer footer";
    column-gap: 3.5em;
  }

  header.site-header { grid-area: header; }

  nav.site-nav {
    grid-area: nav;
    margin: 0;
    padding: 0.2em 1em 0 0;
    border-top: none;
    border-bottom: none;
    border-right: 1px solid var(--line);
    align-self: start;
    position: sticky;
    top: 2em;
  }

  nav.site-nav li {
    display: block;
    margin: 0 0 0.55em;
    line-height: 1.7;
    white-space: normal;
  }

  nav.site-nav .nav-note {
    display: block;
    margin-top: 0.1em;
  }

  main {
    grid-area: main;
    min-width: 0; /* 让表格横滚在网格内正常工作 */
    max-width: 42em;
  }

  footer.site-footer { grid-area: footer; }

  /* 内容区与侧栏顶对齐 */
  main > :first-child,
  main > section:first-child > h2:first-child,
  main > section:first-child.next-lecture > h2:first-child {
    margin-top: 0;
  }
}

/* ---------- 窄屏微调 ---------- */

@media (max-width: 44em) {
  body {
    padding: 1.4em 1.1em 3em;
    font-size: 1em;
  }

  header.site-header {
    margin-bottom: 1.2em;
  }

  header.site-header h1 {
    font-size: 1.35em;
  }

  main h2 {
    margin-top: 1.9em;
  }
}

/* ---------- 打印 ---------- */

@media print {
  body {
    max-width: none;
    padding: 0;
    font-size: 11pt;
  }

  nav.site-nav {
    display: none;
  }

  a {
    color: var(--ink);
  }
}
