/* ============================================================
   codProfit · Responsive & mobile improvements
   Loaded after the inline <style> block on each page so these
   rules cascade last. Don't add anything here that should run
   on desktop too — keep desktop styles in the page <style>.
   ============================================================ */

/* Prevent horizontal page scroll caused by any single overflowing element */
html, body { overflow-x: hidden; }
body { -webkit-tap-highlight-color: transparent; }

/* Sticky nav offset for in-page anchors */
section[id], [id] { scroll-margin-top: 84px; }

/* Generic safety: media never overflows its container */
img, svg, video, canvas { max-width: 100%; height: auto; }

/* Long PKR strings shouldn't push containers wider than the viewport */
.compare .big,
.kpi-body .big,
.trust-bar .val,
.metric-tile .val,
.tier .px {
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

/* ============================================================
   Mobile hamburger button (shown ≤880px, JS-injected)
   ============================================================ */
.mobile-menu-btn {
  display: none;
  width: 44px; height: 44px;
  border: 1px solid var(--line-2, #d8d4c4);
  background: rgba(255, 255, 255, 0.6);
  border-radius: 10px;
  align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
  transition: background .2s ease, border-color .2s ease;
}
.mobile-menu-btn:hover {
  background: white;
  border-color: var(--ink, #0F172A);
}
.mobile-menu-btn .bars {
  position: relative;
  width: 18px; height: 14px;
  display: block;
}
.mobile-menu-btn .bars::before,
.mobile-menu-btn .bars::after,
.mobile-menu-btn .bars > span {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: var(--ink, #0F172A);
  border-radius: 2px;
  transition: transform .25s ease, top .25s ease, opacity .15s ease;
}
.mobile-menu-btn .bars::before { top: 0; }
.mobile-menu-btn .bars > span    { top: 6px; display: block; }
.mobile-menu-btn .bars::after  { top: 12px; }
.mobile-menu-btn.open .bars::before { top: 6px; transform: rotate(45deg); }
.mobile-menu-btn.open .bars::after  { top: 6px; transform: rotate(-45deg); }
.mobile-menu-btn.open .bars > span  { opacity: 0; }

@media (max-width: 880px) {
  .mobile-menu-btn { display: inline-flex; }
}

/* ============================================================
   Mobile drawer (full-width sheet under nav)
   ============================================================ */
.mobile-drawer {
  position: fixed;
  inset: 68px 0 0 0;
  z-index: 49;
  background: rgba(248, 247, 242, 0.98);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  transform: translateY(-12px);
  opacity: 0;
  pointer-events: none;
  transition: transform .3s cubic-bezier(.2,.8,.2,1), opacity .25s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.mobile-drawer.open {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}
.mobile-drawer-inner {
  padding: 18px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.mobile-drawer a.md-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 4px;
  border-bottom: 1px solid var(--line, #E5E2D6);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink, #0F172A);
}
.mobile-drawer a.md-link::after {
  content: "→";
  color: var(--ink-3, #64748B);
  transition: transform .2s ease, color .2s ease;
  font-size: 18px;
}
.mobile-drawer a.md-link:hover::after {
  transform: translateX(4px);
  color: var(--emerald, #047857);
}
.mobile-drawer .md-cta {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mobile-drawer .md-cta .btn {
  justify-content: center;
  padding: 16px 20px;
  font-size: 16px;
  width: 100%;
}
body.menu-open { overflow: hidden; }

/* Hide drawer entirely on desktop — no chance of layout interference */
@media (min-width: 881px) {
  .mobile-drawer { display: none !important; }
}

/* ============================================================
   Hero · tighten on small phones, kill the 3D tilt on mobile
   ============================================================ */
@media (max-width: 720px) {
  .hero { padding: 36px 0 24px; }
  .hero h1.display { font-size: clamp(34px, 8.4vw, 50px); margin: 16px 0 14px; }
  .hero p.lede     { font-size: 16px; margin-bottom: 24px; }

  /* Disable expensive 3D rotation + perspective on mobile */
  .hero-dash-wrap { perspective: none; margin-top: 36px; }
  .hero-dash      { transform: none !important; }
  .hero-dash:hover{ transform: none !important; }
  .hero-dash-body { padding: 16px; }
  .hero-dash-body h3 { font-size: 16px; }
  .hero-dash-bar  { padding: 10px 14px; font-size: 12px; }
  .hero-dash-bar .mono { font-size: 11px; }

  /* Hero background ::before icon often overflows on tiny screens */
  .hero-bg::before { width: 480px; height: 480px; right: -200px; }
}

@media (max-width: 480px) {
  .hero h1.display { font-size: clamp(30px, 9vw, 40px); }
  .hero-ctas { flex-direction: column; align-items: stretch; }
  .hero-ctas .btn { justify-content: center; width: 100%; }
}

/* ============================================================
   Section padding on tiny screens
   ============================================================ */
@media (max-width: 480px) {
  .section    { padding: 64px 0; }
  .section-sm { padding: 48px 0; }
  .wrap       { padding: 0 18px; }
  h2.display  { font-size: clamp(28px, 8vw, 38px); }
  .lede2      { font-size: 16px; }
}

/* ============================================================
   Compare cards (problem section)
   ============================================================ */
@media (max-width: 720px) {
  .compare { gap: 14px; margin-top: 36px; }
  .compare .card { padding: 22px; }
  .compare .big  { font-size: 32px; }
  .compare .breakdown .row { font-size: 13.5px; }
  .compare .breakdown .row.eq .val { font-size: 18px; }
  .closing-line  { font-size: 16px; margin-top: 28px; }
}

/* ============================================================
   Integration diagram (Feature 1) — stack on mobile
   ============================================================ */
@media (max-width: 720px) {
  .integration-diagram { padding: 20px; }
  .integration-diagram .id-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .integration-diagram .id-flow {
    flex-direction: row;
    min-width: 0;
    width: 100%;
    gap: 10px;
    align-items: center;
    justify-content: center;
  }
  .integration-diagram .id-flow .flow-track { flex: 1; max-width: 80px; }
  .integration-diagram .id-flow .label {
    font-size: 9.5px;
    white-space: nowrap;
    letter-spacing: 0.06em;
  }
  .id-status-grid { grid-template-columns: repeat(5, 1fr); gap: 5px; }
  .status-pill { font-size: 10px; padding: 3px 0; }
}

/* ============================================================
   Pricing card · tighter inner padding on mobile
   ============================================================ */
@media (max-width: 720px) {
  .price-card        { padding: 22px; }
  .price-card .right { padding: 18px; }
  .price-card .left .display { font-size: clamp(34px, 8vw, 44px); }
  .tier .name        { font-size: 14.5px; }
  .tier .meta        { font-size: 12px; }
  .tier .px          { font-size: 16px; }
}

/* ============================================================
   FAQ tap targets and font on small screens
   ============================================================ */
@media (max-width: 720px) {
  .faq-q { font-size: 16px; padding: 18px 0; gap: 12px; min-height: 56px; }
  .faq-a { font-size: 15px; }
  .faq-item.open .faq-a { max-height: 800px; padding-bottom: 22px; }
}

/* ============================================================
   Steps / metric tiles padding on tiny screens
   ============================================================ */
@media (max-width: 480px) {
  .step { padding: 22px; }
  .step h4 { font-size: 19px; }
  .step .n { font-size: 52px; right: 18px; top: 14px; }
  .metric-tile { padding: 14px; }
  .metric-tile .val { font-size: 28px; }
}

/* ============================================================
   Trust bar
   ============================================================ */
@media (max-width: 480px) {
  .trust-bar > div { padding: 16px 18px; }
  .trust-bar .val  { font-size: 18px !important; }
  .trust-bar .label { font-size: 10.5px; }
  .trust-bar .small { font-size: 11.5px; }
}

/* ============================================================
   KPI cards · keep big numbers from blowing out card width
   ============================================================ */
@media (max-width: 480px) {
  .kpi-body .big   { font-size: 22px; }
  .kpi-head .label { font-size: 12px; }
  .kpi-grid2 .val  { font-size: 13px; }
}

/* ============================================================
   Final CTA on mobile
   ============================================================ */
@media (max-width: 720px) {
  .final-cta { padding: 80px 0; }
  .final-cta .display { font-size: clamp(36px, 9vw, 56px); }
  .final-cta::before { width: 460px; height: 460px; }
}

/* ============================================================
   Footer · 2-col with full-width logo description on tiny screens
   ============================================================ */
@media (max-width: 480px) {
  footer       { padding: 44px 0 28px; }
  .foot-grid   { grid-template-columns: 1fr 1fr; gap: 28px; }
  .foot-grid > div:first-child { grid-column: 1 / -1; }
  footer .copy { flex-direction: column; gap: 6px; font-size: 12px; align-items: flex-start; }
}

/* ============================================================
   Legal pages (privacy / terms / data-deletion)
   The TOC sidebar is sticky on desktop; on mobile let it flow.
   ============================================================ */
@media (max-width: 960px) {
  .legal-grid .toc {
    position: static !important;
    max-height: none !important;
    overflow: visible !important;
  }
}
@media (max-width: 720px) {
  .contact-card { padding: 22px; }
  .deleted-grid { gap: 12px; }
}

/* ============================================================
   vs-table · keep readable at 720px breakpoint already exists,
   reinforce minimum padding here
   ============================================================ */
@media (max-width: 480px) {
  .vs-row { grid-template-columns: 1.5fr 1fr 1fr; }
  .vs-row > div { padding: 10px 10px; font-size: 12px; }
  .vs-row.head > div { padding: 10px; font-size: 10.5px; letter-spacing: .08em; }
  .icon-circle { width: 18px; height: 18px; font-size: 10px; }
}

/* ============================================================
   Nav · tighten when hamburger appears
   ============================================================ */
@media (max-width: 880px) {
  .nav-inner { gap: 12px; }
  .logo-wordmark { height: 26px; }
}

/* ============================================================
   Modal (.bd-overlay) · ensure it scrolls on small screens
   ============================================================ */
@media (max-width: 480px) {
  .bd-overlay { padding: 16px; }
  .bd-modal { max-height: 92vh; }
  .bd-row { padding: 9px 16px; font-size: 13.5px; }
  .bd-head { padding: 14px 16px; }
}

/* ============================================================
   Reduced motion users
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
