/**
 * acf-local-services-section — service cards grid with waves (Html-css-components/local-services-section).
 */

.acf-local-services-section {
  position: relative;
  overflow: hidden;
  background-color: var(--color-light);
}

.acf-local-services-section__wave {
  display: block;
  line-height: 0;
}

.acf-local-services-section__wave--top {
  margin-inline: 0;
  inline-size: 100%;
}

.acf-local-services-section__wave--top svg {
  display: block;
  inline-size: 100%;
  block-size: auto;
  min-block-size: 50px; /* styleguide-exception: wave decorative min */
  transform: none; /* top wave — same as acf-local-services-hub-section / acf-local-cta-section */
  margin-block-end: -1px; /* styleguide-exception: cover SVG subpixel fringe */
}

.acf-local-services-section__body {
  position: relative;
  padding-inline: var(--block-pad-inline);
  background-color: var(--color-off-white, #f8f8f8);
  overflow: hidden;
}

.acf-local-services-section__inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  padding-inline: 0;
  padding-block: var(--space-xl) var(--space-2xl);
}

.acf-local-services-section__wave--bottom {
  margin-inline: calc(-1 * var(--block-pad-inline));
  inline-size: calc(100% + (2 * var(--block-pad-inline)));
}

.acf-local-services-section__wave--bottom svg {
  display: block;
  inline-size: 100%;
  block-size: auto;
  min-block-size: 50px; /* styleguide-exception: wave decorative min */
  transform: scaleY(-1);
  margin-block-end: -1px; /* styleguide-exception: cover SVG subpixel fringe */
}

.acf-local-services-section__header {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  align-items: center;
  text-align: center;
}

/* Beat .entry-content h2 { color: var(--color-dark) } from reset.css */
.acf-local-services-section .acf-local-services-section__title {
  margin: 0;
  max-inline-size: 56.25rem; /* styleguide-exception: services heading ~900px */
  color: var(--color-brand-forest);
}

.acf-local-services-section__intro {
  max-inline-size: 44.875rem; /* styleguide-exception: intro ~718px */
  font-weight: var(--font-weight-normal);
  color: var(--color-dark);
}

.acf-local-services-section__grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
  inline-size: 100%;
}

.acf-local-services-section__card {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  inline-size: min(100%, 398px);
  max-inline-size: 398px; /* styleguide-exception: card max width */
  padding: var(--space-md);
  box-sizing: border-box;
  background-color: var(--color-light);
  border: var(--border-card);
  border-radius: var(--radius-leaf-lg);
  outline: none;
  overflow: hidden;
}

.acf-local-services-section__card--badge {
  position: relative;
}

.acf-local-services-section__card-visual {
  position: relative;
  flex-shrink: 0;
  inline-size: 100%;
  overflow: visible;
}

.acf-local-services-section__card-media {
  display: block;
  flex-shrink: 0;
  inline-size: 100%;
  block-size: auto;
  aspect-ratio: 398 / 211; /* styleguide-exception: card media ratio */
  max-block-size: 211px;
  border-radius: var(--radius-leaf-sm);
  background-color: #e8f5eb;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Prototype: badge top 163px on 211px media — straddles image bottom into copy (scales with card). */
.acf-local-services-section__card-badge {
  position: absolute;
  inset-block-start: calc(100% * 163 / 211);
  inset-inline-end: clamp(12px, 6.03%, 24px);
  z-index: 2;
  inline-size: clamp(72px, 25.13%, 100px);
  block-size: auto;
  aspect-ratio: 100 / 121;
  object-fit: contain;
  pointer-events: none;
}

.acf-local-services-section__card-content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--space-lg);
  inline-size: 100%;
  min-inline-size: 0;
  min-block-size: 0;
}

.acf-local-services-section__card-copy {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  min-inline-size: 0;
}

