.scenario-gallery {
  padding: 104px 0 112px;
  overflow: hidden;
  background: var(--navy);
  color: #fff;
}

.scenario-gallery .wrap {
  max-width: calc(var(--wrap) - var(--pad));
}

.scenario-gallery__head {
  max-width: 850px;
  margin: 0 auto 42px;
  text-align: center;
}

.scenario-gallery__head h2 {
  color: #fff;
}

.scenario-gallery__head .lead {
  margin: 0 auto;
  color: #c5cce0;
}

.scenario-gallery__hint {
  display: none;
}

.scenario-gallery__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.scenario-gallery__card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(196, 207, 239, .18);
  border-radius: 18px;
  background: #171d33;
  box-shadow: 0 16px 38px rgba(2, 5, 19, .14);
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.scenario-gallery__card:hover,
.scenario-gallery__card:focus-within {
  border-color: rgba(155, 169, 255, .58);
  box-shadow: 0 22px 45px rgba(2, 5, 19, .26);
  transform: translateY(-3px);
}

.scenario-gallery__trigger {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: #10182d;
  color: #fff;
  cursor: pointer;
}

.scenario-gallery__trigger img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease;
}

.scenario-gallery__trigger:hover img {
  transform: scale(1.025);
}

.scenario-gallery__trigger:focus-visible {
  outline: 3px solid #a2adff;
  outline-offset: -5px;
}

.scenario-gallery__play {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 50%;
  background: rgba(79, 70, 245, .94);
  box-shadow: 0 8px 28px rgba(5, 9, 30, .34);
  transition: background .2s ease, scale .2s ease;
}

.scenario-gallery__play svg {
  width: 18px;
  height: 18px;
  margin-left: 3px;
  fill: currentColor;
}

.scenario-gallery__trigger:hover .scenario-gallery__play {
  background: var(--indigo-l);
  scale: 1.08;
}

.scenario-gallery__duration {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(11, 14, 32, .86);
  color: #fff;
  font: 700 11px/1.2 Inter, sans-serif;
}

.scenario-gallery__copy {
  min-height: 132px;
  padding: 17px 20px 19px;
}

.scenario-gallery__theme {
  margin: 0 0 7px;
  color: #9fadff;
  font: 750 11px/1.3 Manrope, sans-serif;
  letter-spacing: .065em;
  text-transform: uppercase;
}

.scenario-gallery__copy h3 {
  margin: 0 0 6px;
  color: #fff;
  font-size: clamp(16px, 1.3vw, 18px);
  line-height: 1.3;
}

.scenario-gallery__description {
  margin: 0;
  color: #bbc6df;
  font-size: 13px;
  line-height: 1.48;
}

.scenario-gallery__cta {
  max-width: 680px;
  margin: 58px auto 0;
  text-align: center;
}

.scenario-gallery__cta h3 {
  margin: 0 0 12px;
  color: #fff;
  font-size: clamp(23px, 2.2vw, 30px);
  line-height: 1.25;
}

.scenario-gallery__cta p {
  margin: 0 0 24px;
  color: #c5cce0;
  font-size: clamp(15px, 1.15vw, 17px);
  line-height: 1.55;
}

.scenario-gallery__cta-button:focus-visible {
  outline: 3px solid #a2adff;
  outline-offset: 4px;
}

