/* Corproots Consultants — mobile layer (loaded LAST on every page).
   Phone-first UX: sticky action bar, full-screen menu, compact hero, list-style service cards,
   scrollable chips, bottom-sheet calculator, 16px inputs (no iOS zoom), 44px+ tap targets. */

html { -webkit-tap-highlight-color: transparent; }
a, button, summary, label { touch-action: manipulation; }
.mbar, .jump { display: none; }
.nav-cta { display: none; }

/* ---------- Tablet & phone navigation: full-screen menu sheet ---------- */
@media (max-width: 960px) {
  /* .header has backdrop-filter, so fixed children are sized relative to it — hence the explicit height */
  .nav { inset: var(--header-h) 0 auto 0; height: calc(100vh - var(--header-h)); height: calc(100dvh - var(--header-h)); overflow-y: auto; overscroll-behavior: contain; gap: 0; padding: 6px 20px calc(28px + env(safe-area-inset-bottom)); border-bottom: 0; background: var(--surface); box-shadow: none; transform: translateY(-8px); }
  .nav a:not(.btn) { display: flex; align-items: center; min-height: 58px; padding: 14px 4px; font-size: 1.12rem; font-weight: 600; color: var(--text); border-radius: 0; border-bottom: 1px solid var(--line); }
  .nav a:not(.btn):hover, .nav a.active, .nav a[aria-current="page"] { background: none; color: var(--brand-ink); }
  .nav a[aria-current="page"]::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-left: auto; }
  .nav-cta { display: grid; gap: 12px; margin-top: 24px; }
  .nav-cta .btn { width: 100%; }
  body.menu-open { overflow: hidden; }
  .menu-btn { width: 46px; height: 46px; }
}

