/* =====================================================================
   Hyper-Space — Wolfram Mathematica 风格主题
   设计语言：标志性 Wolfram 红、干净白底、克制而有结构的留白、
   红色分隔规、左红边引导块、舒适的阅读栏宽与字号。
   ===================================================================== */

:root {
  /* Wolfram 调色板 */
  --wolfram-red:       #d81e05;   /* 标志性红（spikey 红球） */
  --wolfram-red-dark:  #a30f00;   /* 悬停 / 深色 */
  --wolfram-red-soft:  #f4d9d4;   /* 浅红描边 */

  --ink:        #1a1a1a;          /* 正文主色 */
  --ink-soft:   #4a4a4a;          /* 次级文字 */
  --muted:      #6b7280;          /* 弱化文字 */
  --rule:       #e6e6e6;          /* 分隔线 */

  --bg:         #f6f6f7;          /* 页面底色 */
  --card:       #ffffff;          /* 内容卡片 */

  --shadow-sm:  0 1px 2px rgba(0,0,0,.05);
  --shadow-md:  0 6px 24px rgba(0,0,0,.07);
  --radius:     6px;

  /* 字体 —— 干净的人文无衬线，搭配优质中文字体 */
  --font-sans: "Segoe UI", system-ui, -apple-system, "Source Sans Pro",
               "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei",
               "Hiragino Sans GB", "Noto Sans CJK SC", sans-serif;
  --font-mono: "SFMono-Regular", "Cascadia Code", "Consolas", "Menlo",
               "Liberation Mono", monospace;

  --reading-width: 820px;         /* 舒适的阅读栏宽 */
  --fs-base: 18.5px;
  --lh-base: 1.75;
  --lh-heading: 1.28;
}

/* === 基础 === */
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  padding-top: 0;
  padding-bottom: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--wolfram-red); color: #fff; }

/* === 导航栏 —— 白底、底部红规、红色品牌标记 === */
.navbar.navbar-inverse {
  background: var(--card) !important;
  border: none;
  border-bottom: 3px solid var(--wolfram-red);
  box-shadow: var(--shadow-sm);
  min-height: 58px;
}

.navbar.navbar-inverse .navbar-brand {
  color: var(--ink) !important;
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: .01em;
  line-height: 58px;
  height: 58px;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 1.6rem;
  position: relative;
}

/* 品牌前的红色方块标记（呼应 Wolfram 红球） */
.navbar.navbar-inverse .navbar-brand::before {
  content: "";
  position: absolute;
  left: .35rem;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: .72rem;
  height: .72rem;
  background: var(--wolfram-red);
  border-radius: 1px;
}

.navbar.navbar-inverse .nav > li > a {
  color: var(--ink-soft) !important;
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 58px;
  padding-top: 0;
  padding-bottom: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -3px;
  transition: color .15s ease, border-color .15s ease;
}

.navbar.navbar-inverse .nav > li > a:hover,
.navbar.navbar-inverse .nav > li > a:focus {
  color: var(--wolfram-red) !important;
  background: transparent;
  border-bottom-color: var(--wolfram-red);
}

/* === 主容器 === */
.container { max-width: 1140px; }

body > .container {
  padding-top: 58px;   /* 让出固定导航栏高度 */
}

/* 居中阅读容器（卡片） */
.page-main {
  max-width: var(--reading-width);
  margin: 2.25rem auto 3rem;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2.75rem 3rem 3rem;
}

@media (max-width: 768px) {
  .page-main { padding: 1.5rem 1.25rem 2rem; margin: 1.25rem auto 2rem; }
  :root { --fs-base: 17px; }
}

/* === 标题 === */
h1, h2, h3, h4 {
  font-family: var(--font-sans);
  color: var(--ink);
  line-height: var(--lh-heading);
  font-weight: 700;
}

h1 {
  font-size: 2.3rem;
  margin: 0 0 .6rem;
  letter-spacing: -.01em;
}

h2 {
  font-size: 1.62rem;
  margin: 2.2rem 0 .9rem;
}

