@import './notes-dark/codeblock.xydark.css';

@font-face {
  font-family: 'Fira Mono';
  font-style: normal;
  font-weight: normal;
  src: local("Fira Mono Regular"), url("./notes-dark/FiraMono-Regular.ttf") format("truetype");
}

@font-face {
  font-family: 'Fira Mono';
  font-style: normal;
  font-weight: bold;
  src: local("Fira Mono Bold"), url("./notes-dark/FiraMono-Bold.ttf") format("truetype");
}

:root {
  --primary-color: #fcba03;
  --primary-color-rgb: 252, 186, 3;

  --bg-color: #292929;
  --bg-color-dark: #1f1f1f;
  --dark-trait: #141414;
  --light-trait-100: #3d3d3d;
  --light-trait-200: #545454;
  --light-trait-300: #777;
  --light-trait-400: #8c8c8c;

  --text-color: #f8f8f2;
  --text-color-secondary: #d2d3d3;
  --text-highlight-color: #fff;
  --text-highlight-bg: rgba(var(--primary-color-rgb), 0.3);
  --select-text-bg-color: rgba(255, 255, 255, 0.2);
  --search-select-text-color: var(--text-highlight-color);
  --search-select-bg-color: var(--text-highlight-bg);

  --code-color: #f3b3f8;

  --border-radius: 3px;

  --font-size: 14px;
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", sans-serif;
  --monospace: 'Fira Mono', 'Cousine', 'Consolas', monospace;

  --heading-char-color: var(--light-trait-400);
  --color-popover-bg-color: var(--text-color);
  --rawblock-edit-panel-bd: var(--bg-color-dark);
  --control-text-color: var(--text-color);
  --meta-content-color: var(--primary-color);
  --primary-btn-border-color: var(--primary-color);
  --side-bar-bg-color: var(--bg-color-dark);
  --item-hover-bg-color: var(--bg-color);
  --item-hover-text-color: var(--text-highlight-color);
  --active-file-bg-color: var(--bg-color);
  --active-file-border-color: var(--bg-color);
  --window-border: 1px solid var(--bg-color);
  --focus-ring-color: transparent;
  --table-bg-darker-color: var(--bg-color-dark);
  --table-bg-color: var(--bg-color);
}

html {
  font-size: var(--font-size);
}

body {
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  color: var(--text-color);
  line-height: 1.6;
}

#write {
  max-width: 860px;
  margin: 0 auto;
  padding: 30px;
  padding-bottom: 100px;
}

@media only screen and (min-width: 1400px) {
  #write {
    max-width: 1024px;
  }
}

@media only screen and (min-width: 1800px) {
  #write {
    max-width: 1200px;
  }
}

#write > ul:first-child,
#write > ol:first-child {
  margin-top: 30px;
}

a {
  color: var(--primary-color);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  position: relative;
  margin-top: 1rem;
  margin-bottom: 1rem;
  font-weight: bold;
  line-height: 1.4;
  cursor: text;
}

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;
}

h1 tt,
h1 code,
h2 tt,
h2 code,
h3 tt,
h3 code,
h4 tt,
h4 code,
h5 tt,
h5 code,
h6 tt,
h6 code {
  font-size: inherit;
}

h1 {
  padding-bottom: 0.3em;
  font-size: 2.2em;
  line-height: 1.3;
}

h2 {
  padding-bottom: 0.3em;
  font-size: 1.75em;
  line-height: 1.225;
}

h3 {
  font-size: 1.4em;
  line-height: 1.43;
}

h4 {
  font-size: 1.2em;
}

h5 {
  font-size: 1em;
}

h6 {
  font-size: 1em;
  color: var(--light-trait-300);
}

p,
blockquote,
ul,
ol,
dl,
table {
  margin: 0.8em 0;
}

li > ol,
li > ul {
  margin: 0 0;
}

hr {
  height: 2px;
  padding: 0;
  margin: 16px 0;
  background-color: var(--light-trait-100);
  border: 0 none;
  overflow: hidden;
  box-sizing: content-box;
}

sup.md-footnote {
  background-color: var(--light-trait-400);
  color: var(--light-trait-100);
}

li p.first {
  display: inline-block;
}

ul,
ol {
  padding-left: 30px;
}

