/*
 * Split Content block (template-parts/blocks/section_split-content.php).
 * Loaded by abefactors_acf_block_enqueue_assets() only on pages that contain the block (and in the editor).
 * No JavaScript is needed for this block.
 *
 * Design (Figma "Homel" 1949–2698, "About" 1268–1844), at 1728px:
 *   columns   504px heading | 19px | 855px content, a 1px Steel line above each column
 *   heading   Red Hat Display Bold 32px, about 375px wide (two lines)
 *   content   Regular 18/30, up to 790px wide; small headings ExtraBold 18/30;
 *             bulleted lists in two 262px columns, a 27 x 2px Gold dash before each item
 *   spacing   85px above the line, 150px under the block; 70px between two Split Content blocks
 */

/* ------------------------------------------------------------------
 * Spacing (replaces the global block padding for this block)
 * ------------------------------------------------------------------ */
.section_split_content.global-block-ptb {
  padding-top: clamp(48px, 4.9vw, 85px);
  padding-bottom: clamp(60px, 8.7vw, 150px);
}

/* Two Split Content blocks in a row (About page): one 70px gap between them. */
.section_split_content.global-block-ptb:has(+ .section_split_content) {
  padding-bottom: 0;
}

.section_split_content + .section_split_content.global-block-ptb {
  padding-top: clamp(40px, 4.05vw, 70px);
}

/* ------------------------------------------------------------------
 * Background image (Settings > Background Image)
 * 70% Charcoal overlay so text keeps its contrast; set the block text colour to White.
 * ------------------------------------------------------------------ */
.section_split_content {
  position: relative;
}

.section_split_content.has_bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--wp--preset--color--secondary);
  opacity: 0.7;
  pointer-events: none; /* decorative */
}

.section_split_content.has_bg > .container {
  position: relative; /* above the overlay */
}

/* ------------------------------------------------------------------
 * Columns and lines
 * ------------------------------------------------------------------ */
.split_content_grid {
  display: grid;
  grid-template-columns: minmax(0, 504fr) minmax(0, 855fr);
  column-gap: 19px;
  align-items: start;
}

.section_split_content {
  --split-line-color: var(--wp--preset--color--steel);
}

/* On a coloured background (e.g. the yellow testimonial) the line takes the text colour, as in the design. */
.section_split_content.has_bg_color {
  --split-line-color: currentColor;
}

.split_content_head,
.split_content_body {
  padding-top: clamp(28px, 3.07vw, 53px);
  border-top: 1px solid var(--split-line-color);
}

/* Top Line "One line across both columns" (the yellow testimonial on Home). */
.section_split_content.one-top-line .split_content_grid {
  padding-top: clamp(28px, 3.07vw, 53px);
  border-top: 1px solid var(--split-line-color);
}

.section_split_content.one-top-line .split_content_head,
.section_split_content.one-top-line .split_content_body {
  padding-top: 0;
  border-top: 0;
}

.section_split_content.no-top-line .split_content_head,
.section_split_content.no-top-line .split_content_body {
  padding-top: 0;
  border-top: 0;
}

/* ------------------------------------------------------------------
 * Heading
 * ------------------------------------------------------------------ */
.split_content_head .section_title_above {
  margin: 0 0 12px;
}

.split_content_title {
  max-width: 13.2em; /* about 420px at 32px: "Technical accessibility that / works with your design" */
  margin: 0;
  font-size: var(--wp--preset--font-size--medium-32);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0;
  text-wrap: balance;
}

/* Section Description under the title (optional). */
.split_content_head .split_content_description {
  max-width: 440px;
  margin-top: 16px;
  font-weight: 600;
}

/* Default size; a size chosen in "Description Font Size" (.fontsize-*) is used instead.
 * Design (testimonial name): 18px SemiBold, bold lines ExtraBold, normal line height. */
.split_content_head .split_content_description:not([class*='fontsize-']) {
  font-size: var(--wp--preset--font-size--body);
  line-height: 1.35;
}

.split_content_description strong,
.split_content_description b {
  font-weight: 800;
}

.split_content_description p {
  margin: 0 0 15px;
}

.split_content_description > :last-child {
  margin-bottom: 0;
}

/* ------------------------------------------------------------------
 * Content
 * ------------------------------------------------------------------ */
.split_content_body {
  padding-top: calc(clamp(28px, 3.07vw, 53px) + 6px); /* the text box starts 6px lower than the heading in the design */
}

.split_content_text {
  max-width: 790px;
  font-size: var(--wp--preset--font-size--body);
  line-height: 30px;
}

.split_content_text > * {
  margin-top: 0;
}

.split_content_text p {
  margin: 0 0 30px;
}

.split_content_text > :last-child,
.split_content_text li:last-child {
  margin-bottom: 0;
}

