/* ── Pyro Bento — Apple-style stats grid ──
   Each cell carries a unique ambient animation tied to its data. */

.pyro-bento {
  --pb-gap: 16px;
  --pb-radius: 16px;
  --pb-bg: #fff;
  --pb-text: #1d1d1f;
  --pb-teal: #32ade6;
  --pb-indigo: #5856d6;

  display: grid;
  grid-template-columns: 5fr 5fr;
  grid-template-rows: auto auto;
  gap: var(--pb-gap);
  background: #ebebf0;
  padding: var(--pb-gap);
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue",
    Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ── Cells ── */
.pb-cell {
  background: var(--pb-bg);
  border-radius: var(--pb-radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 36px 24px;
  /* Scope layout/paint so per-cell changes don't invalidate siblings */
  contain: layout style paint;
}

.pb-cell--hero {
  padding: 48px 32px;
  min-height: 240px;
}

.pb-cell--contributors {
  grid-column: 1 / -1;
  min-height: 180px;
  padding: 16px 16px 36px;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ═══════════════════════════════════════════
   CELL 2 — 35 Contributors · Poster Cards
   Three Apple TV+-inspired cards with memoji
   avatars for each contributor role.
   ═══════════════════════════════════════════ */

.pb-contrib-cards {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  width: 80%;
}

.pb-contrib-card {
  border-radius: 24px;
  padding: 16px 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  flex: 1;
  aspect-ratio: 1 / 1;
  height: auto;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.08),
    0 1px 4px rgba(0, 0, 0, 0.04);
  opacity: 0;
  transform: translateY(24px) scale(0.92);
  transition:
    opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.pb-cell.is-revealed .pb-contrib-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.pb-cell.is-revealed .pb-contrib-card:nth-child(1) {
  transition-delay: 0.15s;
}
.pb-cell.is-revealed .pb-contrib-card:nth-child(2) {
  transition-delay: 0.25s;
}
.pb-cell.is-revealed .pb-contrib-card:nth-child(3) {
  transition-delay: 0.35s;
}

/* Center card is taller — Apple poster art style */
.pb-contrib-card:nth-child(2) {
  aspect-ratio: 1 / 1.15;
  height: auto;
}

/* Card solid backgrounds matching the image */
.pb-contrib-card--pm {
  background: linear-gradient(to bottom, #284210, #4d663b); /* Green */
}

.pb-contrib-card--designer {
  background: linear-gradient(to bottom, #174b82, #1877b7); /* Blue */
}

.pb-contrib-card--dev {
  background: linear-gradient(to bottom, #c18200, #edb55d); /* Yellow/Orange */
}

.pb-contrib-name {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  text-align: center;
  letter-spacing: 2px;
  position: relative;
  z-index: 2;
  line-height: normal;
}

.pb-memoji-img {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 100%;
  max-width: 300px;
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
  opacity: 0;
  transform: translate(-50%, 24px) scale(0.8);
  transition:
    opacity 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pb-memoji-img--large {
  width: 120%;
  max-width: 300px;
}

.pb-cell.is-revealed .pb-memoji-img {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.pb-cell.is-revealed .pb-contrib-card:nth-child(1) .pb-memoji-img {
  transition-delay: 0.3s;
}
.pb-cell.is-revealed .pb-contrib-card:nth-child(2) .pb-memoji-img {
  transition-delay: 0.42s;
}
.pb-cell.is-revealed .pb-contrib-card:nth-child(3) .pb-memoji-img {
  transition-delay: 0.54s;
}
.pb-right {
  display: flex;
  flex-direction: column;
  gap: var(--pb-gap);
}

.pb-right > .pb-cell {
  flex: 1;
}

.pb-right-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--pb-gap);
  flex: 1;
}

.pb-right-pair .pb-cell {
  min-height: 0;
}

/* ── Typography ── */
.pb-number {
  font-size: 72px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--pb-text);
  position: relative;
  z-index: 2;
  font-variant-numeric: tabular-nums;
  filter: blur(8px);
  opacity: 0.4;
  transition:
    filter 0.6s ease,
    opacity 0.6s ease;
}

.pb-cell.is-revealed .pb-number {
  filter: blur(0);
  opacity: 1;
}

/* Gradient text variants */
.pb-number--blue {
  background: linear-gradient(180deg, #2997ff 0%, #0071e3 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.pb-number--teal {
  background: linear-gradient(180deg, #5ac8fa 0%, #32ade6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.pb-number--indigo {
  background: linear-gradient(180deg, #7d7aff 0%, #5856d6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.pb-number--silver {
  background: linear-gradient(
    180deg,
    #ffffff 0%,
    #f0f0f0 35%,
    #dcdcdc 65%,
    #f5f5f5 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.pb-number--dark-silver {
  color: #1d1d1f;
}

/* ═══════════════════════════════════════════
   CELL 5 — 24 Marketing · User Observation
   Background photo with dark overlay.
   ═══════════════════════════════════════════ */

.pb-cell--mktg {
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.8)),
    url("../../work/intuit/assets/pyro/user_observation.webp") center / cover
      no-repeat;
}

.pb-cell--mktg .pb-top-label,
.pb-cell--mktg .pb-label {
  color: rgba(255, 255, 255, 0.8);
}

.pb-cell--hero .pb-number {
  font-size: 116px;
  letter-spacing: -0.05em;
  padding: 0 8px;
}

/* Top label — pinned near the top of the cell */
.pb-top-label {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--pb-text);
  z-index: 2;
  text-align: center;
  line-height: 1.2;
}

/* Bottom label — pinned near the bottom of the cell */
.pb-bottom-label {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--pb-text);
  z-index: 2;
  text-align: center;
  line-height: 1.2;
}

.pb-label {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--pb-text);
  z-index: 2;
  text-align: center;
  line-height: 1.35;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════
   CELL 1 — 859 Hero · Ripple Rings
   Concentric pulses radiate outward like sonar,
   conveying the breadth of user reach.
   ═══════════════════════════════════════════ */

.pb-ripple-wrap {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
  /* Size comes from positioned parent, content is pure decoration —
     strict containment lets the browser skip this subtree during
     scroll-triggered layout/paint outside the cell. */
  contain: strict;
}

.pb-dot-rings {
  width: 100%;
  height: 100%;
}

/* Each ring <g> fades in and expands slightly outward.
   Staggered delays create the ripple-out effect. */
.pb-dot-ring {
  transform-origin: 500px 500px; /* center of 1000×1000 viewBox */
  opacity: 0;
  will-change: transform, opacity;
}

.pb-cell.is-revealed .pb-dot-ring {
  animation: pbDotRipple 0.8s cubic-bezier(0.22, 1, 0.36, 1)
    var(--ring-delay, 0s) forwards;
}

@keyframes pbDotRipple {
  0% {
    transform: scale(0.85);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ═══════════════════════════════════════════
   CELL 3 — 744 Unmoderated · Waveform
   A Siri-style waveform that spans the cell,
   fades behind the text, and animates on load.
   ═══════════════════════════════════════════ */

.pb-stream {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 64px;
  transform: translateY(-50%);
  z-index: 1;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 3px;
  -webkit-mask-image: linear-gradient(
    to right,
    black 0%,
    black 15%,
    transparent 30%,
    transparent 70%,
    black 85%,
    black 100%
  );
  mask-image: linear-gradient(
    to right,
    black 0%,
    black 15%,
    transparent 30%,
    transparent 70%,
    black 85%,
    black 100%
  );
}

.pb-waveform-bar {
  flex: 1;
  max-width: 5px;
  min-width: 2px;
  height: 64px; /* full container height — visual size controlled by scaleY */
  background: var(--pb-teal);
  border-radius: 999px;
  opacity: 0;
  transform: scaleY(0.0625); /* initial visual height: ~4px */
  transform-origin: center;
  contain: layout style;
  will-change: transform, opacity;
}

.pb-cell.is-revealed .pb-waveform-bar {
  animation: pbWaveformIntro var(--dur) ease-in-out forwards;
  animation-delay: var(--del);
}

@keyframes pbWaveformIntro {
  0% {
    transform: scaleY(0.0625);
    opacity: 0;
  }
  10% {
    transform: scaleY(var(--h));
    opacity: 0.8;
  }
  25% {
    transform: scaleY(calc(var(--h) * 0.25));
    opacity: 0.5;
  }
  40% {
    transform: scaleY(calc(var(--h) * 0.85));
    opacity: 0.7;
  }
  55% {
    transform: scaleY(calc(var(--h) * 0.3));
    opacity: 0.5;
  }
  70% {
    transform: scaleY(calc(var(--h) * 0.7));
    opacity: 0.6;
  }
  85% {
    transform: scaleY(calc(var(--h) * 0.15));
    opacity: 0.4;
  }
  100% {
    transform: scaleY(var(--settle));
    opacity: 0.35;
  }
}

/* ═══════════════════════════════════════════
   CELL 4 — 91 E2E · Journey Path
   An SVG curve draws itself with waypoint
   nodes, representing the end-to-end flow.
   ═══════════════════════════════════════════ */

.pb-journey {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.pb-journey svg {
  width: 100%;
  height: 100%;
}

.pb-journey-line {
  fill: none;
  stroke: var(--pb-indigo);
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0.22;
}

.pb-journey-node {
  fill: var(--pb-indigo);
  opacity: 0;
  transform: scale(0);
  transform-origin: center;
  transform-box: fill-box;
  will-change: transform, opacity;
}

.pb-cell.is-revealed .pb-journey-line {
  animation: pbDraw 2s cubic-bezier(0.65, 0, 0.35, 1) 0.3s forwards;
}

@keyframes pbDraw {
  to {
    stroke-dashoffset: 0;
  }
}

.pb-cell.is-revealed .pb-journey-node {
  animation: pbNodePop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes pbNodePop {
  to {
    opacity: 0.3;
    transform: scale(1);
  }
}

/* ═══════════════════════════════════════════
   Reduced Motion
   ═══════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .pb-dot-ring,
  .pb-waveform-bar,
  .pb-journey-line,
  .pb-journey-node {
    animation-duration: 0.01s !important;
    animation-delay: 0s !important;
  }

  .pb-contrib-card,
  .pb-memoji-img {
    transition-duration: 0.01s !important;
    transition-delay: 0s !important;
  }

  .pb-number {
    transition-duration: 0.01s !important;
  }
}

/* ═══════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════ */

@media (max-width: 720px) {
  .pyro-bento {
    --pb-gap: 8px;
    --pb-radius: 12px;
    grid-template-columns: 1fr;
  }

  .pb-cell--hero .pb-number {
    font-size: 88px;
  }

  .pb-number {
    font-size: 48px;
  }

  .pb-cell--hero {
    min-height: 180px;
    padding: 32px 18px;
  }

  .pb-top-label {
    font-size: 13px;
    top: 12px;
  }

  .pb-label {
    font-size: 13px;
    bottom: 12px;
  }

  .pb-cell--hero .pb-top-label {
    font-size: 15px;
    top: 14px;
  }

  .pb-cell--hero .pb-label {
    font-size: 15px;
    bottom: 14px;
  }

  .pb-cell--contributors {
    min-height: auto;
    padding: 12px 10px 37px;
  }

  .pb-contrib-cards {
    gap: 6px;
    width: 100%;
    max-width: 380px;
  }

  .pb-contrib-card {
    height: 120px;
    aspect-ratio: auto;
    padding: 10px 6px 0;
    border-radius: 16px;
  }

  .pb-contrib-card:nth-child(2) {
    height: 135px;
    aspect-ratio: auto;
  }

  .pb-memoji-img {
    width: 115%;
    max-width: 160px;
  }

  .pb-memoji-img--large {
    width: 140%;
    max-width: 160px;
  }

  .pb-contrib-name {
    font-size: 11px;
    margin-bottom: 6px;
    font-weight: 600;
  }

  .pb-right-pair {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 380px) {
  .pb-cell--hero .pb-number {
    font-size: 52px;
  }

  .pb-number {
    font-size: 34px;
  }
}
