/* Bullets: one thought per block, a faint guide line under nested children, and the editor
   that replaces a block's text during typing. The editor uses exactly the same metrics as the
   rendered text, so nothing jumps when a block switches between the two. */

.blocks { list-style: none; padding: 0; margin: 0; }
.block { position: relative; padding-left: 24px; }
.block > .blocks {
  margin-left: -12.5px;
  padding-left: 12.5px;
  background: linear-gradient(var(--rule), var(--rule)) no-repeat 0 0 / 1px 100%;
}

.row {
  position: relative;
  font-family: var(--font-note);
  font-size: var(--t-note);
  line-height: 1.6;
  border-radius: 5px;
}

/* the bullet: a dot to the left of the text; also the drag handle and fold toggle */
.bullet {
  position: absolute;
  left: -22px;
  top: 3px;
  width: 18px;
  height: 1.6em;
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none;
  border-radius: 50%;
}
.bullet::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--ink-3); }
.bullet:hover::after { background: var(--ink-2); box-shadow: 0 0 0 4px var(--rule); }
.block.folded > .row .bullet::after { background: var(--ink-2); box-shadow: 0 0 0 4px var(--rule); }
.placeholder .bullet { cursor: text; }
.dragging { opacity: .4; }

.content {
  padding-block: 3px;
  min-height: calc(1.6em + 6px);
  overflow-wrap: anywhere;
  cursor: text;
}
.content .t { white-space: pre-wrap; }
.placeholder-text { color: var(--ink-3); }

.editor {
  display: block;
  width: calc(100% + 14px);
  margin: 0 -7px;
  padding: 3px 7px;
  border: 0;
  border-radius: 5px;
  resize: none;
  overflow: hidden;
  font: inherit;
  line-height: inherit;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--rule), 0 1px 3px rgb(27 30 43 / .06);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.editor:focus { outline: none; box-shadow: 0 0 0 1px var(--thread), 0 0 0 3px var(--thread-wash); }
.row.selected { background: var(--select); box-shadow: 0 0 0 4px var(--select); }

/* block types */
.content.h1 { font-size: 1.45em; font-weight: 650; line-height: 1.3; padding-top: 8px; }
.content.h2 { font-size: 1.25em; font-weight: 650; line-height: 1.35; padding-top: 6px; }
.content.h3 { font-size: 1.08em; font-weight: 650; }
.content.quote { border-left: 2px solid var(--rule); padding-left: 12px; color: var(--ink-2); font-style: italic; }
.content.done .t { color: var(--ink-2); text-decoration: line-through; text-decoration-color: var(--ink-3); }

/* inline markdown */
.ref { color: var(--thread); }
.ref:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.br { color: var(--ink-3); font-weight: 400; }
.no-brackets .br { display: none; }
.tag { color: var(--tag); }
.tag:hover { color: var(--thread); }
.attr { font-weight: 650; }
.attr a:hover { color: var(--thread); }
.alias { text-decoration: underline dotted; text-underline-offset: 3px; }
.external { color: var(--thread); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.external:hover { text-decoration-color: currentColor; }
mark { background: var(--mark); color: var(--mark-ink); padding: 0 .14em; border-radius: 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
mark mark { background: none; text-decoration: underline 2px; text-decoration-color: var(--mark-ink); }
strong { font-weight: 650; }
s { color: var(--ink-2); }
.content code {
  font-family: var(--font-mono);
  font-size: .84em;
  background: var(--shelf);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0 .3em;
}
.content pre.code-block {
  margin: 4px 0;
  padding: 10px 12px;
  background: var(--shelf);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow-x: auto;
  font-size: .85em;
  line-height: 1.5;
  white-space: pre;
}
.content pre.code-block code { border: 0; padding: 0; background: none; font-size: 1em; }
.content hr { border: 0; border-top: 1px solid var(--rule); margin: .8em 0; }

.check {
  display: inline-block;
  position: relative;
  width: .8em;
  height: .8em;
  border: 1.5px solid var(--ink-3);
  border-radius: 3px;
  vertical-align: -0.06em;
  margin-right: .45em;
  cursor: pointer;
}
.check:hover { border-color: var(--thread); }
.check.on { background: var(--thread); border-color: var(--thread); }
.check.on::after {
  content: "";
  position: absolute;
  left: .2em;
  top: .04em;
  width: .22em;
  height: .44em;
  border: solid var(--on-thread);
  border-width: 0 .12em .12em 0;
  transform: rotate(45deg);
}

.drop-indicator { position: fixed; height: 2px; background: var(--thread); border-radius: 1px; z-index: 50; pointer-events: none; }
.drag-ghost {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  max-width: 320px;
  padding: 4px 10px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 6px;
  box-shadow: var(--shadow-float);
  font-family: var(--font-note);
  font-size: var(--t-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 760px) {
  .block { padding-left: 20px; }
  .bullet { left: -20px; }
}
