.block-content-wrapper {
  /* 38px is the width of block-control */
  width: calc(100% - 38px);
}

.block-content {
  min-height: 24px;
  max-width: 100%;
  overflow: initial;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
  cursor: text;

  img {
    max-width: 100%;

    /* FIXME: img macros */

    &.left {
      float: left;
    }

    &.right {
      float: right;
    }

    &.loading-asset {
      width: 9px;
    }
  }

  .asset-container {
    display: inline-block;
    position: relative;
    margin-top: 0.5rem;

    .ctl {
      position: absolute;
      top: 0;
      right: 0;
      padding: 5px;
      z-index: 1;
      display: none;

      > a {
        padding: 3px;
        border-radius: 4px;
        opacity: 0.4;
        user-select: none;
        background: var(--ls-primary-background-color);

        &.delete {
          svg {
            color: var(--ls-primary-text-color);

            opacity: 0.5;
            font-weight: normal;
          }
        }

        &:hover {
          opacity: 1;
        }

        &:active {
          opacity: 1;
        }
      }
    }

    &:hover {
      .ctl {
        display: flex;
      }
    }
  }

  .resize {
    display: inline-flex;
    /* Fix chrome missing resize handle issue https://bugs.chromium.org/p/chromium/issues/detail?id=1135676&q=css%20resize%20type%3DBug&can=2.*/
    transform: translate3d(0, 0, 0);
  }

  .draw [aria-labelledby="shapes-title"] {
    position: absolute;
    left: 50%;
    transform: translate(-50%);
  }

  &-fallback-ui {
    padding:10px 15px;
    border-color: var(--ls-secondary-border-color);
  }
}

.open-block-ref-link {
  background-color: var(--ls-page-properties-background-color);
  padding: 1px 4px;
  border-radius: 2px;
}

.block-body {
  blockquote:first-child,
  pre:first-child {
    margin-top: 8px;
    margin-bottom: 8px;
  }
}

.block-body ul,
.block-body ol,
.block-body dl {
  margin-bottom: 0em;

  > li {
    margin: 0;
  }
}

.block-body ol {
  list-style-position: inside;
  margin-left: 0;

  > li {
    &::marker,
    > p {
      display: initial;
    }
  }
}

