/* ═══════════════════════════════════════════════════════════════
   ND STACK — RESPONSIVE.CSS  (single file, replaces all others)
   Link ONCE after main.css:
   <link rel="stylesheet" href="assets/css/responsive.css"/>
   For service pages use: "../assets/css/responsive.css"
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. GLOBAL: stop horizontal scroll without breaking sticky ──
   overflow-x:hidden creates a scroll context that disables
   position:sticky on all descendants. overflow-x:clip prevents
   horizontal scroll without that side effect. */
html, body {
  max-width: 100dvw;
  min-height: 100%;
  overflow-x: hidden;
}
html { overflow-x: visible; }
body { overflow-x: clip; }
/* Fallback for Safari < 16 which doesn't support overflow-x:clip */
@supports not (overflow: clip) {
  body { overflow-x: hidden; }
}

/* Smooth scroll for TOC anchor clicks */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ── 2. CONTAINER: always padded ────────────────────────────── */
.container,
.container--narrow {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
  box-sizing: border-box;
}

/* ── 3. HERO: clip internal overflow ────────────────────────── */
.hero,
.page-hero { overflow: hidden; }

/* ── 4. ALL TEXT: never overflow their box ──────────────────── */
.hero h1,
.page-hero h1,
.hero-desc,
.hero-badge,
.page-hero p,
.page-hero-inner,
.article-hero h1,
.article-content h2,
.article-content h3,
.article-content p,
.article-content blockquote,
.article-cover-inner,
.author-card h4,
.author-card p,
.related-card h3 {
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: break-word;
  min-width: 0;
}

/* ── 5. HERO LEFT: allow shrinking in grid ──────────────────── */
.hero-left,
.page-hero-inner { min-width: 0; width: 100%; }