ul:first-child,
ol:first-child {
  margin-top: 0;
}

ul:last-child,
ol:last-child {
  margin-bottom: 0;
}

mark,
.ty-file-search-match-text,
.md-search-hit {
  background: var(--search-select-bg-color);
  color: var(--search-select-text-color);
}
.md-search-hit * {
  color: var(--search-select-text-color);
}
.cm-search-hit.CodeMirror-selectedtext,
.md-search-hit.md-search-select,
.md-search-select {
  outline: 2px solid var(--primary-color);
}
.outline-item.select, .ty-search-item-line.select, .ty-search-item.select {
  outline-width: 2px;
}
.outline-item.select {
  outline-offset: 0px;
}

blockquote {
  margin-left: -14px;
  margin-right: -14px;
  border-radius: var(--border-radius);
  border-left: 4px solid var(--light-trait-300);
  background-color: var(--light-trait-100);
  padding: 7px 14px 7px 10px;
}

blockquote blockquote {
  padding-right: 0;
}

table {
  padding: 0;
  word-break: initial;
}

table tr {
  border-top: 1px solid var(--dark-trait);
  margin: 0;
  padding: 0;
}

table tr:nth-child(2n),
thead {
  background-color: var(--side-bar-bg-color);
}

table tr th {
  font-weight: bold;
  border: 1px solid var(--dark-trait);
  border-bottom: 0;
  margin: 0;
  padding: 6px 13px;
}

table tr td {
  border: 1px solid var(--dark-trait);
  margin: 0;
  padding: 6px 13px;
}

table tr th:first-child,
table tr td:first-child {
  margin-top: 0;
}

table tr th:last-child,
table tr td:last-child {
  margin-bottom: 0;
}

kbd {
  font-size: 0.875rem;
  background: var(--bg-color-dark);
  border: 1px solid var(--dark-trait);
  box-shadow: 0 2px 0 var(--dark-trait);
  color: var(--text-color-secondary);
}

.md-fences,
code,
tt {
  border: 1px solid var(--dark-trait);
  background-color: var(--bg-color-dark);
  border-radius: var(--border-radius);
  padding: 2px 4px 0px 4px;
  font-size: 0.9em;
  font-family: var(--monospace);
}

.md-fences {
  margin-bottom: 15px;
  margin-top: 15px;
  padding-top: 8px;
  padding-bottom: 6px;
  background-color: var(--side-bar-bg-color);
}

#write pre.md-meta-block {
  padding: 1rem;
  font-size: 85%;
  line-height: 1.45;
  background-color: var(--bg-color-dark);
  border: 0;
  border-radius: var(--border-radius);
  color: var(--light-trait-400);
  margin-top: 0 !important;
}

#write .mathjax-block .md-rawblock-tooltip {
  border-top-left-radius: var(--border-radius);
  border-top-right-radius: var(--border-radius);
}

#write .mathjax-block .md-math-container {
  border-top-left-radius: var(--border-radius);
  border-bottom-right-radius: var(--border-radius);
  border-bottom-left-radius: var(--border-radius);
}

#write .md-mathblock-panel .md-rawblock-control:first-of-type {
  border-top-left-radius: var(--border-radius);
}

.md-mathjax-midline {
  background-color: var(--bg-color);
  color: var(--text-color);
}

.md-inline-math script {
  color: var(--code-color);
}

code {
  padding: 0 2px 0 2px;
}

.CodeMirror-lines {
  padding-left: 4px;
}

.code-tooltip {
  box-shadow: none;
  border-radius: var(--border-radius);
}

#write .code-tooltip {
  bottom: initial;
  top: 100%;
  left: initial;
  right: -1px;
  background: var(--bg-color-dark);
  border: 1px solid var(--dark-trait);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top: 0;
  font-family: var(--monospace);
}

#write .md-mathblock-panel .code-tooltip {
  right: 0;
  border: none;
}

#write .md-task-list-item > input {
  -webkit-appearance: initial;
  display: block;
  position: absolute;
  border: 1px solid var(--light-trait-200);
  border-radius: 50%;
  margin-top: 0.2rem;
  margin-left: -1.8rem;
  height: 1.2rem;
  width: 1.2rem;
  transition: background 0.3s;
}