/* Content Style "Quote" (the testimonial): 22/30 SemiBold, in a <blockquote>. */
.split_content_text.is-quote {
  max-width: 805px;
  margin: 0;
  padding: 0;
  font-size: clamp(19px, 1.28vw, 22px);
  font-weight: 600;
  line-height: 30px;
  @media screen and (max-width: 900px) {
    font-size: var(--wp--preset--font-size--body);
  }
}

/* 53px from the quote to the button, as in the design. */
.split_content_text.is-quote + .split_content_buttons {
  margin-top: clamp(32px, 3.07vw, 53px);
}

.split_content_text.is-quote::before,
.split_content_text.is-quote::after {
  content: none;
}

/* "Read more" text: follows the content with one empty line, like a new paragraph.
 * Padding (not margin), so the space slides open and closed together with the text. */
.split_content_more {
  margin-top: 0;
  padding-top: 30px;
}

.split_content_more[hidden] {
  display: none;
}

/* "Read more" toggle: a down arrow (it opens text here, it does not go to another page); turns over when open. */
.split_content_toggle[hidden] {
  display: none;
}

.button.split_content_toggle::after {
  content: '\e801'; /* abe-icons arrow-down */
  font-size: 11px;
  transition: transform 0.2s ease;
}

.button.split_content_toggle:hover::after,
.button.split_content_toggle:focus::after {
  transform: translateY(2px);
}

.button.split_content_toggle[aria-expanded='true']::after {
  transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
  .button.split_content_toggle::after {
    transition: none;
  }
}

/* Small headings inside the content ("Industries we serve"). */
.split_content_text h3,
.split_content_text h4 {
  margin: 0 0 16px;
  font-size: var(--wp--preset--font-size--body);
  font-weight: 800;
  line-height: 30px;
  letter-spacing: 0;
}

.split_content_text p + h3,
.split_content_text p + h4 {
  margin-top: 0;
}

/* Bulleted list: two columns, gold dash before each item. Numbered lists keep their numbers. */
.split_content_text ul {
  max-width: 524px;
  margin: 0 0 45px;
  padding: 0;
  list-style: none;
  columns: 2 150px;
  column-gap: 0;
}

.section_split_content .split_content_text ul > li {
  position: relative;
  margin: 0; /* 30px rows as in the design */
  padding: 0 12px 0 45px;
  font-weight: 600;
  line-height: 30px;
  break-inside: avoid;
}

.section_split_content .split_content_text ul > li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  width: 27px;
  height: 2px;
  background-color: var(--wp--preset--color--gold); /* decorative */
}

/*
 * List animation (js/blocks_js/block_split-content.js adds .list-anim, then .list-anim-run when the list is in view).
 * Each item waits var(--list-i) x 70ms: the dash draws from the left (0.45s), the text slides in 12px (0.5s).
 */
/* Waiting: hidden at once (no transition), so nothing fades out first. */
.section_split_content .split_content_text ul.list-anim > li {
  opacity: 0;
  transform: translateX(-12px);
}

.section_split_content .split_content_text ul.list-anim > li::before {
  transform: scaleX(0);
  transform-origin: left center;
}

/* In view: each item in turn. */
.section_split_content .split_content_text ul.list-anim.list-anim-run > li {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.5s ease,
    transform 0.5s cubic-bezier(0.215, 0.61, 0.355, 1);
  transition-delay: calc(var(--list-i, 0) * 70ms + 120ms);
}

.section_split_content .split_content_text ul.list-anim.list-anim-run > li::before {
  transform: scaleX(1);
  transition: transform 0.45s cubic-bezier(0.65, 0, 0.35, 1);
  transition-delay: calc(var(--list-i, 0) * 70ms);
}

@media (prefers-reduced-motion: reduce), print {
  .section_split_content .split_content_text ul.list-anim > li,
  .section_split_content .split_content_text ul.list-anim > li::before {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

.split_content_text ol {
  margin: 0 0 30px;
  padding-left: 1.4em;
}

/* Links in running text are underlined (WCAG 1.4.1). */
.split_content_text a:not(.button) {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ------------------------------------------------------------------
 * Buttons
 * ------------------------------------------------------------------ */
.split_content_buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

/* ------------------------------------------------------------------
 * Smaller screens: heading above the content, one line on top
 * ------------------------------------------------------------------ */
@media screen and (max-width: 900px) {
  .split_content_grid {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 24px;
  }

  .split_content_body,
  .section_split_content.no-top-line .split_content_body {
    padding-top: 0;
    border-top: 0;
  }

  .split_content_title {
    max-width: 20em;
  }
}

/* Empty block in the editor. */
.split_content_empty {
  margin: 0;
  padding: 40px 20px;
  border: 1px dashed var(--wp--preset--color--mediumgrey);
  border-radius: 24px;
  text-align: center;
}
