/* sh-mobile-fix.css — Comprehensive mobile responsive polish.
   Loads LAST so all rules win the cascade.
   Targets common issues: overflow, oversized hero, padding, footer stacking,
   topbar clutter, mega menu collapse, pricing/feat grids, blog post layout,
   tables/code blocks overflow, CTA buttons stacking. */

/* ============== Global guards ============== */
html, body { max-width: 100%; overflow-x: hidden; }
img, svg, video, iframe { max-width: 100%; height: auto; }
body.idc-theme .container,
body.idc-theme .container-fluid { padding-left: 16px; padding-right: 16px; }

/* Long words / URLs in article body */
body.idc-theme .pp-help-prose,
body.idc-theme .pp-help-prose p,
body.idc-theme .pp-help-prose li,
body.idc-theme .pp-help-prose h2,
body.idc-theme .pp-help-prose h3 { overflow-wrap: anywhere; word-break: break-word; }

/* Tables in article body — make horizontally scrollable */
body.idc-theme .pp-help-prose { -webkit-overflow-scrolling: touch; }
body.idc-theme .pp-help-prose table { display: block; max-width: 100%; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
body.idc-theme .pp-help-prose pre { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
body.idc-theme .pp-cmp { overflow-x: auto; -webkit-overflow-scrolling: touch; }
body.idc-theme .pp-cmp table { min-width: 560px; }

/* ============== ≤ 992px — tablet & below ============== */
@media (max-width: 992px) {
  /* Topbar — compact */
  body.idc-theme #topbar.idc-topbar { font-size: 12px; }
  body.idc-theme #topbar.idc-topbar .topbar-right,
  body.idc-theme #topbar.idc-topbar .idc-topbar-right { display: none !important; }
  body.idc-theme #topbar.idc-topbar .container,
  body.idc-theme #topbar.idc-topbar > .container { padding-top: 4px; padding-bottom: 4px; }

  /* Header bar height */
  body.idc-theme .idc-nav { min-height: 60px !important; padding: 10px 0 !important; }
  body.idc-theme header.idc-header > .container > .row > .col-md-12 { padding-left: 14px; padding-right: 14px; }

  /* CRITICAL: kill backdrop-filter on header container at mobile,
     because it creates a containing block for fixed descendants
     (which prevents #mainmenu from covering the viewport). */
  body.idc-theme header.idc-header > .container {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: #ffffff !important;
  }

  /* ======== Hamburger button — draw 3 bars explicitly ======== */
  body.idc-theme #menu-btn {
    display: inline-flex !important;
    width: 42px !important; height: 42px !important;
    background: #0f172a !important;
    border-radius: 10px !important;
    align-items: center; justify-content: center;
    position: relative;
    z-index: 1002;
    cursor: pointer;
  }
  /* Override theme/page-idc rules that paint span/before/after invisibly */
  body.idc-theme #menu-btn::before,
  body.idc-theme #menu-btn::after,
  body.idc-theme #menu-btn span {
    content: "" !important;
    display: block !important;
    position: absolute !important;
    left: 50% !important;
    width: 20px !important;
    height: 2px !important;
    background: #ffffff !important;
    border-radius: 2px !important;
    transform: translateX(-50%) !important;
    transition: transform .2s ease, opacity .2s ease, top .2s ease;
  }
  body.idc-theme #menu-btn::before { top: 13px !important; }
  body.idc-theme #menu-btn span    { top: 20px !important; opacity: 1 !important; }
  body.idc-theme #menu-btn::after  { top: 27px !important; }

  /* Animated X when menu is open */
  body.idc-theme header.menu-open #menu-btn::before { top: 20px !important; transform: translateX(-50%) rotate(45deg) !important; }
  body.idc-theme header.menu-open #menu-btn::after  { top: 20px !important; transform: translateX(-50%) rotate(-45deg) !important; }
  body.idc-theme header.menu-open #menu-btn span    { opacity: 0 !important; }

  /* ======== Mobile main menu — proper drawer ======== */
  body.idc-theme #mainmenu {
    display: none !important;
    position: fixed !important;
    top: 60px;
    left: 0; right: 0; bottom: 0;
    background: #ffffff !important;
    box-shadow: 0 24px 60px -20px rgba(15,23,42,.25);
    border-top: 1px solid #eef2f7;
    padding: 16px 16px 32px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0 !important;
    z-index: 999 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  body.idc-theme header.menu-open #mainmenu {
    display: flex !important;
  }

  /* Backdrop overlay so the drawer feels modal */
  body.idc-theme header.idc-header.menu-open::before {
    content: "";
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15,23,42,.35);
    z-index: 998;
    pointer-events: none;
  }

  /* Lock body scroll while menu is open */
  body.idc-theme:has(header.menu-open) { overflow: hidden; }

  body.idc-theme #mainmenu > li {
    width: 100%;
    border-bottom: 1px solid #f1f5f9;
    list-style: none;
  }
  body.idc-theme #mainmenu > li:last-child { border-bottom: 0; }
  body.idc-theme #mainmenu > li > a {
    width: 100%; display: flex !important; align-items: center; justify-content: space-between;
    padding: 16px 8px !important; font-size: 16px !important;
    color: #0f172a !important;
    text-decoration: none !important;
  }

  /* Submenu mega panel — stack inline */
  body.idc-theme #mainmenu .sh-sub {
    position: static !important;
    transform: none !important;
    width: 100% !important;
    margin-top: 0 !important;
    padding: 0 0 8px !important;
  }
  body.idc-theme #mainmenu .sh-sub > .container {
    padding: 0 !important;
    border: 0 !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    background: #f8fafc !important;
    max-width: 100% !important;
  }
  body.idc-theme #mainmenu .sh-sub .idc-mega-grid {
    grid-template-columns: 1fr !important;
    padding: 4px !important;
  }
  body.idc-theme #mainmenu .sh-sub .idc-mega-info {
    padding: 14px !important;
    border-right: 0 !important;
    border-bottom: 1px solid #e2e8f0 !important;
    border-radius: 10px 10px 0 0 !important;
    background: #fff !important;
  }
  body.idc-theme #mainmenu .sh-sub .idc-mega-info h4 { font-size: 16px !important; margin: 4px 0 6px !important; }
  body.idc-theme #mainmenu .sh-sub .idc-mega-info p { font-size: 13px !important; line-height: 1.5 !important; margin-bottom: 8px !important; }
  body.idc-theme #mainmenu .sh-sub .idc-mega-cards {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 6px !important;
    padding: 8px !important;
    background: #fff !important;
    border-radius: 0 0 10px 10px !important;
  }
  body.idc-theme #mainmenu .sh-sub .idc-mcard {
    display: flex !important; align-items: flex-start; gap: 10px;
    padding: 12px !important;
    border-radius: 10px;
    background: #f8fafc;
    text-decoration: none !important;
  }
  body.idc-theme #mainmenu .sh-sub .idc-mcard .ic { flex: none; width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; }
  body.idc-theme #mainmenu .sh-sub .idc-mcard .ic svg { width: 18px; height: 18px; }
  body.idc-theme #mainmenu .sh-sub .idc-mcard h4 { font-size: 14px !important; margin: 0 0 2px !important; color: #0b1020; }
  body.idc-theme #mainmenu .sh-sub .idc-mcard p { font-size: 12.5px !important; margin: 0 !important; color: #64748b; line-height: 1.4 !important; }
  body.idc-theme #mainmenu .sh-sub .idc-mega-tlds {
    grid-template-columns: repeat(2, 1fr) !important;
    padding: 8px !important;
    background: #fff !important;
    gap: 6px !important;
  }

  /* Mobile CTA inside drawer footer */
  body.idc-theme header.menu-open #mainmenu::after {
    content: "";
    display: block;
    height: 24px;
  }

  /* Hide legacy theme submenu UL on mobile too */
  body.idc-theme #mainmenu ul,
  body.idc-theme #mainmenu .mega,
  body.idc-theme #mainmenu .idc-mega { display: none !important; }

  /* Auto-open submenu on mobile when parent <li> tapped (sh-open class added by JS) */
  body.idc-theme #mainmenu > li.sh-has-sub.sh-open > .sh-sub { display: block !important; }
}

