/* ============================================================================
   VeraCita marketing site — MOBILE OVERLAY
   ----------------------------------------------------------------------------
   Loads LAST, after cream-theme.css. Every rule in this file lives inside
   @media (max-width: 768px), so it is structurally impossible for anything
   here to affect the desktop rendering. Do not add a rule outside the query.

   Scope: veracita.ai marketing site only. The app (app.veracita.ai) is a
   separate surface and is deliberately desktop-only.
   Intent (Andy, 2026-08-02): mobile is a full acquisition surface — browse,
   sign up and buy must all work on a phone.
   ========================================================================== */

@media (max-width: 768px) {

  /* --------------------------------------------------------------------
     0. HORIZONTAL OVERFLOW
     Root cause: .founder-section::before is an 800px decorative glow
     (css/sections/founder.css:15) centred with left:50%/translateX(-50%),
     so it reaches x=591 in a 383px viewport and drags the whole document
     sideways. `clip` contains it without creating a scroll container the
     way `hidden` would (which would break position:sticky descendants).
     The html/body rule is a backstop for any future wide decoration.
     -------------------------------------------------------------------- */
  html,
  body {
    overflow-x: clip;
    max-width: 100%;
  }

  .founder-section,
  .hero,
  .core-problem,
  .transformation,
  .stakes {
    overflow-x: clip;
  }

  .founder-section::before {
    width: 100%;
    max-width: 100vw;
  }

  /* --------------------------------------------------------------------
     1. HEADER
     At 393px the logo tagline, theme toggle, primary CTA and hamburger all
     compete for ~140px and overlap. The tagline and the header CTA both
     collapse; the CTA is not lost — the mobile menu carries both
     "Try VeraCita Free" and "Founder Circle" (index.html:277-282).
     -------------------------------------------------------------------- */
  .nav-logo-divider,
  .nav-logo-tagline {
    display: none;
  }

  .nav-actions .btn-primary {
    display: none;
  }

  .nav-inner {
    gap: var(--sp-3);
  }

  .nav-actions {
    gap: var(--sp-2);
    margin-left: auto;
  }

  /* 44px minimum touch target (WCAG 2.5.5 / iOS HIG) without changing the
     painted size of the control — padding does the work, not width/height. */
  .theme-toggle,
  .nav-hamburger {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* --------------------------------------------------------------------
     2. TYPOGRAPHY + RHYTHM
     The page is ~29,000px tall at phone width (~34 screens). Tightening
     section padding recovers roughly a fifth of that without touching
     any copy.
     -------------------------------------------------------------------- */
  .section {
    padding: var(--sp-12) 0;
  }

  .section-header {
    margin-bottom: var(--sp-8);
    padding: 0 var(--sp-4);
  }

  /* Body copy at 16px — smaller than this is hard to read at arm's length
     and triggers iOS zoom heuristics on form controls. */
  body {
    font-size: 16px;
  }

  p,
  li {
    font-size: 16px;
    line-height: 1.6;
  }

  h3 {
    font-size: 18px;
  }

  /* Long unbroken strings (URLs, DOIs, hashes) must wrap, not push the page */
  p, li, td, th, h1, h2, h3, h4, a, code {
    overflow-wrap: anywhere;
  }

  /* --------------------------------------------------------------------
     3. HERO
     -------------------------------------------------------------------- */
  /* .site-nav is position:fixed and 65px tall, so hero padding-top is load
     bearing, not decoration — it is what keeps the H1 out from behind the
     nav. Base is 160px (hero.css:28); 112px still clears the bar with 47px
     of air and buys back half a screen of scroll. Do not go below ~90px. */
  .hero {
    padding-top: 112px;
    padding-bottom: var(--sp-12);
  }

  .hero-ctas {
    flex-direction: column;
    align-items: stretch;
    gap: var(--sp-3);
    width: 100%;
  }

  .hero-ctas .btn {
    width: 100%;
    justify-content: center;
  }

  /* Carousel dots were 8-10px — below any usable tap size. Grow the hit
     area with padding and keep the painted dot small via background-clip. */
  .hero-showcase-dot-nav {
    min-width: 44px;
    min-height: 44px;
    padding: 17px;
    background-clip: content-box;
    box-sizing: border-box;
  }

  /* Industry lens chips: 34px tall -> 44px, and allow them to wrap */
  .lens-chip {
    min-height: 44px;
    padding-top: var(--sp-2);
    padding-bottom: var(--sp-2);
  }

  .lens-chips,
  .hero-lens-chips {
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--sp-2);
  }

  /* --------------------------------------------------------------------
     4. GRIDS -> SINGLE COLUMN
     Two 159px columns at phone width leaves ~14 characters per line.
     -------------------------------------------------------------------- */
  .founder-top-perks,
  .lens-grid,
  .features-grid,
  .use-cases-grid,
  .industries-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  /* --------------------------------------------------------------------
     5. TOUCH TARGETS
     81 interactive elements measured below the 44px floor at 393px.
     -------------------------------------------------------------------- */
  .btn,
  button.btn,
  a.btn,
  .pricing-card-cta,
  .matrix-cta,
  .mobile-menu-link,
  .faq-question {
    min-height: 44px;
  }

  .btn-sm {
    min-height: 44px;
    padding-left: var(--sp-4);
    padding-right: var(--sp-4);
  }

  /* Full-width CTAs read as buttons on a phone and are easier to hit */
  .btn-lg,
  .btn-founder.btn-lg,
  .final-cta-buttons .btn {
    width: 100%;
    justify-content: center;
  }

  .final-cta-buttons {
    flex-direction: column;
    gap: var(--sp-3);
  }

  /* Carousel controls in the Stakes section: 36px arrows, 8px dots.
     Grow the hit area, keep the painted dot the same size. */
  .stakes-arrow {
    min-width: 44px;
    min-height: 44px;
  }

  .stakes-dot {
    min-width: 44px;
    min-height: 44px;
    padding: 18px;
    background-clip: content-box;
    box-sizing: border-box;
  }

  .stakes-dots,
  .stakes-nav {
    gap: 0;
  }

  /* Billing-period toggle sits on the purchase path — 24px is far too small */
  .sub-toggle-btn {
    min-height: 44px;
    padding-left: var(--sp-4);
    padding-right: var(--sp-4);
  }

  .cookie-settings-link,
  .modal-close {
    min-height: 44px;
    min-width: 44px;
  }

  /* --------------------------------------------------------------------
     6. CHECKOUT / SIGN-UP  — the money path
     Two real defects fixed here:
     (a) inputs were 15px; iOS Safari auto-zooms the viewport on focus for
         anything under 16px, which throws the user out of the form layout.
     (b) .checkout-dialog had max-height:none + overflow:visible, so on a
         short viewport (iPhone SE, or any phone with the keyboard open)
         the submit button can sit off-screen with no way to scroll to it.
     -------------------------------------------------------------------- */
  #checkoutModal input,
  #checkoutModal select,
  #checkoutModal textarea,
  .checkout-dialog input,
  .checkout-dialog select,
  .checkout-dialog textarea {
    font-size: 16px;
  }

  .checkout-dialog {
    max-height: 88vh;
    max-height: 88dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--sp-8) var(--sp-5);
    width: calc(100% - var(--sp-8));
  }

  .checkout-close-btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .checkout-dialog .btn,
  .checkout-dialog button[type="submit"] {
    width: 100%;
    min-height: 48px;
  }

  /* --------------------------------------------------------------------
     7. PRICING
     .pricing-matrix is a 900px min-width table inside a 393px viewport.
     Its wrapper already scrolls (overflow-x:auto) but gives no signal that
     it can be scrolled. Pin the row-label column so the reader keeps their
     bearings, and add a scroll hint.
     -------------------------------------------------------------------- */
  .pricing-matrix-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }

  .pricing-matrix-scroll::after {
    content: "Swipe to compare plans \2192";
    display: block;
    padding: var(--sp-2) 0 0;
    font-size: 13px;
    color: var(--vc-text-tertiary);
    text-align: center;
    position: sticky;
    left: 0;
  }

  .pricing-matrix th:first-child,
  .pricing-matrix td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--vc-bg-base);
  }

  .pricing-matrix th,
  .pricing-matrix td {
    scroll-snap-align: start;
  }

  /* Pricing cards stack and stay full width */
  .pricing-cards,
  .pricing-grid {
    grid-template-columns: 1fr;
  }

  .pricing-card {
    width: 100%;
  }

  /* --------------------------------------------------------------------
     8. TABLES + MEDIA
     -------------------------------------------------------------------- */
  img,
  svg,
  video,
  canvas {
    max-width: 100%;
    height: auto;
  }

  table {
    max-width: 100%;
  }

  /* --------------------------------------------------------------------
     9. MOBILE MENU
     -------------------------------------------------------------------- */
  .mobile-menu-actions {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
  }

  .mobile-menu-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }

  .mobile-menu-close {
    min-width: 44px;
    min-height: 44px;
  }
}
