/* color-mix(in srgb,var(--usr-theme) 50%,#fff) */

/* 全局样式 */
*,
:after,
:before,
::marker {
  box-sizing: border-box;
}

blockquote,
body,
button,
dd,
dl,
figure,
h1,
h2,
h3,
h4,
h5,
h6,
input,
p,
pre {
  margin: 0;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family:
    "Open Sans", "Clear Sans", "Helvetica Neue", Helvetica, Arial,
    "Segoe UI Emoji", "SF Pro", sans-serif;
}

#write {
  width: 100%;
  margin: 0 auto;
  padding: 30px;
  padding-bottom: 80px;
  font-size: 0.7rem;
  margin: 0.6rem 0;
  line-height: 1.25rem;
}

#write img
{
display: block;
max-width: 80%;
margin: 5px auto;
}

.katex-display{
overflow-y: hidden;
overflow-x: auto;
font-size: 0.6rem !important;
}

/* 段落样式 */
#write p {
  display: block;
  margin-block-start: 0.7rem;
  margin-block-end: 0.7rem;
  margin-inline-start: 0px;
  margin-inline-end: 0px;
  unicode-bidi: isolate;
  margin: 0.65rem 0;
  line-height: 1.25rem;
}

/* 列表样式 */
#write ol,
#write ul {
  list-style: none;
  padding: 0 0 0 0.5rem;
  margin: 0.6rem 0;
}

#write ol p,
#write ul p {
  margin: 0;
  padding: 0;
}

#write ol {
  counter-reset: li;
}

#write li {
  display: list-item;
  unicode-bidi: isolate;
  margin-bottom: 0.3rem;
}

#write ol > li,
#write ul > li {
  position: relative;
  padding: 0 0 0 1.25rem;
}

#write ol > li::before,
#write ul > li::before {
  position: absolute;
  display: block;
  color: var(--usr-theme);
  transform: none;
  left: 0;
  text-align: center;
}

#write ol > li::before {
  content: counter(li) ".";
  counter-increment: li;
  opacity: 0.7;
}

#write ul > li:before {
  content: "\2022";
  font-size: 1.3rem;
  padding: 0;
  opacity: 0.5;
}

/* 标题样式 */
#write h1,
#write h2,
#write h3,
#write h4,
#write h5,
#write h6 {
  margin: 1.25rem 0 0.8rem 0;
  line-height: 1.25rem;
  font-weight: 700;
  scroll-margin-top: 55px;
}

h1 {
  font-size: 1.6rem !important;
  display: block;
  margin-block-start: 1.1rem;
  margin-block-end: 1.1rem;
  margin-inline-start: 0px;
  margin-inline-end: 0px;
  unicode-bidi: isolate;
}

h2 {
  font-size: 1.2rem !important;
  display: block;
  margin-block-start: 1.33rem;
  margin-block-end: 1.33rem;
  margin-inline-start: 0px;
  margin-inline-end: 0px;
  unicode-bidi: isolate;
}

h3 {
  font-size: 1rem !important;
  display: block;
  margin-block-start: 1.6rem;
  margin-block-end: 1.6rem;
  margin-inline-start: 0px;
  margin-inline-end: 0px;
  unicode-bidi: isolate;
}

h4 {
  font-size: 0.8rem !important;
  display: block;
  margin-block-start: 2.13rem;
  margin-block-end: 2.13rem;
  margin-inline-start: 0px;
  margin-inline-end: 0px;
  unicode-bidi: isolate;
}

h5 {
  font-size: 0.8rem !important;
}
h6 {
  font-size: 0.8rem !important;
  color: #777;
}

/* 超链接样式 */
#write a {
  position: relative;
  color: var(--usr-theme);
  text-decoration: none;
  border-bottom: var(--usr-theme) 1px dotted;
  padding: 0.05rem 0.2rem;
  transition: all 0.3s ease;
}

#write a:hover {
  cursor: pointer;
  color: color-mix(in srgb, var(--usr-theme) 85%, #000);
}

#write a::after {
  content: "";
  position: absolute;
  display: inline-block;
  left: 0;
  bottom: -1px;
  width: 0;
  height: 1px;
  background-color: var(--usr-theme);
  transition: all 0.3s linear;
  z-index: 100;
}

