/* ==========================================================
   PortfolioWall — student portfolio cards filling the Businesses hero
   behind the headline (js/portfolio-wall.js builds and flips them).

   Cards are home's portfolio card (.landed + .portfolio__* + .tags + .chip,
   css/product.css); .landed--wall only places them in the wall.
   A soft fade keeps a calm area around the headline (a gradient, not a
   live blur: cheaper, and the design doc rules out blur on moving parts).
   Only transform animates (the flip).
   ========================================================== */

.biz-wall {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
/* Built by the script; without JS the hero is just the headline */
html:not(.js) .biz-wall { display: none; }

/* A slightly tilted grid, wider and taller than the hero so the tilt never shows an edge */
.biz-wall__grid {
  --wall-card-w: 210px;  /* = CARD_W in js/portfolio-wall.js */
  --wall-card-h: 196px;  /* = CARD_H */
  --wall-gap: 16px;      /* = GAP */
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  grid-template-columns: repeat(var(--wall-cols, 8), var(--wall-card-w));
  grid-auto-rows: var(--wall-card-h);
  gap: var(--wall-gap);
  transform: translate(-50%, -50%) rotate(-6deg) scale(var(--wall-scale, 1));
}
/* Phones: a smaller wall, so more cards fit around the headline */
@media (max-width: 767px) {
  .biz-wall__grid { --wall-scale: 0.72; }
}
/* Every other column sits half a card lower */
.biz-wall__slot { perspective: 900px; }
.biz-wall__slot--low { transform: translateY(calc(var(--wall-card-h) / 2)); }

/* The flip: two faces back to back, the inner turns 180° */
.biz-wall__flip {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 800ms var(--ease);
}
.biz-wall__slot.is-flipped .biz-wall__flip { transform: rotateY(180deg); }

.landed.landed--wall {
  position: absolute;
  inset: 0;
  right: 0;
  top: 0;
  width: auto;
  margin: 0;
  padding: 16px;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  box-shadow: 0 14px 34px -18px rgba(7, 0, 48, 0.35);
}
/* product.css hides .landed until a step reveals it; wall cards are always shown */
.js .landed.landed--wall { opacity: 1; transform: none; transition: none; }
.js .landed.landed--wall.biz-wall__face--back,
.landed.landed--wall.biz-wall__face--back { transform: rotateY(180deg); }
.landed--wall .portfolio__head { gap: 8px 10px; padding-bottom: 10px; margin-bottom: 10px; }
.landed--wall .portfolio__who { min-width: 0; }
.landed--wall .landed__tags { margin-top: 8px; }
.landed--wall .landed__status { margin-top: 10px; }

/* ---------- The calm area around the headline ----------
   Two washes, one per page colour, cross-fading with it (css/businesses.css
   switches the hero between white and navy as you scroll). Strongest behind
   the headline (top left, where home's headline sits), clearing toward the edges. */
.biz-wall__fade {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 600ms var(--ease);
}
.biz-wall__fade--light {
  background:
    radial-gradient(ellipse 62% 72% at 30% 38%, #fff 0%, #fff 42%, rgba(255, 255, 255, 0.9) 56%, rgba(255, 255, 255, 0.45) 74%, rgba(255, 255, 255, 0) 92%),
    linear-gradient(rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.18));
}
.biz-wall__fade--dark {
  background:
    radial-gradient(ellipse 62% 72% at 30% 38%, #070030 0%, #070030 42%, rgba(7, 0, 48, 0.9) 56%, rgba(7, 0, 48, 0.55) 74%, rgba(7, 0, 48, 0.25) 92%),
    linear-gradient(rgba(7, 0, 48, 0.3), rgba(7, 0, 48, 0.3));
}
/* Phones and tablets: the headline spans the width, so the calm area does too */
@media (max-width: 1023px) {
  .biz-wall__fade--light {
    background:
      radial-gradient(ellipse 120% 62% at 40% 34%, #fff 0%, #fff 46%, rgba(255, 255, 255, 0.88) 60%, rgba(255, 255, 255, 0.35) 80%, rgba(255, 255, 255, 0) 96%),
      linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2));
  }
  .biz-wall__fade--dark {
    background:
      radial-gradient(ellipse 120% 62% at 40% 34%, #070030 0%, #070030 46%, rgba(7, 0, 48, 0.88) 60%, rgba(7, 0, 48, 0.5) 80%, rgba(7, 0, 48, 0.25) 96%),
      linear-gradient(rgba(7, 0, 48, 0.3), rgba(7, 0, 48, 0.3));
  }
}

/* Soft bottom edge: the wall dissolves into the page colour instead of stopping at a line */
.biz-wall::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28%;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff);
  transition: opacity 600ms var(--ease);
}
html.biz-dark .biz-wall::after,
html:not(.biz-page) .biz-wall::after,
html:not(.js) .biz-wall::after { background: linear-gradient(to bottom, rgba(7, 0, 48, 0), #070030); }

/* Navy hero: the wall keeps its wash and glow, but instead of fading into a solid
   navy band at the bottom it is masked away there, so the page's hex texture (and its
   pulses) shows through and carries on into the next section with no edge. */
html:not(.biz-page) .biz-wall {
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 66%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 66%, transparent 100%);
}
html:not(.biz-page) .biz-wall::after { display: none; }
/* The glow behind the headline fades out before the hero's bottom edge clips it */
html:not(.biz-page) .biz-hero__glow {
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 88%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 88%);
}

@media (prefers-reduced-motion: reduce) {
  .biz-wall__flip { transition: none; }
}
