/* Match the document canvas and overscroll area; never tile a viewport-sized gradient. */
html { background: var(--ui-bg); }
body {
  margin: 0;
  height: auto;
  min-height: 100vh;
  background: var(--ui-bg);
  color: var(--ui-text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.sidebar-active { padding-left: 0; padding-right: 0; }
.column { background: transparent; }
:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: 4px; }
/* Tab controls already provide their own selected and keyboard focus states. */
.header .menu-item a,
.ui-demo-page .glass-filters .glass-item,
.ui-demo-page .tag-chip { -webkit-tap-highlight-color: transparent; }
/* Remove native tap flashes across mobile layouts and touch-only devices. */
@media (max-width: 767px), (hover: none) and (pointer: coarse) {
  *, *::before, *::after { -webkit-tap-highlight-color: transparent; }
}
::selection { background: #e6eef9; color: #25272b; }
header.header {
  --ui-header-max-width: 1160px;
  --ui-header-gutter: 48px;
  position: fixed;
  inset: 16px 0 auto;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0,1fr) 46px 46px;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  width: min(var(--ui-header-max-width), calc(100% - var(--ui-header-gutter)));
  min-height: 72px;
  margin: 0 auto;
  padding: 10px 13px 10px 24px;
  border: 1px solid var(--glass-border);
  border-radius: 26px;
  background: var(--glass-fill);
}
header.header.liquid-glass-host { background: transparent; border-color: transparent; }
.site-brand-container { display: contents; }
.site-meta { grid-column: 1; grid-row: 1; text-align: left; min-width: 0; }
.site-meta .brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0;
  border: 0;
  color: var(--ui-text);
  background: transparent;
}
.site-meta .site-title { font-size: 20px; font-weight: 750; letter-spacing: -.05em; line-height: 1.3; }
html[data-theme] .site-meta .ui-brand-mark { opacity: 1; }
.ui-brand-mark { flex: none; width: 32px; height: 32px; }
.site-nav-toggle, .header .menu-item-search { display: none; }
.header .site-nav {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: visible;
  height: auto;
  visibility: visible;
  max-height: none;
}
.header .main-menu {
  display: flex;
  align-items: center;
  gap: 0;
  width: max-content;
  margin: 0;
  padding: 5px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: transparent;
  text-align: center;
}
.header .menu .menu-item { position: relative; z-index: 1; display: block; margin: 0; }
.header .menu .menu-item-search { display: none; }
.header .menu .menu-item a {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 44px;
  min-width: 66px;
  padding: 0 17px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ui-secondary);
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
}
.header .menu .menu-item a::after, .header .menu .menu-item .fa { display: none; }
.header .menu .menu-item a:hover, .header .menu .menu-item a.menu-item-active { color: var(--ui-text); }
.main-menu:not(.liquid-glass-group) .menu-item-active { background: var(--ui-panel); }
.header .site-nav-right { grid-column: 3; grid-row: 1; display: block; }
.header .ui-icon-button, .header .theme-switch-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 17px;
  background: transparent;
  color: var(--ui-text);
  font-size: 17px;
  cursor: pointer;
  transition: transform .22s var(--ui-ease);
}
.header .ui-icon-button:hover, .header .theme-switch-toggle:hover { transform: translateY(-2px); background: transparent; }
.header .theme-switch {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  top: auto;
  right: auto;
  transform: none;
}
.theme-switch-caption { display: none; }
.header .theme-switch-panel {
  top: calc(100% + 16px);
  right: 0;
  min-width: 170px;
  padding: 8px;
  border: 0;
  border-radius: 20px;
  background: var(--ui-panel-solid);
  box-shadow: none;
  color: var(--ui-text);
}
.header .theme-switch-panel.liquid-glass-host { background: transparent; }
.header .theme-switch-panel legend { font-size: 11px; color: var(--ui-muted); }
.header .theme-switch-panel label { min-height: 44px; padding: 0 12px; border-radius: 12px; font-size: 13px; }
.header .theme-switch-panel label:hover { background: var(--ui-hover); }
.header .theme-switch-panel input { accent-color: var(--ui-text); }
.main-inner {
  box-sizing: border-box;
  width: min(var(--ui-width), calc(100% - 80px));
  margin: 0 auto;
  padding: 190px 0 0;
  min-height: 70vh;
}
.main-inner.post { width: min(820px, calc(100% - 80px)); }
.footer {
  position: relative;
  left: auto;
  right: auto;
  margin-top: 100px;
  padding: 0;
  background: transparent;
}
.footer .footer-inner {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 24px;
  box-sizing: border-box;
  width: min(var(--ui-width), calc(100% - 80px));
  min-height: 110px;
  margin: auto;
  padding: 20px 0;
  border-top: 0;
  text-align: left;
  color: var(--ui-muted);
  font-size: 11px;
}
.footer a { border: 0; }
.ui-footer-brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ui-text); font-size: 15px; font-weight: 700; }
.ui-footer-brand img { margin: 0; opacity: 1 !important; }
.pagination { margin: 55px 0 0; padding-top: 24px; border-color: var(--ui-line); text-align: center; }
.pagination .page-number, .pagination .extend { min-width: 44px; min-height: 44px; box-sizing: border-box; padding: 8px; margin: 0 3px; border: 0; border-radius: 15px; }
.pagination .page-number.current { background: var(--ui-text); color: var(--ui-bg); }
.pagination .page-number:hover, .pagination .extend:hover { background: var(--ui-panel); color: var(--ui-text); }
.back-to-top, .sidebar-toggle { border-radius: 14px; padding: 10px; color: var(--ui-secondary); background: var(--ui-panel-solid); box-shadow: var(--ui-shadow); }
.back-to-top { left: auto; right: 24px; bottom: -70px; }
.back-to-top.back-to-top-on { bottom: 24px; }
.sidebar-toggle { left: 24px; bottom: 24px; z-index: 41; }
.sidebar { background: var(--ui-panel-solid); color: var(--ui-text); z-index: 40; }
.sidebar-dimmer { z-index: 35; }
html[data-theme="light"] .sidebar-toggle .toggle-line { background: #25272b; }
html[data-theme="light"] .sidebar { border: 0; box-shadow: none; }
.sidebar-inner { color: var(--ui-secondary); }
.sidebar a { color: var(--ui-secondary); }
.sidebar a:hover { color: var(--ui-text); }
.sidebar-nav li { color: var(--ui-muted); }
.sidebar-nav .sidebar-nav-active, .sidebar-toc-active .sidebar-nav-toc, .sidebar-overview-active .sidebar-nav-overview { color: var(--ui-text); border-color: var(--ui-line); }
.header .search-pop-overlay { height: 100dvh; padding: 20px; box-sizing: border-box; }
.header .search-popup {
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: min(640px, 100%);
  height: min(620px, calc(100dvh - 40px));
  max-height: calc(100dvh - 40px);
  border-radius: 29px;
  background: var(--ui-panel-solid);
  box-shadow: none;
}
.header .search-popup.liquid-glass-host { background: transparent; }
html[data-theme] .search-popup .search-header {
  flex: none;
  align-items: center;
  min-height: 68px;
  box-sizing: border-box;
  padding: 10px 15px;
  border-radius: 29px 29px 0 0;
  border-bottom: 1px solid var(--ui-line);
  background: transparent;
}
.search-popup .search-input-container { min-width: 0; }
.search-popup input.search-input { min-height: 44px; color: var(--ui-text); font-size: 16px; }
.search-popup .popup-btn-close { display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; box-sizing: border-box; }
.search-popup .search-result-container { flex: 1; height: auto; min-height: 0; padding: 18px 26px; overscroll-behavior: contain; }
.search-popup .search-result-list { margin: 0; }
.search-popup .search-result-list li { padding: 12px 0; }
.search-popup p.search-result { border-color: var(--ui-line); font-size: 13px; color: var(--ui-secondary); }
.search-popup a.search-result-title { color: var(--ui-text); }
.search-popup mark.search-keyword { color: var(--ui-text); background: var(--ui-panel); border-color: var(--ui-muted); }

/* Animate the header's available area without transforming its fixed overlays. */
@media (min-width: 992px) {
  header.header { transition: left .2s ease-out, width .2s ease-out; }
  body.sidebar-active.ui-drawer-overlaps-header header.header {
    left: var(--ui-drawer-width, 320px);
    width: min(var(--ui-header-max-width), calc(100% - var(--ui-drawer-width, 320px) - var(--ui-header-gutter)));
  }
}
@media (min-width: 992px) and (max-width: 1199px) {
  body.sidebar-active.ui-drawer-overlaps-header .site-meta .site-title { font-size: 16px; }
  body.sidebar-active.ui-drawer-overlaps-header .header .menu .menu-item a { min-width: 50px; padding: 0 9px; }
}
@media (min-width: 1200px) {
  .ui-has-toc .main { display: grid; grid-template-columns: minmax(0,830px) 230px; gap: 60px; width: 1120px; margin: 0 auto; }
  .ui-has-toc .column { display: contents; }
  .ui-has-toc .main-inner.post { grid-column: 1; grid-row: 1; width: 100%; padding-right: 0; }
  .ui-has-toc .sidebar {
    position: sticky;
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    margin-top: 170px;
    top: 170px;
    bottom: auto;
    left: auto;
    right: auto;
    width: 230px;
    max-height: calc(100dvh - 210px);
    padding: 0;
    background: transparent;
    box-shadow: none;
    transition: none;
    z-index: 10;
    scrollbar-width: thin;
  }
  .ui-has-toc .sidebar-inner { padding: 0; }
  .ui-has-toc .sidebar-nav { margin: 0 0 12px; }
  .ui-has-toc .sidebar-nav li { margin: 0 12px 0 0; font-size: 11px; }
  .ui-has-toc .sidebar-toggle, .ui-has-toc .sidebar-dimmer { display: none; }
  .ui-has-toc .post-toc ol { padding-left: 10px; }
  .ui-has-toc .post-toc .nav-item { white-space: normal; }
  .ui-has-toc .post-toc a.nav-link { display: block; border-bottom: 0; border-left: 2px solid var(--ui-line); padding: 7px 0 7px 12px; color: var(--ui-muted); font-size: 12px; }
  .ui-has-toc .post-toc .active-current > a { border-left-color: var(--ui-text); color: var(--ui-text); }
}
@media (max-width: 900px) {
  header.header { gap: 5px; padding-left: 18px; }
  .header .site-nav { margin-right: 0; }
  .header .menu .menu-item a { min-width: 54px; padding: 0 10px; }
  .site-meta .site-title { font-size: 18px; }
  .main-inner, .main-inner.post { width: calc(100% - 52px); padding-top: 160px; }
  .footer .footer-inner { width: calc(100% - 52px); }
}
@media (max-width: 767px) {
  header.header { top: 9px; width: calc(100% - 20px); min-height: 64px; grid-template-columns: minmax(0,1fr) 44px 44px; padding: 8px 10px 8px 18px; border-radius: 22px; }
  .header .theme-switch { grid-column: 2; }
  .header .site-nav-right { grid-column: 3; }
  .header .ui-icon-button, .header .theme-switch-toggle { width: 44px; height: 44px; }
  .header .site-nav {
    position: fixed;
    inset: auto 12px max(13px, env(safe-area-inset-bottom));
    transform: none;
    width: max-content;
    max-width: calc(100% - 24px);
    margin: 0 auto;
    background: var(--ui-panel-solid);
    border-radius: 999px;
    box-shadow: var(--ui-shadow);
  }
  .header .main-menu { flex-wrap: wrap; justify-content: center; width: auto; max-width: 100%; padding: 6px; }
  .header .menu .menu-item a { min-width: 50px; padding: 0 10px; font-size: 11px; }
  .header .theme-switch-panel { right: -49px; top: calc(100% + 17px); }
  .main-inner, .main-inner.post { width: calc(100% - 40px); padding-top: 105px; }
  .footer { margin-top: 32px; padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .footer .footer-inner { width: calc(100% - 40px); gap: 8px 14px; min-height: 0; padding: 12px 0; font-size: 10px; flex-wrap: wrap; }
  .ui-footer-brand { font-size: 13px; }
  .ui-footer-brand img { width: 22px; height: 22px; }
  .header .search-pop-overlay { padding: 12px; }
  .header .search-popup { height: min(620px, calc(100dvh - 24px)); max-height: calc(100dvh - 24px); border-radius: 24px; }
  html[data-theme] .search-popup .search-header { padding: 8px; }
  .search-popup .search-result-container { padding: 12px 18px; }
}
@media (max-width: 390px) {
  .site-meta .site-title { font-size: 16px; }
  .ui-brand-mark { width: 26px; height: 26px; }
  .site-meta .brand { gap: 6px; }
  .ui-footer-brand { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  header.header, .header *, .pagination *, .back-to-top, .sidebar { transition: none !important; }
}
