/* Шторка «Повторить» экрана-сторис (см. 154-effect-stories-mobile.css):
 * форма эффекта и кнопка запуска на подложке снизу; фото — ряд плиток (156).
 * Вынесено из 154 из-за потолка 400 строк (tests/styles-bundles). */

@media (max-width: 767px) {
  /* ── Шторка «Повторить» ─────────────────────────────────────────── */
  .effect-detail-stories .effect-sheet {
    display: block !important;
    position: absolute;
    inset: 0;
    z-index: 40;
    pointer-events: none;
  }
  .effect-detail-stories .effect-sheet-backdrop {
    display: block !important;
    position: absolute;
    inset: 0;
    padding: 0;
    border: 0;
    background: rgb(0 0 0 / 0.55);
    opacity: 0;
    transition: opacity 220ms ease;
  }
  .effect-detail-stories .effect-sheet[data-open="true"] .effect-sheet-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  .effect-detail-stories .effect-sheet-panel {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 86%;
    border-radius: 24px 24px 0 0;
    background: var(--efx-surface-2, #121514);
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.07), 0 -20px 60px -20px rgb(0 0 0 / 0.6);
    transform: translateY(104%);
    visibility: hidden;
    pointer-events: auto;
    transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 320ms;
  }
  .effect-detail-stories .effect-sheet[data-open="true"] .effect-sheet-panel {
    transform: none;
    visibility: visible;
    transition-delay: 0s;
  }
  .effect-detail-stories .effect-sheet-head {
    display: flex !important;
    flex: none;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 2px;
  }
  .effect-sheet-head h2 {
    margin: 0;
    font: 700 20px/1.1 "Gotham", "Helvetica", Arial, sans-serif;
    letter-spacing: -0.01em;
    color: var(--efx-ink, #fff);
  }
  .effect-sheet-close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    color: var(--efx-ink, #fff);
    background: var(--efx-field-bg, #1a1f1c);
  }
  :is(.effect-preview-dialog, html)
    .effect-detail-shell.effect-detail-refresh.effect-detail-stories:is(
      .effect-detail-media-landscape,
      .effect-detail-media-portrait
    )
    .effect-sheet
    .effect-detail-form {
    flex: 1 1 auto;
    min-height: 0;
    height: auto !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    scrollbar-width: none;
    padding: 10px 16px 6px !important;
    background: transparent !important;
  }
  :is(.effect-preview-dialog, html)
    .effect-detail-shell.effect-detail-refresh.effect-detail-stories:is(
      .effect-detail-media-landscape,
      .effect-detail-media-portrait
    )
    .effect-sheet
    .effect-detail-cta {
    position: relative !important;
    inset: auto !important;
    flex: none;
    width: auto !important;
    margin: 0 !important;
    padding: 8px 16px calc(12px + env(safe-area-inset-bottom, 0px)) !important;
    background: transparent !important;
  }
  .effect-detail-stories .effect-sheet .effect-skeleton-action {
    position: relative;
    inset: auto;
    margin: 8px 16px 12px;
  }
  .effect-detail-stories .effect-sheet .effect-more-suggestions {
    display: none;
  }

  /* Лента пресетов листается пальцем: подсказка со стрелками лишняя. */
  .effect-detail-stories .effect-sheet .effect-variant-navigation {
    display: none;
  }
  /* «Из загруженных» в эффекте — лишнее отвлечение: у оставшихся загрузчиков
     (видео, резервные поля) кнопку прячем, фото-поля её не рисуют вовсе. */
  .effect-detail-stories .effect-sheet [data-mobile-upload-root] > div.relative.mt-2 {
    display: none !important;
  }

  /* Компактнее: меньше воздуха между шагами формы. */
  .effect-detail-stories .effect-sheet .effect-detail-form :is(.mb-3, .mb-4) {
    margin-bottom: 12px !important;
  }
  .effect-detail-stories .effect-sheet .effect-detail-form .mb-2 {
    margin-bottom: 6px !important;
  }
  .effect-detail-stories .effect-sheet .effect-media-row {
    margin-inline: -16px;
    padding-inline: 16px;
    scroll-padding-inline: 16px;
  }

  @media (prefers-reduced-motion: reduce) {
    .effect-detail-stories .effect-sheet-panel,
    .effect-detail-stories .effect-sheet-backdrop {
      transition: none;
    }
  }
}

/* The comfortable list exists only while a dropdown is open. Temporarily let
 * it cross the form scroller on both mobile sheets and the desktop dialog;
 * normal scrolling returns as soon as the list closes. */
:is(.effect-preview-dialog, html)
  .effect-detail-shell.effect-detail-refresh
  .effect-detail-form:has([data-setting-popover-size="comfortable"]) {
  overflow: visible !important;
}

@media (max-width: 767px) {
  :is(.effect-preview-dialog, html)
    .effect-detail-shell.effect-detail-refresh.effect-detail-stories:is(
      .effect-detail-media-landscape,
      .effect-detail-media-portrait
    )
    .effect-sheet
    .effect-detail-form:has([data-setting-popover-size="comfortable"]) {
    overflow: visible !important;
  }
}
