/* Beautified MKDocs extra.css
   Improvements:
   - Cleaner color scale / variables
   - Refined header, sidebar, search
   - Better typography and spacing
   - Enhanced code blocks, tables, admonitions
   - Improved accessibility and mobile behavior
*/

/* ---------- Theme Variables ---------- */
:root{
  --md-hue: 225deg;

  /* Primary / Accent */
  --primary-500: hsl(224,76%,48%);
  --primary-400: hsl(231,44%,56%);
  --primary-600: hsl(231,48%,38%);
  --accent-soft: hsla(231,99%,66%,0.08);

  /* Neutral */
  --bg-100: #ffffff;
  --bg-200: hsl(220,14%,96%);
  --fg-900: #111827;
  --muted-600: hsla(220,9%,46%,1);
  --stroke: #e5e7eb;

  /* Code */
  --code-bg: hsl(220,14%,96%);
  --code-fg: hsl(221,39%,11%);

  /* Shadows */
  --shadow-sm: 0 4px 10px rgba(16,24,40,0.05);
  --shadow-md: 0 8px 20px rgba(16,24,40,0.08);
}

/* Global font */
:root > * {
  font-family: Inter, "PingFang SC", system-ui, -apple-system, "Segoe UI",
  Roboto, "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
}

/* ---------- Header ---------- */
.md-header{
  background: var(--bg-100);
  border-bottom: 1px solid var(--stroke);
}
.md-header__button.md-logo img{
  width: 150px;
  height: 32px;
  object-fit: contain;
}
.md-header__topic:first-child{
  font-weight: 600;
}

/* Search */
.md-search__form{
  border-radius: 8px;
  border: 1px solid #e6e9ef;
  background: var(--bg-100) !important;
}
.md-search__input + .md-search__icon{
  color: var(--muted-600);
}
.md-search__form:focus-within{
  box-shadow: 0 0 0 6px rgba(34, 78, 255, 0.06);
}
.md-search__input::placeholder{
  color: rgba(34,34,34,0.35);
}
.md-header--shadow{
  box-shadow: none;
  border-bottom: 1px solid var(--stroke);
}

/* ---------- Layout ---------- */
.md-grid{
  max-width: 1800px;   /* ← 页面整体宽度 */
  margin: 0 auto;
}
.md-main__inner{ margin-top: 0; }
.md-sidebar--primary{ border-right: 1px solid var(--stroke); }
.md-footer{ display: none; }

/* ---------- Typography ---------- */
.md-typeset{
  max-width: 1280px;     /* ← 黄金宽度 */
  margin: 0 auto;        /* 内容居中 */
  line-height: 1.75;
  font-size: 16px;
  letter-spacing: 0.2px;
  color: var(--fg-900);
}

.md-typeset h1{
  font-size: 32px;
  line-height: 1.5;
  font-weight: 700;
  margin: 0.6em 0 0.4em;
}
.md-typeset h2{
  font-size: 24px;
  font-weight: 600;
  margin: 1.2em 0 0.6em;
  padding-top: 0.8em;
  border-top: 1px solid rgba(228,232,240,0.9);
}
.md-typeset h3{
  font-size: 20px;
  font-weight: 600;
  margin: 1em 0 0.5em;
}
.md-typeset h4{
  font-size: 16px;
  font-weight: 600;
  margin: 0.8em 0 0.4em;
}

.md-content{
  padding: 0 28px 36px;
}
.md-content__inner{
  margin: 0 18px !important;
  padding-top: 24px !important;
}
.md-content__inner a{
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Figures */
.md-typeset figure{
  margin: 1.25em 0;
  text-align: center;
}
.md-typeset figure img{
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.06);
}
.md-typeset figcaption{
  color: rgba(34,34,34,0.55);
  font-size: .95em;
  margin-top: .5em;
}

/* Lists */
.md-typeset ul, .md-typeset ol{
  padding-left: 1.25em;
}
.md-typeset li{ margin: 0.35em 0; }
.md-typeset ul ul{ list-style: circle; margin-left: 1.5em; }
.md-typeset ul ul ul{ list-style: square; }

/* Blockquote */
.md-typeset blockquote{
  border-left: 4px solid rgba(99,102,241,0.18);
  background: var(--code-bg);
  padding: .75em 1em;
  margin: 1em 0;
  border-radius: 8px;
}

/* ---------- Code ---------- */
.md-typeset code{
  padding: .15em .35em;
  border-radius: 6px;
  background: rgba(14,22,33,0.02);
}

.md-typeset pre > code{
  display: block;
  padding: 1em 1.1em;
  border-radius: 12px;
  line-height: 1.6;
  overflow: auto;
  background: var(--code-bg);
  box-shadow: var(--shadow-sm);
}

