/* =====================================================
   EMT Cash: mobile-first layer
   Loaded last on every page. Fixes phone layout
   (360-430px) without touching desktop design.
===================================================== */

/* Long paragraphs were split in two; give the halves breathing room
   inside boxes whose own <p> styles have no margin. */
.faq-answer p + p, .tc-faq-answer p + p, .city-faq-answer p + p,
.et-faq p + p, .core-note p + p, .disclaimer-box p + p,
.callout-body p + p, .tip-card p + p,
.ep-faq .faq-answer p + p, .faq-full .faq-answer p + p { margin-top: .7em; }
.callout-body { flex: 1; min-width: 0; }
.callout-body p:last-child { margin-bottom: 0; }

/* A later rule in style.css sets .container padding to 0,
   which pushed text against the screen edge on phones. */
@media (max-width: 1240px) {
  .container { padding-left: 20px; padding-right: 20px; }
}

@media (max-width: 767px) {
  /* Inline 3-column grids on the homepage overflowed to 870px */
  .tips-grid { grid-template-columns: 1fr !important; gap: 1rem !important; }
  .tip-card { padding: 1.35rem 1.25rem; }
  .tip-card .tip-icon { width: 44px; height: 44px; font-size: 1.2rem; margin-bottom: .75rem; }

  /* Policy pages: let the article use the full phone width */
  .tc-body { padding: 0 0 48px; }
  .tc-layout { gap: 1.5rem; }
  .tc-article {
    margin: 0 -20px; padding: 1.75rem 20px;
    border: 0; border-radius: 0; box-shadow: none;
  }
  .tc-article p { line-height: 1.7; }
  .tc-article li { line-height: 1.65; }
  .tc-article h2 { font-size: 1.2rem; line-height: 1.3; gap: .5rem; margin-top: 1.75rem; padding-top: 1.5rem; }
  .tc-article h2 .sec-icon { width: 30px; height: 30px; font-size: .9rem; border-radius: 8px; }
  .tc-callout { padding: 1rem; gap: .6rem; }
  .tc-hero { padding: 48px 0 40px; }
  .tc-hero p { font-size: 1rem; }
}

/* ---------- Headings: two lines or fewer on a phone ---------- */
@media (max-width: 480px) {
  .display-xl { font-size: 1.95rem; line-height: 1.15; }
  .display-lg { font-size: 1.55rem; line-height: 1.2; }
  .tc-hero h1 { font-size: 1.85rem; }
  html body.page-loan-guide .article-hero h1 { font-size: 1.9rem; line-height: 1.15; }
  html body.page-loan-guide .article-body h2 { font-size: 1.45rem; line-height: 1.22; margin-top: 2.25rem; padding-top: 1.75rem; }
  html body.page-loan-guide .mid-cta h2 { font-size: 1.4rem; }
}

/* ---------- Tables become stacked cards on phones ---------- */
@media (max-width: 600px) {
  .table-scroll, .st-table-wrap, .article-table-wrap {
    overflow: visible !important; border: 0 !important; border-radius: 0 !important;
    background: transparent !important; box-shadow: none !important;
  }
  table.mf-cards, table.mf-cards tbody, table.mf-cards tr, table.mf-cards td {
    display: block; width: 100% !important; min-width: 0 !important;
  }
  table.mf-cards { border: 0 !important; background: transparent !important; table-layout: auto; }
  table.mf-cards thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
  }
  table.mf-cards tr {
    background: #fff !important; border: 1px solid #e9ddf7 !important; border-radius: 14px;
    padding: .7rem 1rem; margin: 0 0 .75rem;
    box-shadow: 0 2px 10px rgba(140, 36, 243, .05);
  }
  table.mf-cards td {
    display: flex; justify-content: flex-start; align-items: baseline; gap: .75rem;
    padding: .4rem 0 !important; border: 0 !important; background: transparent !important;
    font-size: .9rem; line-height: 1.5; text-align: left; white-space: normal !important;
  }
  table.mf-cards td + td { border-top: 1px dashed #efe6fa !important; }
  table.mf-cards td::before {
    content: attr(data-label); flex: 0 0 44%; text-align: left;
    font-size: .78rem; font-weight: 700; color: #6b5b7d; letter-spacing: .01em;
  }
  /* Tables whose first column names the row: it becomes the card title */
  table.mf-rowhead td:first-child {
    display: block; text-align: left; font-family: 'Manrope', 'Inter', sans-serif;
    font-size: 1rem; font-weight: 800; color: #1a1523 !important; padding: .2rem 0 .45rem !important;
  }
  table.mf-rowhead td:first-child::before { display: none; }
  table.mf-rowhead td:first-child + td { border-top: 1px solid #efe6fa !important; }
  /* Comparison tables without a row heading: stack label above value */
  table.mf-cards:not(.mf-rowhead) td { display: block; text-align: left; }
  table.mf-cards:not(.mf-rowhead) td::before { display: block; margin-bottom: .15rem; }
}

/* Desktop line breaks in headings make ragged lines on phones */
@media (max-width: 480px) {
  h1 br, h2 br, h3 br { display: none; }
}

/* Callout boxes: icon on top so the text gets the full width */
@media (max-width: 600px) {
  .tc-callout, .tc-warning, .ep-callout { display: block !important; padding: 1rem 1.1rem !important; }
  .tc-callout .callout-icon, .tc-warning .callout-icon, .ep-callout .callout-icon {
    display: block; font-size: 1.2rem; margin: 0 0 .35rem;
  }
}

/* Lists of one- or two-word items: two columns instead of a tall stack */
@media (max-width: 767px) {
  .st-list.mf-chips { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 4px 10px !important; }
  .st-list.mf-chips li { padding: 6px 10px; font-size: .92rem; line-height: 1.45; }
  .st-list.mf-chips li:nth-child(odd) { background: transparent; }
  .st-list.mf-chips li { background: #faf7fe; border-radius: 8px; }
}
@media (max-width: 767px) {
  .st-list.mf-chips li.mf-wide { grid-column: 1 / -1; }
}

/* Single-column grids sized to their widest child pushed past 360px */
@media (max-width: 767px) {
  .elig-hiw-inner, .contact-hero-inner { grid-template-columns: minmax(0, 1fr) !important; }
  .elig-hiw-inner > *, .contact-hero-inner > * { min-width: 0; }
}
