/* Expanding Image Panels — original.
   A row of vertical image panels. Hover, click or focus one and it grows via
   flex-grow while the rest compress; the open panel reveals its caption.
   Every selector is scoped to .byq-gem--expanding-panels-01. */

.byq-gem--expanding-panels-01 {
  font-family: var(--byq-font-sans);
  color: var(--byq-fg);
  width: 100%;
  max-width: 68rem;
  margin: 0 auto;
  padding: 1rem;
  box-sizing: border-box;
}

.byq-gem--expanding-panels-01 *,
.byq-gem--expanding-panels-01 *::before,
.byq-gem--expanding-panels-01 *::after {
  box-sizing: border-box;
}

/* ---- Panel row --------------------------------------------------------- */
.byq-gem--expanding-panels-01__row {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.6rem;
  height: min(30rem, 62vh);
}

.byq-gem--expanding-panels-01__panel {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  border-radius: var(--byq-radius-lg);
  transition: flex-grow 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

/* The open panel takes the lion's share of the row. */
.byq-gem--expanding-panels-01__panel.is-active {
  flex-grow: 5.2;
}

/* Hover trumps the persisted click state so the effect feels immediate,
   without breaking keyboard/click selection. */
.byq-gem--expanding-panels-01__row:hover
  .byq-gem--expanding-panels-01__panel.is-active {
  flex-grow: 1;
}
.byq-gem--expanding-panels-01__row:hover
  .byq-gem--expanding-panels-01__panel:hover {
  flex-grow: 5.2;
}

/* ---- Trigger (the whole panel is a button) ----------------------------- */
.byq-gem--expanding-panels-01__trigger {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  border: 1px solid var(--byq-depth);
  border-radius: var(--byq-radius-lg);
  background: var(--byq-card);
  cursor: pointer;
  overflow: hidden;
  outline: none;
  color: inherit;
  font: inherit;
}

.byq-gem--expanding-panels-01__trigger:focus-visible {
  border-color: var(--byq-fg);
  box-shadow:
    0 0 0 3px var(--byq-bg),
    0 0 0 6px var(--byq-accent-solar);
  z-index: 2;
}

/* ---- Image ------------------------------------------------------------- */
.byq-gem--expanding-panels-01__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(0.35) brightness(0.82);
  transform: scale(1.06);
  transition:
    filter 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- Scrim (keeps captions legible over any photo) --------------------- */
.byq-gem--expanding-panels-01__scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to top,
    rgba(4, 4, 4, 0.72) 0%,
    rgba(4, 4, 4, 0.24) 34%,
    rgba(4, 4, 4, 0) 62%
  );
  opacity: 0;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- Vertical index number (shown while collapsed) --------------------- */
.byq-gem--expanding-panels-01__index {
  position: absolute;
  left: 0.9rem;
  bottom: 1rem;
  font-family: var(--byq-font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--byq-fg);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  transform-origin: center;
  opacity: 0.85;
  pointer-events: none;
  transition: opacity 0.4s ease;
  text-shadow: 0 1px 8px rgba(4, 4, 4, 0.5);
}

/* ---- Caption (revealed when the panel opens) --------------------------- */
.byq-gem--expanding-panels-01__caption {
  position: absolute;
  left: 1.4rem;
  right: 1.4rem;
  bottom: 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: var(--byq-fg);
  text-align: left;
  pointer-events: none;
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.08s,
    transform 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.08s;
}
.byq-gem--expanding-panels-01__eyebrow {
  font-family: var(--byq-font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--byq-accent-solar);
}
.byq-gem--expanding-panels-01__title {
  font-family: var(--byq-font-display);
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  font-weight: 400;
  line-height: 1.02;
  white-space: nowrap;
}
.byq-gem--expanding-panels-01__meta {
  font-family: var(--byq-font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  opacity: 0.82;
  white-space: nowrap;
}

/* ---- Open state (shared by click/keyboard `.is-active` and :hover) ------ */
.byq-gem--expanding-panels-01__panel.is-active .byq-gem--expanding-panels-01__img,
.byq-gem--expanding-panels-01__panel:hover .byq-gem--expanding-panels-01__img {
  filter: grayscale(0) brightness(0.92);
  transform: scale(1);
}
.byq-gem--expanding-panels-01__panel.is-active .byq-gem--expanding-panels-01__scrim,
.byq-gem--expanding-panels-01__panel:hover .byq-gem--expanding-panels-01__scrim {
  opacity: 1;
}
.byq-gem--expanding-panels-01__panel.is-active .byq-gem--expanding-panels-01__caption,
.byq-gem--expanding-panels-01__panel:hover .byq-gem--expanding-panels-01__caption {
  opacity: 1;
  transform: translateY(0);
}
.byq-gem--expanding-panels-01__panel.is-active .byq-gem--expanding-panels-01__index,
.byq-gem--expanding-panels-01__panel:hover .byq-gem--expanding-panels-01__index {
  opacity: 0;
}

/* Keyboard: focusing a collapsed trigger opens its own caption too. */
.byq-gem--expanding-panels-01__trigger:focus-visible .byq-gem--expanding-panels-01__caption {
  opacity: 1;
  transform: translateY(0);
}
.byq-gem--expanding-panels-01__trigger:focus-visible .byq-gem--expanding-panels-01__scrim {
  opacity: 1;
}

/* Keep the caption from flashing when hovering a *different* panel: while the
   row is hovered, only the hovered panel shows its caption/state. */
.byq-gem--expanding-panels-01__row:hover
  .byq-gem--expanding-panels-01__panel.is-active:not(:hover)
  .byq-gem--expanding-panels-01__caption {
  opacity: 0;
  transform: translateY(14px);
}
.byq-gem--expanding-panels-01__row:hover
  .byq-gem--expanding-panels-01__panel.is-active:not(:hover)
  .byq-gem--expanding-panels-01__index {
  opacity: 0.85;
}
.byq-gem--expanding-panels-01__row:hover
  .byq-gem--expanding-panels-01__panel.is-active:not(:hover)
  .byq-gem--expanding-panels-01__img {
  filter: grayscale(0.35) brightness(0.82);
  transform: scale(1.06);
}
.byq-gem--expanding-panels-01__row:hover
  .byq-gem--expanding-panels-01__panel.is-active:not(:hover)
  .byq-gem--expanding-panels-01__scrim {
  opacity: 0;
}

/* ---- Narrow screens: stack into a vertical accordion ------------------- */
@media (max-width: 34rem) {
  .byq-gem--expanding-panels-01__row {
    flex-direction: column;
    height: auto;
  }
  .byq-gem--expanding-panels-01__panel {
    height: 4.6rem;
    flex: 0 0 auto;
    transition: height 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .byq-gem--expanding-panels-01__panel.is-active {
    height: 17rem;
  }
  .byq-gem--expanding-panels-01__index {
    writing-mode: horizontal-tb;
    transform: none;
    left: 1.1rem;
    top: 1.1rem;
    bottom: auto;
  }
  .byq-gem--expanding-panels-01__title {
    white-space: normal;
  }
}

/* ---- Reduced motion ---------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .byq-gem--expanding-panels-01__panel,
  .byq-gem--expanding-panels-01__img,
  .byq-gem--expanding-panels-01__scrim,
  .byq-gem--expanding-panels-01__caption,
  .byq-gem--expanding-panels-01__index {
    transition-duration: 0.001ms;
  }
  .byq-gem--expanding-panels-01__img {
    transform: none;
  }
}
