/* ===========================================================
   Triveni Power - the-engineering-inside.
   Always-dark band (matches Partners for the Long Run).
   Split layout:
     · LHS - sticky stacked headline + lead paragraph
     · RHS - 5 white cards in tall slots, each card is
             position:sticky with staggered top so they
             OVERLAY on scroll (adniaconseils.ca-style).
   =========================================================== */

.engineering {
  /* Local dark scope (same pattern as .positioning / .hero) */
  --ink:          #FFFFFF;
  --ink-80:       rgba(255, 255, 255, 0.84);
  --ink-60:       rgba(255, 255, 255, 0.60);
  --ink-40:       rgba(255, 255, 255, 0.42);
  --ink-12:       rgba(255, 255, 255, 0.16);
  --paper:        #231F20;
  --accent:       #F58220;
  --secondary:    #1B5A90;

  background: #231F20;
  color: var(--ink);
  padding: clamp(80px, 10vw, 140px) 0 clamp(40px, 4vw, 80px);
  position: relative;
  isolation: isolate;
  min-height: 662px;
}

/* =========================================================
   AURORA BACKGROUND - same drifting gradients as Positioning
   ========================================================= */
.engineering__aurora {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 12%, #000 88%, transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0%, #000 12%, #000 88%, transparent 100%);
}
.engineering__aurora-layer {
  position: absolute;
  inset: -20%;
  filter: blur(48px);
  /* Animate transform only (GPU-composited) so the blurred layer is
     rasterised once and cached as a texture, never re-blurred per frame.
     Animating background-position here forced a full 48px-blur repaint
     every frame and stalled the section. */
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

.engineering__aurora-layer--a {
  background:
    repeating-linear-gradient(
      100deg,
      rgba(245,130,32,0.00) 0%,
      rgba(245,130,32,0.00) 7%,
      rgba(245,130,32,0.32) 10%,
      rgba(255,194,14,0.32) 15%,
      rgba(245,130,32,0.00) 20%,
      rgba(245,130,32,0.00) 25%
    ),
    repeating-linear-gradient(
      100deg,
      rgba(35,31,32,0)   0%,
      rgba(35,31,32,0)  10%,
      rgba(35,31,32,0.40) 12%,
      rgba(35,31,32,0)  14%,
      rgba(35,31,32,0)  22%
    );
  background-size: 300% 200%;
  opacity: 0.55;
  mix-blend-mode: screen;
  animation: engAuroraDrift 42s linear infinite;
}

.engineering__aurora-layer--b {
  background:
    repeating-linear-gradient(
      100deg,
      rgba(23,71,158,0.00) 0%,
      rgba(23,71,158,0.00) 12%,
      rgba(23,71,158,0.30) 16%,
      rgba(118,176,67,0.16) 22%,
      rgba(23,71,158,0.00) 28%,
      rgba(23,71,158,0.00) 40%
    );
  background-size: 280% 220%;
  opacity: 0.50;
  mix-blend-mode: screen;
  animation: engAuroraDrift 56s linear infinite reverse;
}

@keyframes engAuroraDrift {
  0%   { transform: translate3d(0, 0, 0); }
  50%  { transform: translate3d(14%, 6%, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .engineering__aurora-layer { animation: none !important; }
}

/* =========================================================
   CONTAINER - 2-col grid (logo-aligned)
   ========================================================= */
.engineering__container {
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(48px, 6vw, 88px);
  align-items: start;
}
@media (min-width: 1024px) {
  .engineering__container {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: clamp(56px, 6vw, 96px);
  }
}

/* =========================================================
   LHS INTRO - stacked headline + body (sticky)
   ========================================================= */
.engineering__intro {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 1.5vw, 20px);
}
@media (min-width: 1024px) {
  .engineering__intro {
    position: sticky;
    top: clamp(96px, 10vw, 140px);
  }
}

.engineering__title {
  font-family: var(--font-display);
  font-size: var(--fs-l);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
  text-transform: uppercase;
  color: #FFFFFF;
  margin: 0;
}
.engineering__title em {
  font-style: normal;
  color: var(--accent);
}

.engineering__body {
  font-family: var(--font-display);
  font-size: var(--fs-m);
  line-height: 1.65;
  color: #FFFFFF;
  margin: 0;
  max-width: 52ch;
}
.engineering__body strong {
  font-weight: 600;
  color: #FFFFFF;
}

/* CTA sits in the intro flex column - align left so the pill
   doesn't stretch full-width; intro gap handles vertical rhythm. */
.engineering__cta {
  align-self: flex-start;
  margin-top: clamp(4px, 0.5vw, 8px);
}

/* =========================================================
   RHS CARD STACK - each card lives in a tall "slot" so
   it has scroll room while position:sticky.
   Cards have staggered top values so previous cards
   peek out behind newer ones (deck-of-cards reveal).
   ========================================================= */
.engineering__cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: block;
  position: relative;
}

/* The <li> wrapper is the sticky element so that ALL cards share the
   same sticky containing block (the <ol>). That's what lets earlier
   cards stay pinned while later cards scroll up over them
   (deck-of-cards reveal, à la adniaconseils.ca). */
.engineering__card-slot {
  position: sticky;
  top: calc(clamp(96px, 10vw, 140px) + var(--i, 0) * 22px);
  display: block;
  margin: 0 0 50px;
}
.engineering__card-slot:last-child {
  margin-bottom: clamp(40px, 4vw, 80px);
}

.engineering__card {
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: clamp(220px, 22vw, 280px);
  background: #FFFFFF;
  color: #231F20;
  padding: clamp(24px, 2.2vw, 32px) clamp(24px, 2.2vw, 36px);
  border-radius: 10px;
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.04) inset,
    0 18px 40px rgba(0, 0, 0, 0.32),
    0 4px 14px rgba(0, 0, 0, 0.20);
  transition: transform 360ms var(--ease-out), box-shadow 360ms var(--ease-out);
}
.engineering__card:hover {
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.04) inset,
    0 26px 56px rgba(0, 0, 0, 0.42),
    0 6px 18px rgba(0, 0, 0, 0.24);
}

