/* The outline editor - identical in the Outliner and inside Canvas cards. */
.outline {
  font-size: 15.5px;
  line-height: 24px;
}
.blk-row {
  display: flex;
  align-items: flex-start;
  min-height: 28px;
}
.chev {
  width: 18px;
  height: 28px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  color: var(--muted);
  opacity: 0;
  padding: 0;
  transition: opacity 0.12s;
}
.chev .ico {
  transform: rotate(90deg);
  transition: transform 0.14s var(--ease);
}
.chev.collapsed .ico {
  transform: rotate(0);
}
.chev.hidden {
  visibility: hidden;
}
.blk-row:hover > .chev,
.chev:focus-visible {
  opacity: 1;
}
.bullet {
  width: 20px;
  height: 28px;
  flex: none;
  display: grid;
  place-items: center;
}
.bullet i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-2);
  opacity: 0.75;
  transition: transform 0.12s;
}
.bullet.folded i {
  box-shadow: 0 0 0 3.5px var(--line-2);
}
.bullet.has-kids {
  cursor: pointer; /* folds and opens, like the chevron */
}
.blk-row:hover > .bullet i {
  transform: scale(1.25);
}
.blk > .blk-list {
  margin-left: 27px;
  border-left: 1px solid var(--line);
}

.blk-content {
  flex: 1;
  min-width: 0;
  padding: 2px 0;
  min-height: 28px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  cursor: text;
}
.blk-content.editing {
  padding: 0;
}
.blk-content[data-ph]:not(.editing)::before {
  content: attr(data-ph);
  color: var(--muted);
  pointer-events: none;
}
.blk-input::placeholder {
  color: var(--muted);
  opacity: 1;
}
.blk-input {
  display: block;
  width: 100%;
  margin: 0;
  padding: 2px 0;
  border: 0;
  outline: 0;
  resize: none;
  overflow: hidden;
  background: transparent;
  font: inherit;
  line-height: inherit;
  color: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  caret-color: var(--accent);
}
.outline-tail {
  height: 34px;
  cursor: text;
}

/* inline marks */
a.wikilink {
  color: var(--accent-ink);
  background: var(--accent-soft);
  text-decoration: none;
  padding: 0 0.3em;
  margin: 0 -0.05em;
  border-radius: 5px;
  font-weight: 520;
  cursor: pointer;
  transition: background 0.1s;
}
a.wikilink:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}
a.wikilink.unresolved {
  background: transparent;
  color: var(--muted);
  border-bottom: 1px dashed var(--muted);
  border-radius: 0;
  padding: 0;
  margin: 0;
}
a.ext {
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 2px;
}
.tag {
  color: var(--violet);
  background: var(--violet-soft);
  padding: 0 0.35em;
  border-radius: 5px;
  font-size: 0.92em;
  cursor: pointer;
}
.outline strong {
  font-weight: 680;
}
.outline del {
  color: var(--muted);
}
.outline code {
  white-space: pre-wrap;
}
input.todo {
  margin: 0 0.55em 0 0;
  vertical-align: -2px;
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}
.done {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--line-2);
}

/* in a card the same editor is a touch tighter */
.outline-card {
  font-size: 14px;
  line-height: 21px;
}
.outline-card .blk-row {
  min-height: 25px;
}
.outline-card .chev,
.outline-card .bullet {
  height: 25px;
}
.outline-card .chev {
  width: 16px;
}
.outline-card .bullet {
  width: 18px;
}
.outline-card .blk-content {
  min-height: 25px;
  padding: 2px 0;
}
.outline-card .blk-content.editing {
  padding: 0;
}
.outline-card .blk > .blk-list {
  margin-left: 24px;
}
.outline-card .outline-tail {
  height: 14px;
}

/* A [[Note#Heading]] link arrived here: the bullet lights up for a moment (FLASH_MS in editor.js). */
.blk-row.flash {
  border-radius: 6px;
  animation: blk-flash 1.2s var(--ease);
}
@keyframes blk-flash {
  0%,
  35% {
    background: var(--accent-soft);
    box-shadow: 0 0 0 4px var(--accent-soft);
  }
  100% {
    background: transparent;
    box-shadow: 0 0 0 4px transparent;
  }
}

/* Heading suggestions in the [[ picker (after '[[Note#'). */
.ac-hash {
  width: 16px;
  flex: none;
  text-align: center;
  font-weight: 700;
  color: var(--accent-ink);
}
.ac-heading .ac-kind {
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------- touch screens
   No hover and a finger instead of a mouse: the fold control is always shown, and the chevron
   with the bullet next to it (both fold) make one target of at least 44 x 44 px in the Outliner. */
@media (pointer: coarse), (hover: none) {
  .chev,
  .bullet {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  .chev:not(.hidden) {
    opacity: 0.55;
  }
  .blk-row:hover > .bullet i {
    transform: none; /* a tap would leave the hover look stuck */
  }
  /* 16 px: iOS zooms the whole page into any text field with smaller text when it gets focus. */
  .outline-page {
    font-size: 16px;
  }
  .outline-page .blk-row {
    min-height: 44px;
  }
  .outline-page .chev,
  .outline-page .bullet {
    width: 22px;
    height: 44px;
  }
  .outline-page .blk-content {
    min-height: 44px;
    padding: 10px 0;
  }
  .outline-page .blk-content.editing {
    padding: 8px 0; /* + the textarea's own 2px: the text does not move when editing starts */
  }
  .outline-page .blk > .blk-list {
    margin-left: 33px; /* the guide line runs under the bullet */
  }
  .outline-page .outline-tail {
    height: 44px;
  }
  .outline input.todo {
    width: 20px;
    height: 20px;
    vertical-align: -4px;
  }
  /* Cards keep their row height: they were sized and placed on the canvas with it (and the canvas
     zooms anyway). The fold target is still 44 px wide. */
  .outline-card .chev {
    width: 20px;
  }
  .outline-card .bullet {
    width: 24px;
  }
  .outline-card .blk > .blk-list {
    margin-left: 32px;
  }
  .ac-item {
    min-height: 44px;
  }
}

/* --------------------------------------------- the editing toolbar (keybar.js)
   On phones and tablets, above the on-screen keyboard while a bullet is edited. keybar.js sets
   top / left / width (and a scale when the page is pinch-zoomed) from window.visualViewport. */
.keybar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 90; /* over the page; under dialogs (100), the link picker (150) and menus */
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 0 max(4px, env(safe-area-inset-right)) 0 max(4px, env(safe-area-inset-left));
  background: var(--surface);
  border-top: 1px solid var(--line-2);
  box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.06);
  transform-origin: 0 0;
  -webkit-user-select: none;
  user-select: none;
}
.keybar[hidden] {
  display: none;
}
.keybar:not(.keyboard) {
  padding-bottom: env(safe-area-inset-bottom); /* no keyboard: keep clear of the home indicator */
}
.kb-btn {
  flex: 1 1 0;
  min-width: 0;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink-2);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.kb-btn.pressed {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.kb-btn[aria-disabled='true'] {
  opacity: 0.35;
}
.kb-text {
  font: 650 15px var(--mono);
}
.kb-done {
  flex: 0 0 auto;
  padding: 0 14px;
  font: 650 15px var(--font);
  color: var(--accent-ink);
}
