/* ============================================================
   JetPatient Mobile Design System v1.0
   --------------------------------------------------------
   Drop-in stylesheet for every mobile-first patient surface.
   Loaded AFTER any page-specific CSS so its tokens win.

   Issued: May 2026
   Owner:  product@jetpatient.com
   Companion docs: JetPatient_Mobile_Design_System_v1.0.docx
                   JetPatient_Mobile_Strategy_v1.0.docx
   ============================================================ */

/* ---- 1. Reset (mobile-aware) ---------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overscroll-behavior-y: contain; }
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }

/* Disable iOS tap highlight + flash */
* { -webkit-tap-highlight-color: transparent; }

/* ---- 2. Design tokens ----------------------------------- */
:root {
  /* Brand */
  --jp-navy: #0A2D6E;
  --jp-navy-lt: #0e3b90;
  --jp-navy-5: rgba(10,45,110,.05);
  --jp-navy-10: rgba(10,45,110,.10);
  --jp-teal: #00C9C0;
  --jp-teal-dk: #00A89F;
  --jp-teal-5: rgba(0,201,192,.07);
  --jp-teal-15: rgba(0,201,192,.15);

  /* Surfaces */
  --jp-bg: #ffffff;
  --jp-bg-elev: #ffffff;
  --jp-bg-off: #F6F8FC;
  --jp-bg-tint: rgba(10,45,110,.04);

  /* Ink */
  --jp-text: #111827;
  --jp-text-2: #374151;
  --jp-muted: #5A6B8C;
  --jp-faint: #94A3B8;
  --jp-border: #E4E9F2;
  --jp-border-strong: #CBD5E1;

  /* Semantic */
  --jp-success: #047857;
  --jp-success-bg: #ECFDF5;
  --jp-warn: #B45309;
  --jp-warn-bg: #FFF7ED;
  --jp-danger: #991B1B;
  --jp-danger-bg: #FEE2E2;

  /* Type — mobile rem-anchored scale */
  --jp-font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  --jp-font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Type scale (mobile-first, deliberately conservative) */
  --jp-fs-xs:   12px;
  --jp-fs-sm:   14px;
  --jp-fs-base: 16px;   /* THIS IS LOAD-BEARING — DO NOT REDUCE ON INPUTS */
  --jp-fs-md:   17px;
  --jp-fs-lg:   19px;
  --jp-fs-xl:   22px;
  --jp-fs-2xl:  26px;
  --jp-fs-3xl:  32px;
  --jp-fs-4xl:  38px;

  /* Spacing — 4 px scale, mobile-tight */
  --jp-sp-1:  4px;
  --jp-sp-2:  8px;
  --jp-sp-3:  12px;
  --jp-sp-4:  16px;
  --jp-sp-5:  20px;
  --jp-sp-6:  24px;
  --jp-sp-7:  32px;
  --jp-sp-8:  40px;
  --jp-sp-9:  56px;

  /* Radii */
  --jp-r-sm: 8px;
  --jp-r-md: 12px;
  --jp-r-lg: 18px;
  --jp-r-xl: 24px;
  --jp-r-pill: 999px;

  /* Elevation */
  --jp-shadow-sm: 0 1px 2px rgba(10,45,110,.06);
  --jp-shadow-md: 0 4px 14px rgba(10,45,110,.08);
  --jp-shadow-lg: 0 12px 32px rgba(10,45,110,.14);
  --jp-shadow-sheet: 0 -8px 32px rgba(10,45,110,.10);

  /* Motion */
  --jp-ease: cubic-bezier(.22, 1, .36, 1);
  --jp-ease-emph: cubic-bezier(.32, .72, 0, 1);
  --jp-dur-1: 120ms;
  --jp-dur-2: 200ms;
  --jp-dur-3: 320ms;
  --jp-dur-sheet: 280ms;

  /* Touch targets (Apple HIG / WCAG 2.5.5) */
  --jp-tap-min: 44px;
  --jp-tap-comfortable: 48px;
  --jp-tap-primary: 56px;

  /* Safe-area shortcuts */
  --jp-sa-top: env(safe-area-inset-top);
  --jp-sa-right: env(safe-area-inset-right);
  --jp-sa-bottom: env(safe-area-inset-bottom);
  --jp-sa-left: env(safe-area-inset-left);

  /* Bottom-nav and top-bar heights */
  --jp-bnav-h: 64px;
  --jp-topbar-h: 56px;
}

/* ---- 3. Reduce-motion handling (JetPatient v2.2 policy) -------------------
   Brand motion stays on for all mobile users so the iPhone experience feels
   like a native app. Truly vestibular-heavy effects (parallax, drift, large
   blur transitions) can opt out via [data-reduce-motion="strict"].
   See assets/css/jp-marketing-mobile-v2.css top-of-file note. */
