/* Shared mobile patterns for the case pages (15 Nov 2026).
   Rule: the content is the same at every width. Only the layout changes, to cut length and scrolling on phones.
   Loaded after each page's own styles, so these rules win on small screens. */

@media (max-width: 599.98px) {
  /* 1. Step flows (.e2e): number and role on one line, then the step, then its description */
  .e2e__step {
    display: grid !important;
    grid-template-columns: 24px 1fr;
    grid-template-areas: "n who" ". name" ". desc";
    column-gap: 10px; row-gap: 2px; align-items: center;
    padding: 10px 12px !important; margin: 0 0 6px !important;
  }
  .e2e__n { grid-area: n; width: 24px; height: 24px; }
  .e2e__who { grid-area: who; display: block !important; }
  .e2e__name { grid-area: name; }
  .e2e__desc {
    grid-area: desc;
    position: static !important; width: auto !important; height: auto !important;
    overflow: visible !important; clip: auto !important; white-space: normal !important;
  }
  .e2e-legend { gap: 6px 16px; margin-top: 10px; }

  /* 2. Build steps (.pipe): tighter cards, same text */
  .pipe { gap: 8px !important; }
  .pipe__step { padding: 12px 14px !important; gap: 4px !important; border-radius: 14px !important; }
  .pipe__out { padding-top: 6px !important; }

  /* 3. Phone screenshots (.flowgrid--mobile): one swipeable row instead of a tall grid.
     The next screen peeks in from the right, so it is clear there is more. */
  .flowgrid--mobile {
    display: grid !important;
    grid-auto-flow: column;
    grid-template-columns: none !important;
    grid-auto-columns: 64%;
    gap: 12px !important;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    padding-bottom: 8px;
    margin-right: calc(-1 * var(--margin, 16px));
    padding-right: var(--margin, 16px);
  }
  .flowgrid--mobile > * { scroll-snap-align: start; min-width: 0; }
}

/* 1b. Step flows as an accordion on phones (needs case-mobile.js; without it every description shows) */
.e2e__toggle { display: none; }
@media (max-width: 599.98px) {
  .e2e.is-collapsible .e2e__step { position: relative; grid-template-columns: 24px 1fr 20px !important; grid-template-areas: "n who chev" ". name chev" ". desc desc" !important; }
  .e2e.is-collapsible .e2e__step::after { content: ""; grid-area: chev; justify-self: end; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); opacity: .7; transition: transform .2s ease; }
  .e2e.is-collapsible .e2e__step.is-open::after { transform: rotate(-135deg); }
  .e2e.is-collapsible .e2e__step:not(.is-open) .e2e__desc { display: none; }
  .e2e.is-collapsible .e2e__step.is-open .e2e__desc { margin-top: 4px; }
  .e2e.is-collapsible .e2e__toggle { display: block; position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; background: transparent; border-radius: inherit; cursor: pointer; z-index: 2; }
  .e2e.is-collapsible .e2e__toggle:focus-visible { outline: 3px solid var(--primary, #9cc3ff); outline-offset: 2px; }
}
@media (prefers-reduced-motion: reduce) { .e2e__step::after { transition: none !important; } }
