/* The Docs tab's CodeMirror editor (docs-editor.js), drawn to match the old
   rich-text body: prod's spacing, section indents, list
   markers, inline styles. Only loaded/used when DocsEditor is enabled. */

.docs-cm {
  --note-indent: 10px;
  position: relative;
}

@media (max-width: 699px) {
  .docs-cm {
    --note-indent: 6px;
  }
}

.docs-cm[hidden] {
  display: none;
}

/* Lines: section indent, then the gap a text line or block ends in. */
.docs-cm .cm-line.cm-ln {
  padding: 0 0 0 calc(var(--sec, 0) * var(--note-indent));
  position: relative;
}

.docs-cm .cm-ln.gap-line {
  padding-bottom: calc(0.94rem * 1.55) !important;
}

.docs-cm .cm-ln.gap-list {
  padding-bottom: 0.3em !important;
}

.docs-cm .cm-ln.h1-spaced {
  padding-top: 2em !important;
}

/* Headings (old: .day-note-rich h1-h3, .note-doc h1). */
.docs-cm .cm-h {
  font-weight: 750;
  line-height: 1.25;
}

.docs-cm .cm-h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.docs-cm .cm-h2 {
  font-size: 1.18em;
}

.docs-cm .cm-h3 {
  font-size: 1.05em;
}

.docs-cm .cm-zoom-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 6px;
  vertical-align: middle;
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.45);
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.12s ease;
}

.docs-cm .cm-line:hover .cm-zoom-btn {
  opacity: 1;
}

.docs-cm .cm-zoom-btn:hover {
  background: #252525;
  color: #fff;
}

/* Inline. */
.docs-cm .cm-b {
  font-weight: 700;
}

.docs-cm .cm-i {
  font-style: italic;
}

.docs-cm .cm-u {
  text-decoration: underline;
}

.docs-cm .cm-s {
  text-decoration: line-through;
}

.docs-cm .cm-mark {
  background: #5c4a0f;
  border-radius: 3px;
  padding: 0 2px;
}

.docs-cm .cm-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
  font-weight: 550;
  background: #252525;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 0.05em 0.35em;
  color: #d6e4f0;
}

.docs-cm .cm-link {
  color: #5b9cff;
  text-decoration: underline;
  text-decoration-color: rgba(91, 156, 255, 0.45);
  text-underline-offset: 2px;
}

.docs-cm .cm-raw {
  color: #6b6b6b;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8em;
}

.docs-cm .cm-chip {
  display: inline-block;
  padding: 0 6px;
  margin: 0 1px;
  border-radius: 5px;
  background: #252525;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.9em;
  line-height: 1.4;
}

.docs-cm .cm-chip.is-ref {
  color: #9acced;
  cursor: pointer;
}

.docs-cm .cm-chip.is-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: rgba(255, 255, 255, 0.72);
}

.docs-cm .cm-img {
  display: inline-block;
  max-width: 100%;
  border-radius: 6px;
  vertical-align: top;
}

/* Lists (old .note-list): grey markers, nested steps of 1.5em, wrapped
   lines hang past the marker. */
.docs-cm .cm-line.cm-li {
  --hang: 1.5em;
  padding-left: calc(var(--sec, 0) * var(--note-indent) + var(--li-level, 0) * 1.5em + var(--hang)) !important;
  text-indent: calc(-1 * var(--hang));
}

.docs-cm .cm-line.cm-li.cm-li-number {
  --hang: 1.8em;
}

.docs-cm .cm-li > * {
  text-indent: 0;
}

.docs-cm .cm-bullet {
  display: inline-block;
  width: 1.5em;
  color: var(--text-muted);
  text-indent: 0;
}

.docs-cm .cm-num {
  display: inline-block;
  min-width: 1.4em;
  margin-right: 0.4em;
  text-align: right;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  text-indent: 0;
}

.docs-cm .cm-check {
  position: relative;
  display: inline-block;
  width: 0.95em;
  height: 0.95em;
  margin-right: 0.55em;
  vertical-align: -0.12em;
  box-sizing: border-box;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  border-radius: 4px;
  cursor: pointer;
  text-indent: 0;
}

.docs-cm .cm-check:hover {
  border-color: rgba(255, 255, 255, 0.75);
}

.docs-cm .cm-check.is-checked {
  background: var(--accent-ios);
  border-color: var(--accent-ios);
}

.docs-cm .cm-check.is-checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 45%;
  width: 0.24em;
  height: 0.48em;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

/* Divider, tables, quotes, code blocks. */
.docs-cm .cm-hr {
  display: inline-block;
  width: 100%;
  height: 14px;
  position: relative;
  vertical-align: middle;
}

.docs-cm .cm-hr::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: #464646;
}

.docs-cm .cm-hr.is-thick::after {
  height: 3px;
  margin-top: -1px;
  background: #5e5e5e;
}

.docs-cm .cm-table-wrap {
  padding: 4px 0 calc(0.94rem * 1.55);
  cursor: text;
}

.docs-cm .cm-table {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
  font-weight: 500;
}

.docs-cm .cm-table td {
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 5px 8px;
  vertical-align: top;
  word-break: break-word;
}

.docs-cm .cm-table tr:first-child td {
  font-weight: 700;
  background: #1e1e1e;
}

.docs-cm .cm-quote {
  border-left: 3px solid rgba(255, 255, 255, 0.18);
  padding-left: 14px !important;
  color: rgba(255, 255, 255, 0.85);
}

.docs-cm .cm-codeblock {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82em;
  background: #0c0c0c;
  color: #d6e4f0;
}

/* The app's blocks (AI blocks, reminders) in place of their tokens. */
.docs-cm .cm-app-block {
  display: block;
  white-space: normal;
  text-indent: 0;
  cursor: auto;
}

.docs-cm .cm-app-block > .note-agent,
.docs-cm .cm-app-block > .note-remind,
.docs-cm .cm-app-block > .note-callout {
  margin: 4px 0;
}

/* In the floating note: the box scrolls itself, so no room below the text. */
.docs-cm.docs-cm-float .cm-content {
  padding-bottom: 1.5em !important;
}

.docs-cm.docs-cm-float:focus-within {
  border-color: rgba(255, 255, 255, 0.28);
  background: #202020;
}

/* .feat-note-editor sets display: block, which would beat [hidden]: the
   float's old and new editors swap with the attribute. */
.day-note-editor-main .feat-note-editor[hidden] {
  display: none !important;
}

/* / menu icons for the commands the old menu didn't have (the rest use
   .note-command-icon.is-* from styles.css). */
.note-command-icon.is-h1,
.note-command-icon.is-h2,
.note-command-icon.is-h3 { background: #94a3b8; }
.note-command-icon.is-divider { background: #cbd5e1; }

/* Markdown markers on the selected line(s): grey, regular weight, no
   highlight background (they sit inside the styled span). */
.docs-cm .cm-md-mark {
  color: rgba(255, 255, 255, 0.35);
  font-weight: 500;
  font-style: normal;
  text-decoration: none;
}

.docs-cm .cm-mark .cm-md-mark,
.docs-cm .cm-code .cm-md-mark {
  background: transparent;
}

/* $$tex$$ (KaTeX); a line of its own is display math. */
.docs-cm .cm-math.is-display {
  display: inline-block;
  width: 100%;
  margin: 6px 0;
  overflow-x: auto;
  text-align: center;
}