@media (prefers-reduced-motion: reduce) and (min-width: 99999px) {
  [data-reduce-motion="strict"], [data-reduce-motion="strict"] * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ---- 4. Mobile typography ------------------------------- */
.jp-m { font-family: var(--jp-font-sans); color: var(--jp-text); font-size: var(--jp-fs-md); line-height: 1.55; }
.jp-m h1, .jp-m .h1 { font-size: var(--jp-fs-3xl); font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; color: var(--jp-navy); margin: 0; }
.jp-m h2, .jp-m .h2 { font-size: var(--jp-fs-2xl); font-weight: 800; line-height: 1.2; letter-spacing: -0.015em; color: var(--jp-navy); margin: 0; }
.jp-m h3, .jp-m .h3 { font-size: var(--jp-fs-xl); font-weight: 700; line-height: 1.25; color: var(--jp-navy); margin: 0; }
.jp-m p { font-size: var(--jp-fs-base); line-height: 1.6; color: var(--jp-text); margin: 0; }
.jp-m .lede { font-size: var(--jp-fs-md); line-height: 1.62; color: var(--jp-muted); }
.jp-m .small { font-size: var(--jp-fs-sm); color: var(--jp-muted); }
.jp-m .micro { font-size: var(--jp-fs-xs); color: var(--jp-muted); letter-spacing: 0.04em; }
.jp-m .eyebrow {
  display: inline-flex; align-items: center; gap: var(--jp-sp-2);
  font-size: 11px; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--jp-teal-dk);
}
.jp-m .eyebrow::before { content:''; width: 16px; height: 2px; background: var(--jp-teal); border-radius: 2px; }

/* ---- 5. Page shell -------------------------------------- */
.jp-m-page {
  min-height: 100dvh;
  min-height: 100vh; /* fallback for old Safari */
  display: flex; flex-direction: column;
  background: var(--jp-bg);
  padding-left: var(--jp-sa-left);
  padding-right: var(--jp-sa-right);
}
.jp-m-topbar {
  position: sticky; top: 0; z-index: 100;
  height: calc(var(--jp-topbar-h) + var(--jp-sa-top));
  padding-top: var(--jp-sa-top);
  padding-left: var(--jp-sp-4); padding-right: var(--jp-sp-4);
  display: flex; align-items: center; gap: var(--jp-sp-3);
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--jp-border);
}
.jp-m-topbar-title { font-weight: 700; font-size: var(--jp-fs-md); color: var(--jp-navy); flex: 1; min-width: 0; }
.jp-m-topbar-action {
  width: var(--jp-tap-min); height: var(--jp-tap-min);
  border-radius: var(--jp-r-pill);
  display: grid; place-items: center;
  background: transparent; border: none; color: var(--jp-navy);
}
.jp-m-topbar-action:active { background: var(--jp-navy-10); }

.jp-m-main {
  flex: 1; min-width: 0; overflow-x: hidden;
  padding-bottom: calc(var(--jp-bnav-h) + var(--jp-sa-bottom) + var(--jp-sp-6));
}

.jp-m-section { padding: var(--jp-sp-5) var(--jp-sp-4); }
.jp-m-section + .jp-m-section { padding-top: 0; }
.jp-m-section-title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--jp-sp-3); }
.jp-m-section-title h2 { font-size: var(--jp-fs-xl); font-weight: 800; color: var(--jp-navy); letter-spacing: -0.015em; }
.jp-m-section-title a { color: var(--jp-teal-dk); font-size: var(--jp-fs-sm); font-weight: 700; text-decoration: none; }

/* ---- 6. Bottom navigation (the canonical pattern) ------- */
.jp-bnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--jp-bnav-h) + var(--jp-sa-bottom));
  padding-bottom: var(--jp-sa-bottom);
  background: rgba(255,255,255,.94);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--jp-border);
}
.jp-bnav-tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  background: transparent; border: none;
  text-decoration: none; color: var(--jp-muted);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em;
  padding: 6px 4px;
  position: relative;
  transition: color var(--jp-dur-1) var(--jp-ease);
  min-height: var(--jp-tap-min);
}
.jp-bnav-tab svg { width: 22px; height: 22px; stroke: currentColor; }
.jp-bnav-tab[aria-current="page"], .jp-bnav-tab.is-active {
  color: var(--jp-navy);
}
.jp-bnav-tab[aria-current="page"]::after, .jp-bnav-tab.is-active::after {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 28px; height: 3px; border-radius: 0 0 4px 4px;
  background: var(--jp-teal);
}
.jp-bnav-tab:active { color: var(--jp-navy); transform: scale(0.96); }

