/* ═══════════════════════════════════════════════════════════════════
   MOOTLY — MOBILE LAYER
   Added 2026-09-22. Loaded LAST on every page, after styles.css, the
   page's own <style> and typeset.css, so it wins on equal specificity.
   Silas: "make our website mobile accessible in general, everything
   about it, including the home page and all the buttons."

   Nothing here applies above 720px. Below it:
     1. No sideways scrolling, ever — the page body clips, and every
        multi-column grid becomes one column (mobile-nav.js collapses
        the ones set by class; the attribute rule below catches the
        ones set inline).
     2. The two navigation bars fold into a Menu button (mobile-nav.js
        adds the button; this file draws the open menu).
     3. Every button and link is at least 44px tall — a fingertip.
     4. Form fields are 16px, so iOS does not zoom the page on focus.
     5. Containers lose their desktop gutters; cards and modals fit the
        screen; tables scroll inside themselves.

   To remove the whole layer: delete this file, mobile-nav.js, and the
   two <link>/<script> lines they travel with. Nothing else changed.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Above the phone width: nothing in this file may show. ─────────
   mobile-nav.js creates the Menu button on every page and regroups the
   home page's bare links into a .nav-links wrapper; both need a desktop
   rule, or the button appears unstyled in every banner and the home
   page's links lose the 26px gap the bar gave them as direct children.
   Live 2026-09-22 (v704), reported by Silas. */
.mobile-menu-btn { display: none; }
.frame .nav .nav-links { display: flex; align-items: center; gap: 26px; }

