/**
 * ==============================================================================
 * Investosure Modular Mobile Viewport & Responsiveness Architecture
 * Optimized for Modern Mobile Devices (iOS, Android, Tablets, Small Screens)
 * Ensures: Zero Horizontal Overflow, 100dvh Support, Safe Area Insets,
 *          iOS Zoom Mitigation, Touch-Friendly 44px Targets, & Smooth Momentum Scroll.
 * ==============================================================================
 */

/* ==========================================================================
   1. ROOT VARIABLES & SAFE AREA BOUNDARIES
   ========================================================================== */
:root {
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);
  --safe-area-right: env(safe-area-inset-right, 0px);
  --touch-target-min: 44px;
}

/* Enforce strict horizontal containment to prevent page swaying on mobile */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Respect notched devices (iPhone 12–16, Galaxy, Pixel) */
@supports (padding-top: env(safe-area-inset-top)) {
  .nav-full__bar {
    padding-top: max(0.85rem, var(--safe-area-top)) !important;
    padding-left: max(1rem, var(--safe-area-left)) !important;
    padding-right: max(1rem, var(--safe-area-right)) !important;
  }

  .footer {
    padding-bottom: max(2rem, calc(1.5rem + var(--safe-area-bottom))) !important;
  }
}

/* ==========================================================================
   2. DYNAMIC VIEWPORT HEIGHT (dvh) FOR BROWSER CHROME COLLAPSE
   ========================================================================== */
.h-dvh,
.nav-full,
.nav-full__tile,
.parallax-fullscreen {
  min-height: 100vh;
  min-height: 100dvh;
}

@media (max-width: 768px) {
  .parallax-fullscreen {
    height: auto !important;
    min-height: 60vh;
    min-height: 60dvh;
  }
}

/* ==========================================================================
   3. RESPONSIVE MEDIA & CONTAINMENT
   ========================================================================== */
img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
  height: auto;
}

/* Ensure brand logo inside billboard retains crisp, compact proportion */
.parallax-billboard-logo img {
  height: 26px !important;
  width: auto !important;
  max-height: 26px !important;
}

/* Ensure footer brand logo maintains original compact size and never stretches */
.footer-logo-col img,
.leome-footer .footer-logo-col img {
  height: 40px !important;
  max-height: 40px !important;
  width: auto !important;
  max-width: 60px !important;
  object-fit: contain !important;
}

/* Prevent fixed-width SVGs from stretching beyond screen */
svg:not([width]) {
  width: 100%;
}

/* ==========================================================================
   4. FORM INPUTS & iOS SAFARI AUTO-ZOOM PREVENTION
   ========================================================================== */
/* iOS Safari forcefully zooms in when input font-size is < 16px.
   Enforcing 16px on mobile prevents jarring viewport displacement. */
@media (max-width: 768px) {
  input[type="text"]:not(.control-input),
  input[type="email"],
  input[type="number"]:not(.control-input),
  input[type="tel"],
  input[type="password"],
  input[type="date"],
  select,
  textarea,
  .form-control,
  .form-select {
    font-size: 16px !important;
    min-height: var(--touch-target-min);
  }

  /* Keep compact numeric badge inputs appropriately sized inside calculator controls */
  .control-input {
    min-height: auto !important;
    height: auto !important;
    font-size: 0.95rem !important;
    padding: 2px 4px !important;
  }

  /* Ensure textareas scale gracefully */
  textarea.form-control {
    min-height: 90px;
  }
}

/* ==========================================================================
   5. TOUCH TARGET ACCESSIBILITY (44px Minimum Hit Area)
   ========================================================================== */