.jp-bnav-tab-badge {
  position: absolute; top: 6px; right: calc(50% - 18px);
  min-width: 16px; height: 16px; padding: 0 5px;
  border-radius: 999px;
  background: var(--jp-danger); color: #fff;
  font-size: 10px; font-weight: 800;
  display: grid; place-items: center;
}

/* ---- 7. Buttons ----------------------------------------- */
.jp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--jp-sp-2);
  min-height: var(--jp-tap-min);
  padding: 0 var(--jp-sp-5);
  border-radius: var(--jp-r-pill);
  border: none;
  font-family: inherit; font-size: var(--jp-fs-base); font-weight: 700; letter-spacing: -0.005em;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--jp-dur-1) var(--jp-ease), box-shadow var(--jp-dur-2) var(--jp-ease), background var(--jp-dur-1) var(--jp-ease);
}
.jp-btn:active { transform: scale(0.97); }
.jp-btn-primary { background: var(--jp-navy); color: #fff; box-shadow: 0 4px 14px rgba(10,45,110,.20); }
.jp-btn-primary:hover { background: var(--jp-navy-lt); }
.jp-btn-teal { background: var(--jp-teal); color: #fff; }
.jp-btn-teal:hover { background: var(--jp-teal-dk); }
.jp-btn-ghost { background: transparent; color: var(--jp-navy); border: 1.5px solid var(--jp-border); }
.jp-btn-ghost:active { background: var(--jp-navy-5); }
.jp-btn-block { width: 100%; }
.jp-btn-lg { min-height: var(--jp-tap-primary); font-size: var(--jp-fs-md); padding: 0 var(--jp-sp-6); }
.jp-btn-sm { min-height: 36px; font-size: var(--jp-fs-sm); padding: 0 var(--jp-sp-4); }

/* Sticky action bar — for forms with primary CTA */
.jp-action-bar {
  position: sticky; bottom: 0; z-index: 80;
  padding: var(--jp-sp-3) var(--jp-sp-4) calc(var(--jp-sp-3) + var(--jp-sa-bottom));
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--jp-border);
  display: flex; gap: var(--jp-sp-3);
}

/* ---- 8. Inputs ------------------------------------------ */
.jp-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--jp-sp-4); }
.jp-field-label { font-size: var(--jp-fs-sm); font-weight: 700; color: var(--jp-text-2); }
.jp-input, .jp-select, .jp-textarea {
  width: 100%;
  min-height: var(--jp-tap-comfortable);
  padding: var(--jp-sp-3) var(--jp-sp-4);
  font-family: inherit;
  font-size: var(--jp-fs-base);  /* MUST stay >= 16px to prevent iOS auto-zoom */
  line-height: 1.4;
  color: var(--jp-text);
  background: var(--jp-bg);
  border: 1.5px solid var(--jp-border);
  border-radius: var(--jp-r-md);
  -webkit-appearance: none;
  appearance: none;
}
.jp-input:focus, .jp-select:focus, .jp-textarea:focus {
  outline: none;
  border-color: var(--jp-teal);
  box-shadow: 0 0 0 4px var(--jp-teal-15);
}
.jp-input::placeholder { color: var(--jp-faint); }
.jp-textarea { min-height: 96px; resize: vertical; }
.jp-field-hint { font-size: var(--jp-fs-xs); color: var(--jp-muted); }
.jp-field-err { font-size: var(--jp-fs-xs); color: var(--jp-danger); font-weight: 700; }

/* ---- 9. Cards ------------------------------------------- */
.jp-card {
  background: var(--jp-bg-elev);
  border: 1px solid var(--jp-border);
  border-radius: var(--jp-r-lg);
  padding: var(--jp-sp-4) var(--jp-sp-4);
  box-shadow: var(--jp-shadow-sm);
}
.jp-card-tap {
  transition: transform var(--jp-dur-1) var(--jp-ease), box-shadow var(--jp-dur-2) var(--jp-ease);
  cursor: pointer;
}
.jp-card-tap:active { transform: scale(0.99); box-shadow: var(--jp-shadow-md); }
.jp-card-row { display: flex; align-items: center; gap: var(--jp-sp-3); }

.jp-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--jp-r-pill);
  font-size: var(--jp-fs-xs); font-weight: 700; letter-spacing: 0.02em;
  background: var(--jp-bg-off); color: var(--jp-text-2);
  border: 1px solid var(--jp-border);
}
.jp-pill-success { background: var(--jp-success-bg); color: var(--jp-success); border-color: rgba(4,120,87,0.3); }
.jp-pill-warn    { background: var(--jp-warn-bg);    color: var(--jp-warn);    border-color: rgba(180,83,9,0.3); }
.jp-pill-danger  { background: var(--jp-danger-bg);  color: var(--jp-danger);  border-color: rgba(153,27,27,0.3); }
.jp-pill-teal    { background: var(--jp-teal-5);     color: var(--jp-teal-dk); border-color: var(--jp-teal-15); }

