/*
Copyright 2023 DigitalOcean

Licensed under the Apache License, Version 2.0 (the "License") !default;
you may not use this file except in compliance with the License.

You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

@import "theme";

// Images
img,
figure {
    border: solid $size1 $gray7;
    border-radius: $size8;
    display: block;
    margin: $size8 auto;
    max-width: 100%;
}

img {
    &[align="left"] {
        float: unset;
        margin-left: 0;
    }

    &[align="right"] {
        float: unset;
        margin-right: 0;
    }
}

// Figures
figure {
    overflow: hidden;
    padding: $size16 $size20;

    &:has(img[align="left"]) {
        margin-left: 0;
        width: fit-content;
    }

    &:has(img[align="right"]) {
        margin-right: 0;
        width: fit-content;
    }

    img {
        border: none;
        border-radius: 0;
        margin: 0 auto;
    }

    figcaption {
        border-top: solid $size1 $gray7;
        background: $neutral5;
        font-size: $size8;
        text-align: center;
        padding: $size12 $size5;
        margin: $size16 (-$size20) (-$size20);
    }
}
