/*
 * Alf Theme — Manufacturing Capabilities Section
 * Figma nodes: 587:1371 (desktop) · 612:1206 (mobile) · 855:2807 (collapsed state)
 *
 * Stack-collapse scroll effect:
 *   • Each .mfg-capabilities__item contains a slim "bar" (icon + title)
 *     and a full expanded "card" (image + body).
 *   • JS adds .mfg-capabilities__item--collapsed once a card scrolls out of
 *     the viewport; this hides the full card and reveals only the bar.
 *   • The collapsed bar gets sticky positioning so it visually stacks at the
 *     top of the section as subsequent cards collapse behind it.
 */

/* ═══════════════════════════════════════════════════════════════════
   SCROLL-PIN TRACK
   Provides the extra scroll height needed for the accordion effect.
   The section inside is position:sticky — it stays pinned while the
   user scrolls through this track. JS sets the track height.
   ═══════════════════════════════════════════════════════════════════ */
.mfg-cap-track {
  position: relative;
  overflow: hidden;
  /* hides pre-pin blank space; fixed section is unclipped */
}

/* ═══════════════════════════════════════════════════════════════════
   SECTION
   ═══════════════════════════════════════════════════════════════════ */
.mfg-capabilities {
  /* position controlled entirely by JS: fixed while pinned, absolute after release */
  background-color: #f8faf0;
  padding: 160px 0;
}

/* ── Header ──────────────────────────────────────────────────────── */
.mfg-capabilities__header {
  display: flex;
  flex-direction: column;
  gap: 32px;
  align-items: center;
  text-align: center;
  max-width: 896px;
  margin: 0 auto 60px;
}

.mfg-capabilities__title {
  font-size: 36px;
  font-weight: 600;
  line-height: 1.2;
  color: #252525;
  margin: 0;
}

.mfg-capabilities__subtitle {
  font-size: 20px;
  font-weight: 400;
  line-height: 1.5;
  color: #252525;
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   STACK CONTAINER
   ═══════════════════════════════════════════════════════════════════ */
.mfg-capabilities__stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   ITEM  (sticky wrapper — collapses to 72 px bar)
   top & z-index are injected by JS: top = baseTop + i×72; z-index = N−i
   (earlier items get higher z-index so their bars aren't covered).
   ═══════════════════════════════════════════════════════════════════ */
.mfg-capabilities__item {
  background: #f8faf0;
}

/* ── Bar — hidden (height 0) until card collapses, slides open ─── */
.mfg-capabilities__item-bar {
  display: flex;
  align-items: center;
  gap: 24px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  /* JS animates max-height + opacity inline */
  transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s ease 0.1s;
}

.mfg-capabilities__item-bar-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 72px;
  width: 100%;
  border-bottom: 1px solid rgba(37, 37, 37, 0.12);
}

.mfg-capabilities__item-bar-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  color: #252525;
}

/* ── Full card body — collapse animation ─────────────────────────── */
[data-cap-card] {
  overflow: hidden;
  /* max-height: animated by JS inline styles; keep transition for JS-driven animation */
  transition: opacity 0.35s ease, max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* JS sets max-height + opacity inline. This rule only handles pointer-events. */
.mfg-capabilities__item--collapsed [data-cap-card] {
  pointer-events: none;
}

/* ── Divider ─────────────────────────────────────────────────────── */
.mfg-capabilities__divider {
  border: none;
  border-top: 1px solid rgba(37, 37, 37, 0.12);
  margin: 60px 0;
  transition: margin 0.35s ease, opacity 0.3s ease;
}

.mfg-capabilities__item--collapsed .mfg-capabilities__divider {
  margin: 0;
  opacity: 0;
}


/* ═══════════════════════════════════════════════════════════════════
   CARD  (expanded full view)
   ═══════════════════════════════════════════════════════════════════ */
.mfg-capabilities__card {
  display: flex;
  align-items: stretch;
  background-color: #f0f0e3;
  border-radius: 16px;
  overflow: hidden;
}

.mfg-capabilities__card--img-left {
  flex-direction: row;
}

.mfg-capabilities__card--img-right {
  flex-direction: row-reverse;
}

/* ── Image half ──────────────────────────────────────────────────── */
.mfg-capabilities__card-image {
  position: relative;
  flex: 0 0 50%;
  min-height: 320px;
  overflow: hidden;
  border-radius: 16px;
  box-shadow: 0px 10px 15px -3px rgba(0, 0, 0, .1), 0px 4px 6px -4px rgba(0, 0, 0, .1);
  background-color: #f8faf0;
}

.mfg-capabilities__card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Icon badge ──────────────────────────────────────────────────── */
.mfg-capabilities__card-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  background-color: var(--color-primary, #cd261d);
  border-radius: 10px;
  box-shadow: 0px 10px 7.5px rgba(0, 0, 0, .1), 0px 4px 3px rgba(0, 0, 0, .1);
  padding: 0 16px;
}

/* Badge positioned on the image half of the expanded card */
.mfg-capabilities__card-badge--on-image {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 2;
}

.mfg-capabilities__card-badge img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
}

