/**
 * acf-gallery-services-section — Project gallery service grid (Figma 7230:4336).
 *
 * Off-white band, service pill, bordered leaf photo cards, play overlay, hover caption.
 */

.acf-gallery-services-section {
  position: relative;
  overflow: hidden;
  background-color: var(--color-off-white, #f8f8f8);
}

.acf-gallery-services-section.alignfull,
.acf-gallery-services-section.alignwide {
  inline-size: 100%;
  max-inline-size: none;
  margin-inline: 0;
}

.acf-gallery-services-section__wave {
  display: block;
  line-height: 0;
}

.acf-gallery-services-section__wave--top {
  margin-inline: 0;
  inline-size: 100%;
}

.acf-gallery-services-section__wave--top svg {
  display: block;
  inline-size: 100%;
  block-size: auto;
  min-block-size: 50px; /* styleguide-exception: wave decorative min */
  transform: scaleY(-1);
}

.acf-gallery-services-section__body {
  position: relative;
  padding-inline: var(--block-pad-inline);
  overflow: hidden;
  background-color: var(--color-off-white, #f8f8f8);
}

.acf-gallery-services-section__container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-16); /* Figma: 64px intro → grid */
  padding-inline: 0;
  padding-block: var(--block-pad-block);
}

.acf-gallery-services-section__container:not(:has(.acf-gallery-services-section__intro-stack)) {
  gap: var(--spacing-6); /* pill → grid when intro is hidden */
}

.acf-gallery-services-section__wave--bottom {
  margin-inline: calc(-1 * var(--block-pad-inline));
  inline-size: calc(100% + (2 * var(--block-pad-inline)));
}

.acf-gallery-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);
}

.acf-gallery-services-section__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-6); /* Figma: 24px heading → pill */
  inline-size: 100%;
  text-align: center;
}

.acf-gallery-services-section .acf-gallery-services-section__heading {
  margin: 0;
  max-inline-size: 48rem;
  color: var(--color-brand-forest);
}

.acf-gallery-services-section__service-label {
  margin: 0;
}

.acf-gallery-services-section__service-label-text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-inline-size: 18.5rem; /* styleguide-exception: Figma chip 296px */
  min-block-size: 2.5rem;
  padding-inline: var(--spacing-5);
  padding-block: 0.625rem;
  border: 0;
  border-radius: var(--radius-md, 8px);
  background-color: var(--color-brand-yellow);
  color: var(--color-brand-forest);
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-normal);
  text-align: center;
}

/* Custom dropdown — Figma yellow pill + yellow list (no native select). */
.acf-gallery-services-section__service-dropdown {
  position: relative;
  z-index: 3;
  inline-size: min(100%, 18.5rem); /* styleguide-exception: Figma chip 296px */
}

.acf-gallery-services-section__service-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-3);
  inline-size: 100%;
  min-block-size: 2.5rem; /* Figma 40px */
  padding-inline: 1.25rem;
  padding-block: 0.5rem;
  border: 0;
  border-radius: var(--radius-md, 8px);
  background-color: var(--color-brand-yellow);
  color: var(--color-brand-forest);
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-normal);
  text-align: left;
  cursor: pointer;
}

.acf-gallery-services-section__service-dropdown.is-open .acf-gallery-services-section__service-trigger {
  border-end-start-radius: 0;
  border-end-end-radius: 0;
}

.acf-gallery-services-section__service-trigger-label {
  flex: 1 1 auto;
  min-inline-size: 0;
}

.acf-gallery-services-section__service-trigger-icon {
  flex: 0 0 auto;
  color: var(--color-brand-forest);
  transition: transform 0.15s ease;
}

.acf-gallery-services-section__service-dropdown.is-open .acf-gallery-services-section__service-trigger-icon {
  transform: rotate(180deg);
}

.acf-gallery-services-section__service-trigger:focus-visible {
  outline: 2px solid var(--color-brand-green);
  outline-offset: 2px;
}

.acf-gallery-services-section__service-menu {
  position: absolute;
  inset-inline: 0;
  inset-block-start: 100%;
  z-index: 4;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
  border-end-start-radius: var(--radius-md, 8px);
  border-end-end-radius: var(--radius-md, 8px);
  box-shadow: 0 4px 12px rgb(3 64 15 / 12%); /* styleguide-exception: dropdown depth */
}

.acf-gallery-services-section__service-menu[hidden] {
  display: none;
}

.acf-gallery-services-section__service-menu-item {
  margin: 0;
}

.acf-gallery-services-section__service-option {
  display: block;
  inline-size: 100%;
  margin: 0;
  padding-inline: 1.25rem;
  padding-block: 0.625rem;
  border: 0;
  background-color: var(--color-brand-yellow);
  color: var(--color-brand-forest);
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-normal);
  text-align: left;
  cursor: pointer;
}

.acf-gallery-services-section__service-option:hover,
.acf-gallery-services-section__service-option:focus-visible {
  background-color: var(--color-sunshine-yellow);
}

.acf-gallery-services-section__service-option[aria-selected="true"] {
  background-color: var(--color-sunshine-yellow);
}

.acf-gallery-services-section__service-option:focus-visible {
  outline: 2px solid var(--color-brand-green);
  outline-offset: -2px;
}

.acf-gallery-services-section__intro-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  inline-size: 100%;
}

.acf-gallery-services-section__intro[hidden] {
  display: none;
}

.acf-gallery-services-section__intro {
  max-inline-size: 60.375rem;
  margin: 0;
  color: var(--color-black);
  font-weight: var(--font-weight-medium);
  text-align: center;
}

