/* =========================================================
   Longview Archive / 观势档案
   MkDocs Material - Publishing System 2.0 Clean
   ========================================================= */


/* =========================================================
   0. Global Variables
   ========================================================= */

:root {
  --lv-bg: #f8f8f5;
  --lv-paper: #ffffff;
  --lv-text: #242424;
  --lv-muted: #6f6f6f;
  --lv-faint: #a8a8a8;
  --lv-line: rgba(0, 0, 0, 0.08);
  --lv-line-strong: rgba(0, 0, 0, 0.16);

  --lv-accent: #546f78;
  --lv-accent-dark: #38545e;
  --lv-accent-soft: rgba(84, 111, 120, 0.10);

  /* 全局布局核心参数 */
  --lv-sidebar-width: 24rem;
  --lv-content-width: 780px;
  --lv-grid-width: 104rem;
  --lv-content-left-gap: 2.8rem;
}


/* =========================================================
   1. Base: publication feeling
   ========================================================= */

html {
  font-size: 15px;
  background: var(--lv-bg);
}

body {
  background: var(--lv-bg);
  color: var(--lv-text);
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.md-main {
  background: var(--lv-bg);
}

.md-content {
  background: var(--lv-bg);
}

.md-grid {
  max-width: var(--lv-grid-width);
}


/* =========================================================
   2. Header: minimal publishing bar
   ========================================================= */

.md-header {
  background: var(--lv-accent);
  box-shadow: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  height: 3rem;
}

.md-header__inner {
  min-height: 3rem;
}

.md-header__title {
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 0.92rem;
}

.md-header__button.md-logo {
  margin-right: 0.4rem;
}

.md-search__form {
  background-color: rgba(0, 0, 0, 0.20);
  border-radius: 2px;
  height: 2.1rem;
}

.md-search__input {
  font-size: 0.82rem;
}

.md-search__input::placeholder {
  color: rgba(255, 255, 255, 0.68);
}


/* =========================================================
   3. Main Layout: content breathing space
   ========================================================= */

@media screen and (min-width: 76.25em) {
  .md-content {
    padding-left: var(--lv-content-left-gap);
  }
}

.md-content__inner {
  max-width: var(--lv-content-width);
  margin-left: 0;
  margin-right: auto;
  padding-top: 2.2rem;
  padding-bottom: 5rem;
}


/* =========================================================
   4. Sidebar Layout: real visible width control
   ========================================================= */

@media screen and (min-width: 76.25em) {
  .md-sidebar--primary {
    width: var(--lv-sidebar-width) !important;
    min-width: var(--lv-sidebar-width) !important;
    max-width: var(--lv-sidebar-width) !important;
    flex: 0 0 var(--lv-sidebar-width) !important;
  }

  .md-sidebar--primary .md-sidebar__inner {
    width: var(--lv-sidebar-width) !important;
    min-width: var(--lv-sidebar-width) !important;
    max-width: var(--lv-sidebar-width) !important;
  }

  .md-sidebar--primary .md-sidebar__scrollwrap {
    width: 100% !important;
    max-width: none !important;
    margin: 0;
    padding-top: 2.2rem;
    padding-right: 0.4rem;
    overflow-x: hidden;
  }

  .md-sidebar--primary .md-nav,
  .md-sidebar--primary .md-nav__list,
  .md-sidebar--primary .md-nav__item {
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box;
  }
}

.md-sidebar__scrollwrap {
  scrollbar-width: thin;
}


/* =========================================================
   5. Left Navigation: full-width thought tree
   ========================================================= */

.md-nav {
  font-size: 0.82rem;
  line-height: 1.45;
}

/* 关键：让 Material 的真实文字容器吃满宽度 */
.md-sidebar--primary .md-ellipsis {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 链接本体必须是 flex，否则箭头和文字宽度会异常 */
.md-sidebar--primary .md-nav__link,
.md-sidebar--primary .md-nav__title {
  display: flex !important;
  align-items: center;
  width: 100% !important;
  max-width: none !important;
  min-width: 0;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 普通导航项 */
.md-nav__link {
  color: #383838;
  padding-top: 0.42rem;
  padding-bottom: 0.42rem;
  padding-left: 0.45rem;
  padding-right: 0.25rem;
  border-radius: 0;
  font-variant-numeric: tabular-nums;
  transition:
    color 0.15s ease,
    background-color 0.15s ease,
    border-color 0.15s ease;
}

.md-nav__link:hover {
  color: var(--lv-accent-dark);
  background-color: var(--lv-accent-soft);
}

.md-nav__title {
  font-size: 0.84rem;
  font-weight: 600;
  color: #333;
  padding-top: 0.4rem;
  padding-bottom: 0.7rem;
}

/* 顶层 section */
.md-nav__item--section {
  margin-top: 0.55rem;
}

.md-nav__item--section > .md-nav__link {
  font-weight: 650;
  color: #6b6b6b;
  letter-spacing: 0.015em;
  margin-top: 0.55rem;
}

/* 树线：缩小缩进，给文字更多空间 */
.md-sidebar--primary .md-nav__item .md-nav {
  border-left: 1px solid var(--lv-line);
  margin-left: 0.25rem;
  padding-left: 0.25rem;
}

/* 第二层缩进：从 1rem 压到 0.7rem */
.md-sidebar--primary .md-nav__item .md-nav .md-nav__link {
  padding-left: 0.7rem;
}

/* 第三层缩进：从 1.65rem 压到 1.05rem */
.md-sidebar--primary .md-nav__item .md-nav .md-nav .md-nav__link {
  padding-left: 1.05rem;
  font-size: 0.79rem;
  color: #555;
}

/* 当前激活项 */
.md-nav__item .md-nav__link--active,
.md-nav__item--active > .md-nav__link {
  color: var(--lv-accent-dark);
  font-weight: 700;
  background: transparent;
  border-left: 3px solid var(--lv-accent-dark);
  padding-left: 0.65rem;
}

.md-nav__link--active {
  position: relative;
}

.md-nav__link--active:hover {
  background: transparent;
}

.md-nav__icon {
  color: var(--lv-faint);
  flex: 0 0 auto;
}

/* =========================================================
   6. Breadcrumbs: archival feeling
   ========================================================= */

.md-path {
  font-size: 0.72rem;
  color: var(--lv-muted);
  margin-bottom: 1.6rem;
}

.md-path__link {
  color: var(--lv-muted);
}

.md-path__link:hover {
  color: var(--lv-accent-dark);
}


/* =========================================================
   7. Typography: paper / essay mode
   ========================================================= */

.md-typeset {
  color: var(--lv-text);
  font-size: 0.92rem;
  line-height: 1.82;
}

.md-typeset p {
  margin: 0.85rem 0;
  line-height: 1.86;
  letter-spacing: 0.01em;
}

.md-typeset h1 {
  font-size: 2.15rem;
  line-height: 1.18;
  font-weight: 720;
  letter-spacing: 0.01em;
  color: #5e5e5e;
  margin-top: 0;
  margin-bottom: 1.65rem;
}

.md-typeset h2 {
  font-size: 1.35rem;
  line-height: 1.35;
  font-weight: 700;
  margin-top: 2.8rem;
  margin-bottom: 1rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--lv-line);
  color: #343434;
}

.md-typeset h3 {
  font-size: 1.08rem;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: #333;
}

.md-typeset h4 {
  font-size: 0.96rem;
  font-weight: 700;
  color: #444;
  margin-top: 1.6rem;
}

.md-typeset .headerlink {
  color: var(--lv-faint);
}

.md-typeset strong {
  font-weight: 700;
  color: #161616;
}

.md-typeset a {
  color: var(--lv-accent-dark);
  text-decoration: none;
  border-bottom: 1px solid rgba(56, 84, 94, 0.25);
}

.md-typeset a:hover {
  border-bottom-color: var(--lv-accent-dark);
}

.md-typeset h1:first-of-type {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.md-typeset h1:first-of-type::after {
  content: "";
}


/* =========================================================
   8. Blockquotes: doctrine / thesis blocks
   ========================================================= */

.md-typeset blockquote {
  margin: 1.4rem 0;
  padding: 0.9rem 1.1rem;
  color: #333;
  border-left: 3px solid var(--lv-accent);
  background: rgba(84, 111, 120, 0.055);
}

.md-typeset blockquote p {
  margin: 0.45rem 0;
}


/* =========================================================
   9. Lists: controlled density
   ========================================================= */

.md-typeset ul,
.md-typeset ol {
  margin-top: 0.65rem;
  margin-bottom: 0.9rem;
}

.md-typeset li {
  margin-bottom: 0.28rem;
}

.md-typeset li p {
  margin: 0.35rem 0;
}


/* =========================================================
   10. Tables: clean archive style
   ========================================================= */

.md-typeset table:not([class]) {
  font-size: 0.82rem;
  border: 1px solid var(--lv-line);
}

.md-typeset table:not([class]) th {
  background: rgba(0, 0, 0, 0.035);
  font-weight: 700;
}

.md-typeset table:not([class]) td,
.md-typeset table:not([class]) th {
  border-color: var(--lv-line);
}


/* =========================================================
   11. Code: low-noise
   ========================================================= */

.md-typeset code {
  font-size: 0.82em;
  background: rgba(0, 0, 0, 0.045);
  color: #333;
  border-radius: 2px;
}

.md-typeset pre {
  background: #f1f1ee;
  border: 1px solid var(--lv-line);
}

.md-typeset pre code {
  background: transparent;
}


/* =========================================================
   12. Right TOC: reduce noise
   ========================================================= */

.md-sidebar--secondary {
  font-size: 0.76rem;
}

@media screen and (min-width: 76.25em) {
  .md-sidebar--secondary {
    margin-left: 2rem;
  }
}

.md-sidebar--secondary .md-nav__title {
  font-size: 0.76rem;
  color: var(--lv-muted);
  font-weight: 600;
}

.md-sidebar--secondary .md-nav__link {
  color: var(--lv-muted);
  padding-top: 0.32rem;
  padding-bottom: 0.32rem;
}

.md-sidebar--secondary .md-nav__link--active {
  color: var(--lv-accent-dark);
  border-left: 2px solid var(--lv-accent-dark);
}


/* =========================================================
   13. Footer: quiet
   ========================================================= */

.md-footer {
  background: #141414;
}

.md-footer-meta {
  background: #111;
}

.md-footer-meta__inner {
  font-size: 0.72rem;
}


/* =========================================================
   14. Admonitions: essay note style
   ========================================================= */

.md-typeset .admonition,
.md-typeset details {
  font-size: 0.86rem;
  border: 1px solid var(--lv-line);
  box-shadow: none;
  background: #fbfbf8;
}

.md-typeset .admonition-title,
.md-typeset summary {
  font-weight: 700;
}


/* =========================================================
   15. Mobile tuning
   ========================================================= */

@media screen and (max-width: 76.1875em) {
  .md-sidebar--primary {
    width: 15rem;
  }

  .md-content {
    padding-left: 0;
  }

  .md-content__inner {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .md-typeset h1 {
    font-size: 1.75rem;
  }
}

@media screen and (max-width: 44.984375em) {
  html {
    font-size: 14px;
  }

  .md-typeset {
    font-size: 0.95rem;
  }

  .md-typeset h1 {
    font-size: 1.55rem;
  }

  .md-header__title {
    font-size: 0.84rem;
  }
}

/* =========================================================
   Longview Archive - Sidebar Sticky Title Fix
   Disable sticky nav section headers
   ========================================================= */

/* 关闭左侧导航标题吸顶 */
.md-sidebar--primary .md-nav__title {
  position: static !important;
  top: auto !important;
  z-index: auto !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* 关闭嵌套导航标题吸顶 */
.md-sidebar--primary .md-nav .md-nav__title {
  position: static !important;
  top: auto !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* 防止滚动时标题变成白色浮层 */
.md-sidebar--primary .md-nav__title[for] {
  position: static !important;
  background: transparent !important;
}

/* 去掉左侧导航标题浮动卡片感 */
.md-sidebar--primary .md-nav__title {
  box-shadow: none !important;
  border: none !important;
}