/* ---- 10. Bottom sheet (replaces center modal on mobile) - */
.jp-sheet-scrim {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(10,15,30,.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--jp-dur-sheet) var(--jp-ease), visibility var(--jp-dur-sheet) var(--jp-ease);
}
.jp-sheet-scrim.is-open { opacity: 1; visibility: visible; }

.jp-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 210;
  background: var(--jp-bg);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding: 6px var(--jp-sp-4) calc(var(--jp-sp-5) + var(--jp-sa-bottom));
  box-shadow: var(--jp-shadow-sheet);
  transform: translateY(110%);
  transition: transform var(--jp-dur-sheet) var(--jp-ease-emph);
  max-height: 92dvh; max-height: 92vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.jp-sheet.is-open { transform: translateY(0); }
.jp-sheet::before {
  content: '';
  display: block;
  width: 40px; height: 4px;
  margin: 8px auto 14px;
  border-radius: 2px;
  background: var(--jp-border-strong);
}
.jp-sheet-title { font-size: var(--jp-fs-xl); font-weight: 800; color: var(--jp-navy); margin: 0 0 var(--jp-sp-3); }

/* ---- 11. Skeleton loaders ------------------------------- */
.jp-skel {
  background: linear-gradient(90deg, var(--jp-bg-off) 0%, #eef1f7 50%, var(--jp-bg-off) 100%);
  background-size: 200% 100%;
  animation: jp-skel-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--jp-r-sm);
}
@keyframes jp-skel-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- 12. Pull-to-refresh hint --------------------------- */
.jp-ptr {
  position: relative;
  text-align: center;
  font-size: var(--jp-fs-xs);
  color: var(--jp-muted);
  padding: var(--jp-sp-2) 0;
}

/* ---- 13. Empty state ------------------------------------ */
.jp-empty {
  padding: var(--jp-sp-7) var(--jp-sp-5);
  text-align: center;
}
.jp-empty-icon {
  width: 72px; height: 72px;
  margin: 0 auto var(--jp-sp-4);
  border-radius: var(--jp-r-pill);
  background: var(--jp-teal-5);
  display: grid; place-items: center;
  color: var(--jp-teal-dk);
}
.jp-empty h3 { font-size: var(--jp-fs-xl); font-weight: 800; color: var(--jp-navy); margin-bottom: var(--jp-sp-2); }
.jp-empty p  { font-size: var(--jp-fs-sm); color: var(--jp-muted); }

/* ---- 14. Tabs (segmented control) ----------------------- */
.jp-tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--jp-bg-off); border: 1px solid var(--jp-border);
  border-radius: var(--jp-r-pill);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.jp-tab {
  flex: 1 0 auto;
  min-height: 36px; padding: 0 var(--jp-sp-3);
  border-radius: var(--jp-r-pill); border: none; background: transparent;
  font-size: var(--jp-fs-sm); font-weight: 700; color: var(--jp-muted);
}
.jp-tab.is-active { background: #fff; color: var(--jp-navy); box-shadow: var(--jp-shadow-sm); }

/* ---- 15. Disclosure banner (Trust & Methods style) ------ */
.jp-disclosure {
  display: flex; gap: var(--jp-sp-3); align-items: flex-start;
  padding: 12px 14px;
  background: var(--jp-warn-bg);
  border: 1.5px solid #FED7AA;
  border-radius: var(--jp-r-md);
  font-size: var(--jp-fs-sm);
  line-height: 1.5;
}
.jp-disclosure-badge {
  flex-shrink: 0;
  background: var(--jp-warn); color: #fff;
  font-size: 10px; font-weight: 800; letter-spacing: 0.09em;
  padding: 4px 8px; border-radius: var(--jp-r-pill);
  text-transform: uppercase; white-space: nowrap;
}

/* ---- 16. Utility classes -------------------------------- */
.jp-row { display: flex; gap: var(--jp-sp-3); align-items: center; }
.jp-col { display: flex; flex-direction: column; gap: var(--jp-sp-3); }
.jp-spread { display: flex; justify-content: space-between; align-items: center; gap: var(--jp-sp-3); }
.jp-grow { flex: 1; min-width: 0; }
.jp-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jp-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ---- 17. Reduce parallax / heavy animation on small ----- */
@media (max-width: 640px) {
  /* Disable expensive marketing animations on small screens for perf */
  .hp-blob, .hero-parallax { display: none !important; }
}

/* ---- 18. Native-feel pointer feedback ------------------- */
@media (hover: none) and (pointer: coarse) {
  /* On touch devices, drop hover styles that fight tap feedback */
  a:hover, button:hover { background-color: inherit; }
}

/* End — jp-mobile.css v1.0 ============================== */
