/**
 * Zenthamizh Innovations - Responsive Overrides & Overflow Safeguards
 */

/* Prevent horizontal overflow across all viewports */
html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden !important;
}

/* Tablet & Smaller (< 992px) */
@media (max-width: 991.98px) {
  .nav-links,
  .nav-cta-desktop {
    display: none !important;
  }

  .hamburger-btn {
    display: flex !important;
  }

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

  /* Hide connecting horizontal track line when cards wrap to 2 columns */
  .growth-connecting-line {
    display: none !important;
  }

  .section-hero {
    min-height: auto;
    padding-top: 3.5rem;
    padding-bottom: 3.5rem;
  }

  .hero-z-img {
    max-width: 220px;
    margin-top: 2rem;
  }

  .loop-container {
    max-width: 380px;
  }

  .loop-node {
    width: 75px;
    height: 75px;
    font-size: 0.68rem;
  }

  /* How We Think - Tablet Overrides */
  .system-pipeline-wrap {
    padding: 1.75rem 1.5rem !important;
  }
  .pipeline-node-circle {
    width: 38px !important;
    height: 38px !important;
    font-size: 1.05rem !important;
  }
  .pipeline-node-name {
    font-size: 0.7rem !important;
  }
  .beliefs-grid-connectors {
    display: none !important;
  }

  /* What We Build - Tablet Overrides */
  .discipline-nav-rail {
    display: none !important;
  }
  .discipline-section {
    padding: 3.5rem 0 !important;
  }
  .discipline-spine-track {
    top: -3.5rem !important;
    bottom: -3.5rem !important;
  }
  .discipline-spine-track.is-first {
    top: 0 !important;
  }
  .discipline-spine-track.is-last {
    bottom: -3.5rem !important;
  }

  /* Work - Connected Protocol Pipeline Tablet Wrap */
  .protocol-nodes-row {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1rem !important;
  }
  .protocol-nodes-row .protocol-step-card.step-04 {
    grid-column: 1 / 2 !important;
  }
  .protocol-nodes-row .protocol-step-card.step-05 {
    grid-column: 2 / 4 !important;
  }
  .protocol-track-line {
    display: none !important;
  }
  .schematic-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Mobile Devices (< 768px) */
@media (max-width: 767.98px) {
  /* Header Spacing & Compact Proportions */
  .site-header > .container-fluid > .d-flex {
    padding-top: 0.7rem !important;
    padding-bottom: 0.7rem !important;
  }

  .site-header.scrolled > .container-fluid > .d-flex {
    padding-top: 0.45rem !important;
    padding-bottom: 0.45rem !important;
  }

  .site-header.scrolled .nav-brand img {
    height: 34px !important;
    transform: none !important;
  }

  .site-header.scrolled .nav-brand-title {
    font-size: 0.92rem !important;
  }

  .site-header.scrolled .nav-brand-subtitle {
    font-size: 0.6rem !important;
  }

  section {
    padding: 3.5rem 0 !important;
  }

  /* Hero Section: breathing room below fixed header, tight bottom */
  .section-hero {
    min-height: auto !important;
    padding-top: clamp(2.25rem, 7vw, 3rem) !important;
    padding-bottom: 2rem !important;
  }

  /* 1. Remove Z logo entirely below 768px */
  .hero-z-visual {
    display: none !important;
  }

  /* 3. Hero Eyebrow rhythm */
  .hero-eyebrow {
    margin-bottom: 1.15rem !important;
    line-height: 1.3 !important;
    font-size: 0.76rem !important;
    letter-spacing: 0.12em !important;
  }

  /* 3. Headline: tight clamp to fit 3 lines naturally */
  .hero-headline {
    font-size: clamp(1.72rem, 7.8vw, 2.2rem) !important;
    line-height: 1.14 !important;
    letter-spacing: -0.025em !important;
    margin-bottom: 1.15rem !important;
  }

  .hero-headline-highlight {
    color: var(--accent-glow) !important;
    display: inline-block !important;
    white-space: nowrap !important;
  }

  /* Hero Subheading */
  .hero-subheading {
    font-size: 1.05rem !important;
    line-height: 1.55 !important;
  }

  /* 2. Hero Button Group: full width, deliberate 16-20px gap, identical height, ~18% reduced vertical padding */
  .hero-cta-group {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 18px !important; /* Deliberate 16-20px spacing */
    margin-top: 1.75rem !important; /* Distinct visual beat from paragraph */
    padding-top: 0 !important;
  }

  .hero-cta-group .hero-cta-btn,
  .hero-cta-group .btn {
    width: 100% !important;
    min-height: 50px !important; /* Guaranteed identical pixel height */
    padding: 0.82rem 1.25rem !important; /* Tightened vertical padding by ~18% */
    font-size: 0.92rem !important;
    line-height: 1.2 !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    border-width: 1px !important;
    border-style: solid !important;
    margin: 0 !important;
  }

  .hero-cta-group .btn i {
    font-size: 1rem !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  /* Client Marquee Strip (Happy Clients) */
  .client-marquee-section {
    padding: 2.25rem 0 2rem !important;
  }

  .client-marquee-section .mb-4 {
    margin-bottom: 1.25rem !important;
  }

  /* Compact Growth Chain Mobile Styles */
  .compact-chain-wrapper {
    margin: 1.75rem auto 2rem;
    max-width: 100%;
  }

  .compact-chain-flow {
    padding: 0.25rem 0;
  }

  .compact-chain-line {
    top: 21px;
    left: 24px;
    right: 24px;
  }

  .compact-node-circle {
    width: 42px;
    height: 42px;
    font-size: 1.05rem;
  }

  .compact-node-step {
    font-size: 0.62rem;
  }

  .compact-node-title {
    font-size: 0.72rem;
  }

  .compact-chain-arrow {
    font-size: 0.75rem;
    margin-top: -20px;
  }

  .hero-glow-ambient {
    width: 280px;
    height: 280px;
  }

  .growth-system-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
  }

  /* Principle proof cards single column & tighter padding */
  .principle-proof-card {
    padding: 1.25rem !important;
    min-height: auto !important;
  }

  /* Capability pill row wrap on narrow mobile */
  .capability-pill-row {
    gap: 0.4rem !important;
  }

  .pill-arrow {
    display: none !important;
  }

  .capability-pill {
    font-size: 0.72rem !important;
    padding: 0.3rem 0.75rem !important;
  }

  .loop-container {
    max-width: 290px;
  }

  .loop-node {
    width: 60px;
    height: 60px;
    font-size: 0.58rem;
  }

  .loop-center {
    max-width: 140px;
    padding: 0.85rem;
    font-size: 0.8rem;
  }

  .case-study-card {
    padding: 1.25rem;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
  }

  .social-btn {
    width: 44px;
    height: 44px;
  }

  /* How We Think - Mobile Pipeline Stepper */
  .system-pipeline-wrap {
    padding: 1.35rem 1rem !important;
    margin-top: 1.5rem !important;
  }

  .pipeline-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.5rem !important;
    padding-bottom: 0.75rem !important;
  }

  .pipeline-mobile-stepper {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }

  .pipeline-step-item {
    padding: 0.65rem 0.85rem !important;
    gap: 0.75rem !important;
  }

  .pipeline-step-circle {
    width: 34px !important;
    height: 34px !important;
    font-size: 0.95rem !important;
  }

  .pipeline-step-name {
    font-size: 0.85rem !important;
  }

  .pipeline-step-num {
    font-size: 0.6rem !important;
  }

  .pipeline-step-line {
    margin-left: 1.55rem !important;
    height: 12px !important;
  }

  /* How We Think - Mobile Diagnostic Radar (~260px scaled) */
  .radar-diagnostic-wrap {
    padding: 1.35rem 1rem !important;
    margin-top: 2rem !important;
  }

  .radar-display-col {
    min-height: 290px !important;
    padding-top: 1rem !important;
  }

  .radar-screen {
    width: 260px !important;
    height: 260px !important;
  }

  .radar-ring-1 {
    width: 80px !important;
    height: 80px !important;
  }

  .radar-ring-2 {
    width: 155px !important;
    height: 155px !important;
  }

  .radar-ring-3 {
    width: 230px !important;
    height: 230px !important;
  }

  .radar-core-hub {
    width: 68px !important;
    height: 68px !important;
  }

  .radar-core-label {
    font-size: 0.58rem !important;
  }

  .radar-probe {
    width: 38px !important;
    height: 38px !important;
    font-size: 0.78rem !important;
  }

  .probe-1 { top: 6px !important; }
  .probe-4 { bottom: 6px !important; }
  .probe-2 { top: 20% !important; right: 8px !important; }
  .probe-3 { bottom: 20% !important; right: 8px !important; }
  .probe-5 { bottom: 20% !important; left: 8px !important; }
  .probe-6 { top: 20% !important; left: 8px !important; }

  .diagnostic-readout-card {
    padding: 1.35rem 1.15rem !important;
  }

  .diagnostic-active-question {
    font-size: 1.18rem !important;
    line-height: 1.35 !important;
  }

  .diagnostic-active-desc {
    font-size: 0.88rem !important;
    margin-bottom: 1rem !important;
  }

  /* How We Think - Mobile Belief Cards */
  .belief-card {
    padding: 1.5rem 1.25rem !important;
  }

  .belief-num-watermark {
    font-size: 2.6rem !important;
  }

  .belief-icon-box {
    width: 44px !important;
    height: 44px !important;
    font-size: 1.4rem !important;
  }

  .belief-title {
    font-size: 1.05rem !important;
  }

  .belief-primary-line {
    font-size: 0.88rem !important;
  }

  .belief-hover-detail {
    font-size: 0.82rem !important;
  }

  /* What We Build - Mobile Spinal Journey & Single Column Full-Width Cards */
  .discipline-section {
    padding: 2.75rem 0 !important;
  }

  .discipline-header-unit {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    margin-bottom: 0.65rem !important;
  }

  .discipline-spine-track {
    top: -2.75rem !important;
    bottom: -2.75rem !important;
    left: 20px !important;
  }

  .discipline-spine-track.is-first {
    top: 0 !important;
  }

  .discipline-spine-track.is-last {
    bottom: -2.75rem !important;
  }

  .discipline-anchor-badge {
    width: 40px !important;
    height: 40px !important;
    font-size: 1.1rem !important;
    margin-bottom: 0 !important;
  }

  .discipline-phase-eyebrow {
    font-size: 0.78rem !important;
    letter-spacing: 0.08em !important;
  }

  .build-hero-headline {
    font-size: clamp(1.68rem, 7.2vw, 2.2rem) !important;
    line-height: 1.14 !important;
    letter-spacing: -0.025em !important;
    margin-bottom: 1.2rem !important;
  }

  .discipline-heading {
    font-size: clamp(1.42rem, 5.8vw, 1.85rem) !important;
    line-height: 1.18 !important;
    margin-bottom: 0.65rem !important;
    letter-spacing: -0.02em !important;
  }

  .discipline-subhead {
    font-size: 0.95rem !important;
    line-height: 1.55 !important;
  }

  .discipline-cards-col {
    margin-top: 1.35rem !important;
  }

  .capability-grid {
    --bs-gutter-y: 0.85rem !important;
  }

  /* Single column full-width mobile cards */
  .capability-mini-card {
    padding: 1.05rem 1.15rem !important;
    border-radius: var(--radius-sm) !important;
    min-height: auto !important;
    background: var(--surface-2) !important;
    border: 1px solid var(--border-light) !important;
  }

  .capability-mini-top {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    margin-bottom: 0.35rem !important;
  }

  .capability-mini-icon {
    width: 34px !important;
    height: 34px !important;
    font-size: 1.1rem !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
  }

  .capability-mini-title {
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    color: #fff !important;
  }

  .capability-mini-desc {
    font-size: 0.85rem !important;
    line-height: 1.45 !important;
    margin-top: 0 !important;
    color: var(--text-muted) !important;
    opacity: 0.9 !important;
  }

  .discipline-phase-badge {
    font-size: 0.7rem !important;
    padding: 0.25rem 0.65rem !important;
  }

  .convergence-point {
    width: 36px !important;
    height: 36px !important;
    font-size: 1.1rem !important;
    top: -18px !important;
  }

  /* Work - Mobile Vertical Connected Stepper (< 768px) */
  .protocol-pipeline-wrap {
    padding: 1.6rem 1.15rem 1.25rem 1.15rem !important;
    border-radius: var(--radius-md) !important;
  }

  .protocol-track-line {
    display: none !important;
  }

  .protocol-nodes-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    position: relative !important;
    padding-left: 28px !important;
  }

  /* Continuous vertical glowing connector line on the left */
  .protocol-nodes-row::before {
    content: '';
    position: absolute;
    top: 26px;
    bottom: 26px;
    left: 8px;
    width: 2px;
    background: linear-gradient(180deg, 
      #F87171 0%, 
      #FBBF24 25%, 
      #38BDF8 50%, 
      #818CF8 75%, 
      #10B981 100%
    );
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
    z-index: 1;
  }

  .protocol-step-card {
    border-radius: var(--radius-sm) !important;
    padding: 1.15rem 1rem !important;
    margin-bottom: 0.9rem !important;
    width: 100% !important;
  }

  /* Connecting node dot attached to the vertical line */
  .protocol-step-card::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 22px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--accent-glow);
    z-index: 2;
  }

  .protocol-step-card.step-01::before { border-color: #F87171; box-shadow: 0 0 6px #F87171; }
  .protocol-step-card.step-02::before { border-color: #FBBF24; box-shadow: 0 0 6px #FBBF24; }
  .protocol-step-card.step-03::before { border-color: #38BDF8; box-shadow: 0 0 6px #38BDF8; }
  .protocol-step-card.step-04::before { border-color: #818CF8; box-shadow: 0 0 6px #818CF8; }
  .protocol-step-card.step-05::before { 
    border-color: #10B981; 
    background: #10B981; 
    box-shadow: 0 0 10px #10B981; 
  }

  .protocol-step-title {
    font-size: 1rem !important;
    margin-bottom: 0.4rem !important;
  }

  .protocol-step-desc {
    font-size: 0.84rem !important;
    line-height: 1.45 !important;
  }

  /* Mobile In-Progress Schematic Card */
  .in-progress-schematic-card {
    border-radius: var(--radius-sm) !important;
  }

  .schematic-header {
    padding: 0.75rem 1rem !important;
  }

  .schematic-body {
    padding: 1.15rem 1rem !important;
  }

  .schematic-grid {
    grid-template-columns: 1fr !important;
    gap: 0.5rem !important;
  }

  /* Closing Section CTAs Full Width Stack on Mobile */
  .work-cta-group {
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.85rem !important;
  }

  .work-cta-group .btn {
    width: 100% !important;
    text-align: center !important;
    justify-content: center !important;
    padding: 0.95rem 1.5rem !important;
  }
}

@media (min-width: 992px) {
  .mobile-drawer {
    display: none !important;
  }
}

@media (max-width: 420px) {
  .compact-node-circle {
    width: 36px !important;
    height: 36px !important;
    font-size: 0.92rem !important;
  }
  .compact-node-label {
    flex-direction: column !important;
    gap: 0 !important;
  }
  .compact-node-step {
    font-size: 0.58rem !important;
  }
  .compact-node-title {
    font-size: 0.64rem !important;
  }
  .compact-chain-line {
    top: 18px !important;
    left: 18px !important;
    right: 18px !important;
  }
  .compact-chain-arrow {
    margin-top: -24px !important;
    font-size: 0.65rem !important;
  }

  /* Extra compact radar on very narrow screens */
  .radar-screen {
    width: 236px !important;
    height: 236px !important;
  }
  .radar-ring-3 {
    width: 210px !important;
    height: 210px !important;
  }
  .radar-ring-2 {
    width: 140px !important;
    height: 140px !important;
  }
  .radar-ring-1 {
    width: 72px !important;
    height: 72px !important;
  }
  .radar-probe {
    width: 34px !important;
    height: 34px !important;
    font-size: 0.72rem !important;
  }
  .radar-core-hub {
    width: 62px !important;
    height: 62px !important;
  }
}
