/**
 * Text Block Styles
 *
 * Flexible text block with optional gallery, shortcode, editorial split,
 * navigation links, and an optional icon marquee.
 */

/* --------------------------------------------------------------------------
   Base text content
   -------------------------------------------------------------------------- */

/* section.text {
  padding: 5rem 0;
} */

.text-block-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
}

.text-content {
  margin-bottom: 2rem;
}

.text-content > :last-child,
.text-block-right-text > :last-child,
.text-block-extra-text > :last-child {
  margin-bottom: 0;
}

.text-content ul,
.text-content ol {
  padding-left: 1.5rem;
}

.text-content ul {
  list-style: disc;
}

.text-content ol {
  list-style: decimal;
}

.text-content ul li,
.text-content ol li {
  margin-bottom: 0.5rem;
}

.text-content img,
.text-block-right-text img {
  max-width: 100%;
  height: auto;
  border-radius: 24px;
}

/* --------------------------------------------------------------------------
   Buttons / link list
   -------------------------------------------------------------------------- */

.text-block-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
}

.link-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}

/* --------------------------------------------------------------------------
   Image gallery
   -------------------------------------------------------------------------- */

.text-block-gallery {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 400px;
  gap: 1.25rem;
  margin: 0;
}

.text-block-gallery.gallery-count-1 {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.text-block-gallery.gallery-count-1 .img-1 {
  grid-column: 1;
  grid-row: 1;
}

.text-block-gallery.gallery-count-2 {
  grid-template-columns: 1fr;
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.text-block-gallery.gallery-count-2 .img-1 {
  grid-column: 1;
  grid-row: 1;
}

.text-block-gallery.gallery-count-2 .img-2 {
  grid-column: 1;
  grid-row: 2;
}

.text-block-gallery.gallery-count-3,
.text-block-gallery.gallery-count-4 {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
}

.text-block-gallery.gallery-count-3 .img-1,
.text-block-gallery.gallery-count-4 .img-1 {
  grid-column: 1 / span 8;
  grid-row: 1 / span 5;
}

.text-block-gallery.gallery-count-3 .img-2,
.text-block-gallery.gallery-count-4 .img-2 {
  grid-column: 6 / span 3;
  grid-row: 6 / span 3;
}

.text-block-gallery.gallery-count-3 .img-3,
.text-block-gallery.gallery-count-4 .img-3 {
  grid-column: 1 / span 3;
  grid-row: 6 / span 3;
}

.text-block-gallery.gallery-count-4 .img-4 {
  grid-column: 4 / span 2;
  grid-row: 6 / span 3;
}

.text-block-gallery img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--bs-border-radius, 0.375rem);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* --------------------------------------------------------------------------
   Shortcode content
   -------------------------------------------------------------------------- */

.text-block-shortcode {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: 2rem;
  overflow: hidden;
  background-color: var(--bs-light, #f8f9fa);
  border-radius: var(--bs-border-radius-lg, 0.5rem);
}

/* --------------------------------------------------------------------------
   Editorial split layout
   -------------------------------------------------------------------------- */

.text-block-split {
  position: relative;
}

.text-block-split .container {
  position: relative;
}

.text-block-split-row {
  align-items: flex-start;
}

/*
 * In text-only and genuine two-text-column variants, topline and headline
 * sit above the content row. If the right WYSIWYG contains media/embedded
 * content, the template keeps the heading inside the left text column.
 */
.text-block-text .text-block-wide-header,
.text-block-text_wyswyg .text-block-wide-header {
  margin-bottom: clamp(2rem, 4vw, 4rem);
}

.text-block-text .text-block-wide-header .text-block-headline,
.text-block-text_wyswyg .text-block-wide-header .text-block-headline {
  margin-bottom: 0;
}

.text-block-split-left,
.text-block-split-right {
  height: 100%;
}

.text-block-subline {
  margin-bottom: 0.5rem;
  color: var(--brand-accent-color);
  font-size: 0.875rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.text-block-headline {
  overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
   Icon row / marquee
   -------------------------------------------------------------------------- */

.text-block-icons-row {
  margin-top: 3rem;
}

.text-block-icons-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 270px);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}

.text-block-icons-grid.has-icons-only {
  grid-template-columns: minmax(0, 1fr);
}

.text-block-icons-grid.has-extra-only {
  grid-template-columns: minmax(0, 300px);
  justify-content: end;
}

.text-block-icons-slider {
  position: relative;
  width: 100%;
  min-width: 0;
}

.text-block-icons-slider.is-marquee {
  overflow: hidden;
}

.text-block-icons-track {
  display: flex;
  align-items: center;
}

.text-block-icons-slider.is-marquee .text-block-icons-track {
  width: max-content;
  will-change: transform;
  animation: text-block-icons-scroll 30s linear infinite;
}

.text-block-icons-group {
  --text-block-icon-gap: clamp(2rem, 4vw, 4rem);

  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: var(--text-block-icon-gap);
}

/*
 * The end padding belongs to each repeated group. Therefore two groups have
 * exactly the same width and translateX(-50%) lands on the second group at
 * precisely the same position as the first one.
 */
.text-block-icons-slider.is-marquee .text-block-icons-group {
  padding-right: var(--text-block-icon-gap);
}

.text-block-icons-slider.is-static .text-block-icons-track {
  width: 100%;
}

.text-block-icons-slider.is-static .text-block-icons-group {
  flex: 1 1 100%;
  flex-wrap: wrap;
  width: 100%;
}

.text-block-icon {
  display: flex;
  flex: 0 0 150px;
  align-items: center;
  justify-content: center;
  width: 150px;
  max-width: 150px;
  height: 48px;
}

.text-block-icon img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
}

.text-block-extra-text {
  width: 100%;
  max-width: 300px;
  margin-left: auto;
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.02em;
  text-align: right;
  overflow-wrap: anywhere;
}

.text-block-icons-slider.is-marquee:hover .text-block-icons-track,
.text-block-icons-slider.is-marquee:focus-within .text-block-icons-track {
  animation-play-state: paused;
}

@keyframes text-block-icons-scroll {
  from {
    transform: translate3d(0, 0, 0);
  }

  to {
    transform: translate3d(-50%, 0, 0);
  }
}

/* --------------------------------------------------------------------------
   Text links layout
   -------------------------------------------------------------------------- */

.text-block-links {
  height: 100%;
}

.text-block-links-list {
  display: flex;
  flex-direction: column;
}

.text-block-link-item {
  display: block;
  padding: 2rem 0;
  color: inherit;
  text-decoration: none;
  border-top: 3px solid var(--bs-gray-200);
}

.text-block-links-list .text-block-link-item:first-child {
  padding-top: 0;
  border-top: 0;
}

.text-block-link-item-inner {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.text-block-link-marker {
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

.text-block-link-number {
  color: var(--brand-accent-color);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.text-block-link-content {
  position: relative;
  display: block;
  min-width: 0;
  padding-right: 3rem;
  color: inherit;
  text-decoration: none;
}

.text-block-link-title {
  transition: color 0.3s ease;
}

.text-block-link-text {
  color: var(--bs-secondary-color);
  font-size: 1rem;
  line-height: 1.7;
}

.text-block-link-text p:last-child {
  margin-bottom: 0;
}

.text-block-link-arrow {
  position: absolute;
  top: 50%;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: #fff;
  background-color: var(--brand-accent-color);
  border-radius: 50%;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 0.3s ease;
}

.text-block-link-content:hover .text-block-link-arrow,
.text-block-link-content:focus-visible .text-block-link-arrow,
.text-block-link-content:active .text-block-link-arrow {
  opacity: 1;
}

.text-block-link-content:hover .text-block-link-title,
.text-block-link-content:focus-visible .text-block-link-title,
.text-block-link-content:active .text-block-link-title {
  color: var(--brand-accent-color);
}

.text-block-link-icon {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  width: 56px;
  min-width: 56px;
}

.text-block-link-icon img {
  display: block;
  width: auto;
  max-width: 56px;
  height: auto;
  max-height: 56px;
  object-fit: contain;
}

.text-block-link-icon-default {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  background: var(--brand-accent-color);
  border-radius: 50%;
}

.text-block-link-icon-default span {
  display: inline-block;
  transform: translateX(1px);
}

.text-block-text_links .text-block-split-left {
  padding-right: 2rem;
}

.text-block-text_links .text-block-links {
  padding-left: 0;
}

/* --------------------------------------------------------------------------
   Dark background variant
   -------------------------------------------------------------------------- */

.light-text {
  color: #fff;
}

.light-text .text-block-headline,
.light-text .text-block-link-title {
  color: #fff;
}

.light-text .text-block-headline {
  margin-bottom: 1rem;
}

.light-text .text-content,
.light-text .text-content *,
.light-text .text-block-right-text {
  color: rgba(255, 255, 255, 0.85);
}

.light-text .text-block-subline {
  color: var(--brand-accent-color);
}

.light-text a:not(.btn) {
  color: #fff;
}

.light-text .text-block-link-text {
  color: rgba(255, 255, 255, 0.75);
}

/* --------------------------------------------------------------------------
   Responsive behavior
   -------------------------------------------------------------------------- */

@media (min-width: 992px) {
  .text-block-split-left {
    padding-right: 3rem;
  }

  .text-block-split-right {
    padding-top: 2.25rem;
  }

  /*
   * The shared heading means both WYSIWYG columns should begin at the same
   * height and use the row's regular Bootstrap gutter symmetrically.
   */
  .text-block-text_wyswyg .text-block-split-left {
    padding-right: calc(var(--bs-gutter-x, 3rem) * 0.5);
  }

  .text-block-text_wyswyg .text-block-split-right {
    padding-top: 0;
  }

  .text-block-text_links .text-block-links {
    padding-left: 2rem;
  }

  .text-block-link-marker {
    justify-content: flex-start;
  }
}

@media (max-width: 991.98px) {
  .text-block-gallery {
    min-height: 300px;
  }

  .text-block-shortcode {
    min-height: 200px;
    padding: 1.5rem;
  }

  .text-block-headline,
  .text-block-right-text {
    max-width: 100%;
  }

  .text-block-split-right {
    padding-top: 0;
  }

  .text-block-icons-row {
    margin-top: 3rem;
  }

  .text-block-icons-grid,
  .text-block-icons-grid.has-icons-only,
  .text-block-icons-grid.has-extra-only {
    grid-template-columns: minmax(0, 1fr);
    gap: 3rem;
    justify-content: stretch;
  }

  .text-block-extra-text {
    max-width: 100%;
    margin-left: 0;
    text-align: left;
  }

  .text-block-link-item {
    padding: 1.5rem 0;
  }

  .text-block-link-item-inner {
    grid-template-columns: 70px minmax(0, 1fr);
  }

  .text-block-link-marker {
    justify-content: flex-start;
  }
}

@media (max-width: 767.98px) {
  .text-block-gallery.gallery-count-3,
  .text-block-gallery.gallery-count-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto;
    min-height: auto;
  }

  .text-block-gallery.gallery-count-3 .img-1,
  .text-block-gallery.gallery-count-3 .img-2,
  .text-block-gallery.gallery-count-3 .img-3,
  .text-block-gallery.gallery-count-4 .img-1,
  .text-block-gallery.gallery-count-4 .img-2,
  .text-block-gallery.gallery-count-4 .img-3,
  .text-block-gallery.gallery-count-4 .img-4 {
    grid-column: span 1;
    grid-row: auto;
    aspect-ratio: 4 / 3;
  }

  .link-list {
    gap: 1rem;
  }

  .link-list-item {
    padding-bottom: 0.75rem;
  }
}

@media (max-width: 575.98px) {
  .text-block-gallery.gallery-count-3,
  .text-block-gallery.gallery-count-4 {
    grid-template-columns: 1fr;
  }

  .text-block-icon {
    flex-basis: 120px;
    width: 120px;
    max-width: 120px;
  }

  .text-block-link-item-inner {
    position: relative;
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .text-block-link-marker {
    justify-content: flex-start;
  }

  .text-block-link-number {
    position: absolute;
    top: 0;
    right: 0;
  }

  .text-block-link-content {
    padding-right: 3rem;
  }

  .text-block-link-arrow {
    right: 0;
  }

  .text-block-split-left {
    order: 2;
  }

  .text-block-split-right {
    order: 1;
    padding-top: 0;
  }

  /* Keep the natural left-to-right content order for the two-text variant. */
  .text-block-text_wyswyg .text-block-split-left,
  .text-block-text_wyswyg .text-block-split-right {
    order: initial;
  }
}

@media (prefers-reduced-motion: reduce) {
  .text-block-icons-slider.is-marquee {
    overflow: visible;
  }

  .text-block-icons-slider.is-marquee .text-block-icons-track {
    width: auto;
    animation: none;
  }

  .text-block-icons-slider.is-marquee .text-block-icons-group {
    flex: 1 1 100%;
    flex-wrap: wrap;
    width: 100%;
    padding-right: 0;
  }

  .text-block-icons-slider.is-marquee .text-block-icons-group[aria-hidden="true"] {
    display: none;
  }
}