/* ==========================================================================
   Admin Assist Master Responsive & Smooth Experience System
   ========================================================================== */

/* 1. Global Viewport Overflow Guard & Fluid Base */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw;
  width: 100%;
}

*, *::before, *::after {
  box-sizing: border-box;
}

h1, h2, h3, h4, h5, h6, p, a, span, label, strong, b, small {
  overflow-wrap: break-word;
  word-break: normal;
}

img, video, iframe {
  max-width: 100%;
  height: auto;
}

.mobile-nav-actions {
  display: none;
}

/* 2. Large Desktop & Laptops (1025px - 1320px) */
@media (max-width: 1320px) {
  .nav-wrap {
    gap: 15px;
  }
  .main-nav .menu > li > a {
    padding: 30px 10px;
    font-size: 13px;
  }
  .site-logo {
    width: 170px;
  }
  .header-actions {
    gap: 10px;
  }
  .header-cta {
    padding: 10px 15px;
    font-size: 12px;
  }
}

@media (max-width: 1200px) {
  .header-phone {
    display: none;
  }
  .main-nav .menu > li > a {
    padding: 30px 8px;
    font-size: 12.5px;
  }
  .container {
    width: min(100% - 40px, 1140px);
  }
  .hero-inner {
    gap: 36px;
  }
}

/* 3. Tablets & Compact Screens (<= 1024px) */
@media (max-width: 1024px) {
  .container {
    width: min(100% - 40px, 940px);
  }

  .section {
    padding: 44px 0;
  }

  .nav-wrap {
    min-height: 72px;
    gap: 15px;
  }

  .site-logo {
    width: 165px;
    max-height: 50px;
  }

  main {
    padding-top: 72px;
  }

  /* Hamburger Menu Toggle Button */
  .menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 8px;
    width: 44px;
    height: 44px;
    border-radius: 6px;
    border: 1px solid rgba(12, 43, 80, 0.1);
    background: transparent;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
  }

  .menu-toggle:hover,
  .menu-toggle:focus {
    background: rgba(12, 43, 80, 0.05);
  }

  .menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--navy);
    border-radius: 2px;
    transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
  }

  .nav-open .menu-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .nav-open .menu-toggle span:nth-child(2) {
    opacity: 0;
  }

  .nav-open .menu-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* Fullscreen Smooth Mobile Navigation Drawer */
  .main-nav {
    position: fixed;
    left: 0;
    right: 0;
    top: 72px;
    bottom: 0;
    background: #ffffff;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    opacity: 0;
    visibility: hidden;
    transform: translate3d(0, -8px, 0);
    transition: opacity 0.28s var(--ease), transform 0.28s var(--ease), visibility 0.28s var(--ease);
    box-shadow: 0 25px 60px rgba(7, 27, 52, 0.18);
    z-index: 999;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .nav-open .main-nav {
    opacity: 1;
    visibility: visible;
    transform: translate3d(0, 0, 0);
  }

  .main-nav .menu {
    display: block;
    padding: 12px 24px;
    list-style: none;
    margin: 0;
  }

  .main-nav .menu > li {
    position: relative;
    border-bottom: 1px solid var(--line);
  }

  .main-nav .menu > li:last-child {
    border-bottom: none;
  }

  .main-nav .menu > li > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    font-size: 15px;
    font-weight: 800;
    color: var(--navy);
    text-decoration: none;
  }

  .menu-item-has-children > a::after {
    display: none;
  }

  /* Submenu Toggle Button */
  .submenu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 0;
    top: 8px;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fbfcfd;
    font-size: 20px;
    font-weight: 300;
    cursor: pointer;
    color: var(--navy);
    line-height: 1;
    transition: all 0.2s ease;
  }

  .menu-item-has-children.submenu-open > .submenu-toggle {
    background: var(--red);
    color: #ffffff;
    border-color: var(--red);
  }

  /* Submenu Drawer */
  .sub-menu {
    position: static;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    display: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    border-left: 3px solid var(--red);
    margin: 4px 0 14px 6px;
    padding: 6px 0 10px;
    background: #f8fafc;
    border-radius: 0 4px 4px 0;
    pointer-events: auto;
  }

  .menu-item-has-children.submenu-open > .sub-menu {
    display: block;
  }

  .sub-menu li > a {
    padding: 11px 16px;
    font-size: 13.5px;
    color: #2e3e52;
    display: block;
    text-decoration: none;
  }

  .sub-menu li > a::after {
    display: none;
  }

  /* Mobile Drawer Actions */
  .mobile-nav-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px 24px 30px;
    border-top: 1px solid var(--line);
    background: #ffffff;
  }

  .mobile-cta {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
    font-size: 13.5px;
    border-radius: var(--radius);
  }

  .mobile-phone {
    display: block;
    text-align: center;
    font-size: 13.5px;
    font-weight: 800;
    color: var(--navy);
    text-decoration: none;
    padding: 6px 0;
  }

  /* Hero Section Adaptations */
  .aa-hero,
  .service-hero,
  .page-hero {
    min-height: auto;
    padding: 60px 0;
  }

  .hero-inner,
  .aa-hero-grid,
  .service-hero-grid {
    grid-template-columns: 1fr;
    padding: 30px 0 40px;
    gap: 36px;
  }

  .aa-hero-why-us .hero-inner {
    grid-template-columns: 1fr !important;
    padding: 40px 0 50px;
    gap: 36px;
    min-height: auto;
  }

  .aa-hero-why-us .hero-copy {
    max-width: 100%;
    padding: 0;
  }

  .aa-hero-why-us .why-us-hero-stage {
    justify-content: center;
    width: 100%;
  }

  .why-card {
    max-width: 100%;
  }

  .hero-stage {
    min-height: 360px;
  }

  .hero-photo,
  .service-image-large,
  .story-photo {
    height: 380px;
    box-shadow: 16px 16px 0 var(--red);
  }

  .service-hero-inner {
    margin: auto;
    padding: 50px 0 40px;
  }

  .service-number {
    position: static;
    margin-top: 20px;
    text-align: right;
  }

  /* Grid Layouts on Tablet */
  .intro-grid,
  .story-grid,
  .service-intro-grid,
  .contact-grid,
  .price-layout,
  .launch-grid,
  .efficiency-grid,
  .service-tech-qc .tech-qc-grid,
  .service-operational-workflow .workflow-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .service-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .platform-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .service-lifecycle .lifecycle-steps,
  .workflow-detail-grid,
  .stats-grid,
  .steps-grid,
  .feature-grid,
  .feature-grid-4,
  .feature-grid-3,
  .logo-wall,
  .workflow-grid,
  .benefit-grid,
  .process-grid,
  .process-grid-4,
  .process-grid-5 {
    grid-template-columns: 1fr 1fr;
  }

  .footer-main {
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 35px;
    padding: 60px 0 40px;
  }

  .cta-panel {
    display: block;
    padding: 40px 30px;
  }
  .cta-panel .btn {
    margin-top: 20px;
  }
}

