/**
 * Scrutiny Global — Master Mobile-First Responsive Ecosystem CSS Architecture
 * Standard: WCAG 2.2 AA | Viewport Range: 320px to 1920px+
 * Fully integrated across Root, Business Portal, and ScrutinyPulse ecosystems.
 */

/* ==========================================================================
   1. GLOBAL RESET & VIEWPORT CONTAINMENT (Strict Zero Overflow Rule)
   ========================================================================== */
html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden !important;
  position: relative;
  -webkit-text-size-adjust: 100%;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: border-box;
  max-width: 100%;
}

img, picture, svg, video, canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

iframe {
  max-width: 100%;
  border: 0;
}

/* ==========================================================================
   2. FLUID TYPOGRAPHY ENGINE (Custom Calibrated clamp() System)
   ========================================================================== */
.display-1 {
  font-size: clamp(1.95rem, 5vw + 0.5rem, 3.8rem) !important;
  line-height: 1.15 !important;
  letter-spacing: -0.03em !important;
  word-break: break-word;
}

.display-2 {
  font-size: clamp(1.65rem, 4vw + 0.4rem, 2.9rem) !important;
  line-height: 1.2 !important;
  letter-spacing: -0.025em !important;
  word-break: break-word;
}

.display-3 {
  font-size: clamp(1.35rem, 3vw + 0.3rem, 2.2rem) !important;
  line-height: 1.25 !important;
  letter-spacing: -0.02em !important;
  word-break: break-word;
}

.display-4 {
  font-size: clamp(1.15rem, 2.2vw + 0.2rem, 1.75rem) !important;
  line-height: 1.3 !important;
  word-break: break-word;
}

h1, .h1 {
  font-size: clamp(1.85rem, 4.5vw + 0.3rem, 3.2rem) !important;
  line-height: 1.18 !important;
  word-break: break-word;
}

h2, .h2 {
  font-size: clamp(1.5rem, 3.5vw + 0.25rem, 2.4rem) !important;
  line-height: 1.25 !important;
  word-break: break-word;
}

h3, .h3 {
  font-size: clamp(1.25rem, 2.5vw + 0.2rem, 1.8rem) !important;
  line-height: 1.3 !important;
  word-break: break-word;
}

h4, .h4 {
  font-size: clamp(1.05rem, 2vw + 0.15rem, 1.4rem) !important;
  line-height: 1.35 !important;
  word-break: break-word;
}

p, .text-lead, .fs-5 {
  font-size: clamp(0.95rem, 1.2vw + 0.3rem, 1.15rem) !important;
  line-height: 1.7 !important;
}

/* ==========================================================================
   3. TOUCH TARGET ACCESSIBILITY (WCAG 2.2 AA — Minimum 44x44px Targets)
   ========================================================================== */
.sg-btn-pill,
.sg-btn-ghost,
.sg-btn-ghost-nav,
.sg-btn-pulse-nav,
.btn,
.mobile-nav-toggle,
.mobile-nav-link,
.nav-pill-link,
button[type="button"],
button[type="submit"],
a.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

/* ==========================================================================
   4. FLOATING ISLAND NAVIGATION RESPONSIVE REBUILD
   ========================================================================== */
.floating-nav-wrapper {
  position: fixed !important;
  top: 1rem !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 1050 !important;
  display: flex !important;
  justify-content: center !important;
  padding: 0 1rem !important;
  pointer-events: none !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.floating-island-nav {
  pointer-events: auto !important;
  background: rgba(7, 32, 65, 0.92) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  border: 1px solid #1A3D66 !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
  border-radius: 9999px !important;
  padding: 0.4rem 0.65rem 0.4rem 1rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 0.75rem !important;
  max-width: 1280px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.brand-logo-wrap img {
  height: 36px !important;
  width: auto !important;
  max-width: 190px !important;
  object-fit: contain !important;
}

/* Mobile adjustments for header island */
@media (max-width: 576px) {
  .floating-nav-wrapper {
    top: 0.45rem !important;
    padding: 0 0.5rem !important;
  }
  .floating-island-nav {
    padding: 0.35rem 0.5rem 0.35rem 0.85rem !important;
    border-radius: 20px !important;
  }
  .brand-logo-wrap img {
    max-width: 145px !important;
    height: 32px !important;
  }
}

@media (max-width: 1199.98px) {
  .nav-links-cluster {
    display: none !important;
  }
  .d-none.d-xl-flex {
    display: none !important;
  }
}

@media (min-width: 1200px) {
  .nav-links-cluster {
    display: flex !important;
  }
  #sgMobileMenuToggle {
    display: none !important;
  }
}

#sgMobileMenuToggle {
  min-width: 44px !important;
  min-height: 44px !important;
  width: 44px !important;
  height: 44px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(36, 181, 223, 0.12) !important;
  border: 1px solid rgba(36, 181, 223, 0.35) !important;
  border-radius: 12px !important;
  color: #24B5DF !important;
  transition: all 0.2s ease !important;
  flex-shrink: 0 !important;
  margin-left: auto !important;
  cursor: pointer !important;
}

#sgMobileMenuToggle:hover, #sgMobileMenuToggle:active {
  background: rgba(36, 181, 223, 0.25) !important;
  border-color: #24B5DF !important;
  color: #FFFFFF !important;
}

/* ==========================================================================
   5. MOBILE FULLSCREEN DRAWER & ACCORDION SYSTEM
   ========================================================================== */
