/* Mobile node counts are independent of the desktop arrangement and content style. */
@media (max-width:760px) {
  [data-mobile-columns="1"] { --node-mobile-columns:1; }
  [data-mobile-columns="2"] { --node-mobile-columns:2; }
  [data-mobile-columns="3"] { --node-mobile-columns:3; }
  [data-mobile-columns="4"] { --node-mobile-columns:4; }
  [data-mobile-columns="5"] { --node-mobile-columns:5; }
  .v4-body .v4-content-sections .v4-content-section .v4-panel :is(.v4-content-elements,.v4-section-gallery)[data-mobile-columns][data-arrangement] {
    display:grid; grid-template-columns:repeat(var(--node-mobile-columns,2),minmax(0,1fr));
    grid-template-rows:none; grid-auto-flow:row; gap:var(--gallery-gap,12px); min-width:0;
  }
  .v4-body .v4-content-sections .v4-content-section .v4-panel [data-mobile-columns] > * {
    grid-column:auto; grid-row:auto; min-width:0; max-width:100%; box-sizing:border-box;
  }
  /* A horizontal gallery keeps its scroll behavior, showing the selected count at once. */
  .v4-body .v4-content-sections .v4-content-section .v4-panel :is(.v4-content-elements,.v4-section-gallery)[data-mobile-columns][data-arrangement="scroll"] {
    grid-template-columns:none; grid-auto-flow:column;
    grid-auto-columns:calc((100% - (var(--node-mobile-columns,2) - 1) * var(--gallery-gap,12px)) / var(--node-mobile-columns,2));
  }
  .v4-body .v4-content-sections .v4-content-section .v4-panel [data-mobile-columns]:not([data-mobile-columns="1"]) > .v4-content-element {
    display:flex; flex-direction:column; align-items:stretch; gap:14px;
    /* Large desktop padding must not force a narrow mobile grid track wider. */
    padding:min(var(--node-padding,14px),14px)!important;
  }
  .v4-body .v4-content-sections .v4-content-section .v4-panel [data-mobile-columns]:not([data-mobile-columns="1"]) .v4-element-symbol {
    width:min(var(--node-icon-size,44px),44px,100%); height:auto; aspect-ratio:1; margin:4px 0;
  }
  .v4-body .v4-content-sections .v4-content-section .v4-panel [data-mobile-columns]:not([data-mobile-columns="1"]) .v4-element-symbol > :is(svg,img.site-custom-icon) { width:50%; height:50%; }
  .v4-body .v4-content-sections .v4-content-section .v4-panel [data-mobile-columns] .v4-element-link { flex-wrap:wrap; }
  .v4-body .v4-content-sections .v4-content-section .v4-panel [data-mobile-columns]:is([data-mobile-columns="4"],[data-mobile-columns="5"]) > .v4-content-element { padding:min(var(--node-padding,6px),6px)!important; }
  /* Connected lines cannot span independently wrapped rows of steps. */
  .v4-body .v4-content-sections .v4-content-section .v4-panel [data-mobile-columns]:not([data-mobile-columns="1"]):is([data-elements-layout="path"],[data-elements-layout="timeline"]) > .v4-content-element::before,
  .v4-body .v4-content-sections .v4-content-section .v4-panel [data-mobile-columns]:not([data-mobile-columns="1"]):is([data-elements-layout="path"],[data-elements-layout="timeline"]) > .v4-content-element::after { display:none; }
  .v4-body .v4-content-sections .v4-content-section .v4-panel .v4-section-gallery[data-mobile-columns] > .v4-gallery-card { display:flex; flex-direction:column; }
  .v4-body .v4-content-sections .v4-content-section .v4-panel .v4-section-gallery[data-mobile-columns] > .v4-gallery-card > img { height:auto; flex:none; aspect-ratio:4/3; }
  .v4-body .v4-content-sections .v4-content-section .v4-panel .v4-section-gallery[data-mobile-columns] .v4-gallery-caption { position:static; background:none; padding:12px; }
  .v4-body .v4-content-sections .v4-content-section .v4-panel .v4-section-gallery:is([data-mobile-columns="4"],[data-mobile-columns="5"]) .v4-gallery-caption { padding:6px; }
  .v4-body .v4-content-sections .v4-content-section .v4-panel .v4-section-gallery[data-mobile-columns] .v4-gallery-caption :is(h3,p) { color:var(--node-body-color,#453b36); overflow-wrap:anywhere; }
  .v4-body .v4-content-sections .v4-content-section .v4-panel .v4-section-gallery[data-mobile-columns] .v4-gallery-caption h3 { color:var(--node-title-color,#713c35); }
}