#write .md-task-list-item > input:focus {
  outline: none;
  box-shadow: none;
}

#write .md-task-list-item > input[checked] {
  background: var(--primary-color);
  border: 1px solid var(--primary-color);
}

#write .md-task-list-item > input[checked]::before {
  content: '✓';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  text-align: center;
  color: var(--dark-trait);
  font-size: 12px;
  font-weight: 500;
}

.md-image > .md-meta {
  border-radius: var(--border-radius);
  padding: 2px 0px 0px 4px;
  font-size: 0.9em;
  color: inherit;
}

.md-toc {
  margin-top: 20px;
  padding-bottom: 20px;
}

/* Source mode */
.CodeMirror.cm-s-typora-default *,
.cm-s-typora-default * {
  background: inherit;
  color: var(--text-color);
  font-family: var(--monospace);
  font-size: var(--font-size) !important;
  font-style: normal;
  font-weight: normal;
}
.CodeMirror.cm-s-typora-default div.CodeMirror-cursor {
  border-left: 2px solid var(--light-trait-400);
}

.sidebar-tabs {
  border-bottom: none;
}

.outline-expander {
  width: 1.5rem;
  vertical-align: initial;
}
.outline-expander:before,
.outline-expander:hover:before,
.outline-item-open > .outline-item > .outline-expander:before,
.outline-item-open > .outline-item > .outline-expander:hover:before {
  content: "\f125";
  transition: transform 125ms ease-in-out;
}
.outline-item-open > .outline-item > .outline-expander:hover:before,
.outline-item-open > .outline-item > .outline-expander:before {
  transform: rotate(90deg);
}
.outline-label:hover {
  text-decoration: none;
}

#toc-dropmenu {
  background: var(--bg-color-dark);
}
#toc-dropmenu .outline-title {
  font-size: 1rem;
  text-transform: uppercase;
}
.dropdown-menu .divider {
  display: none;
}

.context-menu {
  background-color: var(--bg-color-dark);
}

.file-node-background {
  height: 31px;
}
.file-node-content:hover .file-node-icon,
.file-node-content:hover .file-node-open-state {
  visibility: visible;
}
.file-node-icon {
  margin-right: 8px;
}
.file-library-node:not(.file-node-root):focus>.file-node-content {
  outline: none;
}

/* New file animation */
.blink-area {
  animation: none;
}

.file-list-item-summary {
  font-size: var(--font-size);
  font-family: var(--font-family);
}

#md-searchpanel input {
  border-radius: var(--border-radius);
  box-shadow: none;
}
#md-searchpanel input:focus {
  box-shadow: none;
  border-color: var(--meta-content-color);
}
#md-searchpanel .search-type-selection {
  width: auto;
}
#md-searchpanel .btn:not(.close-btn):hover {
  box-shadow: none;
}

.mac-seamless-mode #typora-sidebar {
  background-color: var(--side-bar-bg-color);
}

#md-notification .btn {
  border: 0;
}

.megamenu-menu {
  background-color: var(--bg-color-dark);
}

.megamenu-opened header {
  background-image: none;
}

/* mega menu */
.megamenu-content,
.megamenu-opened header {
    background: var(--bg-color);
}

.megamenu-opened .megamenu-content {
  visibility: visible;
  opacity: 1;
  animation: none;
  background-color: inherit;
}

#recent-file-panel tbody tr:nth-child(2n) {
  background-color: var(--table-bg-darker-color);
}

#recent-file-panel tbody tr:nth-child(2n + 1) {
  background-color: var(--table-bg-color);
}

#recent-file-panel-action-btn {
  background-color: var(--bg-color);
}

.long-btn:hover {
  background-color: var(--item-hover-bg-color);
  color: var(--item-hover-text-color) !important;
}

#recent-file-panel-action-btn:hover{
  background-color: var(--item-hover-bg-color);
  color: var(--item-hover-text-color) !important;
}

.mouse-entered #top-titlebar .toolbar-icon.btn:hover,
.mouse-entered #top-titlebar .toolbar-icon.btn.hover {
    background-color: var(--item-hover-bg-color);
}

#m-import-local:hover .preference-item-hint {
  color: var(--item-hover-text-color);
}

.typora-sourceview-on #toggle-sourceview-btn {
  background-color: var(--bg-color-dark);
}