/**
 * Home — Industries We Serve.
 * Enhanced with staggered entrance, gold top-bar reveal, icon pop + rotate,
 * and a subtle ring pulse on hover.
 */

.bes-industries {
  background: var(--bes-white);
}

.bes-industries__head {
  margin-bottom: clamp(40px, 5vw, 64px);
  max-width: 720px;
}

/* =========================================================================
 * Grid
 * ====================================================================== */

.bes-industries__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}

@media (min-width: 640px) {
  .bes-industries__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  .bes-industries__grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* =========================================================================
 * Card
 * ====================================================================== */

.bes-industry-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bes-silver-50);
  padding: 34px 22px 26px;
  overflow: hidden;
  isolation: isolate;
  transition:
    transform var(--bes-dur) var(--bes-ease-out),
    background var(--bes-dur) var(--bes-ease),
    box-shadow var(--bes-dur) var(--bes-ease);
  min-height: 280px;

  /* Entrance animation, staggered by data-stagger parent */
  opacity: 0;
  transform: translateY(28px);
}

/* Gold top bar — animated width reveal on enter */
.bes-industry-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--bes-gold), var(--bes-gold-600));
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 700ms var(--bes-ease-out);
  z-index: 2;
}

/* Sweep accent that runs across the card on hover */
.bes-industry-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: -80%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(234, 193, 23, 0.1) 50%,
    transparent 100%
  );
  transform: skewX(-16deg);
  transition: left 900ms var(--bes-ease-out);
  pointer-events: none;
  z-index: 0;
}

/* When parent grid enters viewport */
[data-stagger].is-visible .bes-industry-card {
  opacity: 1;
  transform: none;
  transition:
    opacity 700ms var(--bes-ease-out),
    transform 700ms var(--bes-ease-out),
    background var(--bes-dur) var(--bes-ease),
    box-shadow var(--bes-dur) var(--bes-ease);
  transition-delay: calc(var(--bes-stagger-i, 0) * 110ms);
}

[data-stagger].is-visible .bes-industry-card::before {
  transform: scaleX(1);
  transition-delay: calc(var(--bes-stagger-i, 0) * 110ms + 250ms);
}

/* Hover state */
.bes-industry-card:hover {
  transform: translateY(-6px);
  background: var(--bes-white);
  box-shadow: var(--bes-shadow-lg), var(--bes-glow-sm);
}

.bes-industry-card:hover::after {
  left: 140%;
}

/* =========================================================================
 * Icon tile
 * ====================================================================== */

.bes-industry-card__icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  background: var(--bes-black);
  color: var(--bes-gold);
  margin-bottom: 22px;
  z-index: 1;
  transition:
    transform var(--bes-dur-slow) var(--bes-ease-out),
    box-shadow var(--bes-dur) var(--bes-ease);
}

/* Pulsing ring behind the tile, revealed on hover */
.bes-industry-card__icon::before {
  content: "";
  position: absolute;
  inset: -10px;
  border: 1px solid var(--bes-gold);
  opacity: 0;
  transition: opacity var(--bes-dur) var(--bes-ease);
  pointer-events: none;
}

.bes-industry-card__icon::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bes-gold);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 500ms var(--bes-ease-out);
  z-index: -1;
}

.bes-industry-card__icon svg {
  width: 28px;
  height: 28px;
  position: relative;
  z-index: 1;
  transition: transform var(--bes-dur-slow) var(--bes-ease-out);
}

/* Icon entrance */
[data-stagger].is-visible .bes-industry-card__icon {
  animation: bes-industry-icon-in 700ms var(--bes-ease-out) both;
  animation-delay: calc(var(--bes-stagger-i, 0) * 110ms + 200ms);
}

@keyframes bes-industry-icon-in {
  0% {
    opacity: 0;
    transform: scale(0.5) rotate(-25deg);
  }
  60% {
    opacity: 1;
    transform: scale(1.08) rotate(3deg);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

/* Hover: tile fills with gold, icon goes black, icon spins */
.bes-industry-card:hover .bes-industry-card__icon {
  transform: rotate(-4deg) scale(1.06);
  box-shadow: var(--bes-glow-md);
}

.bes-industry-card:hover .bes-industry-card__icon::after {
  transform: scaleX(1);
}

.bes-industry-card:hover .bes-industry-card__icon::before {
  opacity: 0.55;
  animation: bes-industry-ring-pulse 2s ease-in-out infinite;
}

.bes-industry-card:hover .bes-industry-card__icon svg {
  color: var(--bes-black);
  animation: bes-industry-icon-spin 700ms var(--bes-ease-out) forwards;
}

@keyframes bes-industry-icon-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes bes-industry-ring-pulse {
  0% {
    transform: scale(1);
    opacity: 0.55;
  }
  50% {
    transform: scale(1.14);
    opacity: 0.15;
  }
  100% {
    transform: scale(1);
    opacity: 0.55;
  }
}

/* =========================================================================
 * Text
 * ====================================================================== */

.bes-industry-card__title {
  font-family: var(--bes-font-head);
  font-size: 1.1875rem;
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.15;
  margin: 0 0 10px;
  color: var(--bes-text);
  position: relative;
  z-index: 1;
  transition: color var(--bes-dur-fast) var(--bes-ease);
}

.bes-industry-card__text {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--bes-text-muted);
  margin: 0 0 20px;
  position: relative;
  z-index: 1;
}

.bes-industry-card__link {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bes-black);
  border-bottom: 2px solid var(--bes-gold);
  padding-bottom: 2px;
  align-self: flex-start;
  position: relative;
  z-index: 1;
  transition: color var(--bes-dur-fast) var(--bes-ease);
}

.bes-industry-card__link svg {
  width: 12px;
  height: 12px;
  transition: transform var(--bes-dur) var(--bes-ease);
}

.bes-industry-card:hover .bes-industry-card__link {
  color: var(--bes-gold-600);
}

.bes-industry-card:hover .bes-industry-card__link svg {
  transform: translateX(6px);
}

/* =========================================================================
 * Reduced motion
 * ====================================================================== */

@media (prefers-reduced-motion: reduce) {
  .bes-industry-card,
  [data-stagger].is-visible .bes-industry-card {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .bes-industry-card::before {
    transform: scaleX(1) !important;
    transition: none !important;
  }
  [data-stagger].is-visible .bes-industry-card__icon {
    animation: none !important;
  }
  .bes-industry-card:hover .bes-industry-card__icon svg {
    animation: none !important;
  }
  .bes-industry-card:hover .bes-industry-card__icon::before {
    animation: none !important;
  }
}