h3 {
  font-size: 1.28rem;
  margin: 1.8rem 0 .7rem;
}

/* 首页 / 区块大标题，带红色下划规 */
.home-hero { margin-bottom: 1.5rem; }

.home-hero h1 {
  font-size: 2.7rem;
  color: var(--ink);
  position: relative;
  padding-bottom: .65rem;
}
.home-hero h1::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 64px; height: 4px;
  background: var(--wolfram-red);
  border-radius: 2px;
}

.section-title {
  position: relative;
  padding-left: .85rem;
  border-left: 4px solid var(--wolfram-red);
}

.lead {
  color: var(--muted);
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

/* === 引导块（替代 Bootstrap well）=== */
.callout,
.well {
  background: #fbfbfc !important;
  border: 1px solid var(--rule) !important;
  border-left: 4px solid var(--wolfram-red) !important;
  border-radius: var(--radius) !important;
  box-shadow: none !important;
  padding: 1.1rem 1.35rem;
  margin: 1.5rem 0;
  font-size: 1.04rem;
  line-height: var(--lh-base);
  color: var(--ink-soft);
}

.callout p, .well p { margin-bottom: .5rem; }
.callout p:last-child, .well p:last-child { margin-bottom: 0; }

.well h1 {
  color: var(--wolfram-red);
  font-size: 1.35rem;
  margin: .2rem 0 .6rem;
}
.well ul { margin-bottom: 1rem; }

/* === 文章列表（首页）=== */
.post-list { margin-top: 1rem; }

.post-list li {
  display: flex;
  align-items: baseline;
  gap: .9rem;
  padding: .65rem .5rem;
  border-bottom: 1px solid var(--rule);
  transition: background .15s ease, padding-left .15s ease;
}
.post-list li:last-child { border-bottom: none; }
.post-list li:hover {
  background: #fbf2f0;
  border-radius: 4px;
  padding-left: .85rem;
}

.post-date {
  flex: 0 0 auto;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: .92rem;
  font-variant-numeric: tabular-nums;
}

.post-list a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}
.post-list li:hover a { color: var(--wolfram-red); }

/* 通用列表（archives / categories 等） */
.list-unstyled a { color: var(--wolfram-red); text-decoration: none; }
.list-unstyled a:hover { text-decoration: underline; }

/* === 文章页 === */
.post header h1 {
  font-size: 2.4rem;
  margin-bottom: .3rem;
}
.post header .text-muted {
  color: var(--muted);
  font-size: .98rem;
  margin-bottom: 2rem;
  font-family: var(--font-mono);
}

.post-content { font-size: 1.04rem; margin-bottom: 2rem; }

.post-content h2 {
  font-size: 1.55rem;
  margin-top: 2rem;
  margin-bottom: .7rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--rule);
}
.post-content h3 { font-size: 1.25rem; }

.post-content p { margin-bottom: 1.15rem; }
.post-content p:last-child { margin-bottom: 0; }

.post-content ul, .post-content ol { margin-bottom: 1.15rem; }
.post-content li { margin-bottom: .35rem; }

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin: 1rem 0;
}

.post-content blockquote {
  border-left: 4px solid var(--wolfram-red-soft);
  background: #fbfbfc;
  color: var(--ink-soft);
  padding: .6rem 1.2rem;
  margin: 1.25rem 0;
  font-size: 1.02rem;
}

.post-content table {
  border-collapse: collapse;
  margin: 1.25rem 0;
  width: 100%;
}
.post-content th, .post-content td {
  border: 1px solid var(--rule);
  padding: .5rem .75rem;
}
.post-content thead th {
  background: #faf3f2;
  color: var(--ink);
  border-bottom: 2px solid var(--wolfram-red);
}

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.25rem;
  margin-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 1.02rem;
}
.post-nav a { color: var(--wolfram-red); text-decoration: none; }
.post-nav a:hover { text-decoration: underline; }
.post-nav .float-right { margin-left: auto; text-align: right; }

/* === 通用链接 === */
a { color: var(--wolfram-red); transition: color .15s ease; }
a:hover, a:focus { color: var(--wolfram-red-dark); }