.acf-gallery-services-section__intro p {
  margin: 0;
}

.acf-gallery-services-section__panels {
  display: flex;
  flex-direction: column;
  inline-size: 100%;
}

.acf-gallery-services-section__panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  inline-size: 100%;
}

.acf-gallery-services-section__panel[hidden] {
  display: none;
}

.acf-gallery-services-section__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-8);
  inline-size: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.acf-gallery-services-section__cell {
  margin: 0;
}

.acf-gallery-services-section__card {
  box-sizing: border-box;
  overflow: hidden;
  border: var(--border-card-accent);
  border-radius: var(--radius-leaf-lg);
  background-color: var(--color-off-white, #f8f8f8);
}

.acf-gallery-services-section__media,
.acf-gallery-services-section__media.bpa-gallery-lightbox-trigger {
  position: relative;
  display: block;
  inline-size: 100%;
  aspect-ratio: 296 / 251; /* styleguide-exception: Figma card media */
  overflow: hidden;
  border-radius: var(--radius-leaf-lg);
  background-color: var(--color-dark);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  text-decoration: none;
}

.acf-gallery-services-section__media:focus-visible {
  outline: 2px solid var(--color-brand-green);
  outline-offset: 2px;
}

.acf-gallery-services-section__overlay {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0%);
  transition: background-color 0.2s ease;
  pointer-events: none;
}

.acf-gallery-services-section__card:hover .acf-gallery-services-section__overlay,
.acf-gallery-services-section__card:focus-within .acf-gallery-services-section__overlay {
  background: rgb(0 0 0 / 38%); /* styleguide-exception: Figma hover dim */
}

.acf-gallery-services-section__play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.acf-gallery-services-section__play-icon {
  display: block;
  inline-size: 2.625rem; /* styleguide-exception: Figma play ~42px */
  block-size: 2.625rem;
}

.acf-gallery-services-section__caption {
  position: absolute;
  inset-inline: 50%;
  inset-block-end: 50%;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  inline-size: min(15.25rem, calc(100% - (2 * var(--spacing-4))));
  min-block-size: 4.5rem;
  padding: var(--spacing-3);
  box-sizing: border-box;
  border-radius: 10px; /* styleguide-exception: Figma caption card radius */
  background-color: rgb(255 255 255 / 85%);
  color: var(--color-black);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 50%);
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.acf-gallery-services-section__card:hover .acf-gallery-services-section__caption,
.acf-gallery-services-section__card:focus-within .acf-gallery-services-section__caption {
  opacity: 1;
}

.acf-gallery-services-section__footer {
  display: flex;
  justify-content: center;
  margin-block-start: var(--spacing-16); /* Figma: 64px grid → footer CTA */
  padding-block-start: 0;
}

.entry-content .acf-gallery-services-section__card,
.wp-block-post-content .acf-gallery-services-section__card {
  border-radius: var(--radius-leaf-lg);
}

.entry-content .acf-gallery-services-section__media,
.wp-block-post-content .acf-gallery-services-section__media {
  border-radius: var(--radius-leaf-lg);
}

/* Gallery services (off-white) → before/after (white) handoff. */
.acf-gallery-services-section--has-bottom-wave + .acf-gallery-before-after-section .acf-gallery-before-after-section__wave--top,
.wp-block-acf-acf-gallery-services-section:has(.acf-gallery-services-section--has-bottom-wave) + .wp-block-acf-acf-gallery-before-after-section .acf-gallery-before-after-section__wave--top {
  display: none;
}

.acf-gallery-services-section--has-bottom-wave + .acf-gallery-before-after-section,
.acf-gallery-services-section:has(> .bpa-local-grass-divider) + .acf-gallery-before-after-section,
.wp-block-acf-acf-gallery-services-section:has(.acf-gallery-services-section--has-bottom-wave) + .wp-block-acf-acf-gallery-before-after-section .acf-gallery-before-after-section,
.wp-block-acf-acf-gallery-services-section:has(.bpa-local-grass-divider) + .wp-block-acf-acf-gallery-before-after-section .acf-gallery-before-after-section {
  margin-block-start: -4px;
}

.acf-gallery-services-section:has(+ .acf-gallery-before-after-section) > .bpa-local-grass-divider .bpa-local-grass-divider__img,
.wp-block-acf-acf-gallery-services-section:has(+ .wp-block-acf-acf-gallery-before-after-section) .bpa-local-grass-divider__img {
  margin-block-end: -4px;
}

@media (min-width: 640px) {
  .acf-gallery-services-section__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .acf-gallery-services-section__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1023px) {
  .acf-gallery-services-section__body {
    padding-inline: var(--spacing-12);
  }

  .acf-gallery-services-section__wave--bottom {
    margin-inline: calc(-1 * var(--spacing-12));
    inline-size: calc(100% + (2 * var(--spacing-12)));
  }
}

@media (max-width: 639px) {
  .acf-gallery-services-section__body {
    padding-inline: var(--space-sm);
  }

  .acf-gallery-services-section__wave--bottom {
    margin-inline: calc(-1 * var(--space-sm));
    inline-size: calc(100% + (2 * var(--space-sm)));
  }

  .acf-gallery-services-section:has(> .bpa-local-grass-divider) > .bpa-local-grass-divider .bpa-local-grass-divider__img,
  .wp-block-acf-acf-gallery-services-section:has(.bpa-local-grass-divider) .bpa-local-grass-divider__img {
    margin-block-end: -6px;
  }
}
