/* Mobile First Responsive Design */

/* Page Background Video Responsive Styles */
@media (max-width: 768px) {
  .page-bg-video {
    object-position: center;
  }
  
  .video-fallback {
    background-position: center;
  }
}

@media (max-width: 480px) {
  .page-bg-video {
    object-position: center;
  }
  
  .video-fallback {
    background-position: center;
  }
}

/* Ultra High Resolution (2560px+) */
@media (min-width: 2560px) {
  :root {
    --container-padding: 8rem;
    --content-max-width: 1800px;
  }
  
  .hero__title {
    font-size: clamp(2.5rem, 4vw, 4rem);
  }
  
  .hero__subtitle {
    font-size: clamp(1.3rem, 2vw, 2rem);
  }
  
  .section__title {
    font-size: clamp(3rem, 4vw, 4.5rem);
  }
  
  .section {
    padding: 6rem 0;
  }
}

/* Large Desktop (1440px+) */
@media (min-width: 1440px) {
  :root {
    --container-padding: 6rem;
    --content-max-width: 1600px;
  }
  
  .hero__title {
    font-size: clamp(2.2rem, 4.5vw, 3.5rem);
  }
  
  .hero__subtitle {
    font-size: clamp(1.2rem, 2.2vw, 1.8rem);
  }
  
  .section {
    padding: 5rem 0;
  }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
  :root {
    --container-padding: 4rem;
  }
  
  .nav {
    padding: var(--spacing-md) var(--spacing-xl);
  }
  
  .features-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .offerings-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .clients-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .specializations {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .contact-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-3xl);
  }
}

/* Tablet (768px+) */
@media (min-width: 768px) {
  :root {
    --container-padding: 3rem;
  }
  
  .container {
    max-width: 720px;
  }
  
  .hero {
    padding: calc(80px + 4rem) 0 4rem;
  }
  
  .hero--services,
  .hero--contact {
    padding: calc(80px + 3rem) 0 3rem;
  }
  
  .section {
    padding: 4rem 0;
  }
  
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .services-grid {
    grid-template-columns: 1fr;
  }
  
  .offerings-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .clients-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .contact-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-2xl);
  }
  
  .footer__content {
    grid-template-columns: 1fr 1fr;
  }
}

/* Mobile Large (640px+) */
@media (min-width: 640px) {
  :root {
    --container-padding: 2rem;
  }
  
  .container {
    max-width: 600px;
  }
  
  .btn {
    padding: var(--spacing-md) var(--spacing-xl);
  }
  
  .hero__subtitle {
    font-size: var(--font-size-xl);
  }
  
  .content__text {
    font-size: var(--font-size-xl);
  }
  
  .nav__menu {
    display: flex;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }
  
  .nav__toggle {
    display: none;
  }

  /* Hide main hero show/hide toggles on desktop */
  .hero__show-toggle {
    display: none !important;
  }

  /* Remove text clamping on desktop */
  .hero--services .content__text--large {
    display: block !important;
    -webkit-line-clamp: unset !important;
    overflow: visible !important;
  }
}