/* ── Text half ───────────────────────────────────────────────────── */
.mfg-capabilities__card-body {
  flex: 0 0 50%;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 32px;
  justify-content: center;
}

.mfg-capabilities__card-title {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  color: #252525;
  margin: 0;
}

.mfg-capabilities__card-desc {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  color: #252525;
  margin: 0;
}

/* ── Feature tags ────────────────────────────────────────────────── */
.mfg-capabilities__card-tags {
  display: flex;
  gap: 12px;
  align-items: stretch;
  flex-wrap: wrap;
}

.mfg-capabilities__tag {
  flex: 1 0 0;
  min-width: 120px;
  display: flex;
  align-items: center;
  padding: 24px;
  background-color: #ffffff;
  border-left: 4px solid var(--color-primary, #cd261d);
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  color: #252525;
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet ≤1024px
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .mfg-capabilities {
    padding: 120px 0;
  }

  .mfg-capabilities__title {
    font-size: 32px;
  }

  .mfg-capabilities__card-body {
    padding: 24px;
  }

  .mfg-capabilities__card-title {
    font-size: 22px;
  }

  .mfg-capabilities__tag {
    padding: 16px;
    font-size: 14px;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile ≤768px
   Disable the sticky-bar collapse effect; cards always fully expanded.
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .mfg-capabilities__header {
    gap: 32px;
    margin-bottom: 48px;
  }

  .mfg-capabilities__title {
    font-size: 32px;
    font-weight: 600;
  }

  .mfg-capabilities__subtitle {
    font-size: 20px;
    font-weight: 300;
  }

  /* Disable collapse on mobile — normal flow, always expanded */
  .mfg-cap-track {
    height: auto !important;
    overflow: visible !important;
  }

  .mfg-capabilities {
    position: static !important;
    padding: 120px 0;
  }

  .mfg-capabilities__item-bar {
    display: none !important;
  }

  .mfg-capabilities__item--collapsed [data-cap-card] {
    max-height: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .mfg-capabilities__item--collapsed .mfg-capabilities__divider {
    margin: 48px 0 !important;
    opacity: 1 !important;
  }

  /* Stack cards vertically */
  .mfg-capabilities__card,
  .mfg-capabilities__card--img-left,
  .mfg-capabilities__card--img-right {
    flex-direction: column;
  }

  .mfg-capabilities__card-image {
    flex: none;
    min-height: 189px;
    border-radius: 16px 16px 0 0;
    box-shadow: none;
  }

  .mfg-capabilities__card-img {
    position: relative;
    height: 189px;
    width: 100%;
    object-fit: cover;
  }

  .mfg-capabilities__card-body {
    flex: none;
    padding: 16px 16px 32px;
    gap: 24px;
  }

  .mfg-capabilities__card-title {
    font-size: 20px;
    font-weight: 700;
  }

  .mfg-capabilities__card-desc {
    font-size: 16px;
    font-weight: 300;
  }

  .mfg-capabilities__card-tags {
    flex-direction: column;
    gap: 12px;
  }

  .mfg-capabilities__tag {
    flex: none;
    min-width: unset;
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
  }

  .mfg-capabilities__divider {
    margin: 48px 0;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE — Small ≤480px
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .mfg-capabilities {
    padding: 80px 0;
  }

  .mfg-capabilities__title {
    font-size: 28px;
  }
}