/* Industry bento — one 2D grid, expand absorbs column + row */

.industry-bento-demo-notes {
  padding-bottom: 3rem;
}

.industry-bento-demo-notes h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  color: var(--selected);
}

.industry-bento-demo-notes ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--foreground-diminished);
  font-size: 0.92rem;
  line-height: 1.55;
}

.industry-bento-demo-notes li + li {
  margin-top: 0.35rem;
}

.industry-bento-demo-notes code {
  font-size: 0.85em;
}

/* —— Desktop grid ——
   3 content cols + padding gutters (padding interpolates; tracks stay fr-based
   so open/close can tween instead of snapping siblings from 0 → full)
*/

.industry-bento {
  --industry-gap: 1rem;
  --industry-expand-duration: 0.7s;
  --industry-expand-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --industry-collapse-duration: 0.85s;
  --industry-collapse-ease: cubic-bezier(0.45, 0.05, 0.25, 1);
  --industry-tile-h: 20rem;
  --industry-content: min(1100px, 92vw);
  --industry-gutter: max(0px, calc((100vw - var(--industry-content)) / 2));
  --industry-band-h: calc(var(--industry-tile-h) * 2 + var(--industry-gap));

  box-sizing: border-box;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--industry-gap);
  width: 100vw;
  height: var(--industry-band-h);
  margin-left: calc(50% - 50vw);
  padding-inline: var(--industry-gutter);
  overflow: hidden;
  /* Default = close; open overrides below when expanded */
  transition:
    grid-template-columns var(--industry-collapse-duration) var(--industry-collapse-ease),
    grid-template-rows var(--industry-collapse-duration) var(--industry-collapse-ease),
    gap var(--industry-collapse-duration) var(--industry-collapse-ease),
    padding-inline var(--industry-collapse-duration) var(--industry-collapse-ease);
}

.industry-bento[class*="is-expanded-"] {
  transition:
    grid-template-columns var(--industry-expand-duration) var(--industry-expand-ease),
    grid-template-rows var(--industry-expand-duration) var(--industry-expand-ease),
    gap var(--industry-expand-duration) var(--industry-expand-ease),
    padding-inline var(--industry-expand-duration) var(--industry-expand-ease);
}

/* Resting placement: 2+1 / 1+2 */
.industry-bento__tile[data-bento-tile="1"] {
  grid-column: 1 / 3;
  grid-row: 1;
}

.industry-bento__tile[data-bento-tile="2"] {
  grid-column: 3;
  grid-row: 1;
}

.industry-bento__tile[data-bento-tile="3"] {
  grid-column: 1;
  grid-row: 2;
}

.industry-bento__tile[data-bento-tile="4"] {
  grid-column: 2 / 4;
  grid-row: 2;
}

/* Expand: padding → 0, absorb sibling col/row via interpolable minmax(0, fr) */
.industry-bento.is-expanded-1 {
  padding-inline: 0;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0fr) minmax(0, 0fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 0fr);
  gap: 0;
}

.industry-bento.is-expanded-2 {
  padding-inline: 0;
  grid-template-columns: minmax(0, 0fr) minmax(0, 0fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) minmax(0, 0fr);
  gap: 0;
}

.industry-bento.is-expanded-3 {
  padding-inline: 0;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0fr) minmax(0, 0fr);
  grid-template-rows: minmax(0, 0fr) minmax(0, 1fr);
  gap: 0;
}

.industry-bento.is-expanded-4 {
  padding-inline: 0;
  grid-template-columns: minmax(0, 0fr) minmax(0, 0fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 0fr) minmax(0, 1fr);
  gap: 0;
}

.industry-bento__detail {
  grid-column: 1 / -1;
  grid-row: 1 / 3;
  z-index: 2;
  pointer-events: none;
  align-self: stretch;
  justify-self: stretch;
  display: flex;
  align-items: flex-end;
  padding: clamp(1.25rem, 3vw, 2.5rem);
  opacity: 0;
  transition: opacity 0.35s ease calc(var(--industry-expand-duration) * 0.45);
}

