/* ema-mobile.css
   The phone layout for every EMA page. The pages are styled inline, so this
   layer uses !important on purpose: it is the only place the phone
   overrides live, and it applies only under 720px. Hooks are class names
   beginning with m- on the elements that change shape on a phone. */

@media (max-width: 720px) {
  /* Fixed corner marks and slogans crowd a phone; the content carries the brand. */
  .m-corner { display: none !important; }
  .m-hide { display: none !important; }

  /* Top bar: brand on one line, actions on the next, nothing wraps mid-word. */
  .m-topbar { padding: 10px 16px !important; flex-wrap: wrap !important; gap: 8px 12px !important; }
  .m-brand { flex: 1 1 100% !important; flex-direction: row !important; align-items: baseline !important; gap: 10px !important; }
  .m-brand > div:first-child { white-space: nowrap !important; }
  .m-nav { flex: 1 1 100% !important; gap: 8px !important; flex-wrap: wrap !important; }
  .m-nav button { padding: 8px 12px !important; font-size: 8.5px !important; letter-spacing: 0.14em !important; }

  /* Home: the scroller sits under the taller two-row bar; the orb keeps its size. */
  .m-home { padding: 112px 16px 40px !important; }
  .m-tools { flex-direction: column !important; }
  .m-libline { flex-direction: column !important; }
  .m-case { flex-wrap: wrap !important; }
  .m-case > div:first-child { flex: 1 1 100% !important; }

  /* Any screen bar with a title and a row of buttons (brief, kit, board). */
  .m-bar { padding: 12px 16px !important; flex-wrap: wrap !important; gap: 10px !important; }
  .m-bar > div:first-child { flex: 1 1 100% !important; min-width: 0 !important; }
  /* Pages with the fixed Brief back link leave room for it above the title. */
  .m-bar-back { padding-top: 46px !important; }
  .m-bartitle { font-size: 18px !important; overflow-wrap: anywhere !important; }
  .m-barnav { flex: 1 1 100% !important; flex-wrap: nowrap !important; overflow-x: auto !important; -webkit-overflow-scrolling: touch !important; padding-bottom: 2px !important; scrollbar-width: none !important; }
  .m-barnav::-webkit-scrollbar { display: none; }
  .m-barnav button { flex: 0 0 auto !important; padding: 9px 12px !important; }
  .m-barnav .m-tip { display: none !important; }

  /* Reading surfaces: tight gutters, tables scroll instead of overflowing. */
  .m-body { padding: 22px 16px 60px !important; }
  .m-body table { display: block !important; overflow-x: auto !important; max-width: 100% !important; }
  .m-status { padding: 8px 16px !important; }
  .m-status > div:last-child { white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; min-width: 0 !important; }

  /* Coverage and document rows stack: label above value. */
  .m-row { flex-direction: column !important; gap: 3px !important; }
  .m-row > div:first-child { flex: 0 0 auto !important; }
  .m-row > a, .m-row > button { align-self: flex-start !important; margin-top: 4px !important; }
  .m-panel { padding: 14px 16px !important; }
  .m-glance { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  .m-glance > div { padding: 13px 13px 11px !important; }
  .m-glance > div > div:nth-child(2) { font-size: 21px !important; }
  .m-glance > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .m-panel > div:first-child { flex-direction: column !important; gap: 10px !important; }
  .m-panel > div:first-child > button, .m-panel > div:first-child > div:last-child { align-self: flex-start !important; }

  /* Marketing kit body and tab strip. */
  .m-kit { padding: 22px 16px 80px !important; }
  .m-tabs { flex-wrap: nowrap !important; overflow-x: auto !important; -webkit-overflow-scrolling: touch !important; scrollbar-width: none !important; }
  .m-tabs::-webkit-scrollbar { display: none; }
  .m-tabs > div { flex: 0 0 auto !important; }
  .m-block { flex-direction: column !important; }
  .m-block > button { align-self: flex-start !important; }

  /* Whiteboard: the board still scrolls sideways (that is the board), with
     the pinned scrollbar underneath; columns fit two-thirds of the screen. */
  .m-board { padding: 12px 12px 110px !important; }
  .m-board .wb-col { flex: 0 0 min(248px, 78vw) !important; min-width: min(248px, 78vw) !important; }
  .m-boardhead { padding: 18px 16px 4px !important; }

  /* Photo step on the kit prep screen. */
  .m-prep { padding: 20px 14px !important; gap: 18px !important; justify-content: flex-start !important; }
  .m-prep .m-notes { grid-template-columns: 1fr !important; }
  .m-notes > div { flex-wrap: wrap !important; }
  .m-notes > div > div:nth-child(2) { flex: 1 1 100% !important; padding-top: 0 !important; }
  .m-notes > div > input { flex: 1 1 100% !important; }
  /* The remove x on a thumbnail gets a thumb-sized target. */
  .m-thumb-x { width: 24px !important; height: 24px !important; line-height: 22px !important; font-size: 14px !important; right: 4px !important; top: 4px !important; }
}

@media (max-width: 400px) {
  .m-bartitle { font-size: 16px !important; }
}