/* =========================================================
   CARD HEAD - icon badge + title + number
   ========================================================= */
.engineering__card-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(14px, 1.4vw, 18px);
  padding-bottom: clamp(14px, 1.4vw, 18px);
  border-bottom: 1px solid rgba(35, 31, 32, 0.16);
}

.engineering__card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(245, 130, 32, 0.12);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.engineering__card-icon svg,
.engineering__card-icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

.engineering__card-title {
  font-family: var(--font-display);
  font-size: 24px;          /* card titles sit between M and L */
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.2;
  color: #231F20;
  margin: 0;
}

.engineering__card-num {
  font-family: var(--font-sans);
  font-feature-settings: "tnum" 1;
  font-size: var(--fs-s);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  flex-shrink: 0;
}

/* =========================================================
   CARD BODY - sentence-case description (no caps)
   ========================================================= */
.engineering__card-body {
  padding-top: clamp(14px, 1.4vw, 18px);
}

.engineering__card-desc {
  font-family: var(--font-display);
  font-size: var(--fs-m);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.65;
  color: rgba(35, 31, 32, 0.8);
  text-transform: none;
  margin: 0;
  max-width: 56ch;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1023px) {
  /* Keep the sticky deck-of-cards reveal on tablet/mobile, but with
     tighter offsets so each card pins just below the mobile nav and
     subsequent cards slide up over it. */
  .engineering__card-slot {
    top: calc(76px + var(--i, 0) * 14px);
    margin-bottom: clamp(120px, 28vw, 200px);
  }
  .engineering__card-slot:last-child {
    margin-bottom: clamp(40px, 8vw, 80px);
  }
}

@media (max-width: 1023px) and (prefers-reduced-motion: reduce) {
  .engineering__card-slot {
    position: relative;
    top: auto;
    margin-bottom: clamp(16px, 4vw, 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .engineering__card { transition: none !important; }
}
