/* ==========================================================================
   MBH — services.css
   Idea: six text-led service cards, each carrying its discipline icon, then
   a delivery process told as a scroll story: a sticky illustration frame on
   the left crossfades to the stage being read on the right.
   ========================================================================== */

.svc-wrap {
  max-width: 1180px;
  margin-inline: auto;
}

/* --------------------------------------------------------- service tiles */
.svc-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(18px, 2vw, 28px);
}

@media (min-width: 720px) {
  .svc-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1100px) {
  .svc-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.svc {
  position: relative;
  overflow: hidden;
  min-height: 100%;
  padding: clamp(24px, 3vw, 34px);
  border: 1px solid var(--line);
  background: var(--paper);
  scroll-margin-top: calc(var(--header-h-sm) + 40px);
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}

/* Brand rule that runs along the top edge on hover */
.svc::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 44px;
  height: 3px;
  background: var(--accent);
  transition: width 0.6s var(--ease);
}

.svc:hover {
  border-color: rgba(89, 141, 41, 0.45);
  background: #FAFBF9;
  transform: translateY(-4px);
}

.svc:hover::before { width: 100%; }

.svc__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: clamp(28px, 3.4vw, 44px);
}

.svc__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 1px solid var(--line);
  background: var(--bone);
  color: var(--accent);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.svc__icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.svc:hover .svc__icon {
  border-color: var(--green-900);
  background: var(--green-900);
  color: var(--paper);
}

.svc__index {
  color: var(--green-900);
  font-size: clamp(3rem, 5vw, 4.25rem);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 0.8;
  transition: color var(--dur) var(--ease);
}

.svc:hover .svc__index { color: var(--accent); }

/* Optional image: add <figure class="svc__media"> as the card's first child */
.svc__media {
  margin: calc(clamp(24px, 3vw, 34px) * -1) calc(clamp(24px, 3vw, 34px) * -1) clamp(22px, 2.6vw, 30px);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #f1f2ee;
}

.svc__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.svc:hover .svc__media img { transform: scale(1.04); }

.svc__num {
  display: block;
  margin-bottom: 14px;
  color: var(--accent);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.2em;
}

.svc__title {
  margin-bottom: 12px;
  font-size: clamp(1.25rem, 1.8vw, 1.55rem);
  letter-spacing: -0.018em;
}

.svc__text { max-width: 44ch; font-size: var(--fs-small); }

.svc__points { margin-top: 24px; border-top: 1px solid var(--line); }

.svc__points li {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-small);
}

.svc__points li::before {
  content: "";
  width: 10px;
  height: 2px;
  margin-top: 9px;
  background: var(--accent);
  transform: skewX(-19deg);
}

/* --------------------------------------------------------- process story */
/* clip (not hidden) so the sticky frame inside can still stick to the
   viewport; hidden stays as the fallback for older browsers */
.process {
  position: relative;
  overflow: hidden;
  overflow: clip;
  background:
    linear-gradient(135deg, rgba(10, 51, 37, 0.95) 0%, rgba(6, 39, 28, 1) 58%),
    var(--green-900);
  padding-block: var(--section);
}

.process__inner { position: relative; z-index: 1; }

.process .h2 { color: var(--paper); max-width: 16ch; }

.process__layout {
  --i: 0;
  --progress: 0;
  margin-top: clamp(40px, 5vw, 72px);
}

/* Sticky frame: desktop only */
.process__stage { display: none; }

.process__frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 5 / 4;
  border: 1px solid var(--line-dk);
  background: var(--green-900);
}

.process__frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 0.8s var(--ease), transform 1.4s var(--ease);
}

.process__frame img.is-active { opacity: 1; transform: scale(1); }

/* Caption chip: names the stage on show */
.process__caption {
  position: absolute;
  left: clamp(16px, 1.8vw, 24px);
  bottom: clamp(20px, 2.2vw, 28px);
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 12px 18px;
  background: var(--accent);
  color: var(--paper);
  line-height: 1;
}

.process__caption-num {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.process__caption-name {
  font-size: var(--fs-small);
  font-weight: 600;
}

.process__caption-total {
  color: rgba(254, 254, 254, 0.7);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: 0.12em;
}

/* Progress along the foot of the frame */
.process__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgba(254, 254, 254, 0.12);
}

.process__bar i {
  display: block;
  height: 100%;
  background: var(--accent-hi);
  transform: scaleX(calc((var(--i) + 1) / 6));
  transform-origin: left;
  transition: transform 0.8s var(--ease);
}

/* Steps on a vertical rail that fills as you progress */
.process__steps {
  position: relative;
  padding-left: 34px;
}

.process__steps::before,
.process__steps::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 6px;
  width: 2px;
}

.process__steps::before { background: rgba(254, 254, 254, 0.14); }

.process__steps::after {
  background: var(--accent);
  transform: scaleY(var(--progress));
  transform-origin: top;
  transition: transform 0.8s var(--ease);
}

.process__step {
  position: relative;
  padding-bottom: clamp(24px, 3vw, 32px);
}

.process__step:last-child { padding-bottom: 0; }

/* the marker */
.process__step::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 2px;
  left: -34px;
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--green-900);
  transition: background-color 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.process__step.is-active::before,
.process__step.is-passed::before { background: var(--accent); }

.process__step.is-active::before { box-shadow: 0 0 0 7px rgba(89, 141, 41, 0.22); }

.process__step b {
  display: block;
  margin-bottom: 10px;
  color: var(--accent-hi);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.2em;
}

.process__title {
  color: var(--paper);
  font-size: clamp(1.15rem, 1.8vw, 1.6rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.process__step p {
  max-width: 40ch;
  margin-top: 12px;
  color: rgba(254, 254, 254, 0.68);
  font-size: var(--fs-body);
  line-height: 1.65;
}

/* Inline illustration per step (tablet / phone) */
.process__media {
  overflow: hidden;
  aspect-ratio: 5 / 4;
  margin-bottom: 22px;
  border: 1px solid var(--line-dk);
}

.process__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (min-width: 700px) and (max-width: 999px) {
  .process__media { max-width: 560px; }
}

@media (min-width: 1000px) {
  .process__layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: clamp(48px, 6vw, 96px);
    align-items: start;
  }

  .process__stage {
    display: block;
    position: sticky;
    top: clamp(calc(var(--header-h-sm) + 32px), calc(50vh - 22vw), 160px);
  }

  .process__media { display: none; }

  /* Each stage gets a scroll's worth of room so the frame can follow */
  .process__steps { --pad: clamp(20px, 3vh, 32px); }

  .process__steps::before,
  .process__steps::after { top: calc(var(--pad) + 8px); }

  .process__step {
    min-height: clamp(150px, 22vh, 210px);
    padding: var(--pad) 0 0;
  }

  .process__step::before { top: calc(var(--pad) + 2px); }

  /* The stage being read holds focus; the rest soften (JS on) */
  .process__layout.is-live .process__step > * { transition: opacity 0.6s var(--ease); }
  .process__layout.is-live .process__step:not(.is-active) > * { opacity: 0.3; }
}

@media (prefers-reduced-motion: reduce) {
  .svc,
  .svc::before,
  .process__frame img,
  .process__bar i,
  .process__steps::after,
  .process__layout.is-live .process__step > * { transition: none; }
  .svc:hover { transform: none; }
}