@media (max-width: 768px) {
  .btn-animate-chars:not(.is_nav),
  .btn,
  .nav-full__link,
  .modal__btn-close,
  .accordion-button,
  .practice-action-link {
    min-height: var(--touch-target-min);
    display: inline-flex;
    align-items: center;
  }

  /* Keep navbar Menu toggle button compact and original sleek size */
  .btn-animate-chars.is_nav {
    padding: 0.45em 1em !important;
    min-height: auto !important;
    font-size: 0.88rem !important;
  }

  .nav-full__actions {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    flex-shrink: 0 !important;
  }

  /* Direct contact button on mobile: generous pill width with centered contact symbol */
  .btn-animate-chars.is_nav.is-nav-contact {
    padding: 0.45em 1.35em !important;
    min-width: 64px !important;
    width: auto !important;
    height: 34px !important;
    min-height: 34px !important;
    border-radius: 999px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: var(--green-main) !important;
    color: var(--green-light) !important;
    border: 1px solid var(--green-main) !important;
  }

  .btn-animate-chars.is_nav.is-nav-contact .nav-contact-text {
    display: none !important;
  }

  .btn-animate-chars.is_nav.is-nav-contact .nav-contact-icon {
    font-size: 0.95rem !important;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .nav-full__hamburger {
    width: 20px !important;
    height: 13px !important;
  }

  /* Close triggers in slide-overs */
  .modal__btn-close {
    min-width: var(--touch-target-min);
    min-height: var(--touch-target-min);
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* ==========================================================================
   6. RESPONSIVE TABLES & DATA MATRICES
   ========================================================================== */
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1.5rem;
  border-radius: 8px;
}

.table-responsive > table {
  margin-bottom: 0;
  width: 100%;
}

/* Subtle scroll hint shadow for wide tables on small viewports */
@media (max-width: 768px) {
  .table-responsive {
    box-shadow: inset -6px 0 8px -4px rgba(0, 0, 0, 0.08);
  }

  .table-responsive th,
  .table-responsive td {
    white-space: nowrap;
    padding: 0.75rem 0.85rem !important;
    font-size: 0.88rem !important;
  }

  /* Allow the primary label column to wrap */
  .table-responsive td:first-child,
  .table-responsive th:first-child {
    white-space: normal;
    min-width: 140px;
  }
}

/* ==========================================================================
   7. FULLSCREEN ARCHITECTURAL NAVIGATION ON MOBILE
   ========================================================================== */

/* Active Sticky Header Bar: Solid background prevents menu items from showing through and colliding with logo and close button */
[data-navigation-status="active"] .nav-full__bar {
  background: var(--green-main) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(177, 249, 225, 0.15) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

[data-navigation-status="active"] .nav-full__name {
  color: var(--green-light) !important;
}

[data-navigation-status="active"] .btn-animate-chars.is_nav {
  color: var(--green-light) !important;
  border-color: rgba(177, 249, 225, 0.35) !important;
  background: rgba(177, 249, 225, 0.08) !important;
}

[data-navigation-status="active"] .btn-animate-chars.is_nav:hover {
  background: var(--green-light) !important;
  color: var(--green-main) !important;
  border-color: var(--green-light) !important;
}

@media (max-width: 768px) {
  .nav-full__tile {
    padding-top: max(5rem, calc(4.2rem + var(--safe-area-top))) !important;
    padding-bottom: max(3.5rem, calc(2.5rem + var(--safe-area-bottom))) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .nav-full__grid {
    grid-template-columns: 1fr !important;
    max-height: none !important;
    overflow-y: visible !important;
    padding: 0.5rem 0 2rem;
  }

  .nav-full__ul {
    gap: 0.35rem;
    padding: 0 0.5rem;
  }

  .nav-full__link {
    font-size: clamp(1.4rem, 6vw, 2rem) !important;
    padding: 0.4rem 0.5rem;
  }

  .nav-full__sidebar {
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 1rem;
  }

  .nav-subpanel__card {
    padding: 0.85rem 1rem !important;
  }

  .nav-subpanel__title {
    font-size: 0.95rem !important;
  }

  .nav-subpanel__desc {
    font-size: 0.82rem !important;
  }

  .nav__bottom {
    display: none; /* Hide bottom disclaimer in nav to give menu space on small screens */
  }
}

/* ==========================================================================
   8. SLIDE-OVER MODALS & DETAIL DRAWERS
   ========================================================================== */
@media (max-width: 576px) {
  .modal__card {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 16px 16px 0 0 !important;
    top: auto !important;
    bottom: 0 !important;
    height: 92vh !important;
    height: 92dvh !important;
    max-height: 92vh !important;
    max-height: 92dvh !important;
    overflow: hidden !important;
    overscroll-behavior: contain !important;
  }

  .modal__scroll {
    height: 100% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 1.75rem 1.25rem 2rem 1.25rem !important;
  }

  .modal__h2 {
    font-size: 1.5rem !important;
    line-height: 1.25 !important;
  }
}

/* ==========================================================================
   9. INTERACTIVE CALCULATOR TOUCH ENHANCEMENTS
   ========================================================================== */
/* Touch Slider Ergonomics */
input[type="range"] {
  touch-action: pan-y;
}

@media (max-width: 768px) {
  input[type="range"]::-webkit-slider-thumb {
    width: 28px !important;
    height: 28px !important;
    cursor: grab;
  }

  input[type="range"]::-moz-range-thumb {
    width: 28px !important;
    height: 28px !important;
    cursor: grab;
  }

  /* Currency symbol alignment inside rupee input wrappers */
  .input-rupee-wrap {
    position: relative;
    width: 100%;
  }

  .input-rupee-wrap input {
    padding-left: 2.2rem !important;
  }

  .input-rupee-symbol {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-weight: 700;
  }

  /* Calculator summary KPI card grids */
  .calc-kpi-grid,
  .odometer-grid,
  .kpi-cards-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .calc-chart-container {
    width: 100% !important;
    max-height: 280px !important;
  }

  /* Calculator Control Headers & Input Wrap Responsiveness */
  .control-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
  }

  .control-label {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    line-height: 1.3 !important;
  }

  .control-input-wrap {
    flex-shrink: 0 !important;
    max-width: 100% !important;
  }

  .tax-calc-wrapper {
    padding: 1rem !important;
    border-radius: 8px !important;
  }

  .deductions-box-header {
    padding: 0.85rem 1rem !important;
  }

  .deductions-body {
    padding: 1rem 0.85rem !important;
  }
}

/* ==========================================================================
   10. NEWSLETTER & ACTION CTA STACKING (≤ 768px & ≤ 480px)
   ========================================================================== */
/* Desktop base for newsletter form */
.newsletter-form-leome {
  display: flex !important;
  gap: 8px !important;
  max-width: 500px;
  margin: 0 auto;
  align-items: stretch;
}
.newsletter-form-leome input,
.newsletter-form-leome input#email {
  flex: 1 1 auto !important;
  min-width: 0 !important;
}
.newsletter-form-leome button {
  flex-shrink: 0 !important;
}

@media (max-width: 768px) {
  /* Newsletter bar flex input + button */
  .newsletter-form-leome,
  .leome-container form[style*="max-width:500px"],
  .leome-container div[style*="max-width:500px"],
  form[style*="max-width:500px"],
  form[style*="max-width: 500px"],
  div[style*="max-width:500px"],
  div[style*="max-width: 500px"] {
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
  }

  .newsletter-form-leome input,
  .newsletter-form-leome input#email,
  .leome-container form[style*="max-width:500px"] input,
  .leome-container div[style*="max-width:500px"] input,
  form[style*="max-width:500px"] input,
  form[style*="max-width: 500px"] input,
  div[style*="max-width:500px"] input,
  div[style*="max-width: 500px"] input {
    width: 100% !important;
    text-align: center;
    border-radius: 999px !important;
    min-height: 48px;
  }

  .newsletter-form-leome button,
  .leome-container form[style*="max-width:500px"] button,
  .leome-container div[style*="max-width:500px"] button,
  form[style*="max-width:500px"] button,
  form[style*="max-width: 500px"] button,
  div[style*="max-width:500px"] button,
  div[style*="max-width: 500px"] button {
    width: 100% !important;
    padding: 0.85em 1.5em !important;
    border-radius: 999px !important;
    justify-content: center !important;
    text-align: center !important;
    min-height: 48px;
  }
}

@media (max-width: 480px) {
  /* Dual Action buttons (e.g. "Apply Now" + "View Internships") */
  div[style*="justify-content:center; gap:1rem"],
  div[style*="justify-content: center; gap: 1rem"],
  .hero-cta-group {
    flex-direction: column !important;
    width: 100%;
  }

  div[style*="justify-content:center; gap:1rem"] .btn-animate-chars,
  div[style*="justify-content: center; gap: 1rem"] .btn-animate-chars {
    width: 100% !important;
    text-align: center;
  }
}

/* ==========================================================================
   11. FLUID HEADINGS WORD-BREAK CONTAINMENT
   ========================================================================== */
h1,
h2,
h3,
.hero_about-wrap h1,
.footer-text-display,
.parallax-billboard-title {
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: manual;
}

@media (max-width: 380px) {
  /* Ultra-compact screens (e.g. iPhone SE 1st gen, Galaxy Fold outer screen) */
  .hero_about-wrap h1 {
    font-size: clamp(2rem, 11vw, 2.6rem) !important;
  }

  .hero_about-sub p {
    font-size: 0.95rem !important;
  }

  .leome-container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
}

/* ==========================================================================
   12. BUTTON HOVER TEXT CONTRAST SAFEGUARD
   ========================================================================== */
/* Prevents text from turning light green on light background buttons */
.btn-animate-chars[style*="background: var(--green-light)"]:hover [data-button-animate-chars] span,
.btn-animate-chars[style*="background:var(--green-light)"]:hover [data-button-animate-chars] span,
.btn-animate-chars.is-light:hover [data-button-animate-chars] span,
.btn-animate-chars.is-light:hover span,
.btn-animate-chars[style*="background: var(--green-light)"]:hover,
.btn-animate-chars[style*="background:var(--green-light)"]:hover {
  color: var(--green-dark) !important;
}

.btn-animate-chars[style*="background: var(--green-light)"]:hover,
.btn-animate-chars[style*="background:var(--green-light)"]:hover {
  background: #ffffff !important;
  border-color: #ffffff !important;
}

/* ==========================================================================
   13. ACCESSIBILITY (a11y) & WCAG COMPLIANCE ENHANCEMENTS
   ========================================================================== */

/* Skip to main content link (WCAG 2.4.1 Bypass Blocks) */
.skip-to-content {
  position: fixed;
  top: -120px;
  left: 1rem;
  background: var(--green-main);
  color: var(--green-light);
  border: 2px solid var(--green-light);
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  z-index: 100000;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  transition: top 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.skip-to-content:focus {
  top: 1rem;
  outline: 2px solid var(--green-light);
  outline-offset: 3px;
}

/* Submenu chevron button reset for accessibility */
button.nav-full__chevron {
  background: transparent;
  border: none;
  padding: 0.25rem;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1;
  color: var(--green-light-50);
  cursor: pointer;
}

button.nav-full__chevron:focus-visible {
  outline: 2px solid var(--green-light);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Consistent Visible Focus Rings (WCAG 2.4.7 Focus Visible) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--green-light) !important;
  outline-offset: 3px !important;
}

/* Visually Hidden Helper (WCAG 1.3.1 Info and Relationships) */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Respect user's motion preferences (WCAG 2.3.3 Reduced Motion) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  [data-cursor] {
    display: none !important;
  }
}