/* Mobile (up to 639px) */
@media (max-width: 639px) {
  :root {
    --container-padding: 1rem;
  }
  
  .container {
    padding: 0 var(--spacing-md);
  }
  
  .nav {
    padding: var(--spacing-md);
  }
  
  .nav__menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 50%; /* Only take up half the screen width */
    transform: none; /* Override desktop center positioning */
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(212, 175, 55, 0.2);
    border-left: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 0 0 0 8px; /* Round the bottom-left corner */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1500; /* Much higher to ensure it appears above everything */
  }
  
  .nav__menu.active {
    display: block;
  }
  
  /* When mobile menu is active, ensure floating button appears behind it */
  body.mobile-menu-active .floating-quote-btn {
    z-index: 999; /* Lower than mobile menu (1500) */
  }
  
  .nav__list {
    flex-direction: column;
    gap: 0;
  }
  
  .nav__link {
    display: block;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.1);
    color: var(--color-primary);
    font-weight: 500;
    text-align: right; /* Align navigation links to the right */
    transition: all 0.3s ease;
  }
  
  .nav__link:hover {
    background-color: rgba(212, 169, 55, 0.1);
    color: var(--color-secondary);
    padding-right: 2rem; /* Maintain right alignment on hover */
  }
  
  .nav__link--active {
    background-color: rgba(212, 169, 55, 0.15);
    color: var(--color-secondary);
    font-weight: 600;
  }
  
  .nav__toggle {
    display: flex;
  }
  
  .nav__toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
  }
  
  .nav__toggle.active span:nth-child(2) {
    opacity: 0;
  }
  
  .nav__toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
  }
  
  .nav__actions {
    gap: var(--spacing-sm);
  }
  
  .hero {
    padding: calc(80px + 2rem) 0 2rem;
  }
  
  .hero--services,
  .hero--contact {
    padding: calc(80px + var(--spacing-xl)) 0 var(--spacing-xl);
  }
  
  .hero__title {
    font-size: var(--font-size-3xl);
  }
  
  .hero__subtitle {
    font-size: var(--font-size-base);
  }
  
  .section {
    padding: var(--spacing-2xl) 0;
  }
  
  .section__title {
    font-size: var(--font-size-2xl);
  }
  
  .footer {
    padding: 2rem 0 1.5rem;
  }
  
  .features-grid,
  .services-grid,
  .offerings-grid,
  .clients-grid,
  .specializations {
    grid-template-columns: 1fr;
  }
  
  .contact-grid {
    grid-template-columns: 1fr;
  }
  
  .contact-info {
    margin-bottom: var(--spacing-2xl);
  }
  
  .btn--large {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--font-size-base);
  }
  
  .footer__content {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 2rem;
    text-align: center;
    align-items: center;
    justify-items: center;
  }
  
  .footer__brand {
    order: 2;
    justify-content: center;
  }
  
  .footer__logo {
    height: 30px !important;
    width: auto;
  }
  
  .footer__contact {
    order: 1;
    align-items: center;
    text-align: center;
  }
  
  .footer__title {
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
  }
  
  .footer__email {
    font-size: 1rem;
  }
  
  .footer__bottom {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
  }
  
  .btn {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--font-size-sm);
  }
  
  .content__text {
    font-size: var(--font-size-base);
  }
  
  .content__text--large {
    font-size: var(--font-size-lg);
  }
  
  /* Who We Serve Mobile Optimizations */
  #who-we-serve {
    padding: 2rem 0 !important;
  }
  
  .who-we-serve-layout {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto !important;
    gap: 1.5rem !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
  
  .who-we-serve-content {
    order: 1;
    text-align: left !important;
    max-width: 100% !important;
    padding: 0 1rem !important;
    display: block !important;
    width: 100% !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
  }
  
  .who-we-serve-title {
    font-size: 1.8rem !important;
    white-space: normal !important;
    margin-bottom: 0.5rem !important;
    line-height: 1.2 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    text-align: left !important;
  }
  
  .who-we-serve-subtitle {
    font-size: 1rem !important;
    white-space: normal !important;
    margin-bottom: 0.8rem !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    text-align: left !important;
  }
  
  .who-we-serve-text {
    font-size: 0.9rem !important;
    line-height: 1.4 !important;
    text-align: center !important;
    margin: 0 auto !important;
    margin-bottom: 0 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .who-we-serve-text p {
    margin: 0 auto 0.5rem auto !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    text-align: center !important;
  }
  
  .clients-carousel-container {
    order: 2;
    width: 100% !important;
    margin-top: 1rem !important;
    padding: 0 1rem !important;
  }
  
  .clients-carousel {
    border-radius: 8px !important;
    max-width: 280px !important;
    overflow: hidden !important;
    aspect-ratio: 4/3 !important;
    margin: 0 auto !important;
  }
  
  .clients-track {
    width: calc(100% * 4 / 1) !important;
    height: 100% !important;
  }
  
  .clients-track .client {
    flex: 0 0 calc(100% / 4) !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
  
  .client__bg {
    height: 100% !important;
    width: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
  }
  
  .client__title {
    font-size: 1rem !important;
    margin-bottom: 0.4rem !important;
    font-weight: 600 !important;
  }
  
  .client__text {
    font-size: 0.8rem !important;
    line-height: 1.3 !important;
  }
  
  .carousel-controls {
    margin-top: 0.5rem !important;
    margin-bottom: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 0.5rem 0 !important;
  }
  
  .carousel-dots {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0.3rem !important;
  }
  
  .carousel-dot {
    width: 6px !important;
    height: 6px !important;
    margin: 0 !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.5) !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
  }
  
  .carousel-dot.active {
    background: var(--color-secondary) !important;
    transform: scale(1.3) !important;
  }
  
  /* Why Choose Aerosys Mobile Optimizations */
  #why-choose {
    padding: 2rem 0 !important;
  }
  
  #why-choose .hero__title--plain {
    font-size: 1.8rem !important;
    white-space: normal !important;
    margin-bottom: 0.25rem !important;
    line-height: 1.2 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    text-align: center !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 0 1rem !important;
    white-space: nowrap !important; /* keep on one line */
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  
  #why-choose .hero__subtitle {
    font-size: 1.05rem !important;
    white-space: normal !important;
    margin-bottom: 0.8rem !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    text-align: center !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 0 1rem !important;
    white-space: nowrap !important; /* keep on one line */
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Center align Who We Serve title on mobile */
  #who-we-serve .who-we-serve-title {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
  
  /* Why Choose Aerosys Feature Cards Mobile Optimization */
  #why-choose .features {
    display: grid !important;
    grid-template-columns: 1fr !important; /* Single column on small screens */
    gap: 1rem !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 1rem !important;
    overflow: visible !important;
    scroll-snap-type: none !important;
    margin-top: 1rem !important;
  }
  /* Ensure features container's glass/overlay wraps all cards */
  /* Remove glass/gradient helpers on mobile for a clean background */
  #why-choose .features-container {
    position: static !important;
    padding: 0 1rem 1rem 1rem !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
  }

  #why-choose .features-container::before,
  #why-choose .features-container::after {
    content: none !important;
  }

  #why-choose .feature:first-child {
    margin-top: 0 !important;
  }
  
  #why-choose .feature {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 1rem !important;
    flex: none !important;
    min-height: auto !important;
    aspect-ratio: auto !important;
  }

  /* Trim copy and provide toggle for mobile without affecting other sections */
  #why-choose .feature__text {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important; /* clamp to 2 lines on small screens */
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }

  #why-choose .feature__toggle {
    display: inline-block !important;
    margin-top: 0.4rem !important;
    background: transparent !important;
    color: var(--color-secondary) !important;
    border: none !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    padding: 0 !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 1.0) !important;
  }

  #why-choose .feature--expanded .feature__text {
    -webkit-line-clamp: unset !important;
    overflow: visible !important;
  }

  /* Mobile icon sizing for Why Choose */
  #why-choose .feature__icon svg {
    width: 50px !important;
    height: 50px !important;
  }

  /* Ensure icon container accommodates SVG (60px + 8px padding each side) */
  #why-choose .feature__icon {
    width: 76px !important;
    height: 76px !important;
    padding: 8px !important;
  }

  /* Main Hero Mobile Show More/Less */
  .hero--services {
    min-height: 100vh !important;
  }

  .hero--services .content__text--large {
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }

  .hero--services .content__text--large.expanded {
    -webkit-line-clamp: unset !important;
    overflow: visible !important;
  }

  .hero__show-toggle {
    display: inline-block !important;
    margin-top: 0.5rem !important;
    background: transparent !important;
    color: var(--color-secondary) !important;
    border: none !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    padding: 0 !important;
    font-size: inherit !important;
    text-decoration: none !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 1.0) !important;
  }
  
  /* Unified mobile glass container padding for all service heroes */
  .hero--service-individual .hero__content {
    padding: 1rem 1rem !important;
    margin: 1rem auto !important;
  }

  /* Unified mobile hero behavior for all service heroes */
  .hero--service-individual {
    min-height: auto !important;
    height: auto !important;
    padding: 1rem 0 !important;
    margin-bottom: 1rem !important;
  }
  
  /* Unified mobile services page optimization */
  .hero--service-individual.hero--with-images .hero__content {
    flex-direction: column !important;
    gap: 1.5rem !important;
    margin-top: 1rem !important;
  }

  .hero--service-individual.hero--with-images .hero__text-content {
    max-width: 100% !important;
    order: 1 !important;
  }

  .hero--service-individual.hero--with-images .hero__images {
    max-width: 90% !important;
    width: 90% !important;
    height: auto !important;
    position: relative !important;
    order: 2 !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 0.75rem !important;
    margin: 1rem auto !important;
  }

  .hero--service-individual.hero--with-images .hero__image {
    height: 200px !important;
    width: 50% !important;
    flex: 1 !important;
    object-fit: cover !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }
  
  /* Unified bottom spacing for all service heroes */
  .hero--service-individual.hero--with-images {
    padding-bottom: 2rem !important;
  }
  
  /* Unified image container styling for mobile */
  .hero--service-individual.hero--with-images .hero__images {
    margin-bottom: 0 !important;
  }
}

