/**
 * Single text style.
 *
 * @author GLIDE ARTS STUDIO
 *
 * stylelint-disable custom-property-pattern
 */

/* Figure */
figure.wp-block-image.aligncenter {
    text-align: center;
}

figure.wp-block-gallery.is-layout-flex {
    gap: var(--wp--preset--spacing--x-small) !important;

    @media (width >= 340px) {
        display: grid;
        place-items: flex-start;
    }

    @media (width >= 768px) {
        gap: var(--wp--preset--spacing--small) !important;
    }

    @media (width >= 1280px) {
        gap: var(--wp--preset--spacing--normal) !important;
    }
}

figure.wp-block-gallery.has-nested-images.columns-default,
figure.wp-block-gallery.has-nested-images.columns-2 {
        grid-template-columns: repeat(2, 1fr);
}

figure.wp-block-gallery.has-nested-images.columns-3 {
        grid-template-columns: repeat(3, 1fr);
}

figure.wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image),
figure.wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image) {
    width: 100% !important;
}

figure.wp-block-image img {
    width: 100%;
    max-width: 100%;
    object-fit: cover;
    height: auto;
}

figure.wp-block-image img[style*="aspect-ratio"] {
    width: 100%;
    height: 100%;
}

figcaption.wp-element-caption {
    margin-block-start: 8px;
    font-size: var(--wp--preset--font-size--x-small);
    font-weight: 400;
    line-height: 1.7;
    opacity: 0.8;

    @media (width >= 768px) {
        line-height: 1.75;
    }

    @media (width >= 1200px) {
        line-height: 1.8;
    }
}

/* Paragraph */
p.wp-block-paragraph,
:where(.type-post) p {
    font-size: var(--wp--preset--font-size--normal);
    font-weight: 400;
    line-height: 1.85;

    @media (width >= 768px) {
        line-height: 1.9;
    }

    @media (width >= 1200px) {
        line-height: 2;
    }
}

p.has-x-small-font-size {
    font-size: var(--wp--preset--font-size--x-small);
}

p.has-small-font-size {
    font-size: var(--wp--preset--font-size--small);
}

p.has-normal-font-size {
    font-size: var(--wp--preset--font-size--normal);
}

p.has-medium-font-size {
    font-size: var(--wp--preset--font-size--medium);
}

p.has-large-font-size {
    font-size: var(--wp--preset--font-size--large);
}

p.has-x-large-font-size {
    font-size: var(--wp--preset--font-size--x-large);
}

p.has-text-align-left {
    text-align: left;
}

p.has-text-align-right {
    text-align: right;
}

p.has-text-align-center {
    text-align: center;
}

/* List */
ol.wp-block-list,
ul.wp-block-list {
    --bullet-inline-space: 1.3em;

    font-size: var(--wp--preset--font-size--normal);
    font-weight: 400;
    line-height: 1.85;
    padding-inline-start: 0;

    @media (width >= 768px) {
        line-height: 1.9;
    }

    @media (width >= 1200px) {
        line-height: 2;
    }
}

ol.wp-block-list {
    counter-reset: count;
}

ol.wp-block-list > li,
ul.wp-block-list > li {
    list-style-type: none;
    position: relative;
    padding-inline-start: var(--bullet-inline-space);
}

ol.wp-block-list > li {
    counter-increment: count;
}

ol.wp-block-list:is(.footnote, .-footnote) > li {
    padding-inline-start: calc(var(--bullet-inline-space) * 2);
}

ol.wp-block-list > li:nth-child(n + 10) {
    padding-inline-start: calc(var(--bullet-inline-space) * 1.4);
}

ol.wp-block-list:is(.footnote, .-footnote) > li:nth-child(n + 10) {
    padding-inline-start: calc(var(--bullet-inline-space) * 2.2);
}

:is(ol.wp-block-list, ul.wp-block-list) > li::before {
    position: absolute;
    top: 0;
    left: 0;
    content: '・';
}

ol.wp-block-list > li::before {
    content: counter(count) '. ';
}

ol.wp-block-list:is(.footnote, .-footnote) > li::before {
    content: '※' counter(count) '. ';
}

ul.wp-block-list:is(.footnote, .-footnote) > li::before {
    content: '※';
}

ol.wp-block-list > li > ol {
    counter-reset: child-count;
}

ol.wp-block-list > li > ol > li {
    counter-increment: child-count;
    padding-inline-start: calc(var(--bullet-inline-space) * 1.8);
}

ol.wp-block-list > li > ol > li::before {
    content: counter(count) '-' counter(child-count) '. ';
}

/* Separator */
hr.wp-block-separator,
hr.wp-block-separator.is-style-default,
hr.wp-block-separator.is-style-dots,
hr.block-editor-block-list__block[data-type="core/separator"] {
    width: 100%;
    padding-block: var(--wp--preset--spacing--medium);
    border: none;
    position: relative;
    line-height: 0;
    text-align: center;
    border-top: none;

    &::before,
    &.is-style-default::before,
    &.is-style-dots::before {
        padding-left: 2em;
        font-family: serif;
        font-size: 1.5em;
        letter-spacing: 2em;
        content: "···";
        border: none;
    }

    &.is-style-wide {
        border-top: 1px solid;
    }

    &.is-style-wide::before {
        display: none;
    }

    &.has-alpha-channel-opacity {
        opacity: 0.7;
    }
}

