/* OC NeuroDx mobile UX fixes (2026-09-14, rev 2).
   Loaded LAST in <head> on every page so it wins over each page's inline styles.
   Audit: clients/oc_neurodx/audit/mobile_ux_audit_2026-09-14.md
   Rev 2: fees stay in their original places (homepage section + /fees/), just easier to read on phones. */

[hidden] { display: none !important; }
html { scroll-padding-top: 84px; }

/* Plain-template pages now load Cormorant; its tall line box needed tightening */
.pg-hero h1 { line-height: 1.15 !important; }

/* Hidden everywhere except where a media query below shows them */
.toc-mobile, .mbar { display: none; }

/* ---------- Navigation: hamburger menu up to 1100px (phones, tablets, landscape) ---------- */
@media (max-width: 1100px) {
  nav { padding-left: 1rem !important; padding-right: 1rem !important; }
  nav .btn-nav { display: none !important; }
  nav .hamburger { display: flex !important; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0 !important; margin-right: -6px; }

  nav .nav-links {
    display: none !important;
    position: absolute !important; top: 68px !important; left: 0 !important; right: 0 !important;
    height: calc(100vh - 68px); height: calc(100dvh - 68px);
    overflow-y: auto !important; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    flex-direction: column !important; align-items: stretch !important; gap: 0 !important;
    padding: 0.25rem 1.5rem 2.5rem !important; margin: 0 !important;
    background: #fdf8f2 !important; border-top: 1px solid rgba(122,155,138,0.2); box-shadow: none !important; z-index: 199 !important;
  }
  nav .nav-links.open { display: flex !important; }

  nav .nav-links > li { display: block !important; padding: 0 !important; border-bottom: 1px solid rgba(122,155,138,0.2) !important; }
  nav .nav-links > li.mobile-cta { border-bottom: none !important; padding-top: 1.25rem !important; }

  nav .nav-links > li > a {
    display: flex !important; align-items: center; justify-content: space-between; min-height: 54px; padding: 0.25rem 0 !important;
    font-size: 17px !important; letter-spacing: 0.01em !important; text-transform: none !important; color: #3a2e2a !important; text-decoration: none !important;
  }
  nav .nav-links > li.mobile-cta > a { justify-content: center; min-height: 52px; background: #7a9b8a !important; color: #fff !important; border-radius: 100px; font-size: 16px !important; font-weight: 500; }

  /* Services accordion (closed by default; mobile.js toggles .expanded) */
  nav .nav-links .has-dropdown { position: static !important; display: block !important; padding: 0 !important; }
  nav .nav-links .has-dropdown > a::after {
    content: "" !important; width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(45deg); margin: -5px 8px 0 0; opacity: 0.6 !important; font-size: 0 !important; transition: transform 0.2s;
  }
  nav .nav-links .has-dropdown.expanded > a::after { transform: rotate(-135deg); margin-top: 5px; }
  nav .nav-links .dropdown {
    display: none !important; position: static !important; transform: none !important; box-shadow: none !important; background: transparent !important;
    border-radius: 0 !important; max-height: none !important; overflow: visible !important; padding: 0 0 0.9rem 0.25rem !important; margin: 0 !important;
  }
  nav .nav-links .has-dropdown.expanded .dropdown { display: block !important; }
  nav .nav-links .dropdown li { padding: 0 !important; border: none !important; }
  nav .nav-links .dropdown li.dropdown-heading { padding: 0.8rem 0 0.3rem 0.5rem !important; font-size: 11px !important; }
  nav .nav-links .dropdown a {
    display: flex !important; align-items: center; gap: 0.75rem; min-height: 46px; padding: 0.2rem 0.5rem !important; border-radius: 8px;
    font-size: 16px !important; white-space: normal !important; text-transform: none !important; letter-spacing: normal !important; color: #3a2e2a !important; text-decoration: none !important;
  }
  nav .nav-links .dropdown .dd-ico { width: 18px; height: 18px; }

  /* Lock the page behind the open menu (body only: html would break the sticky header) */
  body.nav-open { overflow: hidden !important; }
}

/* ---------- Phones ---------- */
@media (max-width: 768px) {
  /* iOS zooms into any field under 16px */
  input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea { font-size: 16px !important; }

  /* Sticky quick-action bar: Call + Book a Consult */
  .mbar {
    display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 150;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    background: rgba(253,248,242,0.97); border-top: 1px solid rgba(122,155,138,0.25); box-shadow: 0 -6px 20px rgba(58,46,42,0.08);
  }
  .mbar a {
    display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 46px; border-radius: 100px;
    font: 500 15px/1 'DM Sans', sans-serif; letter-spacing: 0; text-transform: none; text-decoration: none;
    color: #3a2e2a; background: #fff; border: 1.5px solid rgba(122,155,138,0.45); white-space: nowrap;
  }
  .mbar a.mbar-book { background: #7a9b8a; border-color: #7a9b8a; color: #fff; }
  .mbar svg { width: 17px; height: 17px; flex-shrink: 0; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)) !important; }
  body.nav-open .mbar, body.kb-open .mbar { display: none; }

  /* Readability + tap targets shared by the service/content templates */
  .form-card label { font-size: 14px !important; }
  .form-privacy { font-size: 13px !important; }
  .sidebar-label, .blog-banner-tag { font-size: 12px !important; }
  .sidebar-toc li a, .sidebar-toc a { font-size: 15px !important; min-height: 40px; }
  footer a { display: inline-block; padding: 7px 0; line-height: 1.5 !important; }

  /* Service pages: "Jump to a section" replaces the sidebar contents card */
  .toc-card { display: none !important; }
  .toc-mobile { display: block; background: #eef4f1; border: 1px solid #c8ddd3; border-radius: 14px; margin: 0 0 2rem; font-family: 'DM Sans', sans-serif; }
  .toc-mobile summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; min-height: 54px; padding: 0 1.15rem; font-size: 16px; font-weight: 500; color: #3a2e2a; }
  .toc-mobile summary::-webkit-details-marker { display: none; }
  .toc-mobile summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid #5d8373; border-bottom: 2px solid #5d8373; transform: rotate(45deg); margin-top: -4px; transition: transform 0.2s; }
  .toc-mobile[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
  .toc-mobile ul { list-style: none !important; display: block !important; margin: 0 !important; padding: 0 1.15rem 0.5rem !important; }
  .toc-mobile li { padding: 0 !important; margin: 0 !important; border-top: 1px solid rgba(122,155,138,0.22) !important; border-bottom: none !important; }
  .toc-mobile li::before, .toc-mobile li a::before { display: none !important; }
  .toc-mobile a { display: flex !important; align-items: center; min-height: 46px; font-size: 15px !important; color: #3a2e2a !important; border: none !important; text-decoration: none !important; }

  /* ---------- Homepage ---------- */
  .page-home section { padding-left: 1.25rem !important; padding-right: 1.25rem !important; }
  .page-home .hero .container { padding: 3rem 1.25rem !important; }
  .page-home .section-heading br { display: none; }
  .page-home #testimonials .container > div[style*="grid"] { grid-template-columns: 1fr !important; }
  .page-home #services .service-item { display: block !important; padding: 1.4rem !important; }
  .page-home #services .service-item::after { content: ""; display: table; clear: both; }
  .page-home #services .service-icon { float: left; width: 40px; height: 40px; margin: 0 0.85rem 0.35rem 0; }
  .page-home #services .service-item h3 { display: flex; align-items: center; min-height: 40px; font-size: 17px; line-height: 1.35; margin-bottom: 0.5rem; }
  .page-home #services .service-item p { clear: left; font-size: 15px !important; }
  .page-home .svc-link { padding: 0.55rem 0; font-size: 15px; }
  .page-home .serve-card p, .page-home .faq-item p, .page-home .hero-card p { font-size: 15px !important; }

  /* Original homepage fees section, same content and order, easier to read on a phone */
  .page-home #fees .fees-grid { gap: 1rem !important; margin-bottom: 1.75rem !important; }
  .page-home #fees .fee-card { padding: 1.4rem 1.35rem !important; border-radius: 16px !important; }
  .page-home #fees .fee-title { font-size: 13px !important; margin-bottom: 0.3rem !important; }
  .page-home #fees .fee-amount { font-size: 30px !important; }
  .page-home #fees .fee-note { font-size: 14px !important; color: #6b5c56 !important; margin-bottom: 1rem !important; padding-bottom: 1rem !important; }
  .page-home #fees .fee-list { gap: 0.5rem !important; }
  .page-home #fees .fee-list li { font-size: 15px !important; }
  .page-home #fees .insurance-grid { gap: 1.25rem !important; }
  .page-home #fees .insurance-info h3 { font-size: 26px !important; }
  .page-home #fees .insurance-info p { font-size: 15px !important; }
  .page-home #fees .superbill-box span { font-size: 14px !important; }
}

@media (max-width: 374px) {
  .mbar a { font-size: 14px; gap: 5px; }
  .mbar svg { width: 15px; height: 15px; }
}

/* Taps on touch screens leave :hover stuck; no lift effects there */
@media (hover: none) {
  .serve-card:hover, .city-article:hover { transform: none !important; }
}