#write a:hover::after {
  width: 100%;
}

.nohovered::after {
  animation: slideline 0.3s linear;
}

@keyframes slideline {
  0% {
    left: 0;
    width: 100%;
  }
  50% {
    left: 50%;
    width: 50%;
  }
  100% {
    left: 100%;
    width: 0;
  }
}

h1:hover a.anchor,
h2:hover a.anchor,
h3:hover a.anchor,
h4:hover a.anchor,
h5:hover a.anchor,
h6:hover a.anchor {
  text-decoration: none;
}

/* 引用样式 */
blockquote {
  border-left: 4px solid color-mix(in srgb, var(--usr-theme) 30%, #ffffff);
  background-color: color-mix(in srgb, var(--usr-theme) 5%, #fff);
  padding: 0.15rem 1rem;
  color: var(--gray-500);
  margin: 0.15rem 0 !important;
}
blockquote blockquote {
  padding-right: 0;
}

/* 表格样式 */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin: 0.5rem 0;
}

table {
  padding: 0;
  word-break: initial;
  caption-side: bottom;
  border-collapse: collapse;
  margin: 0.35rem auto !important;
  line-height: 1.25rem;
  overflow: auto;
}

table tr {
  border: 1px solid var(--usr-theme-invert);
  margin: 0;
  padding: 0;
}
table tr:nth-child(2n),
thead {
  background-color: color-mix(in srgb, var(--usr-theme) 3%, #fff);
}

table th {
  font-weight: bold;
  border: 1px solid color-mix(in srgb, var(--usr-theme) 25%, #fff);
  background-color: color-mix(in srgb, var(--usr-theme) 12%, #fff);
  border-bottom: 0;
  margin: 0;
  padding: 6px 13px;
}
table td {
  border: 1px solid color-mix(in srgb, var(--usr-theme) 15%, #fff);
  margin: 0;
  padding: 6px 13px;
}
table th:first-child,
table td:first-child {
  margin-top: 0;
}
table th:last-child,
table td:last-child {
  margin-bottom: 0;
}

/* 代码样式 */
code {
  background-color: color-mix(in srgb, var(--usr-theme-invert) 15%, #fff);
  border-radius: 3px;
  font-size: 85%;
  color: var(--usr-theme);
  margin: 0;
  padding: 0.2em 0.4em;
}

code,
pre {
  font-family:
    Consolas, Menlo, Monaco, "Courier New", Courier, monospace !important;
  font-variant-ligatures: no-common-ligatures;
  text-rendering: optimizeSpeed;
  overflow-wrap: break-word;
  font-size: 0.65rem !important;

  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  word-wrap: normal;
  line-height: 1.25rem;
  -moz-tab-size: 4;
  -o-tab-size: 4;
  tab-size: 4;
  -webkit-hyphens: none;
  -moz-hyphens: none;
  -ms-hyphens: none;
  hyphens: none;
}

pre {
  padding: 10px 10px;
  margin: 0.5rem 0;
  border: 1px solid var(--gray-100);
  background-color: color-mix(
    in srgb,
    var(--usr-theme-invert) 3%,
    #fff
  ) !important;
  overflow: auto;
  border-radius: 0.25rem;
  cursor: text;
}

pre code {
  counter-reset: line;
  background-color: inherit;
  color: inherit;
  padding: 0;
  border-radius: 0px;
}

pre code div::before {
  counter-increment: line;
  content: counter(line);
  width: 30px;
  margin-right: 10px;
  text-align: right;
  padding-right: 10px;
  color: var(--gray-100);
  display: inline-block;
  border-right: var(--gray-50) 1px solid;
}

:not(pre) > code[class*="language-"] {
  padding: 0.1em;
  border-radius: 0.3em;
}

/* 其他元素样式 */
mark {
  background-color: #ff0;
}
hr {
  height: 0.05rem;
  padding: 0;
  margin: 0.8rem 0;
  background-color: var(--gray-100);
  border: 0 none;
  overflow: hidden;
  box-sizing: content-box;
}
