/* =========================================================================
   Phone layout for index.html (grove) and new_growth.html (findings).

   Every rule is scoped under html.is-mobile, which the inline detector in
   each page's <head> sets only on phone-sized screens (<=768px wide, or a
   touch screen <=500px tall in landscape). Desktop never matches anything
   in this file, so the desktop layout is untouched.

   Same app feel as desktop: the page itself never scrolls. Header, filters
   and tabs stay put, filters wrap onto several rows, cards stack in one
   column inside their own scroll area, and the pager stays pinned below.
   ========================================================================= */

/* 100vh on phones includes the browser toolbar, which hid the bottom of the
   page; 100dvh is the visible height (older browsers keep the 100vh line). */
html.is-mobile #site,
html.is-mobile #app { height: 100vh; height: 100dvh; width: 100%; }

/* index.html opts into viewport-fit=cover, so keep content clear of the notch,
   rounded corners and home indicator (insets are 0 everywhere else). */
html.is-mobile #site {
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* iOS Safari zooms into any focused field under 16px and, on a no-scroll
   page, leaves it zoomed: that is the "UI is locked" effect. */
html.is-mobile input[type="text"],
html.is-mobile input[type="search"],
html.is-mobile input[type="email"],
html.is-mobile input[type="password"],
html.is-mobile input[type="date"],
html.is-mobile select,
html.is-mobile textarea { font-size: 16px; }

/* ── Header (both pages) ── */
html.is-mobile .site-header { height: 52px; padding: 0 12px; gap: 8px; }
html.is-mobile .brand { gap: 8px; min-width: 0; }
html.is-mobile .brand-mark { width: 36px; height: 36px; }
html.is-mobile .brand-text { padding-bottom: 0; }
html.is-mobile .brand-name { font-size: 16px; line-height: 1.4; }
html.is-mobile .brand-slogan { display: none; }
html.is-mobile .header-nav { gap: 6px; flex-shrink: 0; }
html.is-mobile .nav-link { padding: 11px 10px; font-size: 11px; }
html.is-mobile .aauth-trigger { padding: 11px 12px; font-size: 12px; white-space: nowrap; }

/* ── Footer (both pages): one compact row — share icons + legal links ── */
html.is-mobile .site-footer {
  display: flex; flex-wrap: nowrap; align-items: center; justify-content: center;
  gap: 4px 10px; padding: 6px 8px; text-align: center;
}
html.is-mobile .site-footer::after { display: none; }
/* one row: share icons scroll sideways if they don't fit, legal links stay visible */
html.is-mobile .share-row { flex: 0 1 auto; min-width: 0; gap: 4px; flex-wrap: nowrap; justify-content: flex-start;
  overflow-x: auto; scrollbar-width: none; }
html.is-mobile .share-row::-webkit-scrollbar { display: none; }
html.is-mobile .share-btn { flex: none; }
html.is-mobile .share-btn { width: 38px; height: 38px; }
html.is-mobile .share-btn svg { width: 15px; height: 15px; }
html.is-mobile .follow-row,
html.is-mobile .copyright-home { display: none; }
html.is-mobile .footer-right { gap: 0; flex: none; }
html.is-mobile .legal-links { font-size: 11px; }
html.is-mobile .legal-links a { padding: 11px 8px; }

/* ── Grove page (index.html) ── */
html.is-mobile #site { grid-template-rows: 52px minmax(0, 1fr) auto; }
html.is-mobile .grove-console { padding: 10px 8px 8px; gap: 8px; }
html.is-mobile .console-banner { flex-direction: column; align-items: flex-start; gap: 4px; }
html.is-mobile .console-title { font-size: 11px; letter-spacing: .12em; line-height: 1.5; }
html.is-mobile .console-sub { display: block; margin: 2px 0 0; font-size: 11px; }
html.is-mobile .console-meta { font-size: 11px; }
html.is-mobile .product-strip { flex-wrap: wrap; gap: 6px 10px; }
html.is-mobile .legend { position: static; margin: 0 auto; }

