/* THEME STYLES */

/* Ensure block gap is applied to all child elements */
.wp-block-media-text__content > * {
    margin-top: var(--wp--style--block-gap);
}

/* Ensure block uses flex gap instead of padding for spacing */
.wp-block-media-text {
    gap: var(--wp--preset--spacing--80);
}

.wp-block-media-text .wp-block-media-text__content {
    padding: 0;

    & > :first-child {
        margin-top: 0;
    }

    & > :last-child {
        margin-bottom: 0;
    }
}

@media screen and (min-width: 768px) {
    .wp-block-media-text.is-image-fill-element .wp-block-media-text__content {
        padding: var(--wp--custom--global--spacing--padding--background) 0;
    }
}

/* Apply base border radius */
.wp-block-media-text.has-background,
.wp-block-media-text__media,
.wp-block-media-text__media img {
    border-radius: var(--wp--custom--global--border--radius--base);
}

/* CUSTOM STYLES */
.wp-block-media-text.is-style-view-outside-frame .wp-block-media-text__media,
.wp-block-media-text.is-style-peek-inside-frame .wp-block-media-text__media {
    position: relative;
    overflow: hidden;
    background-color: var(--wp--preset--color--primary);
    aspect-ratio: 1/1;
}

.wp-block-media-text.is-style-view-outside-frame .wp-block-media-text__media:before,
.wp-block-media-text.is-style-peek-inside-frame .wp-block-media-text__media img {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 35%;
    max-height: 80%;
    height: auto;
    min-height: auto;
    transform: translate(-50%, -50%);
    z-index: 10;
    aspect-ratio: 180/240;
    background-color: var(--wp--preset--color--primary);
    border-top-left-radius: 100vw;
    border-top-right-radius: 100vw;
}

/* Colors */

/* .is-style-section-base .wp-block-media-text.is-style-view-outside-frame .wp-block-media-text__media,
.is-style-section-base .wp-block-media-text.is-style-peek-inside-frame .wp-block-media-text__media {
    background-color: var(--wp--preset--color--base-variant);
} */

.is-style-section-primary .wp-block-media-text.is-style-view-outside-frame .wp-block-media-text__media,
.is-style-section-primary .wp-block-media-text.is-style-peek-inside-frame .wp-block-media-text__media {
    background-color: var(--wp--preset--color--base);
}

/* Image Mask */
.wp-block-media-text.is-style-image-mask .wp-block-media-text__media.is-bg-from-img {
  background-position: var(--bg-x, 50%) var(--bg-y, 50%);
  background-size: var(--bg-size, 115%);
  background-repeat: no-repeat;
  position: relative;
  width: 100%;
  aspect-ratio: 1/1;
  overflow: hidden;
  isolation: isolate;
  &:before {
    content:'';
    display: block;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    position: absolute;  pointer-events: none;
    background:
        radial-gradient(80% 80% at 50% 45%,
        rgba(0,0,0,0) 0%,
        rgba(0,0,0,0.15) 45%,
        rgba(0,0,0,0.55) 100%
        ),
        radial-gradient(120% 90% at 50% -10%,
        rgba(0,0,0,0.65) 0%,
        rgba(0,0,0,0.25) 40%,
        rgba(0,0,0,0) 70%
        ),
        linear-gradient(
        to bottom,
        rgba(0,0,0,0.25) 0%,
        rgba(0,0,0,0.10) 35%,
        rgba(0,0,0,0.30) 100%
        );

    filter: blur(2px);
    transform: scale(1.03);
    mix-blend-mode: multiply;
    opacity: 0.6;
  }
}

.wp-block-media-text.is-style-image-mask
.wp-block-media-text__media.is-bg-from-img
.parallax-imgwrap {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 35%;
  max-height: 80%;
  aspect-ratio: 180/240;
  transform: translate(-50%, -50%);
  z-index: 10;
  background-color: var(--wp--preset--color--primary);
  border-top-left-radius: 100vw;
  border-top-right-radius: 100vw;
  overflow: hidden;
}

.wp-block-media-text.is-style-image-mask
.wp-block-media-text__media.is-bg-from-img
.parallax-imgwrap > img {
  position: absolute;
  top: 60%;
  left: 60%;
  width: var(--media-w, 100%);
  height: var(--media-h, 100%);
  object-fit: cover;
  object-position: center;
  transform: translate(calc(-50% + var(--fg-x, 0px)), calc(-50% + var(--fg-y, 0px)));
  will-change: transform;
  transition: transform 120ms linear;
  max-width: none;
}


/* Editor */
.block-editor-page .is-style-image-mask figure.wp-block-media-text__media.has-mw-before-img {
  position: relative;
}

.block-editor-page .is-style-image-mask figure.wp-block-media-text__media.has-mw-before-img::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--mw-img-src);
  background-size: cover;
  background-position: center;
  z-index: 0;
  pointer-events: none;
  top: 50%;
  left: 50%;
  width: 35%;
  max-height: 80%;
  aspect-ratio: 180/240;
  transform: translate(-50%, -50%);
  z-index: 10;
  background-color: var(--wp--preset--color--primary);
  border-top-left-radius: 100vw;
  border-top-right-radius: 100vw;
  overflow: hidden;
}

.block-editor-page .is-style-image-mask figure.wp-block-media-text__media.has-mw-before-img > img {
  position: relative;
  z-index: 1;
}

body.single-writer .wp-block-media-text.is-style-image-mask .wp-block-media-text__media.is-bg-from-img:before {
    display: none;
}