.admonition {
  position: relative;
  margin: 1rem 0;
  padding: 0 0.75rem;
  border-left: .25rem solid;
  overflow: hidden;
  background-color: fixit-var(admonition-bg-color);
  border-left-color: fixit-var(admonition-color);
  @include border-radius;

  .admonition-title {
    font-weight: fixit-var(admonition-title-font-weight, bold);
    margin: 0 -0.75rem;
    padding: 0.25rem 1.8rem;
    border-bottom: 1px solid;
    position: relative;
    @include border-radius(0);

    strong {
      font-weight: bolder;
      text-shadow: 0 0.05rem 0.05rem rgba(0, 0, 0, 0.2);

      [data-theme=dark] & {
        text-shadow: 0 0.05rem 0.05rem rgba(255, 255, 255, 0.2);
      }
    }

    // title-only admonition without content
    &:not(:has(+ .details-content)) {
      @include set-fixit-var(admonition-title-font-weight, normal);
      padding: 0.75rem 1rem 0.75rem 2.2rem;
      border: 0;

      i.icon {
        left: 1.1rem;
        font-size: 1rem;
      }
    }
  }

  > .admonition-title {
    border-bottom-color: fixit-var(admonition-bg-color);
    background-color: fixit-var(admonition-bg-color-collapsed);
    transition: all 0.2s ease;

    i.icon {
      color: fixit-var(admonition-color);
    }
  }

  &.open > .admonition-title {
    background-color: fixit-var(admonition-bg-color);
  }

  .admonition-content {
    padding: 0.5rem 0;
    
    // for extended alert syntax
    > p {
      margin: 0;
    }

    // reset sticky header position in code block when inside admonition
    .code-block .code-header,
    .code-tabs .tabs-header {
      top: initial !important;
    }
  }

  i.icon {
    font-size: 0.85rem;
    position: absolute;
    top: 50%;
    left: 0.9rem;
    translate: -50% -50%;
  }

  i.details-icon {
    position: absolute;
    top: 50%;
    right: 0.9rem;
    translate: 50% -50%;
  }

  // default admonition type is note
  @include set-fixit-vars((
    admonition-color: map-get(map-get($admonition-color-map, note), color),
    admonition-bg-color: map-get(map-get($admonition-color-map, note), bg-color),
    admonition-bg-color-collapsed: opacify(map-get(map-get($admonition-color-map, note), bg-color), 0.15),
  ));

  // set color for each admonition type
  @each $type, $item in $admonition-color-map {
    @if $type != 'note' {
      &.#{$type} {
         @include set-fixit-vars((
          admonition-color: map-get($item, color),
          admonition-bg-color: map-get($item, bg-color),
          admonition-bg-color-collapsed: opacify(map-get($item, bg-color), 0.15),
        ));
      }
    }
  }

  &:last-child {
    margin-bottom: 0.75rem;
  }

  // content-only admonition without title
  &:not(:has(.admonition-title)) {
    border: 1px solid fixit-var(admonition-bg-color);

    .admonition-content {
      padding: 0.75rem 0.25rem;
    }
  }
}
