/* Yuque-inspired theme for Docmost 0.97.0
 * Injected via nginx sub_filter into index.html as /yuque.css
 * Prefer CSS variables and stable selectors; hashed module classes
 * (e.g. _node_1mdy3_15) are from this build and may change on upgrade.
 */

:root {
  --yuque-green: #00B96B;
  --yuque-green-hover: #009A59;
  --yuque-green-active: #00864D;
  --yuque-green-soft: #E8F8F0;
  --yuque-green-soft-hover: #D4F3E4;
  --yuque-text: #1F2329;
  --yuque-text-secondary: #646A73;
  --yuque-border: #E5E6EB;
  --yuque-bg: #FFFFFF;
  --yuque-sidebar-bg: #F5F6F7;
  --yuque-hover: #F2F3F5;
  --yuque-code-bg: #F7F8FA;
  --yuque-title: #1F2329;
  --yuque-radius: 6px;

  --mantine-font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mantine-font-family-headings: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mantine-color-anchor: #00B96B;
  --mantine-line-height: 1.75;

  --mantine-primary-color-0: #E8F8F0;
  --mantine-primary-color-1: #C6EFD9;
  --mantine-primary-color-2: #97E3BE;
  --mantine-primary-color-3: #5ED4A0;
  --mantine-primary-color-4: #2AC685;
  --mantine-primary-color-5: #00B96B;
  --mantine-primary-color-6: #00B96B;
  --mantine-primary-color-7: #009A59;
  --mantine-primary-color-8: #007A47;
  --mantine-primary-color-9: #005C35;
  --mantine-primary-color-filled: #00B96B;
  --mantine-primary-color-filled-hover: #009A59;
  --mantine-primary-color-light: rgba(0, 185, 107, 0.12);
  --mantine-primary-color-light-color: #009A59;
  --mantine-primary-color-light-hover: rgba(0, 185, 107, 0.18);
  --mantine-primary-color-contrast: #ffffff;
  --mantine-primary-color-outline: #00B96B;
  --mantine-primary-color-outline-hover: rgba(0, 185, 107, 0.12);
  --mantine-primary-color-text: #00B96B;
}

[data-mantine-color-scheme="light"] {
  --mantine-color-anchor: #00B96B;
  --mantine-color-body: #ffffff;
  --mantine-color-text: #1F2329;
  --mantine-color-default-border: #E5E6EB;
}

html,
body,
#root {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--yuque-bg);
  color: var(--yuque-text);
  -webkit-font-smoothing: antialiased;
}

/* ---------- App shell: header, sidebar, aside ---------- */
.mantine-AppShell-header,
.mantine-AppShell-navbar,
.mantine-AppShell-aside,
._header_1bgp5_1,
._navbar_1bgp5_1,
._aside_1bgp5_1 {
  background-color: var(--yuque-sidebar-bg) !important;
  border-color: var(--yuque-border) !important;
}

.mantine-AppShell-header {
  border-bottom: 1px solid var(--yuque-border) !important;
  background-color: #ffffff !important;
}

._header_18f9g_1,
._header_sb212_1 {
  background-color: #ffffff !important;
  border-bottom: 1px solid var(--yuque-border) !important;
}

.mantine-AppShell-navbar,
.mantine-AppShell-aside,
._navbar_1bgp5_1,
._aside_1bgp5_1 {
  width: 280px !important;
}

.mantine-AppShell-main,
#main-content {
  background-color: #ffffff;
}

/* ---------- Buttons, links, inputs (primary green) ---------- */
.mantine-Button-root[data-variant="filled"],
.mantine-Button-root[data-color="blue"][data-variant="filled"] {
  background-color: var(--yuque-green);
}

.mantine-Button-root[data-variant="filled"]:hover,
.mantine-Button-root[data-color="blue"][data-variant="filled"]:hover {
  background-color: var(--yuque-green-hover);
}

