/*
 * Phone-only refinements for the CSG Company Editor (2026-11-23).
 * EVERY rule in this file must stay inside the phone media query below, so desktop and laptop
 * screens (wider than 700px, the editor's existing phone breakpoint) never change.
 * Loaded last in index.html. tests/mobile-css.test.cjs enforces the media-query wrapper.
 */
@media (max-width: 700px) {
  /* Section bar (01-04, Trash, Images, Settings, View stats): one row that scrolls sideways and stays
     pinned to the top while scrolling, instead of three wrapped rows. The rail becomes "contents" so
     the bar can stick within the whole page. */
  .balanced-studio .balanced-rail {display:contents}
  .balanced-studio .studio-section-tabs {
    position:sticky;top:0;z-index:25;order:0;
    flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none;
    /* Capped at the screen width so the row scrolls inside itself instead of widening the page. */
    min-width:0;max-width:calc(100vw - 24px);box-sizing:border-box;
    gap:6px;margin:0;padding:8px 0;
    background:var(--studio-bg);border-bottom:1px solid var(--studio-line);
    box-shadow:-12px 0 var(--studio-bg),12px 0 var(--studio-bg);
  }
  .balanced-studio .studio-section-tabs::-webkit-scrollbar {display:none}
  .balanced-studio .studio-section-tabs>button {flex:0 0 auto;white-space:nowrap;min-height:44px;padding:10px 12px;font-size:13px}
  .balanced-studio .studio-section-tabs>button br {display:none}
  .balanced-studio .balanced-batch-toggle {order:0;margin:4px 0 0}

  /* Typing fields at 16px so iPhones do not zoom in when one is tapped. Offer text boxes that preview
     a chosen font size set their size inline and are left alone. */
  .balanced-studio input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]):not([type=color]):not([style*="font-size"]),
  .balanced-studio select:not([style*="font-size"]),
  .balanced-studio textarea:not([style*="font-size"]) {font-size:16px !important}

  /* Finger-sized controls: at least 44px tall and wide. */
  .balanced-studio button,
  .balanced-studio select,
  .balanced-studio input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),
  .balanced-studio .upload-label,
  .balanced-studio [role=tab] {min-height:44px !important}
  /* !important is safe here: this whole file only applies on phones, and older desktop rules with ids
     (e.g. #merchant-form) would otherwise keep some buttons at 32-39px. */
  .balanced-studio button {min-width:44px !important}
  /* Help toggles keep their ▸ arrow (list-item) and grow to a 44px tap height with padding. */
  .balanced-studio summary {display:list-item;min-height:44px;box-sizing:border-box;padding-top:12px;padding-bottom:12px}
  .balanced-studio .upload-label {display:inline-flex;align-items:center;justify-content:center}

  /* 01 business picker: one column, so "Choose a business" gets the full width instead of wrapping
     in a narrow column (a later unconditional rule in balanced-studio.css forces two columns). */
  .balanced-studio .business-picker.sidebar {grid-template-columns:minmax(0,1fr)}
  .balanced-studio .business-picker.sidebar>* {grid-column:1/-1}

  /* Header: a little tighter so more of the page shows. */
  .balanced-studio .app-header,.balanced-studio header {padding-top:max(8px, env(safe-area-inset-top));padding-bottom:8px}

  /* Fixed Save / Publish bar clears the phone's home bar. */
  .balanced-studio .editor-publish-actions {padding-bottom:max(12px, env(safe-area-inset-bottom))}

  /* Explore: keep the sticky carousel switcher below the sticky top section tabs instead of behind them. */
  .balanced-studio #carousel-studio .qs-jump {top:61px;z-index:10}

  /* Category buttons: keep drag grip and move buttons touch-friendly without crowding the chip. */
  .balanced-studio .category-order-row .cat-grip {min-width:40px !important;width:40px}
}