/* ============== ≤ 768px — mobile ============== */
@media (max-width: 768px) {
  /* Reduce header push since topbar is compact */
  body.idc-theme #content { padding-top: 90px !important; }
  body.home-idc .idc-hero { padding-top: 110px !important; }

  /* Logo + brand text scale */
  body.idc-theme #logo .logo-main { height: 32px !important; max-width: 36px; }
  body.idc-theme #logo a::after { font-size: 17px; }

  /* Hero (home) */
  .idc-hero { padding: 100px 0 60px !important; }
  .idc-hero h1, body.idc-theme .idc-hero h1 { font-size: clamp(28px, 7vw, 38px) !important; line-height: 1.15 !important; }
  .idc-hero p, .idc-hero .lead { font-size: 15px !important; }
  .idc-hero .row { row-gap: 28px; }
  .idc-hero .col-md-6 + .col-md-6 { margin-top: 8px; }

  /* Page hero */
  .idc-page-hero { padding: 70px 0 40px !important; }
  body.idc-theme .idc-page-hero { padding-top: 50px !important; }
  .idc-page-hero h1 { font-size: clamp(24px, 6.5vw, 34px) !important; line-height: 1.18 !important; margin: 12px 0 10px !important; }
  .idc-page-hero p.lead { font-size: 15px !important; }
  .idc-page-hero .breadcrumb-pill { font-size: 12px; padding: 5px 12px; }

  /* Section padding compact */
  body.idc-theme section { padding: 40px 0 !important; }
  body.idc-theme .pp-sec { padding: 36px 0 !important; }

  /* Headings */
  body.idc-theme h2 { font-size: clamp(22px, 5.6vw, 30px) !important; line-height: 1.2 !important; }
  body.idc-theme h3 { font-size: clamp(18px, 4.6vw, 24px) !important; line-height: 1.25 !important; }

  /* Hero CTA buttons stack */
  .idc-hero .idc-hero-ctas,
  .idc-hero .idc-cta-row,
  .idc-page-hero .hero-actions { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
  .idc-hero .idc-hero-ctas a,
  .idc-hero .idc-cta-row a,
  .idc-page-hero .hero-actions a { width: 100%; justify-content: center; }

  /* Pricing card content */
  body.idc-theme .idc-pricing-grid .price-card { padding: 22px 18px !important; }
  body.idc-theme .price-card h3, body.idc-theme .price-card .name { font-size: 18px !important; }
  body.idc-theme .price-card .price, body.idc-theme .price-card .amt { font-size: clamp(28px, 7vw, 36px) !important; }

  /* Pricing toggle */
  body.idc-theme .idc-toggle { transform: scale(.95); }

  /* Stats numbers */
  body.idc-theme .idc-stats .num,
  body.idc-theme .idc-stats h3 { font-size: clamp(22px, 6vw, 30px) !important; }
  body.idc-theme .idc-stats .lbl,
  body.idc-theme .idc-stats p { font-size: 12.5px !important; }

  /* Feature mini grid spacing */
  body.idc-theme .idc-feat-mini .feat-card,
  body.idc-theme .idc-feat-grid .feat-card { padding: 18px !important; }

  /* Tech stack section */
  body.idc-theme .tech-stack-grid,
  body.idc-theme .pp-tech-grid { gap: 12px !important; }

  /* Steps timeline */
  body.idc-theme .idc-steps { gap: 14px; }
  body.idc-theme .idc-steps .step { padding: 18px !important; }

  /* CTA money / banner */
  body.idc-theme .idc-cta-money,
  body.idc-theme .pp-cta { padding: 28px 20px !important; text-align: center; }
  body.idc-theme .idc-cta-money h2 { font-size: clamp(20px, 5.4vw, 28px) !important; }
  body.idc-theme .idc-cta-money .acts,
  body.idc-theme .pp-cta .acts { display: flex; flex-direction: column; gap: 10px; align-items: stretch; margin-top: 16px; }
  body.idc-theme .idc-cta-money .acts a,
  body.idc-theme .pp-cta .acts a { width: 100%; justify-content: center; }

  /* FAQ details */
  body.idc-theme .idc-faq summary { padding: 14px 16px !important; font-size: 15px; }
  body.idc-theme .idc-faq .ans, body.idc-theme .idc-faq details > div { padding: 0 16px 16px !important; }

  /* Footer */
  body.idc-theme footer.idc-footer { margin-top: 50px !important; }
  body.idc-theme .idc-foot-top { padding: 36px 18px !important; text-align: center; border-radius: 0; }
  body.idc-theme .idc-foot-top h3 { font-size: 20px !important; margin-bottom: 8px !important; }
  body.idc-theme .idc-foot-top p { font-size: 14px !important; }
  body.idc-theme .idc-foot-top .row { row-gap: 18px; }
  body.idc-theme .idc-foot-top .row > div + div { margin-top: 8px; }
  body.idc-theme .idc-foot-top .idc-btn { margin-left: 0 !important; display: inline-flex; margin-top: 6px; }

  body.idc-theme .idc-foot-main { padding: 48px 18px 24px !important; }
  body.idc-theme .idc-foot-main .row { row-gap: 32px; }
  body.idc-theme .idc-foot-main .row > [class*="col-"] { margin-bottom: 8px; padding-left: 0; padding-right: 0; }
  body.idc-theme .idc-foot-brand .brand { justify-content: flex-start; margin-bottom: 14px; }
  body.idc-theme .idc-foot-brand .desc { margin-bottom: 18px; }
  body.idc-theme .contact { margin-bottom: 22px; }

  body.idc-theme footer.idc-footer h5 { margin: 0 0 14px !important; font-size: 13px !important; }
  body.idc-theme footer.idc-footer ul { gap: 12px !important; }
  body.idc-theme footer.idc-footer ul li a { font-size: 14.5px !important; line-height: 1.5; display: inline-block; padding: 2px 0; }

  body.idc-theme .idc-foot-pay {
    margin: 28px 0 0 !important;
    padding: 18px !important;
    flex-direction: column; align-items: flex-start; gap: 12px;
    border-radius: 14px;
  }
  body.idc-theme .idc-foot-pay .pays { gap: 8px; }
  body.idc-theme .idc-foot-pay .pays img { height: 24px; }

  body.idc-theme .idc-foot-bottom {
    margin-top: 28px !important;
    padding: 22px 18px !important;
    text-align: center;
  }
  body.idc-theme .idc-foot-bottom .row { row-gap: 14px; }
  body.idc-theme .idc-foot-bottom .text-md-end { text-align: center !important; margin-top: 4px; }
  body.idc-theme .bot-links { justify-content: center; gap: 14px 18px; flex-wrap: wrap; }

  /* Blog list page */
  body.pp-blog .pp-blog-feat { padding: 24px 18px !important; border-radius: 14px; }
  body.pp-blog .pp-blog-feat h2 { font-size: 20px !important; line-height: 1.25 !important; }
  body.pp-blog .pp-blog-pills { gap: 6px !important; flex-wrap: wrap; }
  body.pp-blog .pp-blog-pills .pill { padding: 6px 12px !important; font-size: 12.5px !important; }
  body.pp-blog .pp-blog-grid { grid-template-columns: 1fr !important; gap: 16px !important; }

  /* Blog detail layout */
  body.pp-blog-post .pp-help-toc {
    position: static !important;
    margin-bottom: 16px;
    /* Collapse TOC into a compact box on mobile to avoid huge scroll */
    max-height: 280px;
    overflow-y: auto;
  }
  body.pp-blog-post .pp-help-prose { padding: 22px 18px !important; }
  body.pp-blog-post .pp-art-sec h2 { font-size: clamp(20px, 5.4vw, 26px) !important; }
  body.pp-blog-post .pp-help-prose p,
  body.pp-blog-post .pp-help-prose li { font-size: 15px !important; line-height: 1.7 !important; }
  body.pp-blog-post .pp-help-bc { font-size: 12.5px; flex-wrap: wrap; }
  body.pp-blog-post .pp-help-cta-banner { padding: 22px 18px !important; text-align: center; }
  body.pp-blog-post .pp-help-cta-banner h3 { font-size: 18px !important; }
  body.pp-blog-post .pp-help-cta-banner .acts { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
  body.pp-blog-post .pp-help-cta-banner .acts a { width: 100%; justify-content: center; }
  body.pp-blog-post .pp-help-related .g { grid-template-columns: 1fr !important; gap: 12px; }

  /* Help sidebar on other pages */
  body.idc-theme .pp-help-aside-card { padding: 16px !important; }

  /* Comparison tables */
  body.idc-theme .pp-cmp { border-radius: 12px; }

  /* Side-by-side rows that should stack */
  body.idc-theme .pp-row,
  body.idc-theme .pp-grid-2 { grid-template-columns: 1fr !important; }
}

/* ============== ≤ 480px — small phones ============== */
@media (max-width: 480px) {
  body.idc-theme #content { padding-top: 80px !important; }
  body.home-idc .idc-hero { padding-top: 96px !important; }

  /* Hide topbar entirely to recover vertical space */
  body.idc-theme #topbar.idc-topbar { display: none !important; }
  body.idc-theme header.idc-nav { top: 0 !important; }

  body.idc-theme .container, body.idc-theme .container-fluid { padding-left: 14px; padding-right: 14px; }

  .idc-hero { padding: 80px 0 50px !important; }
  .idc-hero h1, body.idc-theme .idc-hero h1 { font-size: clamp(26px, 8vw, 34px) !important; }
  .idc-page-hero { padding: 56px 0 32px !important; }
  .idc-page-hero h1 { font-size: clamp(22px, 7vw, 30px) !important; }

  body.idc-theme section { padding: 32px 0 !important; }
  body.idc-theme .pp-sec { padding: 28px 0 !important; }

  /* Logo wordmark hidden — let the icon represent brand */
  body.idc-theme #logo a::after { display: none; }
  body.idc-theme #logo .logo-main { height: 30px !important; max-width: 34px; }

  /* Footer extra-tight */
  body.idc-theme .idc-foot-main { padding: 30px 0 12px !important; }
  body.idc-theme .idc-foot-pay .pays { gap: 6px; }
  body.idc-theme .idc-foot-pay .pays img { height: 20px; }

  /* Blog cards */
  body.pp-blog .pp-blog-feat h2 { font-size: 18px !important; }
  body.pp-blog .pp-blog-feat p { font-size: 14px; }

  /* Article body images */
  body.pp-blog-post .pp-help-prose img { border-radius: 10px; }
  body.pp-blog-post .pp-help-prose blockquote { padding: 14px 16px !important; font-size: 14.5px !important; }

  /* Reduce mega menu image sizes if any */
  body.idc-theme #mainmenu .mega img { max-height: 28px; }
}

/* ============== Landscape phone ============== */
@media (max-width: 900px) and (orientation: landscape) {
  body.idc-theme #content { padding-top: 80px !important; }
  body.home-idc .idc-hero { padding-top: 80px !important; }
  .idc-hero, .idc-page-hero { padding-top: 56px !important; padding-bottom: 36px !important; }
}

/* ============== Touch device — disable hover translate ============== */
@media (hover: none) {
  body.idc-theme .idc-article:hover,
  body.idc-theme .feat-card:hover,
  body.idc-theme .price-card:hover { transform: none !important; }
}
