.hero {
  max-width: 100% !important;
}

.hero__container {
  display: flex;
  flex-direction: column;
  width: 100%;
}

@media screen and (min-width: 768px) {
  .hero__container {
    flex-direction: row;
  }
}

.hero__media {
  flex: 0 0 100%;
  overflow: hidden;
}

.hero__media--with-caption {
  padding-block-end: var(--wp--preset--spacing--70);
}

@media screen and (min-width: 768px) {
  .hero__media {
    flex: 0 0 50%;
  }

  .hero--media-size-two-thirds .hero__media {
    flex: 0 0 66.6667%; /* 2/3 split */
  }
}

.hero__text {
  flex: 1;
  padding: var(--wp--preset--spacing--50);
}

@media screen and (min-width: 768px) {
  .hero__text {
    padding: var(--wp--preset--spacing--80) var(--wp--preset--spacing--80) var(--wp--preset--spacing--100);
  }
}

.hero__text > .acf-innerblocks-container {
  display: flex;
  flex-direction: column;
}

.hero__text > .acf-innerblocks-container * {
  text-align: center;

  @media screen and (min-width: 768px) {
    text-align: left;
  }
}

.hero__text .wp-block-buttons {
  margin-block-start: var(--wp--preset--spacing--70);
}

.hero__figure {
  margin: 0;
  width: 100%;
  height: 100%;
  max-height: 320px;
  position: relative;
}

.hero__image {
  display: block;
  height: 100%;
  max-height: 320px;
  object-fit: cover;
  width: 100%;
}

/* Above the row breakpoint, the media column's height is meant to be driven
 * entirely by the text column (align-items: stretch), with the image
 * cropped to fill it. Without this, a percentage height on an indefinite
 * flex-item ancestor falls back to the image's own intrinsic aspect ratio,
 * letting a differently-shaped image push the row taller than the text
 * needs. Pulling the image out of flow removes it from that calculation.
 * Below the breakpoint (column layout, no cross-sibling to stretch against)
 * it must stay in-flow or it collapses to 0 height. */
@media screen and (min-width: 768px) {
  .hero__figure {
    position: relative;
    max-height: none;
  }

  .hero__image {
    position: absolute;
    inset: 0;
    max-height: none;
  }
}

.hero__caption {
  font-size: 1.3rem;
  color: var(--wp--preset--color--text);
  font-style: italic;
  padding: 0 var(--wp--preset--spacing--30);
  position: absolute;
  top: 100%;
}

.hero.hero--bg-primary .hero__caption {
  color: var(--wp--preset--color--white);
}

.hero__video {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
}

.hero__video iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.hero__video .hero__video-element {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero--media-right .hero__container {
  @media screen and (min-width: 768px) {
    flex-direction: row-reverse;
  }
}

.hero__heading {
  color: var(--wp--custom--color--primary);
  font-weight: 700;
}

/* Blue background modifier */
.hero--bg-primary {
  background-color: var(--wp--custom--color--primary);
  padding-top: var(--wp--preset--spacing--50);
  padding-bottom: var(--wp--preset--spacing--50);
}

.hero--bg-primary .hero__heading,
.hero--bg-primary .hero__text,
.hero--bg-primary .hero__text * {
  color: var(--wp--custom--color--white);
}

.hero--bg-primary .hero__text .wp-block-button:not(.is-style-outline):not(.is-style-link) .wp-block-button__link {
  background-color: var(--wp--custom--color--accent-1);
  color: var(--wp--custom--color--black);
}

.hero--bg-primary .hero__text .wp-block-button:not(.is-style-outline):not(.is-style-link) .wp-block-button__link:hover {
  background-color: var(--wp--custom--color--secondary);
  color: var(--wp--custom--color--black);
}

.hero--bg-primary .hero__text .wp-block-button.is-style-outline .wp-block-button__link {
  color: var(--wp--custom--color--white);
  border-color: var(--wp--custom--color--white);
}

.hero--bg-primary .hero__text .wp-block-button.is-style-outline .wp-block-button__link:hover {
  color: var(--wp--custom--color--accent-1);
  border-color: var(--wp--custom--color--accent-1);
}

/* Block editor preview styles */
.acf-block-preview {
  .hero {
    padding: 60px 0;
  }

  .hero__container {
    padding: 0 30px;
  }

  .hero__container > .block-editor-inner-blocks {
    flex: 1;
  }

  .hero__container > .block-editor-inner-blocks > .block-editor-block-list__layout {
    display: flex;
    flex-direction: column;
    gap: var(--wp--preset--spacing--30);
  }
}