/* Mobile Small (up to 480px) */
@media (max-width: 480px) {
  :root {
    --container-padding: 1rem;
  }
  
  .container {
    padding: 0 var(--spacing-sm);
  }
  
  .hero__title {
    font-size: var(--font-size-2xl);
  }
  
  .section__title {
    font-size: var(--font-size-xl);
  }
  
  .feature__icon {
    width: 50px;
    height: 50px;
  }
  
  .service-card__icon {
    width: 60px;
    height: 60px;
  }
  
  .offering-item__icon {
    width: 40px;
    height: 40px;
  }
  
  .contact-item__icon {
    width: 40px;
    height: 40px;
  }
  
  .contact-form-wrapper {
    padding: var(--spacing-lg);
  }
  
  .cta {
    padding: var(--spacing-lg);
  }
  
  .btn {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
  }
}

/* Print Styles */
@media print {
  .header,
  .nav__toggle,
  .nav__actions,
  .btn {
    display: none !important;
  }
  
  .hero {
    padding-top: var(--spacing-lg);
  }
  
  * {
    color: black !important;
    background: white !important;
  }
  
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }
  
  p, li {
    font-size: 12pt;
    line-height: 1.4;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --primary-blue: #000080;
    --secondary-blue: #0000ff;
    --accent-orange: #ff8c00;
    --neutral-gray: #000000;
    --border-light: #000000;
  }
  
  .nav__link,
  .btn,
  .feature-card,
  .service-card {
    border: 2px solid currentColor;
  }
} 