/* 正文内链接：优雅的下划线 */
.post-content a:not(.btn) {
  text-decoration: underline;
  text-decoration-color: var(--wolfram-red-soft);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.post-content a:not(.btn):hover {
  text-decoration-color: var(--wolfram-red);
}

/* 键盘可达的焦点态 */
a:focus-visible,
.navbar .nav > li > a:focus-visible {
  outline: 2px solid var(--wolfram-red);
  outline-offset: 2px;
  border-radius: 2px;
}

/* === 分隔线 === */
hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2rem 0;
}

/* === 行内代码 === */
code {
  background: #f4f2f2;
  color: var(--wolfram-red-dark);
  font-family: var(--font-mono);
  font-size: .9em;
  padding: .15em .42em;
  border-radius: 4px;
}

/* === 代码块 —— Mathematica notebook 输入单元风格 ===
   浅色单元 + 右侧标志性 cell bracket「]」 */
pre,
.highlight > pre,
figure.highlight pre {
  position: relative;
  background: #fcfcfc;
  color: #1a1a1a;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: .9rem 2rem .9rem 1.1rem;   /* 右侧留出 bracket 空间 */
  margin: 1.3rem 0;
  overflow-x: auto;
  line-height: 1.62;
  font-family: var(--font-mono);
  font-size: .9rem;
  -webkit-overflow-scrolling: touch;
}

/* Mathematica cell bracket（右侧的「]」形）*/
pre::after,
.highlight > pre::after,
figure.highlight pre::after {
  content: "";
  position: absolute;
  top: 7px;
  bottom: 7px;
  right: 7px;
  width: 7px;
  border: 1.5px solid #b0b0b0;
  border-left: none;
  pointer-events: none;
}

pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: 1em;
  border-radius: 0;
}

/* rouge 语法高亮容器去掉默认底色，交给上面的单元样式 */
.highlight, figure.highlight { background: transparent; margin: 0; }

/* 轻量 Wolfram Language 配色（rouge token） */
.highlight .k, .highlight .kt { color: var(--wolfram-red-dark); }   /* 关键字 */
.highlight .s, .highlight .s1, .highlight .s2 { color: #2e7d32; }   /* 字符串 */
.highlight .c, .highlight .c1, .highlight .cm { color: #999; font-style: italic; } /* 注释 */
.highlight .mi, .highlight .mf { color: #1565c0; }                  /* 数字 */
.highlight .nf { color: #6a1b9a; }                                  /* 函数名 */

/* === 页脚 === */
footer {
  max-width: var(--reading-width);
  margin: 0 auto 2.5rem !important;
  padding: 1.5rem 1rem !important;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: .95rem;
  text-align: center;
}
footer a { color: var(--wolfram-red); }
footer a:hover { color: var(--wolfram-red-dark); }

/* === 心经[Colored] 排版（保留）=== */
.post-content .xinjing-colored { text-align: center; margin: 1.5rem 0; }
.post-content .xinjing-colored .xinjing-title {
  font-size: 2rem; color: var(--wolfram-red); margin-bottom: 1.5rem; font-weight: 700;
}
.post-content .xinjing-colored .xinjing-table-wrap {
  overflow-x: auto; margin: 1rem 0; -webkit-overflow-scrolling: touch; text-align: center;
}
.post-content .xinjing-colored table.xinjing-table { margin: 0 auto; border-collapse: collapse; }
.post-content .xinjing-colored table.xinjing-table td { padding: .2em .3em; min-width: 1.5em; border: none; }

/* === 兼容旧 sidebar / 其他 === */
.copyright { color: var(--muted); }
.footer { text-align: center; }
.footer a { color: var(--wolfram-red); }
.sidebar h1 { color: var(--wolfram-red); font-size: 1.3em; }
.sidebar a { color: var(--wolfram-red); }
.sidebar li { margin-top: .7em; line-height: 1.4em; }
.sidebar a:hover { color: var(--wolfram-red-dark); }
.container-left { margin: 0; }
.author, .author a { color: var(--wolfram-red); }
