/* =============================================================================
   OBIZWORKS RESPONSIVE LAYER — v1.0  (estate reusable Module: obizworks-responsive)
   -----------------------------------------------------------------------------
   Additive, class-keyed responsive layer for the Obizworks design system
   (base.css family). Adapts every portal to phones, tablets, laptops & desktops
   with an iOS look-and-feel. PURELY ADDITIVE — targets the shared estate class
   names (.top-bar/.nav/.wrap/.kpi-strip/.section-grid/.panel/.sidebar/table);
   rules no-op harmlessly where a class is absent. Remove this block to revert.

   Breakpoints (best-practice, mobile-first minded but written desktop-down to
   overlay existing base.css):
     desktop            > 1200px   (base)
     laptop         1024–1200px
     tablet          768–1024px
     large phone     560–768px
     phone           380–560px
     small phone       < 380px
   Companion: obizworks-nav.js upgrades the scroll-nav into a hamburger drawer
   (progressive enhancement). Without the JS, the CSS scroll-nav still works.
   ========================================================================== */

/* ---- global guards: no horizontal scroll, smooth iOS momentum, safe areas -- */
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
img, svg, video, canvas, table { max-width: 100%; }
* { -webkit-tap-highlight-color: rgba(249,115,22,.18); }

/* honour iPhone notch / home-indicator safe areas on sticky chrome */
.top-bar, .topbar, .ob-topbar {
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

/* ---- iOS-style hamburger button (hidden on desktop; shown by JS/breakpoint) - */
.obz-navtoggle {
  display: none;
  appearance: none; -webkit-appearance: none;
  width: 44px; height: 44px;                 /* iOS HIG min touch target */
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 12px;
  background: rgba(255,255,255,.04);
  color: var(--text, #fff);
  align-items: center; justify-content: center;
  cursor: pointer; flex: 0 0 auto;
}
.obz-navtoggle svg { width: 22px; height: 22px; display: block; }
.obz-navtoggle:active { background: rgba(255,255,255,.10); }

/* drawer backdrop */
.obz-nav-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(4,7,15,.55); backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden; transition: opacity .22s ease;
}
.obz-nav-open .obz-nav-backdrop { opacity: 1; visibility: visible; }

/* =========================== LAPTOP  (≤1200px) ============================= */
@media (max-width: 1200px) {
  .wrap { padding-left: 20px; padding-right: 20px; }
  .kpi-strip { gap: 12px; }
}

/* =========================== TABLET  (≤1024px) ============================= */
@media (max-width: 1024px) {
  .wrap { max-width: 100%; padding-top: 28px; padding-bottom: 48px; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: repeat(2, 1fr); }   /* 3-up landing cards */
  h1.hero, .hero { font-size: clamp(1.9rem, 4.5vw, 3rem); }
  /* tablet: let the bar wrap and the nav scroll so links never clip (768–1024) */
  .top-bar, .topbar, .ob-topbar { flex-wrap: wrap; row-gap: 10px; }
  .nav { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
}

/* ==================== LARGE PHONE / SMALL TABLET (≤768px) ================== */
@media (max-width: 768px) {
  /* top bar: keep it a single tidy row, allow the brand sub to hide if tight */
  .top-bar, .topbar, .ob-topbar { padding-top: 12px; padding-bottom: 12px; }
  .brand-sub { display: none; }

  /* NAV: replace the old `.nav{display:none}` with a usable iOS scroll-nav.
     Horizontally scrollable pill row — always reachable, no JS required. */
  .nav {
    display: flex !important;
    gap: 14px;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
    -ms-overflow-style: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; padding: 8px 4px; min-height: 40px; display: inline-flex; align-items: center; }

  /* layout grids collapse */
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .section-grid,
  .sk-grid,
  .cards { grid-template-columns: 1fr; }

  /* fluid headings + comfortable reading measure */
  h1.hero, .hero { font-size: clamp(1.7rem, 7vw, 2.4rem); }
  .lead { font-size: 1rem; max-width: 100%; }
  .panel { padding: 18px; }

  /* comfortable tap targets on all buttons/links in chrome */
  .btn-pill-primary, .btn-pill-secondary, .btn, .btn-ghost { min-height: 44px; display: inline-flex; align-items: center; }

  /* ---- responsive tables: wrap wide tables in a horizontal scroller ------ */
  .obz-table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* ---- opt-in table→card: add class="obz-cards" to a <table> to stack it.
     Cells reveal their header via data-label (JS mirrors <th> automatically). */
  table.obz-cards, table.obz-cards thead, table.obz-cards tbody,
  table.obz-cards th, table.obz-cards td, table.obz-cards tr { display: block; }
  table.obz-cards thead { position: absolute; left: -9999px; }
  table.obz-cards tr {
    margin-bottom: 12px; border: 1px solid var(--border, rgba(255,255,255,.08));
    border-radius: 14px; padding: 6px 12px; background: var(--surface, #141925);
  }
  table.obz-cards td {
    display: flex; justify-content: space-between; gap: 16px;
    padding: 8px 0; border: 0; text-align: right;
  }
  table.obz-cards td::before {
    content: attr(data-label);
    font-weight: 700; text-align: left; color: var(--text-muted, #94a3b8);
  }

  /* when JS drawer is active, present the nav as a slide-in panel instead */
  .obz-nav-js .nav {
    position: fixed; top: 0; right: 0; z-index: 50;
    height: 100dvh; width: min(82vw, 320px);
    flex-direction: column; align-items: stretch; gap: 4px;
    overflow-y: auto; overflow-x: hidden;
    background: var(--surface, #141925);
    border-left: 1px solid var(--border, rgba(255,255,255,.08));
    padding: calc(env(safe-area-inset-top) + 72px) 20px calc(env(safe-area-inset-bottom) + 24px);
    transform: translateX(100%); transition: transform .26s cubic-bezier(.32,.72,0,1);
    box-shadow: -18px 0 48px rgba(0,0,0,.5);
  }
  .obz-nav-js.obz-nav-open .nav { transform: translateX(0); }
  .obz-nav-js .nav a {
    font-size: 1rem; padding: 14px 12px; border-radius: 12px; min-height: 48px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,.06));
  }
  .obz-nav-js .nav a:active { background: rgba(255,255,255,.06); }
  .obz-nav-js .obz-navtoggle { display: inline-flex; }

  /* sidebar-shell portals (Church Growth / HSI-family): let content go full width */
  .with-sidebar, .app-shell { grid-template-columns: 1fr !important; display: block !important; }
  .sidebar { position: static; width: auto; }
}

/* =============================== PHONE (≤560px) ============================ */
@media (max-width: 560px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .kpi-strip { grid-template-columns: 1fr; }
  .page-footer { flex-direction: column; align-items: flex-start; gap: 6px; }
  .logo-tile { width: 40px; height: 40px; }
  h1.hero, .hero { font-size: clamp(1.6rem, 8vw, 2.1rem); }
  .cta-row { width: 100%; }
  .cta-row .btn, .cta-row .btn-ghost,
  .cta-row .btn-pill-primary, .cta-row .btn-pill-secondary { flex: 1 1 auto; justify-content: center; }
}

/* ============================ SMALL PHONE (≤380px) ======================== */
@media (max-width: 380px) {
  .wrap { padding-left: 13px; padding-right: 13px; }
  .brand-name { font-size: .95rem; }
  .nav a { font-size: .85rem; }
  .panel { padding: 15px; }
}

/* ---- accessibility: respect reduced-motion preference --------------------- */
@media (prefers-reduced-motion: reduce) {
  .obz-nav-js .nav, .obz-nav-backdrop { transition: none !important; }
}
/* ===================== END OBIZWORKS RESPONSIVE LAYER ====================== */