/* ── Findings page (new_growth.html) ── */
html.is-mobile .admin-toolbar { padding: 0 10px; }
html.is-mobile .controls-row { gap: 6px; padding: 8px 0; }
html.is-mobile .search-wrap { order: -2; flex: 1 1 150px; max-width: none; min-width: 0; }
html.is-mobile .search-wrap input { height: 40px; }
html.is-mobile .div-pipe,
html.is-mobile .date-label { display: none !important; }
html.is-mobile .preset-group { flex: 1 1 100%; flex-wrap: wrap; gap: 4px; }
html.is-mobile .preset-btn { flex: 1 1 auto; min-height: 38px; padding: 6px 4px; font-size: 12px; }
html.is-mobile .custom-dates { flex: 1 1 100%; flex-wrap: nowrap; gap: 4px; min-width: 0; }
/* width:0 + flex lets date inputs shrink below their intrinsic width */
html.is-mobile .custom-dates input[type="date"] { flex: 1 1 0; min-width: 0; width: 0; height: 40px; }
html.is-mobile .clr-dates { flex: none; width: 40px; height: 40px; }
html.is-mobile .toolbar-right { order: -1; flex: 0 1 auto; min-width: 0; gap: 6px; }
html.is-mobile .refresh-btn { min-height: 40px; min-width: 40px; padding: 0 12px; font-size: 0; }
html.is-mobile .refresh-btn .icon { font-size: 15px; }
html.is-mobile .feed-status { flex: 0 1 130px; min-width: 0; height: 40px; padding: 0 8px; }
html.is-mobile .feed-progress { flex-basis: 40px; }

html.is-mobile .cat-tab { padding-left: 10px; padding-right: 10px; min-height: 42px; font-size: 12px; }
html.is-mobile .scroll-area {
  min-height: 0; padding: 8px 8px 12px;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
html.is-mobile .result-meta { flex-wrap: wrap; gap: 4px 10px; }

/* Cards: number column narrower; label sits ABOVE its value (a side-by-side
   label column left ~150px for the text and crushed the Direct/Indirect bullets). */
html.is-mobile .card { gap: 0 10px; padding: 10px 10px 10px 12px; grid-template-columns: 30px minmax(0, 1fr); }
html.is-mobile .field-title { font-size: 14px; }
html.is-mobile .field-row { flex-direction: column; align-items: stretch; gap: 1px; }
html.is-mobile .field-label { max-width: none; min-width: 0; }
html.is-mobile .field-val { font-size: 13px; }
html.is-mobile .bullet-list li { display: block; font-size: 13px; }
html.is-mobile .bullet-list li::before { margin-right: 6px; }

/* Pager: one tidy row — "x of y" text drops, arrows + pages + rows/page stay. */
html.is-mobile .pagination { padding: 6px 8px; gap: 6px; }
html.is-mobile .page-info { display: none; }
html.is-mobile .page-controls { flex: 1 1 auto; justify-content: center; flex-wrap: wrap; gap: 4px; }
html.is-mobile .pg-btn { min-width: 40px; height: 40px; padding: 0 6px; font-size: 13px; }
html.is-mobile .per-pg { font-size: 0; gap: 0; }            /* hide the "Rows / page" words, keep the select */
html.is-mobile .per-pg select { height: 40px; }

/* Landscape phones are too short for fixed chrome: let the whole app column
   scroll as one (cards included) so nothing is cut off. */
@media (max-height: 500px) {
  html.is-mobile #app,
  html.is-mobile #site { height: auto; min-height: 100vh; min-height: 100dvh; }
  html.is-mobile,
  html.is-mobile body { height: auto; overflow-y: auto; }
  html.is-mobile .scroll-area { overflow: visible; flex: none; }
  html.is-mobile .grove-console { min-height: 340px; }
}
