:root {
  --vertical-post-item-spacing-big: 35px;
  --vertical-post-item-spacing-small: 30px;
}

.single-post-main-group {
  position: relative;
  user-select: none;
  letter-spacing: -0.5px;
}

/* Last child margin if .is-layout-flow added */
.single-post-main-group .wp-block-post-content.is-layout-flow > :last-child {
  margin-block-end: var(--vertical-post-item-spacing-big);
}

.single-post-main-group h1 {
  font-size: 2rem;
}
.single-post-main-group h2 {
  font-size: 1.5rem;
}
.single-post-main-group h3 {
  font-size: 1.125rem;
}
.single-post-main-group h4 {
  font-size: 1rem;
}
.single-post-main-group h5 {
  font-size: 0.75rem;
}
.single-post-main-group h6 {
  font-size: 0.5rem;
}

.single-post-main-group p {
  white-space: pre-line;
  line-height: 26px;
}

.single-post-main-group .wp-block-list li {
  margin-top: 0;
}

.single-post-main-group .wp-block-details {
  summary {
    font-size: 1.125rem;
    margin-bottom: 16px;
  }

  font-size: 1rem;
}

.single-post-main-group .wp-block-pullquote {
  p {
    margin-bottom: unset;
  }

  blockquote {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
  }
}

.single-post-main-group .wp-block-code {
  border-radius: 2px;
}

.single-post-main-group .wp-block-media-text {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  p {
    margin-bottom: unset;
  }

  figure {
    height: 100%;

    img {
      height: 100%;
      object-fit: cover;
    }
  }

  .wp-block-media-text__content {
    padding: 0;
    word-break: unset;
    align-self: flex-start;
  }
}

.single-post-main-group a {
  font-weight: 700;
  text-decoration: underline;
}

.single-post-main-group p,
.single-post-main-group .wp-block-preformatted,
.single-post-main-group .wp-block-code,
.single-post-main-group .wp-block-verse {
  font-size: 1rem;
}

.single-post-main-group .wp-block-image,
.single-post-main-group .wp-block-embed,
.single-post-main-group .wp-block-video,
.single-post-main-group .wp-block-table,
.single-post-main-group .wp-block-list,
.single-post-main-group p,
.single-post-main-group .wp-block-details,
.single-post-main-group .wp-block-quote,
.single-post-main-group .wp-block-preformatted,
.single-post-main-group .wp-block-code,
.single-post-main-group .wp-block-pullquote,
.single-post-main-group .wp-block-verse,
.single-post-main-group .wp-block-gallery,
.single-post-main-group .wp-block-audio,
.single-post-main-group .wp-block-media-text,
.single-post-main-group .wp-block-cover,
.single-post-main-group .tv3-photo-carousel {
  margin-bottom: var(--vertical-post-item-spacing-big);
}

.single-post-main-group .wp-block-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 1rem;
  line-height: 26px;
}

.single-post-main-group .wp-block-heading {
  font-family: Formular;
}

.single-post-wrapper {
  max-width: 670px;
  margin: auto;
}

/* Single Post title: normal wrapping, no balancing/hard breaks */
.single-post-bg-wrapper .wp-block-post-title {
  margin-top: 64px;
  font-size: 2rem;
  max-width: 100%;
  display: block; /* be explicit */
  text-wrap: wrap; /* override any text-wrap: balance/pretty */
  overflow-wrap: normal; /* don't break words unless needed */
  word-break: normal; /* prevents break-all behavior */
  hyphens: manual; /* no auto hyphenation */
  min-width: 0; /* if parent is flex, allow proper width calc */
  background-color: var(--wp--preset--color--deep-black);
}

.single-post-main-group .gray-bg {
  height: 527px;
  position: absolute;
  top: 0;
  left: 50%;
  right: 50%;
  width: 100vw;
  max-width: none;
  margin-left: -50vw;
  margin-right: -50vw;
  background-color: var(--wp--preset--color--deep-black);
  z-index: -1;
}

.single-post-bg-wrapper .wp-post-image {
  border-radius: 2px;
}

/* Post meta */
.single-post-bg-wrapper .tv3-postmeta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--wp--preset--color--white);
  opacity: 0.8;
  font-size: 0.75rem;
  margin: 32px 0;
}

.single-post-bg-wrapper .tv3-postmeta .tv3-postmeta__cat {
  text-decoration: none;
}

.single-post-wrapper .wp-block-post-content {
  padding: 56px 0 0 0;
}

@media (max-width: 1024px) {
  .single-post-wrapper {
    max-width: 100%;
    width: 100%;
  }
  .single-post-main-group .gray-bg {
    height: 200px;
  }

  /* Your content wrapper stays constrained with its own padding */
  .single-post-wrapper .single-post-bg-wrapper {
    position: relative; /* create containing block for ::before */
    background: none; /* we’ll paint the color with ::before */
    z-index: 0; /* keep it under the content */
    padding-bottom: 40px;
  }

  /* Full-bleed background that spans the entire viewport width */
  .single-post-wrapper .single-post-bg-wrapper::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 100vw; /* full screen width */
    transform: translateX(-50%); /* center across viewport */
    background-color: var(--wp--preset--color--deep-black);
    z-index: -1; /* sit behind the real content */
    pointer-events: none; /* never block clicks */
  }

  .single-post-wrapper .wp-block-post-content {
    padding-top: 32px;
  }
}

@media (max-width: 781px) {
  /* Last child margin if .is-layout-flow added */
  .single-post-main-group .wp-block-post-content.is-layout-flow > :last-child {
    margin-block-end: var(--vertical-post-item-spacing-small);
  }

  .single-post-bg-wrapper .wp-block-post-title {
    font-size: 1.5rem;
    margin-top: 32px;
    margin-bottom: 0;
  }

  .single-post-bg-wrapper .tv3-postmeta {
    margin: 24px 0;
  }

  .single-post-main-group .wp-block-image,
  .single-post-main-group .wp-block-embed,
  .single-post-main-group .wp-block-video,
  .single-post-main-group .wp-block-table,
  .single-post-main-group .wp-block-list,
  .single-post-main-group p,
  .single-post-main-group .wp-block-details,
  .single-post-main-group .wp-block-quote,
  .single-post-main-group .wp-block-preformatted,
  .single-post-main-group .wp-block-code,
  .single-post-main-group .wp-block-pullquote,
  .single-post-main-group .wp-block-verse,
  .single-post-main-group .wp-block-gallery,
  .single-post-main-group .wp-block-audio,
  .single-post-main-group .wp-block-media-text,
  .single-post-main-group .wp-block-cover,
  .single-post-main-group .tv3-photo-carousel {
    margin-bottom: var(--vertical-post-item-spacing-small);
  }

  .single-post-main-group .wp-block-media-text {
    flex-direction: column;
  }
}
