/*
 * Choose a plan or single services (service-bespoke-bnr): a shallow band on pale teal above the comparison, with
 * two cards joined by a round "or". On the left a white card, "Choose a plan", pointing at the table below; on the
 * right a raised, wider teal card, "Pick single services", with "Build a bespoke plan" (to the Bespoke page) and
 * three ticked reassurances in a row. Below 900px the cards stack, with the "or" between them.
 */

.wp-block-group.service-pattern.service-pattern--bespoke-bnr {
  margin: 0;
  padding: 0;
  background: var(--teal-pale);
}

.service-pattern--bespoke-bnr .wp-block-group__inner-container {
  display: contents;
}

.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 2fr);
  gap: 16px;
  align-items: stretch;
  padding: 32px clamp(24px, 5vw, 64px);
}

/* The two cards */

.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-plans,
.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-single {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 28px 32px;
  border-radius: 16px;
}

.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-plans {
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--white);
  box-shadow: 0 8px 24px rgba(13, 61, 57, 0.06);
}

.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-single {
  gap: 16px;
  background: var(--teal-darker);
  box-shadow: 0 12px 32px rgba(13, 61, 57, 0.18);
}

/* The label, heading and line in each card: teal on white, light on teal */

.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-eyebrow {
  margin: 0;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-heading {
  margin: 0;
  color: #0d3d39;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: clamp(26px, 2.6vw, 30px);
  font-weight: 400;
  line-height: 1.1;
  text-transform: none;
}

.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.55;
}

.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-single .service-pattern__bespoke-bnr-eyebrow {
  color: #9fded7;
}

.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-single .service-pattern__bespoke-bnr-heading {
  color: var(--white);
}

/* The round "or" between the cards */

.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-or {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: 44px;
  height: 44px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--white);
  color: var(--teal-darker);
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 19px;
  font-style: italic;
  line-height: 1;
}

/* The teal card's top row: the heading beside the button, which drops below when there's no room */

.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-single-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin: 0;
}

.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-single-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}

.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-actions {
  display: flex;
  flex: 0 0 auto;
}

.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-button .wp-block-button__link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 20px;
  border: 1.5px solid var(--white);
  border-radius: 8px;
  background: var(--white);
  color: #0d3d39;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-button .wp-block-button__link::after {
  content: "→";
  transition: transform 0.2s ease;
}

.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-button .wp-block-button__link:hover,
.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-button .wp-block-button__link:focus-visible {
  border-color: var(--teal-light);
  background: var(--teal-light);
}

.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-button .wp-block-button__link:hover::after,
.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-button .wp-block-button__link:focus-visible::after {
  transform: translateX(3px);
}

.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-button .wp-block-button__link:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 3px;
}

/* The three reassurances side by side, each after a teal tick, keeping the card shallow */

.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-points {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0;
  padding: 0;
  color: var(--teal-light);
  font-size: 14px;
  line-height: 1.4;
  list-style: none;
}

.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-points li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  white-space: nowrap;
}

.service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-points li::before {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  background: var(--teal);
  content: "";
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Visitors who ask for reduced motion: the arrow stays put */

@media (prefers-reduced-motion: reduce) {
  .service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-button .wp-block-button__link::after {
    transition: none;
    transform: none;
  }
}

/* Tablets and phones: the cards stack, with the "or" between them */

@media (max-width: 899px) {
  .service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-or {
    justify-self: center;
  }
}

/* Phones: less room around the cards */

@media (max-width: 700px) {
  .service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-inner {
    padding: 28px 16px;
  }

  .service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-plans,
  .service-pattern--bespoke-bnr .service-pattern__bespoke-bnr-single {
    padding: 24px;
  }
}

/*
 * Tablets and phones, with the script (assets/js/patterns/service-bespoke-bnr.js): "Choose a plan" fills the
 * band's width, pinned below the header while the visitor scrolls, and "Pick single services" slides in from
 * the right until it covers it, the "or" riding on its leading edge and fading as it lands. `--bespoke-slide` runs
 * from 0 to 1 as it comes across; `--bespoke-track` makes the section tall enough to scroll for it. Without the
 * script, or with reduced motion, the cards stay stacked as above.
 */

@media (max-width: 899px) {
  .wp-block-group.service-pattern.service-pattern--bespoke-bnr.is-sliding {
    height: var(--bespoke-track, auto);
  }

  .service-pattern--bespoke-bnr.is-sliding .service-pattern__bespoke-bnr-inner {
    position: sticky;
    top: var(--bespoke-offset, 0px);
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "card";
    overflow: hidden;
  }

  .service-pattern--bespoke-bnr.is-sliding .service-pattern__bespoke-bnr-plans,
  .service-pattern--bespoke-bnr.is-sliding .service-pattern__bespoke-bnr-single,
  .service-pattern--bespoke-bnr.is-sliding .service-pattern__bespoke-bnr-or {
    grid-area: card;
  }

  /* Each card takes the band's width, its words centred */

  .service-pattern--bespoke-bnr.is-sliding .service-pattern__bespoke-bnr-plans,
  .service-pattern--bespoke-bnr.is-sliding .service-pattern__bespoke-bnr-single {
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 32px 24px;
    text-align: center;
  }

  .service-pattern--bespoke-bnr.is-sliding .service-pattern__bespoke-bnr-heading {
    font-size: clamp(30px, 7vw, 40px);
  }

  .service-pattern--bespoke-bnr.is-sliding .service-pattern__bespoke-bnr-text {
    max-width: 34ch;
    font-size: 16px;
  }

  .service-pattern--bespoke-bnr.is-sliding .service-pattern__bespoke-bnr-single-top {
    flex-direction: column;
    gap: 16px;
  }

  .service-pattern--bespoke-bnr.is-sliding .service-pattern__bespoke-bnr-single-copy {
    gap: 6px;
  }

  .service-pattern--bespoke-bnr.is-sliding .service-pattern__bespoke-bnr-points {
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
    font-size: 15px;
    text-align: left;
  }

  .service-pattern--bespoke-bnr.is-sliding .service-pattern__bespoke-bnr-plans {
    opacity: calc(1 - var(--bespoke-slide, 1) * 0.4);
    transform: scale(calc(1 - var(--bespoke-slide, 1) * 0.04));
  }

  .service-pattern--bespoke-bnr.is-sliding .service-pattern__bespoke-bnr-single {
    z-index: 1;
    transform: translateX(calc((1 - var(--bespoke-slide, 1)) * 100vw));
    will-change: transform;
  }

  .service-pattern--bespoke-bnr.is-sliding .service-pattern__bespoke-bnr-or {
    z-index: 2;
    justify-self: start;
    transform: translateX(calc((1 - var(--bespoke-slide, 1)) * 100vw - 12px));
    opacity: calc((1 - var(--bespoke-slide, 1)) * 2.5);
  }
}