.mantine-Anchor-root,
a.mantine-Text-root,
.mantine-NavLink-root[data-active] {
  --anchor-color: var(--yuque-green);
}

.mantine-NavLink-root[data-active] {
  background-color: var(--yuque-green-soft);
  color: var(--yuque-green);
}

.mantine-Checkbox-input:checked,
.mantine-Radio-radio:checked,
.mantine-Switch-input:checked + .mantine-Switch-track,
.mantine-Switch-track[data-checked] {
  background-color: var(--yuque-green);
  border-color: var(--yuque-green);
}

.mantine-Tabs-tab[data-active] {
  color: var(--yuque-green);
  border-color: var(--yuque-green);
}

.mantine-Input-input:focus,
.mantine-Input-input:focus-within,
.mantine-TextInput-input:focus,
.mantine-PasswordInput-input:focus,
.mantine-Textarea-input:focus {
  border-color: var(--yuque-green) !important;
}

/* ---------- Document tree ---------- */
.mantine-AppShell-navbar [data-selected="true"],
.mantine-AppShell-navbar [data-active],
._node_1mdy3_15[data-selected="true"],
._link_1ivk4_14[data-active],
._activeButton_1k1tz_93 {
  background-color: var(--yuque-green-soft) !important;
  color: var(--yuque-green-active) !important;
  font-weight: 600;
}

.mantine-AppShell-navbar [data-selected="true"] [class*="_text_"],
._node_1mdy3_15[data-selected="true"] ._text_1mdy3_64 {
  color: var(--yuque-green-active);
}

._node_1mdy3_15,
._pageLink_1k1tz_77,
._spaceItem_1mlmw_83,
._link_1ivk4_14 {
  border-radius: var(--yuque-radius);
  color: var(--yuque-text);
}

._node_1mdy3_15:hover,
._pageLink_1k1tz_77:hover,
._spaceItem_1mlmw_83:hover,
._link_1ivk4_14:hover,
._rowWrapper_1mdy3_86:hover {
  background-color: var(--yuque-hover) !important;
}

._tree_1mdy3_1,
._treeContainer_1mdy3_5 {
  padding-right: 4px;
}

._text_1mdy3_64,
._pageLink_1k1tz_77,
._spaceItem_1mlmw_83 {
  font-size: 14px;
  font-weight: 500;
}

._spaceName_1nhp9_1,
._pagesHeader_1k1tz_71,
._sectionHeader_1mlmw_65,
._linkHeader_1ivk4_51 {
  color: var(--yuque-text-secondary);
  font-size: 12px;
  letter-spacing: 0.02em;
}

/* ---------- Article typography ---------- */
#main-content .page-title,
#main-content .ProseMirror {
  max-width: 850px;
  margin-left: auto;
  margin-right: auto;
}

#main-content .ProseMirror,
.ProseMirror {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: var(--yuque-text);
  font-weight: 400;
}

.page-title .ProseMirror h1,
#main-content .page-title h1 {
  font-size: 36px !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
  letter-spacing: -0.02em;
  color: var(--yuque-title) !important;
  margin-top: 0 !important;
  margin-bottom: 0.6em !important;
}

.ProseMirror h1,
.ProseMirror h2,
.ProseMirror h3,
.ProseMirror h4 {
  color: var(--yuque-title);
  letter-spacing: -0.01em;
  font-weight: 650;
  line-height: 1.4;
}

.ProseMirror h1 {
  font-size: 28px !important;
  margin-top: 2em;
  margin-bottom: 0.5em;
}

.ProseMirror h2 {
  font-size: 22px !important;
  margin-top: 1.75em;
  margin-bottom: 0.5em;
  padding-bottom: 0.25em;
  border-bottom: 1px solid var(--yuque-border);
}

.ProseMirror h3 {
  font-size: 18px !important;
  margin-top: 1.5em;
  margin-bottom: 0.4em;
}

.ProseMirror p {
  margin-top: 0.6em;
  margin-bottom: 0.6em;
}

