/* ==========================================================================
   INDUSTRIES — Compact card grid with pop-on-scroll animation
   12 small cards (3 cols desktop, 2 cols tablet, 1 col mobile). Each card
   pops in (scale 0.9 → 1.05 → 1.0 with orange glow flash) as it scrolls
   into view via IntersectionObserver. No pinning, normal section height.
   ========================================================================== */

.industries {
  background: var(--bg-2);
  padding: var(--space-section) 0;
  position: relative;
  overflow: hidden;
}

.industries::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 700px 400px at 50% 30%, rgba(37, 99, 235, 0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.industries > .container {
  position: relative;
  z-index: 1;
}

.industries .section-title {
  text-align: center;
}

.industries .section-title::after {
  margin-left: auto;
  margin-right: auto;
  width: 80px;
  height: 3px;
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 800ms cubic-bezier(0.16, 1, 0.3, 1);
}

.industries .section-title.revealed::after {
  transform: scaleX(1);
}

.industries__subline {
  font-family: var(--font-body);
  font-size: var(--text-body);
  color: var(--text-secondary);
  text-align: center;
  max-width: 640px;
  margin: calc(var(--space-xl) * -1 + var(--space-sm)) auto var(--space-2xl);
  line-height: var(--leading-normal);
}

/* ==========================================================================
   GRID
   ========================================================================== */

.industries__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  max-width: 1100px;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .industries__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .industries__grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   INDUSTRY CARD
   ========================================================================== */

.industry-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  /* Pre-animation state — calm, slightly small + faded */
  opacity: 0;
  transform: scale(0.92) translateY(8px);
  transition: border-color 220ms cubic-bezier(0.4, 0, 0.2, 1),
              background 220ms cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Pop-in animation triggered by IO adding .is-popped */
.industry-card.is-popped {
  animation: industry-pop 900ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes industry-pop {
  0% {
    opacity: 0;
    transform: scale(0.88) translateY(20px);
    box-shadow: 0 0 0 rgba(37, 99, 235, 0);
    border-color: var(--border-light);
  }
  55% {
    opacity: 1;
    transform: scale(1.06) translateY(0);
    box-shadow: 0 12px 36px rgba(37, 99, 235, 0.32);
    border-color: rgba(37, 99, 235, 0.6);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
    box-shadow: 0 0 0 rgba(37, 99, 235, 0);
    border-color: var(--border-light);
  }
}

/* Hover */
.industry-card:hover,
.industry-card:focus-visible {
  background: var(--surface-hover);
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.22);
}

.industry-card:hover .industry-card__icon,
.industry-card:focus-visible .industry-card__icon {
  background: rgba(37, 99, 235, 0.18);
  border-color: var(--primary);
  transform: scale(1.08) rotate(-4deg);
}

.industry-card:hover .industry-card__arrow,
.industry-card:focus-visible .industry-card__arrow {
  transform: translateX(3px);
  color: var(--primary);
}

/* Icon — orange box on left */
.industry-card__icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-subtle);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 8px;
  color: var(--primary);
  transition: background 220ms cubic-bezier(0.4, 0, 0.2, 1),
              border-color 220ms cubic-bezier(0.4, 0, 0.2, 1),
              transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.industry-card__icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.75px;
}

/* Body — title + sub */
.industry-card__body {
  flex: 1;
  min-width: 0;
}

.industry-card__title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  line-height: 1.15;
  margin: 0 0 0.2rem;
}

.industry-card__sub {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.35;
  margin: 0;
  /* Single-line ellipsis to keep cards tight */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  overflow: hidden;
}

/* Arrow on the right */
.industry-card__arrow {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1),
              color 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.industry-card__arrow svg {
  width: 100%;
  height: 100%;
  stroke-width: 1.75px;
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .industry-card {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }

  .industry-card:hover {
    transform: none !important;
  }

  .industry-card__icon {
    transform: none !important;
  }
}

/* ==========================================================================
   MOBILE COMPACTION — Show top 6 cards by default with "View more" expander.
   Driven by native <details> + :has() sibling selector — no JS needed.
   ========================================================================== */

.industries__expand {
  display: none;
}

@media (max-width: 768px) {
  .industries__expand {
    display: block;
    text-align: center;
    margin-top: var(--space-md);
  }

  .industries__expand-toggle {
    list-style: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: var(--text-small);
    font-weight: 600;
    color: var(--primary-hover);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
  }

  .industries__expand-toggle::-webkit-details-marker { display: none; }
  .industries__expand-toggle::marker { content: ''; }

  .industries__expand-text--hide { display: none; }
  .industries__expand[open] .industries__expand-text--show { display: none; }
  .industries__expand[open] .industries__expand-text--hide { display: inline; }

  /* Hide cards 7-12 when expander is closed */
  .industries__grid:has(+ .industries__expand:not([open])) .industry-card:nth-child(n+7) {
    display: none;
  }
}