.scenario-gallery__form-dialog {
  width: min(590px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: auto;
  border: 1px solid #d8dcec;
  border-radius: 22px;
  background: #fff;
  color: #111827;
  box-shadow: 0 30px 90px rgba(1, 5, 20, .38);
}

.scenario-gallery__form-dialog::backdrop {
  background: rgba(5, 9, 25, .75);
}

.scenario-gallery__form-inner {
  padding: 0 26px;
}

.scenario-gallery__form-head {
  position: sticky;
  z-index: 1;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin: 0 -26px;
  padding: 22px 26px 18px;
  border-bottom: 1px solid #e7e9f2;
  background: #fff;
}

.scenario-gallery__form-head h2 {
  margin: 0 0 6px;
  color: #111827;
  font-size: clamp(23px, 2.2vw, 28px);
  line-height: 1.2;
}

.scenario-gallery__form-head p {
  margin: 0;
  color: #4b5568;
  font-size: 15px;
  line-height: 1.55;
}

.scenario-gallery__form-close {
  display: grid;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid #d8dcec;
  border-radius: 50%;
  background: #fff;
  color: #111827;
  cursor: pointer;
  font: 400 24px/1 Inter, sans-serif;
}

.scenario-gallery__form-close:hover { background: #f4f6ff; }
.scenario-gallery__form-close:focus-visible,
.scenario-gallery__form-placeholder button:focus-visible {
  outline: 3px solid #4f46f5;
  outline-offset: 3px;
}

.scenario-gallery__form-shell,
.scenario-gallery__form-frame,
.scenario-gallery__form-frame iframe {
  width: 100%;
  max-width: 100%;
}

.scenario-gallery__form-placeholder {
  display: grid;
  gap: 18px;
  justify-items: start;
  margin-top: 22px;
  padding: 28px;
  border: 1px solid #e7e9f2;
  border-radius: 16px;
  background: #f8f9fc;
}

.scenario-gallery__form-placeholder[hidden],
.scenario-gallery__form-status[hidden] { display: none !important; }

.scenario-gallery__form-placeholder p {
  margin: 0;
  color: #4b5568;
  font-size: 15px;
}

.scenario-gallery__form-placeholder button {
  min-height: 44px;
  padding: 11px 18px;
  border: 0;
  border-radius: 11px;
  background: #4f46f5;
  color: #fff;
  cursor: pointer;
  font: 700 14px/1.3 Manrope, sans-serif;
}

.scenario-gallery__form-status { color: #4b5568; font-size: 14px; }

.scenario-gallery__dialog {
  width: min(1000px, calc(100vw - 40px));
  max-height: calc(100dvh - 40px);
  padding: 0;
  overflow: auto;
  border: 1px solid rgba(200, 211, 241, .28);
  border-radius: 22px;
  background: #151b30;
  color: #fff;
  box-shadow: 0 30px 90px rgba(1, 5, 20, .55);
}

.scenario-gallery__dialog::backdrop {
  background: rgba(5, 9, 25, .82);
}

.scenario-gallery__dialog-inner {
  padding: 22px;
}

.scenario-gallery__dialog-head {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.scenario-gallery__close {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(196, 207, 239, .3);
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  cursor: pointer;
  font: 400 25px/1 Inter, sans-serif;
}

.scenario-gallery__close:hover {
  background: rgba(255, 255, 255, .18);
}

.scenario-gallery__close:focus-visible {
  outline: 3px solid #a2adff;
  outline-offset: 3px;
}

.scenario-gallery__video {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  max-height: calc(100dvh - 220px);
  border-radius: 12px;
  background: #080e1e;
  object-fit: contain;
}

.scenario-gallery__dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(196, 207, 239, .18);
}

.scenario-gallery__dialog-copy { min-width: 0; }

.scenario-gallery__dialog-copy h3 {
  margin: 0 0 5px;
  color: #fff;
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.3;
}

.scenario-gallery__dialog-copy p {
  margin: 0;
  color: #bbc6df;
  font-size: 14px;
  line-height: 1.45;
}

.scenario-gallery__dialog-cta {
  flex: 0 0 auto;
  width: auto;
  white-space: nowrap;
}

.scenario-gallery__dialog-cta:focus-visible {
  outline: 3px solid #a2adff;
  outline-offset: 4px;
}

.scenario-gallery__error {
  margin: 12px 0 0;
  color: #ffd7dc;
  font-size: 14px;
}

@media (max-width: 960px) {
  .scenario-gallery__hint { display: block; margin: 0 0 14px; color: #aebbe0; font-size: 13px; }
  .scenario-gallery__grid {
    grid-auto-flow: column;
    grid-auto-columns: minmax(300px, 44%);
    grid-template-columns: none;
    gap: 14px;
    margin-right: calc(-1 * var(--pad));
    padding: 0 var(--pad) 14px 0;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
  }
  .scenario-gallery__card { scroll-snap-align: start; }
}

@media (max-width: 700px) {
  .scenario-gallery { padding: 76px 0 70px; }
  .scenario-gallery__head { margin-bottom: 28px; text-align: left; }
  .scenario-gallery__head .lead { margin-left: 0; }
  .scenario-gallery__grid { grid-auto-columns: minmax(280px, 84%); }
  .scenario-gallery__copy { min-height: 145px; }
  .scenario-gallery__dialog { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); }
  .scenario-gallery__dialog-inner { padding: 14px; }
  .scenario-gallery__video { max-height: calc(100dvh - 250px); }
  .scenario-gallery__dialog-footer { align-items: stretch; flex-direction: column; gap: 16px; margin-top: 14px; padding-top: 14px; }
  .scenario-gallery__dialog-cta { width: 100%; white-space: normal; }
  .scenario-gallery__cta { margin-top: 42px; }
  .scenario-gallery__cta-button { width: 100%; }
  .scenario-gallery__form-dialog { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); }
  .scenario-gallery__form-inner { padding: 0 18px; }
  .scenario-gallery__form-head { margin: 0 -18px; padding: 20px 18px 16px; }
  .scenario-gallery__form-placeholder { margin-top: 20px; padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .scenario-gallery__card,
  .scenario-gallery__trigger img,
  .scenario-gallery__play { transition: none; }
  .scenario-gallery__card:hover,
  .scenario-gallery__card:focus-within { transform: none; }
  .scenario-gallery__trigger:hover img { transform: none; }
  .scenario-gallery__trigger:hover .scenario-gallery__play { scale: 1; }
}