/* 4. Small Tablet & Large Phone (<= 768px) */
@media (max-width: 768px) {
  .header-actions {
    display: none;
  }

  .footer-main {
    grid-template-columns: 1fr 1fr;
    gap: 30px;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .section-head {
    display: block;
    margin-bottom: 35px;
  }

  .section-head > p {
    margin-top: 14px;
  }
}

/* 5. Mobile Screens (<= 640px) */
@media (max-width: 640px) {
  .container {
    width: min(100% - 28px, 100%);
  }

  .section {
    padding: 34px 0;
  }

  /* Headings & Text Fluidity */
  .section-head h2,
  .intro-grid h2,
  .story-content h2,
  .service-intro h2,
  .contact-copy h2,
  .narrow-copy h2,
  .cta-panel h2 {
    font-size: clamp(27px, 6.5vw, 36px);
    line-height: 1.05;
    letter-spacing: -.03em;
  }

  .hero-copy h1,
  .aa-hero h1,
  .service-hero h1,
  .page-hero h1 {
    font-size: clamp(30px, 7.5vw, 40px);
    line-height: 1.05;
    letter-spacing: -.04em;
    margin: 16px 0;
  }

  .hero-copy > p,
  .service-hero p,
  .page-hero p,
  .intro-copy > p,
  .rich-copy {
    font-size: 15.5px;
    line-height: 1.65;
  }

  /* Touch Input Optimization (prevents iOS auto-zoom) */
  input, select, textarea {
    font-size: 16px !important;
  }

  /* Hero Section */
  .hero-stage {
    min-height: 280px;
    overflow: hidden;
  }

  .hero-photo {
    inset: 0 0 20px 10px;
    box-shadow: 12px 12px 0 rgba(229, 29, 42, 0.85);
  }

  .hero-float {
    left: 0;
    bottom: 0;
    width: min(270px, 92%);
    padding: 16px;
  }

  .hero-float strong {
    font-size: 16px;
    margin: 6px 0 12px;
  }

  .hero-proof {
    gap: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* Why Us Card */
  .why-us-hero-stage {
    min-height: auto;
  }

  .why-card {
    padding: 20px 16px;
    border-radius: 12px;
  }

  .why-card-header {
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 12px;
    margin-bottom: 14px;
  }

  .why-comp-row {
    padding: 9px 11px;
    gap: 10px;
  }

  .comp-content strong {
    font-size: 13px;
  }

  .comp-content span {
    font-size: 11px;
  }

  .comp-metric {
    font-size: 11px;
    padding: 3px 7px;
  }

  .why-card-footer {
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 14px;
  }

  .footer-stat strong {
    font-size: 20px;
  }

  .footer-badge {
    text-align: left;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Single Column Stacks for Cards */
  .service-cards,
  .platform-grid,
  .workflow-detail-grid,
  .impact-grid,
  .mosaic-grid,
  .service-lifecycle .lifecycle-steps,
  .feature-grid,
  .feature-grid-4,
  .feature-grid-3,
  .feature-grid-2,
  .logo-wall,
  .workflow-grid,
  .benefit-grid,
  .process-grid,
  .process-grid-4,
  .process-grid-5,
  .tech-qc-grid,
  .qc-list,
  .price-points,
  .stats-grid,
  .steps-grid {
    grid-template-columns: 1fr;
  }

  .stat-cell {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px 14px;
  }

  .stat-cell:last-child {
    border-bottom: none;
  }

  .rule-stats {
    grid-template-columns: 1fr;
    margin-top: 24px;
  }

  .rule-stats > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 14px 0;
  }

  .rule-stats > div:last-child {
    border-bottom: none;
  }

  /* Service Directory Row */
  .service-row {
    grid-template-columns: 32px 1fr 24px;
    gap: 12px;
    padding: 18px 0;
  }

  .service-main b {
    font-size: 18px;
  }

  .service-main small {
    font-size: 13px;
    line-height: 1.4;
  }

  .service-arrow {
    font-size: 20px;
  }

  /* Pricing Box */
  .price-box {
    min-height: auto;
    padding: 30px 20px;
    border-radius: var(--radius);
  }

  .price-box strong {
    font-size: clamp(52px, 14vw, 76px);
    margin: 8px 0;
  }

  /* Contact Form */
  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .contact-form-card {
    padding: 22px 16px;
    border-radius: 8px;
  }

  .contact-links strong {
    font-size: 16px;
  }

  .story-photo,
  .service-large-image,
  .launch-image {
    height: 320px;
    min-height: 320px;
  }

  .service-number {
    display: none;
  }

  /* Footer */
  .footer-main {
    grid-template-columns: 1fr;
    gap: 26px;
    padding: 50px 0 30px;
  }

  .footer-brand img {
    width: 170px;
  }

  .footer-bottom {
    display: block;
    text-align: center;
  }

  .footer-bottom span {
    display: block;
    margin: 6px 0;
  }
}

/* 6. Extra Small Screens (<= 380px) */
@media (max-width: 380px) {
  .container {
    width: min(100% - 20px, 100%);
  }

  .site-logo {
    width: 145px;
  }

  .hero-copy h1,
  .aa-hero h1,
  .service-hero h1,
  .page-hero h1 {
    font-size: 27px;
  }

  .btn {
    padding: 12px 18px;
    font-size: 12px;
  }

  .price-box strong {
    font-size: 48px;
  }

  .stat-value {
    font-size: 38px;
  }

  .why-card {
    padding: 16px 12px;
  }
}
