/*===============================================
  CARVETECH - Responsive Stylesheet
  ===============================================*/

/*===============================================
  LARGE DESKTOP (1440px and below)
  ===============================================*/
@media (max-width: 1440px) {
  :root {
    --container-width: 1200px;
  }

  .mega-menu-wrapper {
    width: 800px;
  }

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

/*===============================================
  DESKTOP (1200px and below)
  ===============================================*/
@media (max-width: 1200px) {
  :root {
    --container-width: 960px;
  }

  h1 { font-size: 50px; }
  h2 { font-size: 38px; }

  .hero-title {
    font-size: 50px;
  }

  .section-title {
    font-size: 38px;
  }

  .page-banner-title {
    font-size: 44px;
  }

  .about-grid {
    gap: 50px;
  }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .team-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
  }

  .mega-menu-wrapper {
    width: 700px;
  }

  .mega-menu-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .shop-layout {
    grid-template-columns: 240px 1fr;
  }

  .shop-products {
    grid-template-columns: repeat(2, 1fr);
  }

  .single-service-layout {
    grid-template-columns: 1fr 300px;
  }

  .pricing-card.featured {
    transform: none;
  }

  .pricing-card.featured:hover {
    transform: translateY(-5px);
  }
}

/*===============================================
  LAPTOP (992px and below)
  ===============================================*/
