/* ═══════════════════════════════════════════════════════════════
   SAASKART — COMPLETE RESPONSIVE SYSTEM
   Breakpoints:
     xs:  < 480px   — small mobile
     sm:  480–639px — mobile
     md:  640–767px — large mobile / small tablet
     lg:  768–1023px — tablet
     xl:  1024–1279px — small laptop
     2xl: 1280–1535px — laptop / desktop
     3xl: 1536–1919px — large desktop
     4xl: 1920px+      — big screen / TV
═══════════════════════════════════════════════════════════════ */

/* ══ WIDE SCREEN (1920px+) ══════════════════════════════════ */
@media (min-width: 1920px) {
  :root { --container-max: 1440px; }
  body { font-size: 17px; }
  .section-title { font-size: clamp(2rem, 2.5vw, 3rem); }
  .hero-h1 { font-size: clamp(3rem, 4vw, 5rem); }
  .nav { padding: 0 3rem; height: 72px; }
  .stat-num { font-size: 2rem; }
}

/* ══ LARGE DESKTOP (1536–1919px) ══════════════════════════ */
@media (min-width: 1536px) and (max-width: 1919px) {
  :root { --container-max: 1360px; }
  .hero-h1 { font-size: clamp(2.6rem, 3.8vw, 4rem); }
  .nav { padding: 0 2.5rem; }
}

/* ══ DESKTOP (1280–1535px) ═════════════════════════════════ */
@media (min-width: 1280px) and (max-width: 1535px) {
  :root { --container-max: 1200px; }
}

/* ══ SMALL LAPTOP (1024–1279px) ═══════════════════════════ */
@media (max-width: 1279px) {
  :root { --container-max: 1080px; }
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 2rem; }
  .footer-grid .footer-col:last-child { grid-column: span 1; }
}

