/*!
 * RTI Wiki — Mobile polish overlay (sitewide).
 * Targets ≤640px viewports. Fixes the most common narrow-viewport issues
 * across tools, intelligence, ask, forum, wiki articles.
 */
@media (max-width: 640px) {
  /* Body baseline */
  body { font-size: 15px !important; }

  /* All hero gradient blocks: tighter padding + smaller H1 */
  .header, #rti-tool-hero, .hero {
    padding: 18px 16px !important;
  }
  .header h1, #rti-tool-hero .rti-hero-h1, .hero h1 {
    font-size: 22px !important;
    line-height: 1.2 !important;
  }
  .lede, .header .lede, #rti-tool-hero .rti-hero-lede, .hero p {
    font-size: 13.5px !important;
    line-height: 1.55 !important;
  }

  /* Tool main content area */
  .main, .wrap, #fa, #chk, #tcalc {
    padding: 0 14px 40px !important;
    margin-top: 12px !important;
  }

  /* Cards */
  .card, .step, .panel {
    padding: 16px !important;
    margin-bottom: 12px !important;
    border-radius: 12px !important;
  }
  .card h2, .step h2 {
    font-size: 16px !important;
  }

  /* Two-column inputs collapse cleanly */
  .row, .grid2, .row2 {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* Inputs / textareas: bigger touch targets */
  input[type=text], input[type=email], input[type=password], input[type=number],
  input[type=search], input[type=date], select, textarea {
    font-size: 16px !important; /* prevents iOS auto-zoom */
    padding: 11px 13px !important;
  }

  /* Buttons: full-width primary in actions row */
  .actions {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .actions .btn, .actions button {
    width: 100% !important;
    justify-content: center;
    text-align: center;
    padding: 12px 16px !important;
    font-size: 14px !important;
  }
  .actions a.btn-ghost, .actions a.btn {
    width: 100% !important;
    text-align: center;
  }

  /* Workflow strip: still scrollable horizontally */
  #rti-shell-flow {
    padding: 4px 6px !important;
  }
  #rti-shell-flow a {
    min-width: 76px !important;
    padding: 8px 10px !important;
  }
  #rti-shell-flow a .lbl { font-size: 11px !important; }

  /* Brand strip: pile menu below logo on narrow */
  #rti-shell-brand {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
    padding: 10px 12px !important;
  }
  #rti-shell-brand .menu {
    margin-left: 0 !important;
    flex-wrap: wrap !important;
  }

  /* Tool footer: 1 column on phone */
  #rti-tool-footer .rti-tf-nav {
    grid-template-columns: 1fr 1fr !important;
    gap: 14px !important;
  }
  #rti-tool-footer .rti-tf-stats {
    flex-wrap: wrap !important;
  }
  #rti-tool-footer .rti-tf-stat {
    flex: 1 1 calc(50% - 6px) !important;
    min-width: auto !important;
  }

  /* Q&A feed cards: vote tile narrower */
  .rti-feed-card {
    padding: 12px !important;
    gap: 10px !important;
  }
  .rti-feed-vote {
    flex: 0 0 44px !important;
  }

  /* Auth pill / menu fits viewport */
  #rti-aw-menu {
    width: calc(100vw - 20px) !important;
    right: 10px !important;
    left: 10px !important;
    max-width: none !important;
  }

  /* Pre/code blocks scroll */
  pre, .draft-block {
    font-size: 12px !important;
    padding: 12px !important;
    overflow-x: auto !important;
  }

  /* Result cards on intel tools */
  .rti-bi-pane { padding: 12px !important; font-size: 13.5px !important; }
}