@media (max-width: 720px) {

  /* ── 1. the frame ──────────────────────────────────────────────── */
  html, body { overflow-x: hidden; max-width: 100vw; }
  img, svg, video, canvas, iframe { max-width: 100%; height: auto; }
  pre, code { white-space: pre-wrap; overflow-wrap: anywhere; }
  table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  h1, h2, h3, p, li, td, th, label, .hc-caption { overflow-wrap: anywhere; }

  .container, .container-narrow, .app-container, .sect, .meta-band,
  .voice-container, .wizard-shell, .set-wrap, .page, .content {
    padding-left: 16px !important;
    padding-right: 16px !important;
    max-width: 100% !important;
  }
  .sect { padding-top: 36px !important; padding-bottom: 36px !important; }
  .app-page { padding-top: 20px; }

  /* Inline grids: every "grid-template-columns: … …" written in a style
     attribute becomes one column. Class-based grids are collapsed by
     mobile-nav.js, which reads the computed track count. */
  [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  /* The ones we know by name, so they are right before the script runs. */
  .hero-grid, .steps-grid, .audience-grid, .judges-grid, .pricing-grid, .diff-strip,
  .split, .statbar, .stepgrid, .diffgrid, .audgrid,
  .matter-grid, .matter-detail-grid, .debrief-grid, .debrief-hero,
  .upload-grid, .set-row, .form-grid, .two-col, .oc-voice-options,
  .footer .container { grid-template-columns: 1fr !important; }
  .statbar { grid-template-columns: 1fr 1fr !important; }

  /* Flex rows that were told never to wrap. */
  #matter-actions, .app-page-head, .hero-actions, .matter-header > div,
  .page-head, .card-head, .session-row, .file-row, .team-row,
  [style*="flex-wrap:nowrap"], [style*="flex-wrap: nowrap"] {
    flex-wrap: wrap !important;
    white-space: normal !important;
  }
  #matter-actions { gap: 8px !important; }
  /* THE ACTION COLUMN POKED PAST THE CARD (Silas, 2026-09-23, phone
     screenshot). A flex item's minimum width is its content's minimum
     width, and the split control's two never-wrap buttons set that wider
     than the card, so width:100% below could not help. Let every child of
     the header row shrink, and stack the split control's two halves. */
  .matter-header > div:first-of-type > * { min-width: 0; max-width: 100%; flex: 1 1 100%; }
  #matter-actions { min-width: 0; max-width: 100%; box-sizing: border-box; }
  #matter-actions > *, #matter-actions #startSplit { width: 100%; min-width: 0; box-sizing: border-box; }
  #matter-actions #startSplit { display: flex !important; flex-wrap: wrap !important; white-space: normal !important; height: auto !important; min-height: 0 !important; }
  #matter-actions #startSplit > .btn {
    flex: 1 1 100% !important; min-width: 0; justify-content: center;
    white-space: normal !important; height: auto !important; min-height: var(--action-h, 44px);
    border-right: 0 !important;
  }
  #matter-actions #startSplit > .btn:first-child { border-bottom: 1px solid rgba(255,255,255,.35); }
  #matter-actions .btn { justify-content: center; white-space: normal !important; height: auto !important; min-height: var(--action-h, 44px); }
  #hearing-length-row { flex-wrap: wrap !important; }
  #hearing-length-row select { max-width: 100%; }

  /* ── 2. navigation ─────────────────────────────────────────────── */
  .nav, .app-nav { padding: 10px 16px !important; gap: 12px; position: relative; }
  /* wordmark size on phones: typeset.css */
  .app-nav-left { gap: 12px; }
  .nav-links, .app-nav-links, .frame .nav .nav-links { display: none; }
  .nav-open .nav-links, .nav-open .app-nav-links, .frame .nav.nav-open .nav-links {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    position: absolute;
    left: 0; right: 0;
    top: 100%;
    background: var(--surface, #fff);
    border-bottom: 1px solid var(--rule, #d9e6f2);
    box-shadow: 0 12px 24px -12px rgba(15, 36, 71, .25);
    padding: 6px 8px 10px;
    z-index: 200;
  }
  .nav-open .nav-links a, .nav-open .app-nav-links a,
  .nav-open .nav-links .btn, .nav-open .app-nav-links .btn {
    display: flex !important;
    align-items: center;
    min-height: 46px;
    padding: 10px 12px;
    border-bottom: none;
    font-size: 16px;
    width: 100%;
    box-sizing: border-box;
  }
  .nav-open .nav-links .btn { justify-content: center; margin-top: 6px; }
  .nav-open .nav-links .nav-link.active, .nav-open .app-nav-links .app-nav-link.active {
    border-bottom: none;
    border-left: 3px solid var(--crimson, #3a73a9);
  }
  .frame .nav .cta { margin-left: 0; white-space: nowrap; }
  /* On a phone the home bar is wordmark, Sign in, Menu. The "Argue a matter"
     pill stays in the page body, where it already is. Silas, 2026-09-23,
     from a phone screenshot: the pills were wrapping onto two lines. */
  .frame .nav .cta:not(.secondary) { display: none; }
  .frame .nav .cta.secondary {
    margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px; padding: 0 14px; font-size: 14px; font-weight: 600;
    border: 1px solid var(--rule, #d9e6f2); background: var(--surface, #fff); color: var(--ink, #20303f);
    border-radius: 999px;
  }
  .frame .nav .logo { white-space: nowrap; }
  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-left: auto;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--rule, #d9e6f2);
    border-radius: 999px;
    background: var(--surface, #fff);
    color: var(--ink, #20303f);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
  }
  .mobile-menu-btn[aria-expanded="true"] { border-color: var(--crimson, #3a73a9); }
  .app-nav-right { gap: 8px; min-width: 0; }
  /* The account chip keeps its avatar and caret; the name goes. */
  .app-user-chip { padding: 4px; gap: 0; font-size: 0; max-width: 60px; overflow: hidden; }
  .app-user-chip .user-avatar-sm { font-size: 13px; }
  .app-user-chip .mootly-acct-caret { font-size: 13px; margin-left: 2px; }
  .mootly-acct-menu { right: 0; }

  /* ── 3. touch targets ──────────────────────────────────────────── */
  .btn, .btn-call, button:not(.oc-voice-play):not(.mobile-menu-btn),
  .app-nav-link, .nav-link, .btn-archive-view, .drillbtn, .mootly-acct-item,
  input[type="submit"], input[type="button"], [role="button"] {
    min-height: 44px;
  }
  a.btn, .btn, .btn-call { display: inline-flex; align-items: center; justify-content: center; }
  .hero-actions .btn, .cta-row .btn, .form-card .btn, .auth-card .btn, .wizard-card .btn { width: 100%; }
  .btn + .btn { margin-left: 0; }
  .call-controls { flex-direction: column !important; }
  .call-controls .btn-call { width: 100% !important; }
  .drillbtn { padding: 8px 14px; }
  /* Footer links and the small text links inside cards. */
  .footer a, .app-foot a, .sidebar-card a, .sidebar-card button[style*="underline"],
  .auth-card a, .form-card a, .voice-settings-note a {
    display: inline-block; padding: 10px 6px; min-height: 44px; line-height: 24px;
  }
  .app-foot a { margin: 0 2px; }

  /* ── 4. form fields ────────────────────────────────────────────── */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea, .me-input {
    font-size: 16px !important;
    min-height: 44px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }
  input[type="range"] { min-height: 32px; }
  .me-input { min-width: 0 !important; }
  .volrow, .volume-row { flex-wrap: wrap; }
  .volrow label, .volume-row label { width: 100% !important; }

  /* ── 5. surfaces ───────────────────────────────────────────────── */
  .auth-card, .wizard-card, .form-card, .matter-header, .card, .sidebar-card,
  .hearing-card, .voice-settings-panel, .demo-shell, .oneband, .audio-shell {
    padding-left: 18px !important;
    padding-right: 18px !important;
  }
  .auth-card { padding-top: 28px !important; padding-bottom: 28px !important; }
  .auth-shell { padding: 20px 12px; min-height: 0; }
  /* Modals: the debrief dialog and the drill picker. */
  [id$="Modal"] > div, .modal, .modal-card, .dialog {
    max-width: calc(100vw - 20px) !important;
    margin: 10px auto !important;
    padding: 18px 16px !important;
  }

  /* ── 6. type ───────────────────────────────────────────────────── */
  h1, .voice-header h1 { font-size: 30px !important; }
  h2 { font-size: 24px !important; }
  .hero h1, .sect h2[style*="font-size:40px"] { font-size: 32px !important; line-height: 1.12 !important; }
  .welcome-greeting { font-size: 30px !important; }
  .voice-header { margin-bottom: 14px; }

  /* The parties & counsel dialog: one field per line. */
  .pe-grid { grid-template-columns: 1fr !important; }
  .pe-dialog { padding: 18px 14px !important; }

  /* The hearing page on a phone: card, buttons, transcript. */
  .voice-stage { gap: 16px; }
  .transcript-content { max-height: 60vh !important; min-height: 0 !important; }
}