.block-children {
  border-left: 1px solid;
  border-left-color: var(--ls-guideline-color, #ddd);

  padding-top: 2px;
  padding-bottom: 3px;

  > .ls-block {
    &:last-child {
      margin-bottom: -5px;
    }
  }
}

.block-control, .block-control:hover {
  @apply: opacity-50.hover:opacity-100;
  text-decoration: none;
  cursor: pointer;
  font-size: 14px;
  min-width: 22px;
  min-height: 22px;
  padding: 2px;
  color: initial;
  user-select: none;

  .control-hide {
    display: none;
  }
 }

.block-ref {
  border-bottom: 0.5px solid;
  border-bottom-color: var(--ls-block-ref-link-text-color);
  cursor: alias;
  padding: 2px 0;
  display: inline;

  &:hover {
    color: var(--ls-link-text-hover-color);
  }

  .block-content {
    cursor: inherit;
  }
}

.block-ref-no-title {
    border-bottom: 0.5px solid;
    border-bottom-color: var(--ls-block-ref-link-text-color);
    cursor: alias;
    padding: 2px 5px;
    display: block;

    &:hover {
        color: var(--ls-link-text-hover-color);
    }

    .block-content {
        cursor: inherit;
    }
}

.page-ref {
  color: var(--ls-link-ref-text-color);

  &:hover {
    color: var(--ls-link-ref-text-hover-color);
  }
}

.asset-ref {
  &-wrap {
    &[data-ext=pdf] {
      display: inline-flex;
      align-items: center;
    }
  }
}

.embed-page {
  @apply py-2 my-2 px-2;

  > section {
    margin-bottom: 5px;
  }

  &.in-sidebar {
    background-color: var(--ls-tertiary-background-color);
  }
}

.block-properties {
  margin: 4px 0;
  padding: 4px 8px;
  background-color: var(--ls-block-properties-background-color, #f0f8ff);
}

.page-properties {
  background-color: var(--ls-page-properties-background-color);
}

.block-marker {
  padding: 2px 4px;
  opacity: 0.7;
  font-size: 85%;
  margin: 0 2px 0 0px;
  font-weight: 650;
  border: 0px;
}

.marker-switch {
  &:hover {
    color: var(--ls-link-text-hover-color);
    opacity: 1;
  }
}

.ls-block {
  @apply: .flex.flex-col.rounded-sm;
  position: relative;
  min-height: 24px;
  padding: 2px 0;
  border-bottom: 1px solid transparent;

  &.selected {
    border-bottom-color: var(--ls-primary-background-color);

    &:last-child {
      border-bottom-color: transparent;
    }
  }

  img {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  }
}

.ls-block,
.editor-wrapper {
  margin-right: auto;
  margin-left: auto;
}

.ls-block h1,
.editor-inner .h1 {
  font-size: 2em;
  min-height: 1.5em;
}

.ls-block h2,
.editor-inner .h2 {
  font-size: 1.5em;
  min-height: 1.5em;
}

.ls-block h3,
.editor-inner .h3 {
  font-size: 1.17em;
  min-height: 1.17em;
}

.ls-block h4,
.editor-inner .h4 {
  font-size: 1.12em;
  min-height: 1.12em;
}

.ls-block h5,
.editor-inner .h5 {
  font-size: 0.83em;
  min-height: 0.83em;
}

.ls-block h6,
.editor-inner .h6 {
  font-size: 0.75em;
  min-height: 0.75em;
}

.ls-block :is(h1, h2, h3, h4, h5, h6),
.editor-inner :is(.h1, .h2, .h3, .h4, .h5, .h6) {
  font-weight: 600;
}

.ls-block :is(h1, h2),
.editor-inner :is(.h1, .h2) {
  border-bottom: 1px solid var(--ls-quaternary-background-color);
  margin: 0.4em 0 0;
}

.block-ref .ls-block :is(h1, h2),
.block-ref .editor-inner :is(.h1, .h2) {
  border-bottom: none;
}

.block-ref :is(h1, h2, h3, h4, h5, h6) {
    border-bottom: none;
    font-size: 1rem;
}

.document-mode .ls-block h1,
.document-mode .editor-inner .h1 {
  margin: 0.67em 0;
}
.document-mode .ls-block h2,
.document-mode .editor-inner .h2 {
  margin: 0.75em 0;
}
.document-mode .ls-block h3,
.document-mode .editor-inner .h3 {
  margin: 0.83em 0;
}
.document-mode .ls-block h4,
.document-mode .editor-inner .h4 {
  margin: 1.12em 0;
}
.document-mode .ls-block h5,
.document-mode .editor-inner .h5 {
  margin: 1.5em 0;
}
.document-mode .ls-block h6,
.document-mode .editor-inner .h6 {
  margin: 1.67em 0;
}

.document-mode .ls-block {
    margin-bottom: 1rem;
}

.color-level {
  background-color: var(--color-level-1);
}

.color-level .color-level {
  background-color: var(--color-level-2);
}

.color-level .color-level .color-level {
  background-color: var(--color-level-3);
}

.color-level .color-level .color-level .color-level {
  background-color: var(--color-level-4);
}

.color-level .color-level .color-level .color-level .color-level {
  background-color: var(--color-level-5);
}

.color-level .color-level .color-level .color-level .color-level .color-level {
  background-color: var(--color-level-3);
}

.color-level .color-level .color-level .color-level .color-level .color-level .color-level {
  background-color: var(--color-level-4);
}

.color-level .color-level .color-level .color-level .color-level .color-level .color-level .color-level {
  background-color: var(--color-level-5);
}

.color-level .color-level .color-level .color-level .color-level .color-level .color-level .color-level .color-level {
  background-color: var(--color-level-3);
}

.color-level .color-level .color-level .color-level .color-level .color-level .color-level .color-level .color-level .color-level {
  background-color: var(--color-level-4);
}

.color-level .color-level .color-level .color-level .color-level .color-level .color-level .color-level .color-level .color-level .color-level {
  background-color: var(--color-level-5);
}

.bullet-container {
  display: flex;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  justify-content: center;
  align-items: center;

  .bullet-heading {
    background-color: var(--ls-block-bullet-color, #8fbc8f);
  }

  .bullet {
    border-radius: 50%;
    width: 6px;
    height: 6px;
    background-color: var(--ls-block-bullet-color, #394b59);
    transition: transform 0.2s;
  }

  &.bullet-closed {
    background-color: var(--ls-block-bullet-border-color, #ced9e0);
  }
}

a:hover > .bullet-container .bullet {
  transform: scale(1.4);
}

a:hover > .bullet-container {
    background-color: var(--ls-block-bullet-border-color, #ced9e0);
}

.doc-mode {
  margin-left: -16px;

  .block-children {
    border-left: none;
  }

  .hide-inner-bullet .bullet {
    display: none;
  }
}

/* copied from https://github.com/drdogbot7/tailwindcss-responsive-embed */
.embed-responsive {
  position: relative;
  display: block;
  height: 0;
  padding: 0;
  overflow: hidden;

  .embed-responsive-item,
  iframe,
  embed,
  object,
  video {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100%;
    width: 100%;
    border: 0;
  }
}

.embed {
  border-radius: var(--ls-border-radius-low);
}

.embed-header {
  font-weight: 600;
}

a.filter svg {
  transform: scale(0.9);
}

.table-query-properties svg {
    display: inline;
}

.query-title {
    background: var(--ls-page-properties-background-color);
}

.ls-card {
    height: 100%;
}

@media (min-width: 1024px) {
    .ui__modal-panel .ls-card {
        min-height: 24rem;
    }
}

a[data-ref="card"], .page-reference[data-ref="card"] {
    opacity: 0.3;
}

.ls-card a[data-ref="card"], .ls-card .page-reference[data-ref="card"] {
    display: none;
}

span.cloze {
    color: var(--ls-cloze-text-color);
}

span.cloze-revealed {
    color: var(--ls-cloze-text-color);
    text-decoration: underline;
    text-underline-position: under;
}

.page-property-key {
  color: var(--ls-secondary-text-color);
}

.block-parents a {
  color: var(--ls-primary-text-color);
}

.block-parents a:hover {
  opacity: 1;
}