.ProseMirror a {
  color: var(--yuque-green) !important;
  border-bottom: 1px solid rgba(0, 185, 107, 0.35) !important;
  font-weight: 500;
  text-decoration: none;
}

.ProseMirror a:hover {
  border-bottom-color: var(--yuque-green) !important;
}

/* ---------- Blockquote (Yuque-style left bar) ---------- */
.ProseMirror blockquote {
  border-left: 4px solid var(--yuque-green) !important;
  background: var(--yuque-code-bg);
  margin: 1em 0 !important;
  padding: 10px 16px !important;
  color: var(--yuque-text-secondary);
  border-radius: 0 var(--yuque-radius) var(--yuque-radius) 0;
}

/* ---------- Code ---------- */
.ProseMirror :not(pre) > code {
  font-family: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  background: var(--yuque-code-bg) !important;
  color: #c41d7f !important;
  border: 1px solid var(--yuque-border);
  border-radius: 4px;
  padding: 0.15em 0.4em !important;
  font-size: 0.875em;
}

.ProseMirror .codeBlock,
.ProseMirror pre {
  background: var(--yuque-code-bg) !important;
  border: 1px solid var(--yuque-border);
  border-radius: 8px !important;
  color: var(--yuque-text) !important;
}

.ProseMirror pre {
  padding: 14px 16px !important;
  margin: 1em 0 !important;
  line-height: 1.65;
  overflow-x: auto;
}

.ProseMirror pre code {
  color: inherit !important;
  background: transparent !important;
  border: 0 !important;
  font-size: 13.5px;
  font-family: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

/* ---------- Tables ---------- */
.tableWrapper table,
.ProseMirror table {
  border-collapse: collapse;
  border: 1px solid var(--yuque-border);
  min-width: unset !important;
  width: 100%;
  margin: 1em 0;
}

.ProseMirror table th,
.ProseMirror table td {
  border: 1px solid var(--yuque-border) !important;
  padding: 8px 12px !important;
  line-height: 1.6;
}

.ProseMirror table th,
.ProseMirror table tr:first-child th {
  background: var(--yuque-code-bg) !important;
  font-weight: 600;
  color: var(--yuque-title);
}

.ProseMirror table tr:hover td {
  background: #fafafa;
}

/* ---------- Dividers, lists, callouts ---------- */
.ProseMirror hr {
  border: none !important;
  border-top: 1px solid var(--yuque-border) !important;
  margin: 1.75em 0;
}

.ProseMirror ul,
.ProseMirror ol {
  padding-left: 1.5rem;
  margin: 0.4em 0;
}

.ProseMirror li + li {
  margin-top: 0.2em;
}

/* Callout wrappers kept colorful; slightly tighten radius/padding to match Yuque alerts */
.ProseMirror .react-renderer.node-callout > div,
.ProseMirror .node-callout > div {
  border-radius: 8px;
}

/* ---------- TOC / search ---------- */
._link_yx44p_8:hover,
._linkActive_yx44p_39 {
  color: var(--yuque-green);
}

._linkActive_yx44p_39 {
  border-left-color: var(--yuque-green);
  font-weight: 600;
}

._root_xk24j_1 {
  border-radius: 8px;
}

/* Login / setup pages */
._title_1ha5n_13,
._heading_1w8qh_8,
._title_j0n55_20 {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

/* Keep presentation / dark mode readable without forcing light mode */
[data-mantine-color-scheme="dark"] {
  --mantine-color-anchor: #33d190;
  --mantine-primary-color-filled: #00B96B;
  --mantine-primary-color-filled-hover: #33d190;
}

[data-mantine-color-scheme="dark"] .ProseMirror a {
  color: #33d190 !important;
}

[data-mantine-color-scheme="dark"] .mantine-AppShell-navbar [data-selected="true"],
[data-mantine-color-scheme="dark"] ._node_1mdy3_15[data-selected="true"] {
  background-color: rgba(0, 185, 107, 0.2) !important;
  color: #33d190 !important;
}