.acf-local-services-section .acf-local-services-section__card-title {
  margin: 0;
  font-family: var(--font-family-base);
  font-size: var(--font-size-h5);
  font-weight: var(--font-weight-bold);
  line-height: 1.4;
  color: var(--color-brand-forest);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.acf-local-services-section__card-text {
  margin: 0;
  color: var(--color-dark);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.acf-local-services-section__card-text :where(p, li) {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.acf-local-services-section__card-action {
  margin-block-start: auto;
}

.acf-local-services-section__card-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  max-inline-size: 100%;
  border-radius: var(--radius-button);
  color: var(--color-brand-forest);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  text-decoration: none;
}

.acf-local-services-section__card-link-label {
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-color: var(--color-brand-green-alt);
}

.acf-local-services-section__card-link-icon {
  inline-size: 14px;
  block-size: 14px;
  flex-shrink: 0;
  color: var(--color-brand-green);
}

.acf-local-services-section__card-link:hover,
.acf-local-services-section__card-link:focus-visible {
  color: var(--color-brand-green);
}

.acf-local-services-section__footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  align-self: center;
  text-align: center;
}

.acf-local-services-section__footer-text {
  margin: 0;
  font-weight: var(--font-weight-normal);
  color: var(--color-brand-forest);
}

.acf-local-services-section__footer-button {
  font-weight: var(--font-weight-semibold);
}

/* Top wave → off-white body: kill subpixel hairline below the curve. */
.acf-local-services-section:has(.acf-local-services-section__wave--top) .acf-local-services-section__body {
  margin-block-start: -4px; /* styleguide-exception: cover top-wave → body fringe */
  position: relative;
  z-index: 1;
}

/* Handoff: services hub → this section (service-hub: hub has no bottom wave). */
.acf-local-services-hub-section + .acf-local-services-section,
.wp-block-acf-acf-local-services-hub-section + .wp-block-acf-acf-local-services-section .acf-local-services-section {
  margin-block-start: -6px; /* styleguide-exception: cover wave path on white hub */
  position: relative;
  z-index: 1;
}

.wp-block-acf-acf-local-services-hub-section + .wp-block-acf-acf-local-services-section {
  margin-block-start: 0 !important;
}

@media (min-width: 1024px) {
  .acf-local-services-hub-section + .acf-local-services-section,
  .wp-block-acf-acf-local-services-hub-section + .wp-block-acf-acf-local-services-section .acf-local-services-section {
    margin-block-start: -8px;
  }

  .acf-local-services-section:has(.acf-local-services-section__wave--top) .acf-local-services-section__body {
    margin-block-start: -6px;
  }
}

@media (min-width: 640px) {
  .acf-local-services-section__grid {
    display: grid;
    gap: var(--space-lg);
    justify-items: center;
    align-items: stretch;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  }

  /* 3 cards — 2 columns on tablet (iPad Mini/Air/Pro portrait); 3 cols from 1280px */
  .acf-local-services-section__grid--count-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .acf-local-services-section__grid--count-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-inline-size: 820px;
    margin-inline: auto;
  }

  .acf-local-services-section__grid--count-1 {
    grid-template-columns: minmax(0, 398px);
    justify-content: center;
  }

  .acf-local-services-section__card {
    inline-size: 100%;
    max-inline-size: 398px;
  }

  .acf-local-services-section__footer {
    flex-direction: row;
    gap: var(--space-md);
  }

  .acf-local-services-section__footer-text {
    white-space: nowrap;
  }
}

@media (min-width: 1280px) {
  .acf-local-services-section__grid--count-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .acf-local-services-section__grid:not(.acf-local-services-section__grid--count-1):not(.acf-local-services-section__grid--count-2):not(.acf-local-services-section__grid--count-3) {
    gap: var(--space-xl);
  }

  .acf-local-services-section__grid--count-3 {
    gap: var(--space-lg);
  }
}

@media (max-width: 639px) {
  .acf-local-services-section__body {
    padding-inline: var(--space-sm);
  }

  .acf-local-services-section__inner {
    padding-block: var(--space-lg) var(--space-xl);
  }

  .acf-local-services-section__card {
    padding: var(--space-sm);
    max-inline-size: 398px;
  }

  .acf-local-services-section__card-media {
    max-block-size: 212px; /* styleguide-exception: card media cap mobile */
  }

  .acf-local-services-section__card-badge {
    inset-block-start: calc(100% * 130 / 212);
    inset-inline-end: 16px;
    inline-size: 88px;
  }

  .acf-local-services-hub-section + .acf-local-services-section,
  .wp-block-acf-acf-local-services-hub-section + .wp-block-acf-acf-local-services-section .acf-local-services-section {
    margin-block-start: -8px;
  }

  .acf-local-services-section:has(.acf-local-services-section__wave--top) .acf-local-services-section__body {
    margin-block-start: -6px;
  }

  .acf-local-services-section__wave--top svg {
    margin-block-end: -2px;
  }

  .acf-local-services-section__card-text {
    font-size: var(--font-size-sm);
    line-height: 1.25;
  }
}