@media (max-width: 768px) {
  :root { --header-h: 64px; }
  .header.scrolled { --header-h: 58px; height: 58px; }
  .container { width: min(1180px, 100% - 32px); }
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }

  /* header: the sticky bar carries the CTAs, so the header keeps only logo + menu */
  .header-actions .btn { display: none; }
  .logo img { height: 40px; }
  .header.scrolled .logo img { height: 34px; }

  /* sticky bottom action bar (shown after the first screen) */
  .mbar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; position: fixed; inset: auto 0 0 0; z-index: 95; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); box-shadow: 0 -10px 30px -14px rgba(11, 37, 69, .3); transform: translateY(110%); transition: transform .3s ease; }
  .mbar.show { transform: none; }
  .mbar.show.kbd, body.menu-open .mbar { transform: translateY(110%); }
  .mbar .btn { padding: 14px 8px; font-size: .96rem; min-height: 48px; }
  .fab-wa { display: none; }
  .fab-top { right: 16px; bottom: calc(92px + env(safe-area-inset-bottom)); width: 46px; height: 46px; }

  /* rhythm */
  .section { padding: 52px 0; }
  .section-head { margin-bottom: 30px; }
  .section-head h2 { font-size: clamp(1.6rem, 7vw, 2rem); margin: 14px 0 10px; }
  .section-head p { font-size: 1rem; }
  .eyebrow { font-size: .7rem; letter-spacing: .08em; padding: 6px 12px; }
  .btn { white-space: normal; text-align: center; min-height: 48px; }
  .btn-lg { padding: 15px 22px; font-size: 1rem; }
  .hero-cta { flex-direction: column; align-items: stretch; gap: 10px; margin-top: 24px; }
  .hero-cta .btn { width: 100%; }

  /* lighter visuals */
  .blob { filter: blur(46px); animation: none; }
  .blob.b3 { display: none; }
  .js .reveal { transform: translateY(16px); transition-duration: .55s; }

  /* homepage hero */
  .hero { padding-top: calc(var(--header-h) + 24px); }
  .hero h1 { font-size: clamp(2.05rem, 9vw, 2.6rem); margin: 16px 0 14px; }
  .hero .lead { font-size: 1rem; }
  .hero-grid { gap: 26px; padding-bottom: 40px; }
  .hero-mini { margin-top: 20px; font-size: .86rem; }
  .hero-visual { padding: 0 0 6px; }
  .float-chip { display: none; }
  .stats { margin-bottom: 0; padding-bottom: 28px; }   /* the old negative margin was clipped by the hero's overflow:hidden */
  .stat { padding: 16px 14px; }
  .stat .num { font-size: 1.65rem; }
  .stat .lbl { font-size: .82rem; }
  .hero + .section { padding-top: 52px; }

  /* sub-page hero */
  .page-hero { padding: calc(var(--header-h) + 20px) 0 32px; }
  .page-hero h1 { font-size: clamp(1.85rem, 8vw, 2.4rem); margin: 14px 0 12px; }
  .page-hero .lead { font-size: 1rem; }
  .page-hero + .section { padding-top: 36px; }
  .crumbs { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; scrollbar-width: none; margin-bottom: 14px; }
  .crumbs::-webkit-scrollbar { display: none; }
  .facts { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding: 2px 16px 8px; margin-top: 22px; }
  .facts::-webkit-scrollbar { display: none; }
  .fact { flex: none; font-size: .84rem; padding: 9px 13px; }

  /* "on this page" jump bar for service pages */
  .jump { display: flex; gap: 8px; position: sticky; top: 58px; z-index: 90; overflow-x: auto; scrollbar-width: none; padding: 10px 16px; background: rgba(255, 255, 255, .94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
  .jump::-webkit-scrollbar { display: none; }
  .jump a { flex: none; padding: 9px 15px; border-radius: 99px; border: 1px solid var(--line); font-size: .86rem; font-weight: 600; color: var(--muted); background: var(--surface); }
  .jump a.on { background: var(--grad); color: #fff; border-color: transparent; }
  main section[id] { scroll-margin-top: 112px; }

  /* chips: one scrollable row instead of wrapping */
  .filters, .cmp-controls { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding: 2px 16px 10px; margin-bottom: 18px; }
  .filters::-webkit-scrollbar, .cmp-controls::-webkit-scrollbar { display: none; }
  .chip { flex: none; min-height: 44px; }

  /* service cards become tappable list rows (no hover-to-flip on touch) */
  .svc-grid { grid-template-columns: 1fr; gap: 10px; }
  .svc { min-height: 0; cursor: pointer; }
  .svc-back { display: none; }
  .svc:hover, .svc:focus-within, .svc.flip { transform: none; box-shadow: var(--shadow-sm); border-color: var(--line); }
  .svc:active { border-color: var(--brand); background: var(--brand-soft); }
  .svc-front { display: grid; grid-template-columns: 48px 1fr 22px; grid-template-areas: "i t h" "i p h"; column-gap: 14px; row-gap: 2px; align-items: center; padding: 14px 16px; }
  .svc-ico { grid-area: i; width: 48px; height: 48px; border-radius: 14px; font-size: 1.3rem; }
  .svc h3 { grid-area: t; font-size: 1.02rem; align-self: end; }
  .svc p { grid-area: p; font-size: .85rem; align-self: start; }
  .svc-hint { grid-area: h; margin: 0; font-size: 0; gap: 0; opacity: 1; }
  .svc-hint .icon { width: 20px; height: 20px; }
  .calc-band { padding: 26px 20px; border-radius: 22px; }

  /* comparison table: narrower label column */
  .cmp th, .cmp td { padding: 13px 12px; font-size: .88rem; }
  .cmp tbody th { width: 104px; min-width: 104px; font-size: .8rem; }
  .cmp td.col, .cmp thead th.col { min-width: 148px; }

  /* testimonials, FAQ */
  .car-nav { display: none; }
  .tcard { flex-basis: 86%; padding: 22px; }
  .faq-q { padding: 18px; font-size: 1rem; min-height: 58px; }
  .faq-a p { padding: 0 18px 18px; }
  .final { padding: 36px 20px; border-radius: 24px; }

  /* sub-page blocks */
  .panel-card, .feat, .price-card { padding: 22px; }
  .price-card .btn { align-self: stretch; }
  .link-card, .post-card { padding: 20px; }
  .contact-card { padding: 16px; }
  .map-frame iframe { height: 260px; }
  .prose { font-size: 1.02rem; }
  .prose h2 { font-size: 1.3rem; margin-top: 30px; }

  /* footer: two compact link columns */
  .footer { padding: 44px 0 20px; }
  .f-grid { grid-template-columns: 1fr 1fr; gap: 28px 18px; }
  .f-grid > div:first-child, .f-grid > div:last-child { grid-column: 1 / -1; }
  .footer li { margin-bottom: 0; }
  .footer li a { padding: 9px 0; }
  .socials a { width: 44px; height: 44px; }
  .f-bottom { margin-top: 32px; flex-direction: column; gap: 6px; }

  /* inputs: 16px stops iOS zooming the page on focus */
  .news input, .field input, .field select, .field textarea { font-size: 16px; }
  .news input { min-height: 44px; }
  .field input, .field select { min-height: 48px; }
}

/* ---------- Calculator: bottom sheet on phones ---------- */
@media (max-width: 600px) {
  dialog.calc { width: 100%; max-width: none; margin: auto 0 0; border-radius: 24px 24px 0 0; max-height: 94vh; max-height: 94dvh; }
  dialog.calc[open] { animation: sheet .35s cubic-bezier(.2, .9, .3, 1); }
  dialog.calc::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 5px; background: var(--line); margin: 10px auto 0; flex: none; }
  .calc-top { padding-top: 12px; }
  .opt .card { padding: 14px; min-height: 66px; }
  .stepper button { width: 58px; height: 58px; }
  .addon { padding: 14px; min-height: 52px; }
  .calc-foot { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .calc-foot .btn, .res-cta .btn { min-height: 48px; }
  .calc-foot #calcNext { flex: 1; }
  .icon-btn { width: 44px; height: 44px; }
}
@keyframes sheet { from { transform: translateY(100%); } }

@media (max-width: 960px) and (min-width: 769px) { .svc-grid { grid-template-columns: repeat(2, 1fr); } }
@media (prefers-reduced-motion: reduce) { .mbar { transition: none; } dialog.calc[open] { animation: none; } }


/* compact include / value cards on phones: icon beside the text */
@media (max-width: 600px) {
  .feat { display: grid; grid-template-columns: 42px 1fr; column-gap: 14px; padding: 18px; align-items: start; }
  .feat .ck { grid-row: 1 / span 2; margin: 0; }
  .feat h3 { grid-column: 2; font-size: 1.04rem; margin-bottom: 4px; }
  .feat p { grid-column: 2; font-size: .9rem; }
}

@media (max-width: 600px) {
  .calc-foot { flex-direction: column-reverse; align-items: stretch; gap: 10px; }
  .calc-foot > .btn, .res-cta { width: 100%; }
  .res-cta { flex-direction: column-reverse; }
  .res-cta .btn { width: 100%; }
}

/* comparison: no sideways scrolling on phones — two structures share the width */
@media (max-width: 768px) {
  .cmp-wrap { overflow-x: visible; }
  .cmp { min-width: 0; table-layout: fixed; }
  .cmp th, .cmp td { padding: 12px 10px; font-size: .84rem; overflow-wrap: anywhere; }
  .cmp tbody th { position: static; width: 92px; min-width: 0; font-size: .76rem; }
  .cmp thead th:first-child { position: static; }
  .cmp thead th { position: static; padding-top: 14px; padding-bottom: 12px; }
  .cmp td.col, .cmp thead th.col { min-width: 0; }
  .cmp thead .ent b { font-size: .98rem; }
  .cmp thead .ent small { font-size: .74rem; }
  .cmp .tag { white-space: normal; font-size: .72rem; line-height: 1.3; padding: 3px 9px; }
  .cmp .meter i { max-width: none; flex: 1; }
  .cmp-controls .chip[data-e="__all"] { display: none; }
}

@media (max-width: 768px) {
  /* comparison chips wrap (so every choice and its on/off state stays visible) instead of scrolling */
  .cmp-controls { flex-wrap: wrap; justify-content: center; overflow: visible; margin-inline: 0; padding: 0; gap: 8px; }
  .cmp-controls .chip { padding: 9px 14px; font-size: .86rem; }
}



/* certificate card on phones */
@media (max-width: 768px) { .cert-card { padding: 18px; max-width: none; } .cert-stage { height: 270px; } .cert-ico { width: 84px; height: 84px; } }


/* Safari: never let the estimator body collapse to nothing inside the bottom sheet */
@media (max-width: 768px) { .calc-body { min-height: min(360px, 45vh); } }

@media (max-width: 768px) { .lv-chip { padding: 8px 13px; min-height: 36px; } .lv-loc select { font-size: 16px; min-height: 44px; } }
