/* Keep the original light palette; override colors only for dark mode. */
:root { color-scheme: light; }
.header_wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#blog_name { flex-shrink: 0; }
.menus_items { flex: 1; }
.color-mode-control { order: 3; margin-left: auto; }
#color-mode {
  font: inherit;
  font-size: 14px;
  width: 94px;
  min-height: 36px;
  padding: 4px 6px;
  color: #494e52;
  background: #fff;
  border: 1px solid #bdc1c4;
  border-radius: 6px;
  cursor: pointer;
}
#color-mode:focus-visible { outline: 2px solid #096494; outline-offset: 3px; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 34em) {
  .header_wrap { padding: 16px; }
  #blog_name a { margin: 0; font-size: 18px; }
  .color-mode-control { margin-right: 44px; }
  .menus_icon { right: 16px; }
  .menus_items { top: 100%; }
}

html[data-color-mode="dark"] {
  color-scheme: dark;
  --night-bg: #171b22;
  --night-panel: #202630;
  --night-text: #dde3eb;
  --night-muted: #b0bac8;
  --night-border: #414d5e;
  --night-link: #91c7f3;
  background: var(--night-bg);
}
html[data-color-mode="dark"] body { background: var(--night-bg); color: var(--night-text); }
html[data-color-mode="dark"] .page,
html[data-color-mode="dark"] .side-card { background: var(--night-panel); }
html[data-color-mode="dark"] .side-card { opacity: 1; }
html[data-color-mode="dark"] #page_header,
html[data-color-mode="dark"] .author-avatar img,
html[data-color-mode="dark"] .menus_items li,
html[data-color-mode="dark"] .nav_items li { border-color: var(--night-border); }
html[data-color-mode="dark"] #blog_name a,
html[data-color-mode="dark"] .menus_items a,
html[data-color-mode="dark"] .nav_items a,
html[data-color-mode="dark"] .author-discrip,
html[data-color-mode="dark"] .social-links .e-social-link,
html[data-color-mode="dark"] .social-icons i { color: var(--night-text); }
html[data-color-mode="dark"] .page article a,
html[data-color-mode="dark"] .cv-links { color: var(--night-link) !important; }
html[data-color-mode="dark"] a:hover,
html[data-color-mode="dark"] .page article a:hover,
html[data-color-mode="dark"] .social-icons i:hover { color: #ff9aaf !important; }
html[data-color-mode="dark"] .nav_items,
html[data-color-mode="dark"] .social-icons,
html[data-color-mode="dark"] #color-mode,
html[data-color-mode="dark"] .m-social-links {
  background: var(--night-panel);
  color: var(--night-text) !important;
  border-color: var(--night-border) !important;
}
html[data-color-mode="dark"] #color-mode:focus-visible { outline-color: var(--night-link); }
html[data-color-mode="dark"] .social-icons::before { border-color: var(--night-panel) transparent; }
html[data-color-mode="dark"] .nav_items::before { border-left-color: var(--night-panel); }
html[data-color-mode="dark"] .nav_items a:hover { background: #303a49; }
html[data-color-mode="dark"] blockquote {
  background: #29313d;
  color: var(--night-muted);
  border-left-color: #71829a;
}
html[data-color-mode="dark"] #page_footer {
  background: #202630;
  color: var(--night-muted);
  border-color: var(--night-border);
}
html[data-color-mode="dark"] #page_footer a { color: var(--night-muted); }
html[data-color-mode="dark"] hr { border-color: var(--night-border); }
html[data-color-mode="dark"] .page article code,
html[data-color-mode="dark"] .page article pre,
html[data-color-mode="dark"] .page article .highlight,
html[data-color-mode="dark"] .page article .highlight td {
  background: #151a21;
  color: var(--night-text);
}
html[data-color-mode="dark"] .page article .gutter pre { color: var(--night-muted); }
html[data-color-mode="dark"] .highlight .comment,
html[data-color-mode="dark"] .highlight .quote { color: #a4b1c2; }
html[data-color-mode="dark"] .highlight .keyword,
html[data-color-mode="dark"] .highlight .selector-tag { color: #d7b0ff; }
html[data-color-mode="dark"] .highlight .string,
html[data-color-mode="dark"] .highlight .title { color: #8edbbb; }
html[data-color-mode="dark"] .highlight .number,
html[data-color-mode="dark"] .highlight .literal { color: #ffc18a; }
html[data-color-mode="dark"] .highlight .built_in,
html[data-color-mode="dark"] .highlight .attr { color: #91c7f3; }
/* The homepage introduction contains authored inline light colors. */
html[data-color-mode="dark"] .research-summary {
  background-color: #29313d !important;
  color: var(--night-text) !important;
}
html[data-color-mode="dark"] .research-summary b { color: inherit !important; }
html[data-color-mode="dark"] .page font[color="blue"] { color: var(--night-link); }
html[data-color-mode="dark"] .page font[color="green"] { color: #8edbbb; }
html[data-color-mode="dark"] .page font[color="purple"] { color: #d7b0ff; }
html[data-color-mode="dark"] .page font[color="red"] { color: #ff9aaf; }
html[data-color-mode="dark"] .page font[color="orange"] { color: #ffc18a; }
html[data-color-mode="dark"] .highlight .variable,
html[data-color-mode="dark"] .highlight .attribute,
html[data-color-mode="dark"] .highlight .regexp,
html[data-color-mode="dark"] .highlight .tag { color: #ff9aaf; }
html[data-color-mode="dark"] .highlight .meta,
html[data-color-mode="dark"] .highlight .function { color: #d7b0ff; }
html[data-color-mode="dark"] .highlight .value,
html[data-color-mode="dark"] .highlight .formula { color: #8edbbb; }
html[data-color-mode="dark"] .highlight .addition { background: #254536; }
html[data-color-mode="dark"] .highlight .deletion { background: #502d39; }
html[data-color-mode="dark"] ::-webkit-scrollbar,
html[data-color-mode="dark"] ::-webkit-scrollbar-track { background: var(--night-bg); }
html[data-color-mode="dark"] ::-webkit-scrollbar-thumb { background: #58677b; }
@media (max-width: 34em) {
  html[data-color-mode="dark"] .menus_items {
    background: var(--night-panel);
    border-color: var(--night-border);
  }
  html[data-color-mode="dark"] .menus_items::before { border-color: var(--night-panel) transparent; }
}
