/* ============================================================
   Ops Singularity - Responsive overrides
   Mobile-first cleanups for the existing grids.
   Loaded LAST so it can override component defaults.

   Breakpoints (max-width):
     1200  →  small desktop / large tablet landscape
     1024  →  tablet portrait / small laptop
      768  →  large phone / small tablet
      560  →  phone portrait
   ============================================================ */

/* ── Universal safety: prevent horizontal page scroll ───── */
html, body { overflow-x: hidden; max-width: 100%; }
img, svg, video, iframe, table { max-width: 100%; }

/* ── 1200px and below: tighten very wide layouts ────────── */
@media (max-width: 1200px) {
  .module-intro-grid        { grid-template-columns: repeat(3, 1fr) !important; }
  .module-layout            { gap: 48px !important; }
  .architecture-grid        { grid-template-columns: repeat(3, 1fr) !important; }
}

/* ── 1024px and below: collapse most multi-cols to 2 ───── */
@media (max-width: 1024px) {
  .pillars-grid            { grid-template-columns: repeat(2, 1fr) !important; }
  .oiao-grid               { grid-template-columns: repeat(2, 1fr) !important; }
  .uc-grid                 { grid-template-columns: repeat(2, 1fr) !important; }
  .ind-grid                { grid-template-columns: 1fr !important; }
  .metrics-grid            { grid-template-columns: repeat(2, 1fr) !important; }
  .ind-metrics             { grid-template-columns: repeat(2, 1fr) !important; }
  .comparison-grid         { grid-template-columns: 1fr !important; gap: 24px !important; }
  .footer-top              { grid-template-columns: 1fr 1fr !important; }
  .hero-content            { grid-template-columns: 1fr !important; min-height: auto !important; }
  .hero-left               { padding: var(--space-10) var(--gutter) var(--space-9) !important; }
  .hero-visual             { padding: 0 var(--gutter) var(--space-10) !important; }
  .problem-grid            { grid-template-columns: 1fr !important; gap: var(--space-9) !important; }
  .sentinel-grid           { grid-template-columns: 1fr !important; gap: var(--space-9) !important; }
  .sentinel-visual         { position: static !important; }
  .sentinel-cta-bar        { flex-direction: column !important; text-align: center; gap: var(--space-5); padding: var(--space-7) var(--space-6) !important; }
  .scb-left                { text-align: center; }
  .ind-pain                { position: static !important; }

  .module-intro-grid       { grid-template-columns: repeat(2, 1fr) !important; }
  .module-layout           { grid-template-columns: 1fr !important; gap: 40px !important; }
  .module-layout.reverse   { direction: ltr !important; }
  .architecture-grid       { grid-template-columns: repeat(2, 1fr) !important; }
  .architecture-pillars    { grid-template-columns: repeat(3, 1fr) !important; }

  .module-metric-strip     { grid-template-columns: repeat(3, 1fr) !important; }

  .diff-grid               { grid-template-columns: repeat(2, 1fr) !important; }
  .diff-pillars            { grid-template-columns: repeat(2, 1fr) !important; }

  .why-cta-inner           { padding: 0 var(--gutter); }
  .philosophy-grid         { grid-template-columns: 1fr !important; gap: 20px !important; }

  .upcoming-grid           { grid-template-columns: repeat(2, 1fr) !important; }
  .ca-main                 { grid-template-columns: 1fr !important; }
  .ca-sidebar              { position: static !important; height: auto !important; }

  /* OIAO arrows look weird when stacked - hide them */
  .oiao-phase::after       { display: none !important; }

  /* Industry hero nav: allow horizontal scroll */
  .industry-nav            { overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
  .industry-nav-card       { flex-shrink: 0; }

  /* Products pillar nav: same */
  .pillar-nav              { overflow-x: auto; }
  .pillar-nav-inner        { min-width: max-content; }

  /* Contact form: single column */
  .contact-grid            { grid-template-columns: 1fr !important; }

  /* Integrations hub category grid keeps auto-fill but ensure padding */
  .int-cat-grid            { gap: 16px !important; }
}

/* ── 768px and below: phone landscape / small tablet ───── */
@media (max-width: 768px) {
  :root { --nav-h: 64px; }

  /* Nav -> hamburger */
  .nav-links               { display: none !important; }
  .nav-toggle              { display: inline-flex !important; }
  .nav-inner               { padding: 0 var(--space-5); }
  .nav-links.is-open {
    display: flex !important;
    position: absolute;
    top: var(--nav-h);
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: var(--space-4);
    gap: var(--space-1);
    box-shadow: var(--shadow-lg);
    max-height: calc(100vh - var(--nav-h));
    overflow-y: auto;
  }
  .nav-links.is-open .nav-link,
  .nav-links.is-open .nav-dropdown-btn { padding: 12px 14px; font-size: 15px; }
  .nav-links.is-open .nav-cta { margin-left: 0; margin-top: var(--space-3); justify-content: center; padding: 12px 20px; }
  .nav-links.is-open .nav-dropdown-menu {
    position: static; opacity: 1; visibility: visible;
    transform: none; box-shadow: none; border: none;
    width: 100%; padding: 0; padding-left: var(--space-4);
  }

  /* Multi-col grids -> single column */
  .pillars-grid,
  .uc-grid,
  .ind-grid,
  .metrics-grid,
  .oiao-grid,
  .ind-metrics,
  .module-intro-grid,
  .diff-grid,
  .diff-pillars,
  .upcoming-grid,
  .arch-pillars            { grid-template-columns: 1fr !important; }

  .metrics-grid .metric-item { border-right: none !important; border-bottom: 1px solid rgba(255,255,255,0.08); }
  .metrics-grid .metric-item:last-child { border-bottom: none; }

  .module-metric-strip     { grid-template-columns: repeat(2, 1fr) !important; }

  /* Footer: stacks */
  .footer-top              { grid-template-columns: 1fr !important; gap: var(--space-7); }
  .footer-bottom           { flex-direction: column; align-items: flex-start; gap: var(--space-4); }

  /* Type scale */
  .hero-h1                 { font-size: clamp(32px, 8vw, 48px) !important; letter-spacing: -0.035em !important; }
  .section-title           { font-size: clamp(26px, 6.5vw, 38px) !important; line-height: 1.2 !important; }
  .cta-inner .section-title { font-size: clamp(28px, 7vw, 42px) !important; }

  /* Use case header / actions */
  .uc-header               { flex-direction: column !important; align-items: flex-start !important; gap: var(--space-4); }
  .uc-flow                 { grid-template-columns: repeat(2, 1fr) !important; }
  .uc-metrics              { grid-template-columns: repeat(3, 1fr) !important; gap: 8px !important; }

  /* Filters wrap row on mobile */
  .uc-filters,
  .int-filters-inner,
  .int-chips               { gap: 8px !important; }
  .uc-filter-label         { display: none; }

  /* Generic action rows */
  .hero-actions,
  .cta-actions             { flex-direction: column !important; align-items: stretch !important; }
  .cta-actions .btn,
  .hero-actions .btn       { width: 100%; justify-content: center; }

  /* Sentinel page mobile fixes */
  .ah-name                 { font-size: 22px !important; }
  .ah-tagline              { font-size: 13px !important; }

  /* Industry section: stack header */
  .ind-header              { flex-direction: column !important; gap: 16px !important; text-align: left; }
  .ind-header-text         { width: 100%; }

  /* Comparison cards */
  .comparison-card         { width: 100% !important; }

  /* Capability matrix: allow horizontal scroll, narrow text */
  .matrix-wrap             { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .matrix                  { min-width: 720px; }

  /* Integrations search bar: full width */
  .int-search              { flex: 1 1 100%; min-width: 0; }

  /* Custom-agents dark sidebar -> static, full width */
  .ca-detail               { padding: 24px 20px 40px !important; }
  .flow-diagram            { flex-direction: column; }
  .flow-connector          { transform: rotate(90deg); padding: 4px 0 !important; }

  /* Blog post sidebar */
  .post-layout             { grid-template-columns: 1fr !important; }
  .post-sidebar            { position: static !important; }

  /* FAQ layout */
  .faq-layout              { grid-template-columns: 1fr !important; }
  .faq-sidebar             { position: static !important; display: none; }
}

/* ── 560px and below: phone portrait ───────────────────── */
@media (max-width: 560px) {
  :root { --gutter: 18px; }

  .hero-left               { padding: var(--space-8) var(--gutter) var(--space-7) !important; }
  .hero-social-proof       { flex-direction: column; align-items: flex-start; gap: var(--space-3); }
  .hero-sp-tags            { flex-wrap: wrap; }

  /* Aggressive padding compression on long-form sections */
  .platform-section,
  .problem-section,
  .sentinel-section,
  .usecases-section,
  .industries-section,
  .metrics-section,
  .oiao-section,
  .cta-section,
  .diff-section,
  .int-hero,
  .int-body,
  .int-cta,
  .why-hero,
  .matrix-section,
  .philosophy-section,
  .why-cta,
  .industry-section        { padding: var(--section-y-sm, 56px) 0 !important; }

  .sentinel-cta-bar        { padding: var(--space-6) var(--space-5) !important; }
  .scb-left h3             { font-size: 20px !important; }
  .scb-btn                 { width: 100%; justify-content: center; }

  .sd-metric-row,
  .uc-metrics              { grid-template-columns: repeat(3, 1fr) !important; gap: 6px !important; }
  .uc-flow                 { grid-template-columns: 1fr !important; }
  .module-metric-strip     { grid-template-columns: 1fr !important; }

  .logo-strip              { gap: var(--space-6); }

  /* Form rows full-width */
  .form-grid               { grid-template-columns: 1fr !important; }

  /* Filter chips compact */
  .uc-filter-chip,
  .int-chip                { padding: 6px 10px !important; font-size: 12px !important; }

  /* Cards padding compression */
  .pillar-card,
  .uc-card,
  .ind-card,
  .diff-card,
  .diff-pill,
  .int-cat-card,
  .connector-card,
  .module-card,
  .sentinel-feat           { padding: 20px !important; }

  /* Hero diagram SVG shrink */
  .platform-diagram        { padding: 20px !important; }

  /* Breadcrumbs hug edges */
  .breadcrumbs             { font-size: 12px; padding: 12px 0 0 !important; }

  /* Notify form (videos page) */
  .notify-form             { flex-direction: column; gap: 8px; }
  .notify-btn              { width: 100%; }

  /* Code blocks scroll */
  .bs-code, pre, code      { overflow-x: auto; max-width: 100%; }

  /* Headings shrink on tight cards */
  .diff-card h3,
  .pillar-name,
  .uc-title                { font-size: 16px !important; }
}

/* ── 420px and below: very small phones ────────────────── */
@media (max-width: 420px) {
  .breadcrumbs             { flex-wrap: wrap; }
  .nav-logo-text           { font-size: 15px !important; }
  .nav-cta                 { padding: 8px 14px !important; font-size: 13px !important; }
}

/* ── Touch / hover capabilities ────────────────────────── */
@media (hover: none) {
  /* Disable hover-lift transforms on touch devices to avoid sticky hover states */
  .card:hover,
  .uc-card:hover,
  .ind-card:hover,
  .pillar-card:hover,
  .diff-card:hover,
  .int-cat-card:hover,
  .module-card:hover       { transform: none !important; }
}

/* ── Print: minimal cleanup ────────────────────────────── */
@media print {
  .nav, .footer, .nav-cta, .btn,
  .uc-filter-wrap, .int-filters { display: none !important; }
  body { background: white !important; color: black !important; }
  a { color: black !important; text-decoration: underline; }
}
