/* ============================================================
   AI CONSTRUCTION HOW WE WORK - module.css
   --ahw-accent / --ahw-bg are injected on the section from HubL;
   --ahw-rows (on .ahw-steps) and --ahw-row (on each step) place
   the steps around the centre image on desktop.
   Grid: [left step: text | 40px node] [image] [40px node | text]
   Type sizes and breakpoints follow applied-ai-solutions.
   ============================================================ */

.ahw-section {
  --ahw-accent: #3B7BF6;
  --ahw-bg: #F5F6FA;
  --ahw-ring: rgba(59, 123, 246, .16);
  --ahw-gap: 14px;
  padding: clamp(48px, 7vw, 96px) 40px;
  background: var(--ahw-bg);
  -webkit-font-smoothing: antialiased;
}

@supports (background: color-mix(in srgb, red 10%, white)) {
  .ahw-section {
    --ahw-ring: color-mix(in srgb, var(--ahw-accent) 16%, transparent);
  }
}

.ahw-container {
  max-width: 1180px;
  margin: 0 auto;
}

/* -- Header (matches applied-ai-solutions) ------------------- */
/* Eyebrow on top; title (left) | description (right) below */
.ahw-eyebrow {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ahw-accent);
}

.ahw-head-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px clamp(32px, 4vw, 64px);
  align-items: start;
}

.ahw-eyebrow + .ahw-head-row {
  margin-top: 14px;
}

.ahw-section .ahw-title {
  width: auto !important;
  max-width: 100% !important;
  margin: 0 !important;
  font-size: clamp(30px, 3.4vw, 44px) !important;
  font-weight: 800;
  letter-spacing: -.028em;
  line-height: 1.06;
  color: #0B1020;
}

.ahw-desc {
  margin: 0;
  padding-top: 6px;
  font-size: 16px;
  line-height: 1.75;
  color: #5A6472;
}

/* -- Steps grid ---------------------------------------------- */
.ahw-steps {
  --ahw-rows: 4;
  margin-top: clamp(32px, 4vw, 48px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr);
  column-gap: var(--ahw-gap);
  row-gap: clamp(32px, 3.6vw, 52px);
}

.ahw-step {
  --ahw-row: 1;
  display: grid;
  column-gap: var(--ahw-gap);
  align-items: start;
  min-width: 0;
  grid-row: var(--ahw-row);
}

/* Left column: text then node (node faces the image) */
.ahw-step--left {
  grid-column: 1;
  grid-template-columns: minmax(0, 1fr) 40px;
  grid-template-areas: "txt node";
}

/* Right column: node then text */
.ahw-step--right {
  grid-column: 3;
  grid-template-columns: 40px minmax(0, 1fr);
  grid-template-areas: "node txt";
}

.ahw-step-txt {
  grid-area: txt;
  min-width: 0;
}

.ahw-node {
  grid-area: node;
  position: relative;
  /* Centre the 40px bubble on the title's first line */
  margin-top: -7px;
}

.ahw-num {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--ahw-accent);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s ease;
}

/* Short connector from the bubble towards the image */
.ahw-node::after {
  content: "";
  position: absolute;
  top: 19px;
  width: calc(var(--ahw-gap) + clamp(4px, 1vw, 16px));
  height: 2px;
  background: var(--ahw-accent);
  transform: scaleX(.35);
  transition: transform .45s cubic-bezier(.22, .61, .36, 1);
}

.ahw-step--left .ahw-node::after {
  left: 100%;
  transform-origin: left center;
}

.ahw-step--right .ahw-node::after {
  right: 100%;
  transform-origin: right center;
}

/* Hover only - every step looks the same at rest */
.ahw-step:hover .ahw-num {
  transform: scale(1.08);
  box-shadow: 0 0 0 6px var(--ahw-ring), 0 10px 22px -10px rgba(16, 30, 80, .45);
}

.ahw-step:hover .ahw-node::after {
  transform: scaleX(1);
}

.ahw-section .ahw-step-title {
  margin: 0 !important;
  font-size: 20px !important;
  font-weight: 800;
  letter-spacing: -.015em;
  line-height: 1.3;
  color: #0F1A2E;
}

.ahw-step-desc {
  margin: 8px 0 0;
  font-size: 16px;
  line-height: 1.75;
  color: #5A6472;
}

/* -- Centre image -------------------------------------------- */
.ahw-media {
  grid-column: 2;
  grid-row: 1 / span var(--ahw-rows);
  align-self: center;
  min-width: 0;
  padding: 0 clamp(4px, 1vw, 16px);
}

.ahw-img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1040 / 918;
  object-fit: contain;
}

/* Placeholder while no image is chosen: soft blueprint panel */
.ahw-media-fallback {
  display: block;
  width: 100%;
  aspect-ratio: 1040 / 918;
  border-radius: 24px;
  background-color: #EAF0FD;
  background-image:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, .9) 0%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(rgba(59, 123, 246, .10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 123, 246, .10) 1px, transparent 1px);
  background-size: auto, 28px 28px, 28px 28px;
}

/* -- Scroll reveal (steps fade up, staggered via --d from JS) -- */
@media (prefers-reduced-motion: no-preference) {
  .ahw-animate .ahw-step,
  .ahw-animate .ahw-media {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .6s ease var(--d, 0ms),
                transform .6s cubic-bezier(.22, .61, .36, 1) var(--d, 0ms);
  }

  .ahw-animate .ahw-step.is-visible,
  .ahw-animate .ahw-media.is-visible {
    opacity: 1;
    transform: none;
  }
}

/* -- Responsive ---------------------------------------------- */
@media (max-width: 1024px) {
  /* Header stacks into one centred column */
  .ahw-head {
    text-align: center;
  }

  .ahw-head-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .ahw-section .ahw-title {
    max-width: 600px !important;
    margin: 0 auto !important;
    text-align: center;
    text-wrap: wrap;
  }

  .ahw-desc {
    max-width: 550px;
    margin: 0 auto;
    text-align: center;
    text-wrap: wrap;
  }

  /* Image hidden (as in the design); steps go 2-up in order,
     an odd last step fills the row */
  .ahw-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 20px;
    row-gap: 36px;
  }

  .ahw-media {
    display: none;
  }

  .ahw-step,
  .ahw-step--left,
  .ahw-step--right {
    grid-column: auto;
    grid-row: auto;
    grid-template-columns: 40px minmax(0, 1fr);
    grid-template-areas: "node txt";
    column-gap: 16px;
  }

  /* The hidden image is the grid's last child, so the last step is
     :nth-last-child(2); it fills the row when the count is odd */
  .ahw-steps > .ahw-step:nth-last-child(2):nth-child(odd) {
    grid-column: 1 / -1;
  }

  .ahw-node::after {
    display: none;
  }
}

@media (max-width: 640px) {
  .ahw-section {
    padding: 48px 20px;
  }

  .ahw-steps {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 28px;
  }

  .ahw-steps > .ahw-step:nth-last-child(2):nth-child(odd) {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ahw-num,
  .ahw-node::after {
    transition: none;
  }

  .ahw-step:hover .ahw-num {
    transform: none;
  }
}
