@mixin invisibleEmbed() {
  --embed-border-left: none;
  --embed-border-right: none;
  --embed-border-start: none;
  --embed-border-end: none;
  --embed-padding: 0;
}

body {
  --ebw-embed-border-color: var(--gray-dark-7);
  --embed-border-left: 0.0625rem solid var(--ebw-embed-border-color);
  --embed-border-right: 0.0625rem solid var(--ebw-embed-border-color);
  --embed-padding: var(--size-2-1) var(--size-4-2);
}

.theme-light {
  --ebw-embed-border-color: var(--primary-accent-1);
}

// Floating images
img,
div {
  &[alt~='float-right'] {
    float: right;
    margin-left: 1rem;
    margin-top: 1rem;
  }
  &[alt~='float-left'] {
    float: left;
    margin-right: 1rem;
    margin-top: 1rem;
  }
  // Use an anchor tag: ![Image](image.jpg#portrait)
  &[src$="#portrait"] {
    float: right;
    margin-left: 0.3125rem;
    width: 12.5rem;
    height: 12.5rem;
  }
  &[src$="#callout"] {
    float: right;
    margin-left: 0.3125rem;
    width: 50%;
  }
  &[src$="#small-right"] {
    float: right;
    margin-left: 0.3125rem;
    width: 4.6875rem;
  }
}

// Naked embeds
.markdown-embed.internal-embed[alt="invisible-embed"] {
  @include invisibleEmbed;
}

.markdown-embed {
  border-radius: var(--radius-l);
  position: relative;

  .markdown-embed-content {
    max-height: unset;
    overflow: unset;

    > .markdown-preview-view {
      // no scroll
      overflow-y: unset;
    }
  }
}

.inline-embed .markdown-embed-content {
  .markdown-rendered div > ul,
  .markdown-rendered div > ol {
    display: inline-block;
    margin-block-start: 0;
  }
}

li .internal-embed {
  blockquote {
    margin: 0;
  }
  p {
    margin-bottom: 0;
  }
  .markdown-embed-content {
    padding-right: 12px;
  }
}

// Hide the embedded header and use other styling to create uniform padding
.ebullientworks-hide-embedded-heading {
  .markdown-embed {
    .markdown-embed-title,
    .mod-header {
      display: none;
    }
    div.markdown-preview-section > div {
      > h1[data-heading]:first-of-type,
      > h2[data-heading]:first-of-type,
      > h3[data-heading]:first-of-type,
      > h4[data-heading]:first-of-type,
      > h5[data-heading]:first-of-type,
      > h6[data-heading]:first-of-type {
        display: none;
      }
    }
  }
}

// EMBED LINK
.markdown-embed-link,
.file-embed-link {
  --icon-size: var(--icon-xs);
  color: var(--ebw-link-underline);
  top: 0;
  right: 0;
}

// Scaled iframes
.embedframe iframe {
  width: 125%;
  height: 46.875rem;
  -webkit-transform: scale(.8);
  transform: scale(.8);
  -webkit-transform-origin: 0 0;
  transform-origin: 0 0;
}

.embedframe .scaled-iframe {
  width: 100%;
  height: 37.5rem;
  position: relative;
}

.markdown-source-view {
  .internal-embed {
    --list-indent: 1.6em;
    vertical-align: top;
    display: inline-block;
    width: calc(100% - 1.25rem);

    .markdown-embed-content {
      padding-right: 12px;
    }
  }

  // .HyperMD-list-line > .internal-embed {
  //   .markdown-rendered ul,
  //   .markdown-rendered ol {
  //     display: inline-block;
  //     margin-block-start: 0;
  //     margin-block-end: 0;
  //   }
  //   .markdown-preview-section {
  //     display: inline-block;
  //     blockquote {
  //       margin: 0;
  //     }
  //     p {
  //       margin-bottom: 0;
  //     }
  //   }
  // }
}
