/* ═══════════════════════════════════════════════════════════════
   BRUNELLY RESPONSIVE — Shared canonical breakpoints
   Applied to all public pages. Excludes admin & analytics.

   Standard Breakpoint Set:
   - Desktop      : default (no media query)
   - Laptop       : (max-width: 1199px)
   - Tablet       : (max-width: 900px)
   - Mobile       : (max-width: 600px)
   - Small Mobile : (max-width: 400px)
   - Landscape    : (max-width: 600px) and (orientation: landscape)
   - Portrait     : (max-width: 600px) and (orientation: portrait)
   ═══════════════════════════════════════════════════════════════ */

/* ── Shared nav buttons ── */
.btn-ghost {
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--light);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.btn-ghost:hover { color: var(--white); border-color: rgba(255,255,255,0.25); }

/* ── btn-primary (shared nav button) ── */
.btn-primary {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--black);
  background: var(--accent);
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  font-weight: 500;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.btn-primary:hover { background: #c4b5fd; box-shadow: 0 0 20px rgba(167,139,250,0.4); }

/* ── Global overflow & fluid media ── */
html, body { overflow-x: hidden; }
img, video, iframe, svg, canvas, embed, object {
  max-width: 100%;
  height: auto;
}
code { overflow-wrap: break-word; }

/* ── Social icon images ── */
.social-btn img {
  width: 16px;
  height: 16px;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.45;
  transition: opacity .2s;
}
.social-btn:hover img { opacity: 1; }
.contact-social img {
  width: 16px;
  height: 16px;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.7;
  transition: opacity .2s;
}
.contact-social:hover img { opacity: 1; }

/* ── Minimum touch targets ── */
@media (max-width: 900px) {
  a, button, [role="button"], input, textarea, select, label, .nav-links li a,
  .mobile-nav a, .page-nav-btn, .page-nav-item, .sub-nav-item,
  .newsletter-btn, .newsletter-input, .contact-social, .social-btn,
  .faq-q, .filter-btn, .btn-primary, .btn-ghost, .btn-secondary,
  .pill-btn, .tab-btn, .nav-hamburger {
    min-height: 44px;
    min-width: 44px;
  }
}

/* ── Laptop ── */
@media (max-width: 1199px) {
  nav { padding: 0 2rem; }
  section, .res-section, .faq-section, .credits-section,
  .use-section, .newsletter, .calendly-section { padding: 4rem 2rem; }
  .page-hero, .res-hero, .hub-hero, .pricing-hero, .contact-hero, .policy-hero { padding: 8rem 2rem 4rem; }
}

/* ── Tablet ── */
@media (max-width: 900px) {
  /* Nav */
  nav { padding: 0 1.5rem; gap: 1rem; }
  .nav-links { display: none !important; }
  .nav-hamburger { display: flex !important; }
  .nav-actions .btn-ghost { display: none; }

  /* Typography */
  h1, .res-hero h1, .hub-hero h1, .pricing-hero h1, .contact-hero h1 {
    font-size: clamp(2rem, 8vw, 3rem) !important;
  }

  /* Sections */
  section, .res-section, .faq-section, .credits-section,
  .use-section, .newsletter, .calendly-section { padding: 3rem 1.5rem !important; }
  .res-hero, .hub-hero, .pricing-hero, .contact-hero, .policy-hero { padding: 6rem 1.5rem 3rem !important; }
  .page-hero { padding: 7rem 1.5rem 3rem; }
  .body { padding: 1.5rem !important; }
  .article-hero { padding: 1.5rem 1.5rem 2rem; }
  .article-cover { padding: 0 1.5rem; }
  .article-body { padding: 2rem 1.5rem 4rem; }
  .breadcrumb { padding: 5rem 1.5rem 0; }
  .feat-section { padding: 4rem 1.5rem; }
  .sub-nav { padding: 0 1.5rem; }

  /* Grids */
  .articles-grid, .videos-grid { grid-template-columns: 1fr !important; }
  .use-cases-grid, .row-3, .scroll-grid { grid-template-columns: 1fr 1fr !important; }
  .pillars-grid { grid-template-columns: repeat(2, 1fr); }
  .why-stats { grid-template-columns: repeat(2, 1fr); }
  .row-2, .row-half, .credits-grid,
  .contact-hero-inner, .calendly-inner,
  .contact-form-wrap { grid-template-columns: 1fr !important; gap: 2rem !important; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr) !important; }
  .stats-row { grid-template-columns: repeat(3, 1fr) !important; }
  .pricing-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .feat-inner { grid-template-columns: 1fr !important; gap: 2.5rem !important; }
  .feat-inner.reverse { direction: ltr; }
  .page-next-inner { flex-direction: column; gap: 1.5rem; }

  /* Footer */
  footer { grid-template-columns: 1fr !important; gap: 2rem !important; padding: 2rem 1.5rem !important; }
  .footer-right { align-items: flex-start !important; }
  .footer-copy { text-align: left !important; }
  .footer-policy { justify-content: flex-start !important; }
  .footer-cols { gap: 1.5rem; }

  /* Cookie banner */
  #cookie-banner { padding: 1rem 1.5rem !important; flex-direction: column !important; align-items: flex-start !important; }

  /* Hero btn pair */
  .btn-pair { flex-direction: column; width: 100%; max-width: 320px; border-radius: 10px; }
  .btn-pair-left, .btn-pair-right { justify-content: center; border-right: none !important; border-bottom: 1px solid rgba(255,255,255,0.12); }
  .btn-pair-right { border-bottom: none !important; }

  /* Page nav */
  .page-nav { overflow-x: auto; justify-content: flex-start; padding: 0 1rem; }
  .page-nav-btn, .page-nav-item { padding: 0.9rem 1.1rem; white-space: nowrap; }

  /* Filter bar */
  .filter-bar { padding: 1rem 1.5rem !important; gap: 0.5rem; }

  /* Feature pages */
  .feat-visual { min-height: 240px !important; }
  .sub-nav { overflow-x: auto; padding: 0 1rem; justify-content: flex-start; }
  .sub-nav-item { white-space: nowrap; padding: 0.8rem 1rem; font-size: 0.65rem; }
  .page-nav-section { padding: 1.2rem 1.5rem; }
  .prev-next { flex-direction: column; gap: 1rem; padding: 2rem 1.5rem; }

  /* Comparison table */
  .comp-table { font-size: 0.75rem; }
  .comp-table th, .comp-table td { padding: 0.6rem 0.7rem; }

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

/* ── Mobile ── */
@media (max-width: 600px) {
  /* Single col everything */
  .pricing-grid { grid-template-columns: 1fr !important; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .stats-row { grid-template-columns: repeat(2, 1fr) !important; }
  .use-cases-grid, .row-3, .scroll-grid { grid-template-columns: 1fr !important; }
  .source-row { grid-template-columns: 24px 1fr auto !important; }
  .feat-bullets { grid-template-columns: 1fr !important; }

  /* Nav */
  nav { height: 60px; }
  .nav-logo img { height: 44px !important; }
  .mobile-nav { top: 60px; }

  /* Hero sections */
  .res-hero, .hub-hero, .pricing-hero, .contact-hero, .policy-hero { padding: 5rem 1.2rem 2.5rem !important; }
  .page-hero { padding: 5rem 1.2rem 2.5rem; }
  .hero-badge { font-size: 0.65rem !important; }
  .article-hero h1 { font-size: 1.7rem; }
  .article-nav { grid-template-columns: 1fr; }
  .pillars-grid { grid-template-columns: 1fr; }
  .why-stats { grid-template-columns: 1fr; }

  /* Sections */
  section, .res-section, .faq-section, .credits-section,
  .use-section, .newsletter, .calendly-section { padding: 2.5rem 1.2rem !important; }
  .articles-section { padding: 2.5rem 1.2rem !important; }
  .feat-section { padding: 3rem 1.5rem; }
  .feat-copy h2 { font-size: 1.6rem; }

  /* Cards */
  .pillar-card { padding: 1.5rem !important; }
  .plan-card { padding: 1.5rem 1.3rem !important; }
  .card { padding: 1.2rem !important; }
  .form-panel { padding: 1.5rem !important; }

  /* Billing toggle */
  .billing-toggle { flex-wrap: wrap; gap: 0.6rem; }

  /* Newsletter form */
  .newsletter-form { flex-direction: column !important; }
  .newsletter-btn { width: 100%; justify-content: center; }
  .newsletter-input { width: 100%; }

  /* Footer */
  footer { padding: 1.5rem 1.2rem !important; gap: 1.5rem !important; }
  .footer-cols { flex-direction: column; gap: 1.2rem; }
  .footer-socials { gap: 0.5rem; }

  /* Contact socials */
  .contact-socials { flex-wrap: wrap; gap: 0.5rem; }
  .contact-social { font-size: 0.78rem; padding: 0.5rem 0.8rem; }

  /* Video cards */
  .videos-grid { grid-template-columns: 1fr !important; }

  /* Context / diagrams */
  .context-callout { flex-direction: column; gap: 0.75rem; }
  .context-diagram-wrap img { width: 100% !important; margin-left: 0 !important; }

  /* Tables */
  .art-table th:nth-child(3),
  .art-table td:nth-child(3),
  .data-table th:nth-child(4),
  .data-table td:nth-child(4) { display: none; }
}

/* ── Small Mobile ── */
@media (max-width: 400px) {
  nav { padding: 0 1rem; }
  .res-hero, .hub-hero, .pricing-hero { padding: 4.5rem 1rem 2rem !important; }
  .page-hero { padding: 4.5rem 1rem 2rem; }
  section, .res-section { padding: 2rem 1rem !important; }
  .kpi-grid { grid-template-columns: 1fr 1fr !important; }
  .kpi-val { font-size: 1.6rem !important; }
  footer { padding: 1.5rem 1rem !important; }
  .plan-card { padding: 1.2rem 1rem !important; }
  .feat-section { padding: 2rem 1rem; }
  .feat-copy h2 { font-size: 1.3rem; }
}

/* ── Landscape Tablet/Phone (640px–900px) ── */
@media (max-width: 900px) and (orientation: landscape) {
  .articles-grid, .videos-grid { grid-template-columns: 1fr 1fr !important; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ── Landscape Phone ── */
@media (max-width: 600px) and (orientation: landscape) {
  .res-hero, .hub-hero, .pricing-hero, .contact-hero, .policy-hero, .page-hero {
    padding: 4rem 1.5rem 2rem !important;
    min-height: auto;
  }
  .hero-badge { font-size: 0.6rem !important; }
  .feat-visual { min-height: 180px !important; }
  .article-hero { padding: 4rem 1.5rem 1.5rem; }
  .use-cases-grid, .row-3, .scroll-grid { grid-template-columns: 1fr 1fr !important; }
}

/* ── Portrait Phone ── */
@media (max-width: 600px) and (orientation: portrait) {
  .res-hero, .hub-hero, .pricing-hero, .contact-hero, .policy-hero, .page-hero {
    padding: 5.5rem 1.2rem 2.5rem !important;
  }
  .article-hero { padding: 5.5rem 1.2rem 2rem; }
}

/* ── Mobile nav group (collapsible submenu) ── */
.mobile-nav-group { display: flex; flex-direction: column; }
.mobile-nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  font-family: "DM Mono", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.9rem 2rem;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  text-align: left;
}
.mobile-nav-group-toggle::after {
  content: "+";
  font-size: 1.1rem;
  color: var(--muted);
  transition: transform 0.25s;
}
.mobile-nav-group-toggle.open::after {
  content: "−";
  color: var(--accent);
}
.mobile-nav-group-toggle:hover,
.mobile-nav-group-toggle.open {
  color: var(--accent);
  background: var(--accent-dim);
}
.mobile-nav-sub {
  display: none;
  flex-direction: column;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
}
.mobile-nav-sub.open {
  display: flex;
}
.mobile-nav-sub a {
  padding-left: 2.5rem !important;
  font-size: 0.75rem !important;
}

/* ── Mobile nav drawer transitions ── */
.mobile-nav {
  display: flex;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  pointer-events: none;
}
.mobile-nav.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}