@media (max-width: 992px) {
  :root {
    --container-width: 720px;
    --section-padding: 80px;
  }

  h1 { font-size: 42px; }
  h2 { font-size: 32px; }
  h3 { font-size: 22px; }

  .section-title {
    font-size: 32px;
  }

  .hero {
    height: 600px;
  }

  .hero-title {
    font-size: 42px;
  }

  .hero-desc {
    font-size: 16px;
  }

  .page-banner {
    height: 320px;
  }

  .page-banner-title {
    font-size: 38px;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .about-section {
    padding-top: 80px;
  }

  .about-experience-badge {
    right: 20px;
    bottom: 20px;
  }

  .industries-grid,
  .portfolio-grid,
  .pricing-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .cta-banner-content {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .process-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .testimonials-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .testimonials-cards {
    grid-template-columns: 1fr;
  }

  .faq-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .contact-info-cards {
    grid-template-columns: 1fr 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }

  .stat-number {
    font-size: 42px;
  }

  .stats-number {
    font-size: 56px;
  }

  .hero-service-cards .container {
    grid-template-columns: 1fr;
  }

  .hero-service-cards {
    position: relative;
    bottom: auto;
    padding: 40px 0 0;
  }

  .hero {
    /* .hero is `display:flex` (row) on desktop. Once .hero-service-cards stops
       being absolutely positioned it becomes a flex ITEM, so the hero text and
       the three cards were being squeezed side-by-side on tablet/phone.
       Switching to block stacks them properly. */
    display: block;
    height: auto;
    padding: 120px 0 80px;
  }

  .hero > .container {
    position: relative;
    z-index: 2;
  }

  .nav-list > li > a {
    padding: 0 12px;
    font-size: 14px;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .shop-layout {
    grid-template-columns: 1fr;
  }

  .shop-sidebar {
    order: -1;
  }

  .single-service-layout {
    grid-template-columns: 1fr;
  }

  .service-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .service-sidebar > * {
    flex: 1;
    min-width: 280px;
  }
}

/*===============================================
  TABLET (768px and below)
  ===============================================*/
@media (max-width: 768px) {
  :root {
    --container-width: 100%;
    --section-padding: 60px;
  }

  h1 { font-size: 36px; }
  h2 { font-size: 28px; }

  .section-title {
    font-size: 28px;
  }

  .hero-title {
    font-size: 36px;
  }

  .page-banner-title {
    font-size: 32px;
  }

  .hero {
    padding: 100px 0 60px;
  }

  .hero-desc {
    font-size: 15px;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Mobile nav */
  .header-inner {
    height: 70px;
  }

  /* Mobile nav - show hamburger */
  .mobile-menu-label {
    display: block;
  }

  /* Logo must shrink so the hamburger always has room */
  .logo img {
    max-height: 44px;
    width: auto;
  }

  /* ---- Slide-out drawer -------------------------------------------------
     .main-nav inherits `display:flex; align-items:center` from style.css.
     A centred flex child inside a scrolling box pushes its own top out of
     reach - that is why the first menu items were "hiding inside the screen".
     Forcing block layout + top alignment makes the whole list scrollable. */
  .main-nav {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;        /* avoids the cut-off bottom in mobile browsers */
    background: var(--white);
    z-index: 1002;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-top: 0;
    padding-bottom: 40px;
    box-shadow: 5px 0 20px rgba(0,0,0,0.1);
  }

  .mobile-menu-toggle:checked ~ .header .main-nav {
    transform: translateX(0);
  }

  /* .header is a stacking context (sticky + z-index), so the drawer inside it
     can never beat the backdrop unless the header itself is lifted above it. */
  .mobile-menu-toggle:checked ~ .header {
    z-index: 1003;
  }

  /* Tap-anywhere-outside backdrop */
  .mobile-nav-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1001;
    cursor: pointer;
  }

  .mobile-menu-toggle:checked ~ .mobile-nav-overlay {
    opacity: 1;
    visibility: visible;
  }

  /* Close bar pinned to the top of the drawer */
  .mobile-nav-close {
    display: block;
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 12px 20px;
    text-align: right;
    font-size: 30px;
    line-height: 1;
    color: var(--heading);
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    user-select: none;
  }

  /* Stop the page behind the drawer from scrolling */
  html:has(.mobile-menu-toggle:checked),
  body:has(.mobile-menu-toggle:checked) {
    overflow: hidden;
  }

  .nav-list {
    flex-direction: column;
    height: auto;
    align-items: flex-start;
  }

  .nav-list > li {
    height: auto;
    width: 100%;
    flex-direction: column;
  }

  .nav-list > li > a {
    height: auto;
    padding: 14px 20px;
    width: 100%;
    border-bottom: 1px solid var(--border-color);
  }

  /* Show dropdowns inline on mobile */
  .products-dropdown,
  .sub-flyout,
  .sub-flyout-2,
  .submenu {
    position: static;
    width: 100%;
    opacity: 1;
    visibility: visible;
    box-shadow: none;
    border: none;
    border-left: 3px solid var(--primary);
    padding: 0;
  }

  .products-dropdown > li > a,
  .sub-flyout > li > a,
  .sub-flyout-2 > li > a,
  .submenu > li > a {
    padding: 12px 20px 12px 30px;
    font-size: 13px;
  }

  .sub-flyout > li > a {
    padding-left: 40px;
  }

  .sub-flyout-2 > li > a {
    padding-left: 50px;
  }

  .sub-flyout-2 .sub-flyout-2 > li > a {
    padding-left: 60px;
  }

  .arrow {
    display: none;
  }

  .header-cta {
    display: none;
  }

  /* REMOVED: a duplicate `.nav-list > li > a { padding: 0 10px; font-size: 13px; }`
     used to sit here. Being later in the file it overrode the drawer's
     `padding: 14px 20px`, collapsing every menu row to a thin unreadable line. */

  .industries-grid,
  .portfolio-grid,
  .pricing-grid,
  .team-grid {
    grid-template-columns: 1fr;
  }

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

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

  .contact-info-cards {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

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

  .footer-bottom-inner {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .need-help-inner {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }

  .top-bar-left {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .top-bar-inner {
    flex-direction: column;
    gap: 8px;
  }

  .about-features {
    grid-template-columns: 1fr;
  }

  .service-benefits-list {
    grid-template-columns: 1fr;
  }

  .shop-products {
    grid-template-columns: 1fr;
  }

  .category-filter {
    flex-wrap: wrap;
  }

  .filter-btn {
    font-size: 12px;
    padding: 8px 16px;
  }

  .clients-grid {
    gap: 30px;
  }

  .cta-banner {
    padding: 60px 0;
  }
}

/*===============================================
  MOBILE (576px and below)
  ===============================================*/
@media (max-width: 576px) {
  h1 { font-size: 30px; }
  h2 { font-size: 24px; }

  .hero-title {
    font-size: 30px;
  }

  .section-title {
    font-size: 26px;
  }

  .page-banner-title {
    font-size: 28px;
  }

  .stats-number {
    font-size: 48px;
  }

  .stat-number {
    font-size: 36px;
  }

  .pricing-card .price {
    font-size: 42px;
  }

  .btn {
    padding: 14px 24px;
    font-size: 13px;
  }

  .about-image img {
    height: 350px;
  }

  .about-experience-badge {
    width: 110px;
    height: 110px;
  }

  .about-experience-badge .number {
    font-size: 32px;
  }

  .contact-form {
    padding: 24px;
  }

  .industry-card-body {
    padding: 20px;
  }

  .portfolio-card-body {
    padding: 20px;
  }

  .team-card-body {
    padding: 20px 16px;
  }

  .process-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .process-item .btn {
    align-self: flex-end;
  }
}

/*===============================================
  CNC PRODUCT PAGE RESPONSIVE
  ===============================================*/
@media (max-width: 1200px) {
  .product-hero-grid {
    gap: 40px;
  }

  .product-hero-title {
    font-size: 40px;
  }

  .machine-title {
    font-size: 34px;
  }

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

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

  .product-feature-icons {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 992px) {
  .product-hero-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .product-hero-image {
    min-height: 350px;
  }

  .product-hero-title {
    font-size: 36px;
  }

  .machine-layout {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .machine-layout.reverse {
    direction: ltr;
  }

  .machine-title {
    font-size: 32px;
  }

  .product-specs-section > .container > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  .product-info-grid {
    grid-template-columns: 1fr;
  }

  .product-cta-inner {
    flex-direction: column;
    text-align: center;
  }

  .product-cta-text p {
    margin-left: auto;
    margin-right: auto;
  }

  .product-cta-actions {
    justify-content: center;
  }

  .why-choose-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .highlights-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .product-hero-title {
    font-size: 30px;
  }

  .product-feature-icons {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .product-actions {
    flex-direction: column;
  }

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

  .machine-title {
    font-size: 28px;
  }

  .product-sample-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .product-cta-actions {
    flex-direction: column;
    width: 100%;
  }

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

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

  .highlights-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .product-specs-table tbody td,
  .product-specs-table thead th {
    padding: 10px 14px;
    font-size: 13px;
  }
}

@media (max-width: 576px) {
  .product-hero-title {
    font-size: 26px;
  }

  .product-hero-image {
    min-height: 280px;
  }

  .product-sample-grid {
    grid-template-columns: 1fr;
  }

  .why-choose-grid {
    grid-template-columns: 1fr;
  }

  .highlights-grid {
    grid-template-columns: 1fr 1fr;
  }

  .machine-image-wrapper {
    padding: 20px;
    min-height: 280px;
  }

  .product-feature-icon-item {
    padding: 10px 4px;
  }
}

/*===============================================
  SMALL MOBILE (400px and below)
  ===============================================*/
@media (max-width: 400px) {
  h1 { font-size: 26px; }

  .hero-title {
    font-size: 26px;
  }

  .section-title {
    font-size: 22px;
  }

  .page-banner-title {
    font-size: 24px;
  }

  .hero-service-card {
    padding: 24px;
  }

  .footer-newsletter-form {
    flex-direction: column;
  }

  .footer-newsletter-form input,
  .footer-newsletter-form button {
    width: 100%;
  }
}