.mobile-nav-drawer-overlay {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  z-index: 1099 !important;
  background: rgba(0, 6, 18, 0.96) !important;
  backdrop-filter: blur(28px) !important;
  -webkit-backdrop-filter: blur(28px) !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  padding: env(safe-area-inset-top, 1rem) 1rem env(safe-area-inset-bottom, 1.5rem) 1rem !important;
  display: none;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.mobile-nav-drawer-overlay.is-active {
  display: block !important;
  opacity: 1 !important;
  transform: translateY(0) !important;
}

.mobile-drawer-inner {
  max-width: 560px;
  margin: 1rem auto 2.5rem auto;
  background: #072041;
  border: 1px solid rgba(36, 181, 223, 0.35);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
}

.mobile-nav-accordion-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: 0;
  color: #FFFFFF;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.75rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  text-align: left;
}

.mobile-nav-accordion-btn:hover,
.mobile-nav-accordion-btn[aria-expanded="true"] {
  background: rgba(36, 181, 223, 0.1);
  color: #24B5DF;
}

.mobile-nav-accordion-btn .chevron-icon {
  font-size: 0.75rem;
  transition: transform 0.25s ease;
}

.mobile-nav-accordion-btn[aria-expanded="true"] .chevron-icon {
  transform: rotate(180deg);
}

.mobile-nav-accordion-content {
  display: none;
  padding: 0.35rem 0 0.5rem 1.25rem;
  border-left: 2px solid rgba(36, 181, 223, 0.3);
  margin-left: 0.75rem;
  margin-bottom: 0.5rem;
}

.mobile-nav-accordion-content.is-open {
  display: block;
}

.mobile-nav-sublink {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.5rem;
  color: #7B9DB7;
  text-decoration: none;
  font-size: 0.86rem;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
  min-height: 44px;
}

.mobile-nav-sublink:hover,
.mobile-nav-sublink:focus {
  color: #FFFFFF;
  background: rgba(36, 181, 223, 0.08);
}

/* ==========================================================================
   6. 3D WEBGL HERO CANVAS RESPONSIVENESS
   ========================================================================== */
.hero-globe-container,
.hero-canvas-wrapper {
  width: 100% !important;
  max-width: 580px !important;
  height: clamp(320px, 48vh, 500px) !important;
  margin: 0 auto !important;
  position: relative !important;
  touch-action: pan-y !important;
}

#hero-interactive-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  cursor: grab;
  touch-action: pan-y !important;
}

@media (max-width: 767px) {
  .hero-globe-container,
  .hero-canvas-wrapper {
    height: clamp(280px, 42vh, 400px) !important;
  }
}

/* ==========================================================================
   7. BENTO GRID & CARD SYSTEM REFLOW
   ========================================================================== */
.bezel-shell,
.glass-card,
.sg-card {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  margin-bottom: 0;
}

@media (max-width: 767px) {
  .row.gy-5 { --bs-gutter-y: 2.25rem !important; }
  .row.gy-4 { --bs-gutter-y: 1.5rem !important; }
  .row.g-4 { --bs-gutter-x: 1rem !important; --bs-gutter-y: 1rem !important; }
  .row.g-3 { --bs-gutter-x: 0.75rem !important; --bs-gutter-y: 0.75rem !important; }
  .section-space-lg { padding: 3.5rem 0 !important; }
}

/* ==========================================================================
   8. RESPONSIVE FORMS & RECAPTCHA ENGINE
   ========================================================================== */
.recaptcha-responsive-wrapper {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  display: flex;
  justify-content: flex-start;
  margin: 1rem 0;
}

@media (max-width: 360px) {
  .recaptcha-responsive-wrapper > div {
    transform: scale(0.85);
    transform-origin: 0 0;
  }
}

@media (max-width: 325px) {
  .recaptcha-responsive-wrapper > div {
    transform: scale(0.78);
    transform-origin: 0 0;
  }
}

.form-control,
.form-select {
  font-size: 16px !important; /* Prevents auto-zoom in iOS Safari */
  min-height: 48px !important;
  background-color: rgba(7, 32, 65, 0.75) !important;
  border: 1px solid #1A3D66 !important;
  color: #FFFFFF !important;
  border-radius: 10px !important;
}

.form-control:focus,
.form-select:focus {
  border-color: #24B5DF !important;
  box-shadow: 0 0 0 3px rgba(36, 181, 223, 0.25) !important;
  background-color: #072041 !important;
  color: #FFFFFF !important;
}

/* ==========================================================================
   9. RESPONSIVE DATA TABLES
   ========================================================================== */
.table-responsive-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.25rem 0;
  border: 1px solid #1A3D66;
  border-radius: 12px;
  background: rgba(7, 32, 65, 0.5);
}

.table-responsive-container table {
  width: 100%;
  margin-bottom: 0;
  min-width: 580px;
}

/* ==========================================================================
   10. FOOTER RESPONSIVE ARCHITECTURE
   ========================================================================== */
footer {
  width: 100% !important;
  overflow-x: hidden !important;
}

.footer-social-icon {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 50% !important;
  text-decoration: none !important;
  touch-action: manipulation !important;
}

@media (max-width: 767px) {
  footer .row.g-4 > div {
    margin-bottom: 1.5rem;
  }
}

/* ==========================================================================
   11. ACCESSIBILITY & PREFERS-REDUCED-MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal-on-scroll {
    opacity: 1 !important;
    transform: none !important;
  }
}