.md-typeset pre{
  position: relative;
}
.md-typeset pre::-webkit-scrollbar{ height: 10px; }
.md-typeset pre::-webkit-scrollbar-thumb{
  border-radius: 8px;
  background: rgba(34,34,34,0.12);
}

.md-typeset pre:after{
  content: "↔";
  position: absolute;
  right: .6em;
  bottom: .45em;
  font-size: 12px;
  opacity: .28;
}

/* Line numbers */
.highlighttable{
  border-radius: 12px;
  overflow: hidden;
}
.highlighttable td.linenos{
  background: var(--bg-200);
  color: rgba(34,34,34,0.45);
  padding-right: .6em;
  user-select: none;
}

/* ---------- Tables ---------- */
.md-typeset table:not([class]){
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.md-typeset table:not([class]) thead th{
  background: var(--bg-200);
  font-weight: 600;
  padding: .9em 1em;
}
.md-typeset table:not([class]) tbody td{
  padding: .8em 1em;
  border-right: 1px solid #e5e7eb;   /* ← 表格竖线 */
}
.md-typeset table:not([class]) tbody tr:nth-child(odd){
  background: #fbfcfe;
}
.md-typeset table:not([class]) tbody tr:hover{
  background: rgba(34,78,255,0.03);
}

/* ---------- Admonition ---------- */
.md-typeset .admonition,
.md-typeset details{
  border-radius: 12px !important;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(226,232,240,0.9);
  padding: .8em .95em;
}
.md-typeset .admonition-title,
.md-typeset summary{
  font-weight: 700;
}
.md-typeset .admonition.note{
  border-left: 5px solid var(--primary-400);
}
.md-typeset .admonition.tip{
  border-left: 5px solid hsl(143,64%,34%);
}
.md-typeset .admonition.warning{
  border-left: 5px solid hsl(38,92%,50%);
}
.md-typeset .admonition.danger{
  border-left: 5px solid hsl(0,72%,55%);
}

/* ---------- Navigation ---------- */
.md-nav__title{
  color: var(--muted-600);
  font-weight: 600;
}

.md-nav__link{
  margin-top: 10px !important;
  padding: .4em .6em;
  border-radius: 8px;
}

.md-nav--primary .md-nav__link::before{
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  vertical-align: middle;
  background-image: url('../assets/icons/workbook-fill.svg');
  background-size: contain;
  background-repeat: no-repeat;
  margin-right: .6em;
}

.md-nav--secondary{
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 110px);
  overflow: auto;
}
.md-nav--secondary .md-nav__link[aria-current="page"],
.md-nav--secondary .md-nav__link--active{
  background: var(--accent-soft);
  border-radius: 6px;
}

.md-nav__link:focus-visible,
.md-nav__link:hover{
  background: var(--bg-200);
}

/* Links */
.md-typeset a{
  color: var(--primary-500);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}
.md-typeset a:focus-visible{
  outline: 3px solid rgba(34,78,255,0.18);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Search Fix ---------- */
.md-search-result{ box-shadow: none !important; }
.md-search-result__list{
  background: #fff !important;
  z-index: 9999;
}
.md-search-result__item{
  transform: none !important;
  filter: none !important;
}

input.md-search__input,
[data-md-component="search-query"]{
  text-shadow: none !important;
  -webkit-text-stroke: 0 !important;
  filter: none !important;
  font-weight: 400 !important;
  -webkit-font-smoothing: antialiased;
}
input.md-search__input::placeholder,
[data-md-component="search-query"]::placeholder{
  text-shadow: none !important;
  -webkit-text-stroke: 0 !important;
}

.md-header .md-search__inner .md-search__suggest,
[data-md-component="search-suggest"]{
  display: none !important;
}

/* ---------- Dark Mode ---------- */
[data-md-color-scheme="slate"]{
  --bg-100: hsl(222,18%,11%);
  --fg-900: hsl(220,15%,92%);
  --code-bg: hsl(222,18%,9%);
}
[data-md-color-scheme="slate"] .md-typeset blockquote{
  background: rgba(255,255,255,0.02);
  border-left-color: rgba(255,255,255,0.08);
}

/* ---------- Print ---------- */
@media print{
  .md-header, .md-footer, .md-sidebar--primary, .md-sidebar--secondary{
    display:none !important;
  }
  .md-content{ padding:0 !important; }
  .md-typeset{ max-width:none; font-size:12pt; }
  pre{ box-shadow:none; }
  a[href^="http"]::after{
    content: " (" attr(href) ")";
    font-size:0.9em;
  }
}

/* ---------- Mobile ---------- */
@media (max-width: 900px){
  .md-grid{ padding: 0 10px; }
  .md-content{ padding: 0 16px 28px; }
  .md-nav__link::before{ display:none; }
}