.industry-bento[class*="is-expanded-"] .industry-bento__detail {
  opacity: 1;
}

.industry-bento__detail .industry-bento__close,
.industry-bento__detail .industry-bento__detail-inner,
.industry-bento__detail .industry-bento__detail-inner a {
  pointer-events: auto;
}

/* —— Tile —— */

.industry-bento__tile {
  position: relative;
  display: block;
  overflow: hidden;
  isolation: isolate;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 1rem;
  background: #111;
  color: #fff;
  text-align: left;
  cursor: pointer;
  outline: none;
  font: inherit;
}

.industry-bento[class*="is-expanded-"] .industry-bento__tile.is-active {
  border-radius: 0;
}

.industry-bento__tile:focus-visible {
  outline: 2px solid var(--selected);
  outline-offset: 3px;
}

/* Cutout mask: media is locked to the bento origin via --tile-x/--tile-y
   (updated every frame while the grid tweens). The tile only clips. */
.industry-bento__media {
  position: absolute;
  left: calc(-1 * var(--tile-x, 0px));
  top: calc(-1 * var(--tile-y, 0px));
  width: 100vw;
  height: var(--industry-band-h);
  max-width: none;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

.industry-bento__scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      to top,
      rgba(0, 0, 0, 0.78) 0%,
      rgba(0, 0, 0, 0.35) 45%,
      rgba(0, 0, 0, 0.15) 100%
    );
  transition: background 0.35s ease;
}

.industry-bento[class*="is-expanded-"] .industry-bento__tile.is-active .industry-bento__scrim {
  background:
    linear-gradient(
      to top,
      rgba(0, 0, 0, 0.82) 0%,
      rgba(0, 0, 0, 0.45) 40%,
      rgba(0, 0, 0, 0.25) 100%
    );
}

