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

  @screen sm {
    width: calc(100% - 33px);
    overflow-x: visible;
  }
}

.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-container {
  position: relative;
}

.block-children-left-border {
  z-index: 1;
  width: 4px;
  left: -1px;
  top: 0;
  height: 100%;
  cursor: pointer;
  background-clip: content-box;
  background-color: transparent;
  position: absolute;
  border-radius: 2px;
}

.block-children-left-border:hover {
  background-color: var(--ls-primary-text-color);
}

.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 {
  text-decoration: none;
  cursor: default;
  font-size: 14px;
  min-width: 22px;
  min-height: 22px;
  padding: 2px;
  color: initial;
  user-select: none;

  .control-hide {
    display: none;
  }
}

.block-left-menu {
    background-color: var(--ls-secondary-background-color);
    background: linear-gradient(90deg, var(--ls-primary-background-color) 0%, var(--ls-secondary-background-color) 100%);

    .commands-button {
        overflow: hidden;
        max-width: 40px;
        text-align: center;
        margin: auto 0;

        .indent {
            opacity: 30%;
        }
    }
}

.block-right-menu {
    background-color: var(--ls-secondary-background-color);
    /* background: linear-gradient(-90deg, var(--ls-primary-background-color) 0%, var(--ls-secondary-background-color) 100%); */

    .commands-button {
        overflow: hidden;
        text-align: center;
        margin: auto 0;

        .outdent {
            margin: 0 12px;
            opacity: 30%;
        }

        .more {
            margin: 0 12px;
            opacity: 30%;
        }
    }
}

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

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

  .block-content {
    cursor: inherit;

    &-inner {
      display: inherit;

      > * {
        display: 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;
    }
  }

  &.is-doc {
      &:before {
          content: "[[📜";
          opacity: .7;
          margin-right: 4px;
      }

      &:after {
          content: "]]";
          opacity: .7;
      }
  }
}

.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 {
  position: relative;
  min-height: 24px;
  padding: 2px 0;
  border-bottom: 1px solid transparent;
  transition: background-color 0.3s cubic-bezier(0.16, 1, 0.3, 1);

  &.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.uniline-block {
  font-size: 2em;
  min-height: 1.5em;
}

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

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

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

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

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

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

.ls-block :is(h1, h2),
.editor-inner .uniline-block: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 .block-children {
  border-left: 0px solid;
}

.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-left-border {
    display: 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;
}

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

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

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

.page-property-key:hover {
    background-color: var(--ls-selection-background-color);
}

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

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

.cp__fenced-code-block {
  .not-edit {
    cursor: default;
  }
}

html.is-native-ios {
    audio {
        width: 100%;
        max-width: 350px;
    }
}

html:not(.is-mac) {
    body[data-active-keystroke="Control"] {
        .block-content {
            cursor: pointer;
        }
    }
}

html.is-mac {
    body[data-active-keystroke="Meta"] {
        .block-content {
            cursor: pointer;
        }
    }
}