/* ── 6. HAMBURGER: dark on white header ─────────────────────── */
.hamburger span { background: #111827; }

/* ── 7. BUTTONS: never overflow ─────────────────────────────── */
.btn { max-width: 100%; }

/* ── 8. ARTICLE: prevent layout overflow ────────────────────── */
.article-body,
.article-layout,
.article-content { min-width: 0; }

.article-content pre {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.article-content pre code {
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
}
.article-content code,
.article-content a { word-break: break-word; overflow-wrap: anywhere; }
.article-content img,
.article-content iframe,
.article-content video { max-width: 100%; height: auto; }

/* ══════════════════════════════════════════════════════════════
   1100px
══════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .svc-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════════════════════════════════════════════════════
   960px — Tablet
══════════════════════════════════════════════════════════════ */
@media (max-width: 960px) {

  /* Hero */
  .hero { padding: 100px 0 60px; min-height: auto; }
  .hero-inner { grid-template-columns: 1fr; gap: 40px; }
  .hero h1 { font-size: clamp(26px, 5.5vw, 48px); }

  /* Dashboard cards → vertical stack, no scroll */
  .hero-dashboard {
    position: relative !important;
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    overflow: visible !important;
    width: 100% !important;
  }
  .glass-card {
    position: relative !important;
    top: auto !important; right: auto !important;
    left: auto !important; bottom: auto !important;
    animation: none !important;
    width: 100% !important;
    height: auto !important;
  }

  /* Hero panel */
  .hero-panel { flex-direction: column; width: 100%; gap: 14px; }
  .hero-card  { width: 100%; }

  /* Page hero */
  .page-hero { padding: 140px 0 64px; }
  .page-hero h1 { font-size: clamp(24px, 5vw, 44px); }

  /* Grids */
  .int-grid   { grid-template-columns: 1fr 1fr; }
  .testi-grid { grid-template-columns: 1fr 1fr; }
  .why-inner, .contact-inner, .two-col, .cta-band-inner { grid-template-columns: 1fr; gap: 36px; }
  .two-col--rev .col-visual { order: 0; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }

  /* Team */
  .team-grid { grid-template-columns: repeat(2, 1fr); }
  .team-card:nth-child(1),
  .team-card:nth-child(2),
  .team-card:nth-child(n+3) { grid-column: auto; }

  /* Article: collapse TOC sidebar above the content */
  .article-layout { grid-template-columns: 1fr; gap: 28px; }
  .article-toc {
    position: static;
    order: -1;
    padding: 16px;
    border-radius: 12px;
    background: var(--bg-soft, #f8fafc);
    border: 1px solid rgba(0,0,0,.06);
  }
  .article-toc .toc-list { border-left: none; }
  .article-toc .toc-list a { border-left: none; padding: 6px 0; }
  .article-content { max-width: 100%; }
  .article-cover-inner { font-size: 48px; }

  /* Related grid */
  .related-grid { grid-template-columns: 1fr 1fr; }

  /* Blog listing — tablet 2-col */
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
  .featured-card { grid-template-columns: 1fr; padding: 28px; }
}

/* ══════════════════════════════════════════════════════════════
   768px — Mobile
══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Container */
  .container, .container--narrow { padding-left: 18px; padding-right: 18px; }

  /* Nav */
  .main-nav  { display: none; }
  .hamburger { display: flex; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }

  /* Hero */
  .hero { padding: 88px 0 52px; }
  .hero h1 {
    font-size: clamp(20px, 6.5vw, 36px);
    line-height: 1.1;
    letter-spacing: -0.02em;
  }
  .hero-desc { font-size: 15px; }

  /* Hero actions */
  .hero-actions { flex-direction: column; align-items: stretch; gap: 10px; }
  .hero-actions .btn { width: 100%; justify-content: center; display: flex; }

  /* Hero trust: 2-col grid */
  .hero-trust {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 28px;
  }
  .hero-trust-item { font-size: 12px; white-space: normal; }

  /* Page hero */
  .page-hero { padding: 110px 0 52px; }
  .page-hero h1 { font-size: clamp(22px, 6.5vw, 34px); line-height: 1.1; letter-spacing: -0.02em; }
  .page-hero p  { font-size: 15px; line-height: 1.7; }
  .page-hero-inner .btn { width: 100%; justify-content: center; display: inline-flex; }
  .breadcrumb { font-size: 11px; flex-wrap: wrap; }

  /* All grids → 1 col */
  .svc-grid, .int-grid, .testi-grid, .offer-grid,
  .feature-list, .values-grid, .team-grid { grid-template-columns: 1fr; }

  /* Keep why-stats 2-col */
  .why-stats { grid-template-columns: 1fr 1fr; gap: 10px; }

  .team-card:nth-child(1),
  .team-card:nth-child(2),
  .team-card:nth-child(n+3) { grid-column: auto; }

  /* Form */
  .form-row { grid-template-columns: 1fr; }

  /* Footer */
  .footer-grid   { grid-template-columns: 1fr; gap: 22px; }
  .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }

  /* CTA band */
  .cta-band-actions { flex-direction: column; }
  .cta-band-actions .btn { width: 100%; justify-content: center; }

  /* Strip */
  .strip-row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .strip-logos { flex-wrap: wrap; gap: 14px; }

  /* col-visual */
  .col-visual { grid-template-columns: 1fr 1fr; padding: 20px; gap: 10px; }

  /* Section padding */
  .services-sect, .offer-sect, .int-sect,
  .why-sect, .testi-sect, .contact-sect,
  .content-sect { padding: 64px 0; }
  .cta-band { padding: 56px 0; }

  .section-hd { margin-bottom: 36px; }
  .section-hd h2 { font-size: clamp(22px, 5.5vw, 32px); }

  .contact-form { padding: 22px 16px; }

  /* Touch targets */
  .btn, .btn-submit, .nav-cta, .mobile-nav a { min-height: 44px; }

  /* ── ARTICLE PAGE — MOBILE FIXES ─────────────────────────── */
  .article-hero { padding: 110px 0 48px; }
  .article-hero h1 {
    font-size: clamp(22px, 6vw, 32px);
    line-height: 1.15;
    letter-spacing: -0.015em;
  }
  .article-cat { font-size: 11px; padding: 5px 11px; }
  .article-meta { font-size: 12px; gap: 10px; }
  .author-block { gap: 10px; }
  .author-avatar { width: 38px; height: 38px; font-size: 13px; }

  .article-cover { margin-top: -28px; padding: 0 18px; }
  .article-cover-inner {
    aspect-ratio: 16 / 9;
    font-size: 32px;
    border-radius: 14px;
  }

  .article-body { padding: 48px 0; }

  .article-content { font-size: 15.5px; line-height: 1.7; }
  .article-content > p:first-of-type { font-size: 17px; line-height: 1.55; }
  .article-content h2 {
    font-size: clamp(20px, 5.5vw, 24px);
    line-height: 1.2;
    margin: 36px 0 12px;
    letter-spacing: -0.01em;
  }
  .article-content h3 { font-size: 18px; margin: 24px 0 10px; }
  .article-content blockquote {
    margin: 24px 0;
    padding: 14px 18px;
    border-radius: 0 10px 10px 0;
    font-size: 15px;
  }
  .article-content pre {
    padding: 14px 16px;
    font-size: 12.5px;
    border-radius: 10px;
    margin: 18px 0;
  }
  .article-content .info-box { padding: 14px 16px; margin: 22px 0; }
  .article-content ul, .article-content ol { padding-left: 18px; }

  .article-tags { margin-top: 32px; padding-top: 22px; }
  .tag-pill { font-size: 12px; padding: 5px 11px; }

  .share-bar { padding: 16px 18px; gap: 12px; }
  .share-btn { width: 36px; height: 36px; }

  /* Mobile author card layout:
     - Photo stays at desktop 120x120 size in the top-left.
     - Name + role sit to the RIGHT of the photo (rows 1 and 2).
     - Description sits BELOW the photo, spanning the full card width.

     Grid map:
       col 1 (120px)   col 2 (rest)
       ┌──────────┬──────────────┐
       │          │ Name  (row1) │
       │  Photo   ├──────────────┤
       │ rows 1-2 │ Role  (row2) │
       ├──────────┴──────────────┤
       │ Description (row3, 1/-1)│
       └─────────────────────────┘

     The inner <div> wraps h2/p.role/p in the HTML; we use
     `display: contents` to dissolve it so its 3 children become
     direct grid items of .author-card. The KEY fix vs. the previous
     attempt: column 1 is a FIXED 120px (not `auto`) so the long
     description in row 3 can't blow up the photo column and squash
     the name column down to a few pixels. */
  .author-card {
    display: grid;
    grid-template-columns: 120px 1fr;
    grid-template-rows: auto auto auto;
    column-gap: 16px;
    row-gap: 4px;
    align-items: start;
    padding: 20px;
  }
  .author-card .author-photo-des {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: start;
    /* Re-declare width/height explicitly. The desktop rule sets these,
       but inside a grid context the photo div can otherwise collapse. */
    width: 120px;
    height: 120px;
    flex-shrink: 0;
  }
  /* The <img> inside .author-photo-des has NO size rules in main.css
     (the existing img rule is incorrectly scoped under .author-photo-circle).
     Force it to fill its container so the photo renders at 120x120. */
  .author-card .author-photo-des img {
    width: 100%;
    /*height: 100%;*/
    object-fit: cover;
    display: block;
  }
  .author-des {        
	margin-top: auto;
    margin-bottom: 10px;
  }
  /* Dissolve the inner wrapper <div> so its children land in the grid. */
  .author-card > div {
    display: contents;
  }
  .author-card > div > h2 {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    margin: 0 0 2px;
    font-size: 17px;
    line-height: 1.25;
    min-width: 0;       /* allow the name to ellipsize/wrap normally */
  }
  .author-card > div > .role {
    grid-column: 2;
    grid-row: 2;
    align-self: start;
    margin: 0;
    font-size: 12.5px;
    line-height: 1.4;
    min-width: 0;
  }
  .author-card > div > p:not(.role) {
    grid-column: 1 / -1;   /* span both columns */
    grid-row: 3;
    margin: -10px 0 0;
    font-size: 13.5px;
    line-height: 1.65;
  }

  /* Related + CTA */
  .related-sect { padding: 56px 0; }
  .related-sect h2 { font-size: clamp(22px, 5.5vw, 28px); margin-bottom: 22px; }
  .related-grid { grid-template-columns: 1fr; gap: 18px; }

  .article-cta { padding: 48px 0; }
  .article-cta h2 { font-size: clamp(20px, 5vw, 26px); }
  .article-cta p { font-size: 14px; }

  /* Blogs listing page */
  .blog-hero { padding: 110px 0 52px; }
  .blog-hero h1 { font-size: clamp(24px, 6vw, 36px); line-height: 1.12; }
  .blog-hero p { font-size: 15px; }
  .blog-controls { flex-direction: column; align-items: stretch; gap: 12px; }
  .blog-search { max-width: none; margin-bottom: -250px;}
  .blog-filters { gap: 6px; }
  .filter-chip { font-size: 12px; padding: 7px 12px; }
  .featured-card { grid-template-columns: 1fr; padding: 22px; gap: 22px; }
  .featured-card h2 { font-size: clamp(20px, 5vw, 26px); }
  .blog-grid { grid-template-columns: 1fr; }
  .grid-header { flex-direction: column; align-items: flex-start; gap: 6px; }
  .featured-sect, .blog-grid-sect { padding: 48px 0; }
  .newsletter-band { padding: 56px 0; }
  .newsletter-form { flex-direction: column; }
  .newsletter-form input,
  .newsletter-form button { width: 100%; }
}

/* ══════════════════════════════════════════════════════════════
   560px — Small phones
══════════════════════════════════════════════════════════════ */
@media (max-width: 560px) {

  .container, .container--narrow { padding-left: 16px; padding-right: 16px; }

  .hero h1      { font-size: clamp(18px, 7vw, 26px); }
  .hero-desc    { font-size: 14px; }
  .hero-trust   { grid-template-columns: 1fr; }

  .page-hero    { padding: 100px 0 44px; }
  .page-hero h1 { font-size: clamp(20px, 7.5vw, 28px); letter-spacing: -0.015em; }
  .page-hero p  { font-size: 14px; }

  .why-stats  { grid-template-columns: 1fr 1fr; }
  .wstat-num  { font-size: 26px; }
  .stat-num   { font-size: 26px; }

  .col-visual { grid-template-columns: 1fr; }

  .services-sect, .offer-sect, .int-sect,
  .why-sect, .testi-sect, .contact-sect,
  .content-sect { padding: 52px 0; }
  .section-hd   { margin-bottom: 28px; }
  .contact-inner { gap: 28px; }
  .cta-band-copy h2 { font-size: clamp(20px, 6vw, 28px); }

  /* Article — extra-tight on small phones */
  .article-hero { padding: 100px 0 40px; }
  .article-hero h1 { font-size: clamp(20px, 6.5vw, 26px); }
  .article-cover { margin-top: -22px; padding: 0 16px; }
  .article-cover-inner { font-size: 26px; }
  .article-content h2 { font-size: clamp(19px, 5.5vw, 22px); }
  .article-content h3 { font-size: 16px; }
  .article-content { font-size: 15px; }
  .article-content pre { font-size: 12px; padding: 12px 14px; }
}

/* ══════════════════════════════════════════════════════════════
   400px — Very small (iPhone SE, Galaxy Fold)
══════════════════════════════════════════════════════════════ */
@media (max-width: 400px) {

  .container, .container--narrow { padding-left: 14px; padding-right: 14px; }

  .hero h1      { font-size: 18px; }
  .hero-desc    { font-size: 13px; }
  .page-hero h1 { font-size: 19px; }
  .page-hero p  { font-size: 13px; }
  .page-hero    { padding: 95px 0 40px; }

  .btn       { font-size: 13px; padding: 12px 16px; }
  .btn-submit { font-size: 13px; }
  .wstat-num { font-size: 22px; }
  .stat-num  { font-size: 22px; }
  .col-visual { grid-template-columns: 1fr; }
  .team-grid  { grid-template-columns: 1fr; }

  /* Article */
  .article-hero h1 { font-size: 19px; }
  .article-content h2 { font-size: 18px; }
  .article-content { font-size: 14.5px; }
}

/* ── Mobile nav CTA ─────────────────────────────────────────── */
.mobile-nav a.nav-cta {
  background: var(--cyan) !important;
  color: var(--navy) !important;
  font-weight: 700 !important;
  text-align: center;
  margin-top: 8px;
  display: block;
}

/* ── Reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .fade-up             { opacity: 1 !important; transform: none !important; transition: none !important; }
  .glass-card          { animation: none !important; }
  .hero-badge-dot      { animation: none !important; }
  .line-graph polyline { animation: none !important; stroke-dashoffset: 0 !important; }
  .progress-fill       { animation: none !important; }
}