/* ══ TABLET (768–1023px) ══════════════════════════════════ */
@media (max-width: 1023px) {
  :root {
    --container-max: 100%;
    --nav-height: 64px;
  }

  /* Nav — hide links, show hamburger */
  .nav { padding: 0 1.5rem; }
  .nav-links { display: none; }
  .nav-hamburger { display: flex !important; }
  .nav-cta .btn-ghost { display: none; }

  /* Sections */
  section, .section { padding: 60px 1.5rem; }

  /* Hero */
  .hero-h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
  .hero-sub { font-size: .95rem; }
  .hero-ctas { gap: 10px; }

  /* Grids */
  .grid-4, .grid-lined-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-lined-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
  .split { grid-template-columns: 1fr; gap: 3rem; }
  .split-left { grid-template-columns: 1fr; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr 1fr 1fr; gap: 2rem; }
  .footer-grid > div:first-child { grid-column: span 3; }

  /* Dashboard frames */
  .dash-frame { overflow-x: auto; }
  .dash-body { min-width: 560px; }

  /* Sol grid */
  .sol-grid { grid-template-columns: repeat(2, 1fr); }
  .sol-card.featured { grid-column: span 2; }

  /* Workflow */
  .workflow-track { overflow-x: auto; padding-bottom: .8rem; }

  /* SP grid */
  .sp-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ══ LARGE MOBILE / SMALL TABLET (640–767px) ══════════════ */
@media (max-width: 767px) {
  :root { --nav-height: 60px; }

  .nav { padding: 0 1.2rem; }
  .nav-logo img { height: 34px; }

  section, .section { padding: 52px 1.2rem; }

  /* Hero */
  #hero { padding-top: 100px; padding-bottom: 60px; }
  .hero-h1 { font-size: clamp(1.7rem, 5.5vw, 2.3rem); letter-spacing: -.3px; }
  .hero-sub { font-size: .9rem; margin-bottom: 1.8rem; }
  .hero-ctas { flex-direction: column; align-items: center; gap: 10px; }
  .hero-ctas .btn { width: 100%; max-width: 320px; justify-content: center; }
  .hero-badge { font-size: 11px; padding: 4px 12px; }

  /* Hero stats */
  .hero-stats { grid-template-columns: repeat(2, 1fr); display: grid; }
  .hero-stat { padding: 14px 12px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
  .hero-stat:nth-child(2n) { border-right: none; }
  .hero-stat:nth-last-child(-n+2) { border-bottom: none; }
  .hero-stat-num { font-size: 1.4rem; }

  /* Section typography */
  .section-title { font-size: clamp(1.4rem, 4.5vw, 1.9rem); }
  .section-sub { font-size: .9rem; }

  /* Grids → single column */
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .grid-lined-2, .grid-lined-3, .grid-lined-4 { grid-template-columns: 1fr; }
  .split, .split-left { grid-template-columns: 1fr; gap: 2rem; }

  /* Cards */
  .sol-card.featured { grid-column: span 1; }
  .sol-grid { grid-template-columns: 1fr; }

  /* Footer */
  .footer { padding: 44px 1.2rem 24px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 1.8rem; }
  .footer-grid > div:first-child { grid-column: span 2; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: .6rem; }

  /* Stats strip */
  .stats-strip { display: grid; grid-template-columns: repeat(2, 1fr); }
  .stat-item { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 14px 16px; }
  .stat-item:nth-child(2n) { border-right: none; }
  .stat-item:nth-last-child(-n+2) { border-bottom: none; }

  /* Chat / SIA */
  .sia-chat { font-size: 13px; }
  .chat-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .chat-tab { flex-shrink: 0; }

  /* SIA wrap */
  .sia-wrap, .sia-sp-wrap { grid-template-columns: 1fr; gap: 2rem; }

  /* Workflow */
  .workflow-track, .sp-workflow { flex-direction: column; align-items: center; }
  .wf-step, .sp-wf-step { width: 100%; max-width: 340px; min-width: unset; }
  .wf-step::after, .sp-wf-step::after { content: '↓'; right: 50%; top: auto; bottom: 0; transform: translateX(50%); }

  /* Profile mock */
  .sp-profile-stats { grid-template-columns: repeat(2, 1fr); }

  /* Audience grid */
  .audience-grid { grid-template-columns: repeat(2, 1fr); }

  /* Intent / vis grids */
  .vis-grid, .mi-grid { grid-template-columns: 1fr; gap: 2rem; }
  .ps-grid { grid-template-columns: 1fr; }

  /* CTA */
  .cta-btns { flex-direction: column; align-items: center; gap: 10px; }
  .cta-btns .btn { width: 100%; max-width: 320px; justify-content: center; }
  .cta-h { font-size: clamp(1.4rem, 5vw, 2rem); }

  /* Pricing */
  .plans-grid { grid-template-columns: 1fr; }

  /* Compliance trust strip */
  .trust-compliance { flex-direction: column; align-items: flex-start; gap: .6rem; }

  /* SIA float */
  .sia-float { width: 48px; height: 48px; border-radius: 50%; padding: 0; justify-content: center; bottom: 1.2rem; right: 1.2rem; }
  .sia-float span { display: none; }

  /* Search */
  .hero-search-wrap, .page-hero-search { max-width: 100%; }
  .search-bar { font-size: 16px !important; padding: 13px 52px 13px 44px; }
  .search-pills, .hero-pills { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .search-pills::-webkit-scrollbar, .hero-pills::-webkit-scrollbar { display: none; }
  .search-pill { flex-shrink: 0; white-space: nowrap; }

  /* Nav mobile open */
  .nav-links.mobile-open { padding: 1rem 1.2rem 1.4rem; }
  .nav-links.mobile-open a { font-size: 15px; padding: 10px 12px; }
}

/* ══ MOBILE (480–639px) ══════════════════════════════════ */
@media (max-width: 639px) {
  :root { --nav-height: 58px; }

  section, .section { padding: 44px 1rem; }

  .hero-h1 { font-size: clamp(1.55rem, 6vw, 2rem); }
  .hero-ctas .btn { max-width: 100%; }

  /* Container padding */
  .container, .container-sm, .container-lg { padding: 0 1rem; }

  /* Footer single column */
  .footer-grid { grid-template-columns: 1fr; }
  .footer-grid > div:first-child { grid-column: span 1; }
  .newsletter-form { max-width: 100%; }

  /* Stats strip 2-col */
  .stat-num { font-size: 1.3rem; }
  .stat-label { font-size: 10px; }

  /* SP metrics */
  .sp-metrics-grid { grid-template-columns: 1fr; }
  .sp-content-grid { grid-template-columns: 1fr; }
  .sp-grid { grid-template-columns: 1fr; }

  /* Audience chips */
  .audience-grid { grid-template-columns: 1fr; }

  /* Intel cards */
  .intel-grid { grid-template-columns: repeat(2, 1fr); }

  /* Profile stats */
  .sp-profile-stats { grid-template-columns: repeat(2, 1fr); }

  /* Button full width on smallest */
  .btn-xl { width: 100%; justify-content: center; }

  /* Section label smaller */
  .section-label { font-size: 10.5px; letter-spacing: 1.5px; }
}

/* ══ SMALL MOBILE (< 480px) ═════════════════════════════ */
@media (max-width: 479px) {
  :root { --nav-height: 56px; }

  .nav { padding: 0 1rem; }
  .nav-logo img { height: 30px; }
  .nav-cta .btn-ghost { display: none; }
  .nav-cta .btn-primary { font-size: 12px; padding: 7px 14px; }

  section, .section { padding: 36px .9rem; }

  .hero-h1 { font-size: clamp(1.4rem, 7vw, 1.8rem); letter-spacing: -.2px; }
  .hero-sub { font-size: .86rem; margin-bottom: 1.5rem; }

  .section-title { font-size: clamp(1.25rem, 6vw, 1.6rem); }
  .section-sub { font-size: .86rem; line-height: 1.65; }

  /* Grids single col */
  .intel-grid { grid-template-columns: 1fr; }
  .why-grid { grid-template-columns: 1fr; }

  /* Footer compact */
  .footer { padding: 36px .9rem 20px; }
  .footer-brand-sub { font-size: .8rem; }
  .footer-col a { font-size: .82rem; margin-bottom: .6rem; }

  /* Chat compact */
  .chat-body { padding: 12px; }
  .msg { font-size: 12px; padding: 9px 12px; }

  /* Stats 1-col on very small */
  .stats-strip { grid-template-columns: repeat(2, 1fr); }

  /* Breadcrumb */
  .breadcrumb { font-size: 10.5px; }

  /* Partner metrics */
  .partner-metrics, .sp-metrics-grid { grid-template-columns: 1fr; }
}

/* ══ MOBILE NAV DRAWER (all mobile breakpoints) ═════════ */
@media (max-width: 1023px) {
  /* Hamburger always visible on tablet/mobile */
  .nav-hamburger { display: flex !important; }

  /* Desktop nav links hidden by default on mobile */
  .nav-links:not(.mobile-open) { display: none !important; }

  /* Mobile drawer full styling */
  .nav-links.mobile-open {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: var(--nav-height);
    left: 0; right: 0;
    max-height: calc(100vh - var(--nav-height));
    overflow-y: auto;
    background: rgba(255,255,255,.99);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 2px solid var(--border2);
    padding: 1rem 1.4rem 2rem;
    gap: .1rem;
    z-index: 9990;
    box-shadow: 0 12px 40px rgba(27,42,74,.12);
    animation: skMobileNavIn .22s cubic-bezier(.16,1,.3,1) both;
  }

  .nav-links.mobile-open a {
    display: block;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    transition: all .15s;
    border-left: 3px solid transparent;
  }

  .nav-links.mobile-open a:hover,
  .nav-links.mobile-open a.active {
    background: var(--red-dim);
    color: var(--red);
    border-left-color: var(--red);
  }

  /* Divider between link groups */
  .nav-links.mobile-open a.nav-divider-before {
    margin-top: .6rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
  }

  @keyframes skMobileNavIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

/* ══ TABLET-ONLY TWEAKS (640–1023px) ════════════════════ */
@media (min-width: 640px) and (max-width: 1023px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .sol-grid { grid-template-columns: repeat(2, 1fr); }
  .sol-card.featured { grid-column: span 2; }
  .sp-grid { grid-template-columns: repeat(2, 1fr); }
  .audience-grid { grid-template-columns: repeat(2, 1fr); }
  .sp-content-grid { grid-template-columns: repeat(2, 1fr); }
  .sp-metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .intel-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr 1fr; }
  .footer-grid > div:first-child { grid-column: span 3; }
  .plans-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-stats { display: flex; flex-wrap: wrap; }
}

/* ══ PRINT ══════════════════════════════════════════════ */
@media print {
  .nav, .sia-float, .nav-hamburger { display: none !important; }
  body { background: #fff; color: #000; }
  section { padding: 24px 0; }
  .btn { border: 1px solid #ccc; }
}