.industry-bento__content {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 1.25rem 1.35rem 1.4rem;
  transition:
    opacity 0.3s ease,
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.industry-bento[class*="is-expanded-"] .industry-bento__tile.is-active .industry-bento__content {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.industry-bento__icon {
  width: 2.25rem;
  height: 2.25rem;
  margin-bottom: 0.25rem;
  filter: brightness(0) invert(1);
  opacity: 0.95;
}

.industry-bento__content strong {
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
}

.industry-bento__content > span {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.35;
}

/* Collapsed siblings — fade with size (not a hard pop on close) */
.industry-bento.is-ready .industry-bento__tile {
  z-index: 0;
  transition:
    opacity var(--industry-collapse-duration) var(--industry-collapse-ease),
    border-radius var(--industry-collapse-duration) var(--industry-collapse-ease),
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.industry-bento.is-ready[class*="is-expanded-"] .industry-bento__tile {
  transition:
    opacity 0.2s ease,
    border-radius var(--industry-expand-duration) var(--industry-expand-ease),
    transform 0.35s ease;
}

.industry-bento[class*="is-expanded-"] .industry-bento__tile:not(.is-active) {
  opacity: 0;
  pointer-events: none;
}

.industry-bento:not([class*="is-expanded-"]) .industry-bento__tile:hover,
.industry-bento:not([class*="is-expanded-"]) .industry-bento__tile:focus-visible {
  z-index: 1;
  transform: scale(1.035);
}

.industry-bento:not([class*="is-expanded-"]) .industry-bento__tile:hover .industry-bento__media,
.industry-bento:not([class*="is-expanded-"]) .industry-bento__tile:focus-visible .industry-bento__media {
  filter: brightness(1.06);
}

.industry-bento:not([class*="is-expanded-"]) .industry-bento__tile:hover .industry-bento__content,
.industry-bento:not([class*="is-expanded-"]) .industry-bento__tile:focus-visible .industry-bento__content {
  transform: translateY(-4px);
}

/* Detail */

.industry-bento__detail-inner {
  max-width: min(36rem, 92vw);
  color: #fff;
}

.industry-bento__detail-inner[hidden] {
  display: none;
}

.industry-bento__detail-inner h3 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #fff;
}

.industry-bento__detail-inner p {
  margin: 0 0 1.25rem;
  font-size: 1.05rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
}

.industry-bento__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 3;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.industry-bento__close:hover,
.industry-bento__close:focus-visible {
  background: rgba(0, 0, 0, 0.65);
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* —— Mobile: 1 column, grow vertically —— */

@media (max-width: 899px) {
  .industry-bento {
    --industry-gap: 0.75rem;
    --industry-tile-h: 14rem;
    --industry-band-h: calc(var(--industry-tile-h) * 4 + var(--industry-gap) * 3);
    --industry-gutter: 0px;

    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
    height: var(--industry-band-h);
    margin-left: calc(50% - 50vw);
    padding-inline: 0;
  }

  .industry-bento__tile[data-bento-tile="1"],
  .industry-bento__tile[data-bento-tile="2"],
  .industry-bento__tile[data-bento-tile="3"],
  .industry-bento__tile[data-bento-tile="4"] {
    grid-column: 1;
  }

  .industry-bento__tile[data-bento-tile="1"] { grid-row: 1; }
  .industry-bento__tile[data-bento-tile="2"] { grid-row: 2; }
  .industry-bento__tile[data-bento-tile="3"] { grid-row: 3; }
  .industry-bento__tile[data-bento-tile="4"] { grid-row: 4; }

  .industry-bento__tile {
    border-radius: 0;
  }

  .industry-bento__media {
    width: 100vw;
    height: var(--industry-band-h);
  }

  .industry-bento.is-expanded-1,
  .industry-bento.is-expanded-2,
  .industry-bento.is-expanded-3,
  .industry-bento.is-expanded-4 {
    grid-template-columns: minmax(0, 1fr);
    padding-inline: 0;
    gap: 0;
  }

  .industry-bento.is-expanded-1 {
    grid-template-rows: minmax(0, 1fr) minmax(0, 0fr) minmax(0, 0fr) minmax(0, 0fr);
  }
  .industry-bento.is-expanded-2 {
    grid-template-rows: minmax(0, 0fr) minmax(0, 1fr) minmax(0, 0fr) minmax(0, 0fr);
  }
  .industry-bento.is-expanded-3 {
    grid-template-rows: minmax(0, 0fr) minmax(0, 0fr) minmax(0, 1fr) minmax(0, 0fr);
  }
  .industry-bento.is-expanded-4 {
    grid-template-rows: minmax(0, 0fr) minmax(0, 0fr) minmax(0, 0fr) minmax(0, 1fr);
  }

  .industry-bento__detail {
    grid-column: 1;
    grid-row: 1 / -1;
  }
}

/* Entrance — one-shot animation so close isn't delayed by entrance stagger */

.industry-bento__tile {
  opacity: 0;
  transform: translateY(18px);
}

@keyframes industry-bento-enter {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.industry-bento.is-ready .industry-bento__tile {
  opacity: 1;
  transform: translateY(0);
  animation: industry-bento-enter 0.55s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.industry-bento.is-ready .industry-bento__tile[data-bento-tile="1"] { animation-delay: 0.05s; }
.industry-bento.is-ready .industry-bento__tile[data-bento-tile="2"] { animation-delay: 0.12s; }
.industry-bento.is-ready .industry-bento__tile[data-bento-tile="3"] { animation-delay: 0.19s; }
.industry-bento.is-ready .industry-bento__tile[data-bento-tile="4"] { animation-delay: 0.26s; }

@media (prefers-reduced-motion: reduce) {
  .industry-bento,
  .industry-bento__tile,
  .industry-bento__media,
  .industry-bento__content,
  .industry-bento__scrim,
  .industry-bento__detail {
    transition: none !important;
    animation: none !important;
  }

  .industry-bento__tile {
    opacity: 1;
    transform: none;
  }
}
