/* Stage Map section. Seven compact cards. Each card = stage number,
   stage name, one-line Amalgamy move. No role breakdown (that's §3).
   3-column grid at desktop so 7 items wrap as 3 + 3 + 1 — the lone
   card in the last row breaks the strict-left-to-right read. */

.stage-map {
  position: relative;
  padding-block: clamp(3rem, 6vw, 5rem);
}

.stage-map__intro {
  max-width: 56rem;
  margin: 0 0 clamp(1.75rem, 3vw, 2.5rem);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}

.stage-map__heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.4vw, 2.5rem);
  font-weight: var(--font-weight-display);
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--color-foreground);
  /* Tailwind max-w-2xl (42rem) + text-wrap: balance so the browser
     evens out line lengths instead of leaving a short orphan like
     "Any Stage." alone on line 2. Supported in all modern browsers;
     older engines fall through to the static max-width. */
  max-width: 42rem;
  text-wrap: balance;
  text-transform: capitalize;
}

.stage-map__heading-accent {
  background: linear-gradient(90deg, var(--brand-teal) 0%, var(--brand-blue) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.stage-map__deck {
  margin: 0;
  font-size: var(--fs-lg);
  line-height: 1.45;
  color: var(--color-muted-foreground);
  max-width: 60ch;
}

/* --- Card grid ----------------------------------------------------- */

.stage-map__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.875rem;
}

.stage-map__card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  /* Center-align the head row so the stage-number pill's bounding
     box centers against the stage title's cap height, not its
     baseline. Baseline alignment was visibly dropping the pill below
     the title. */
  align-items: center;
  row-gap: 0.875rem;
  column-gap: 0.625rem;
  padding: 1rem 1.125rem 1.125rem;
  background: var(--color-card, #ffffff);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px rgb(16 17 20 / 4%);
  transition:
    transform var(--dur-med) var(--ease),
    box-shadow var(--dur-med) var(--ease),
    border-color var(--dur-fast) var(--ease);
}

/* Brand gradient ring overlay. Same mask-composite trick as the
   resource-rail cards: a teal→blue 1px frame sits on top of the
   neutral border and fades in on hover, giving the card a branded
   lift without fighting the card's border radius. */
.stage-map__card::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--radius-lg) + 1px);
  padding: 1px;
  background: var(--brand-gradient);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--dur-med) var(--ease);
  pointer-events: none;
}

.stage-map__card:hover,
.stage-map__card:focus-within {
  transform: translateY(-3px);
  border-color: transparent;
  box-shadow:
    0 12px 28px -14px color-mix(in oklch, var(--brand-teal) 55%, transparent),
    0 6px 14px -8px color-mix(in oklch, var(--brand-blue) 30%, transparent),
    0 1px 2px rgb(16 17 20 / 6%);
}

.stage-map__card:hover::after,
.stage-map__card:focus-within::after {
  opacity: 1;
}

.stage-map__card-n {
  grid-row: 1;
  grid-column: 1;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.14em;
  padding: 0.1875rem 0.4375rem;
  border-radius: var(--radius-sm);
  background: color-mix(in oklch, var(--brand-teal) 10%, transparent);
  color: var(--brand-teal);
  border: 1px solid color-mix(in oklch, var(--brand-teal) 18%, transparent);
  white-space: nowrap;
}

.stage-map__card-name {
  grid-row: 1;
  grid-column: 2;
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: var(--font-weight-display);
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--color-foreground);
}

/* Two-move body: TEAM line (services) + AMALGAMY line (software).
   Each line is a narrow label column + text column. Label color is
   the only differentiator; both lines use the same body size so
   neither role outranks the other visually. */
.stage-map__card-moves {
  grid-row: 2;
  grid-column: 1 / -1;
  margin: 0;
  padding: 0.75rem 0 0;
  border-top: 1px solid color-mix(in oklch, var(--color-border) 80%, transparent);
  display: flex;
  flex-direction: column;
}

.stage-map__card-move {
  margin: 0;
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.625rem;
  align-items: baseline;
  font-size: var(--fs-sm);
  line-height: 1.4;
  color: var(--color-foreground);
}

/* Light rule between the TEAM and AMALGAMY lines. Uses the same
   border token as the head-row divider but at half intensity so
   the inner rule reads as a secondary divider, not a repeat. */
.stage-map__card-move + .stage-map__card-move {
  margin-top: 0.625rem;
  padding-top: 0.625rem;
  border-top: 1px solid color-mix(in oklch, var(--color-border) 50%, transparent);
}

.stage-map__card-move-label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.stage-map__card-move--team .stage-map__card-move-label {
  color: var(--color-muted-foreground);
}

.stage-map__card-move--software .stage-map__card-move-label {
  color: var(--brand-teal);
}

/* --- Responsive ---------------------------------------------------- */

@media (max-width: 980px) {
  .stage-map__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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