/* ==========================================================================
   INTEGRITY AUTO GROUP - RESPONSIVE STYLESHEET
   Mobile First & Fluid Breakpoints (1220px, 1040px, 800px, 560px)
   ========================================================================== */

/* 1. Vehicle Grid Breakpoints: 1 col on phones, 2 from 640px, 3 from 1024px, 4 from 1500px */
@media (min-width: 1500px) {
  .cars-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

@media (min-width: 1024px) and (max-width: 1499px) {
  .cars-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .cars-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 639px) {
  .cars-grid {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }
  .car-title {
    font-size: var(--card-title-size-mobile, 26px) !important;
    font-weight: var(--card-title-weight, 800) !important;
    font-family: var(--card-title-font, 'Manrope', sans-serif) !important;
  }
  .car-subline {
    font-size: var(--card-sub-size-mobile, 15px) !important;
    font-weight: var(--card-sub-weight, 500) !important;
    font-family: var(--card-sub-font, 'Inter', sans-serif) !important;
  }
  .car-price-main {
    font-size: var(--card-price-size-mobile, 36px) !important;
    font-weight: var(--card-price-weight, 800) !important;
    font-family: var(--card-price-font, 'Manrope', sans-serif) !important;
  }
  .car-spec-cell .spec-value {
    font-size: var(--card-spec-size-mobile, 17px) !important;
    font-weight: var(--card-spec-weight, 800) !important;
    font-family: var(--card-spec-font, 'Inter', sans-serif) !important;
  }
}

/* 2. Standard Laptops & Desktops (max-width: 1220px) */
@media (max-width: 1220px) {
  .nav {
    gap: 19px;
  }
  .header-inner {
    gap: 15px;
  }
  .header-book {
    padding: 0 16px;
  }
}

/* 3. Tablets Landscape & Small Laptops (max-width: 1040px) */
@media (max-width: 1040px) {
  .nav {
    gap: 13px;
  }
  .nav-link {
    font-size: 11px;
  }
  .header-actions {
    margin-left: 0;
  }
  .header-actions .icon-btn {
    display: none;
  }
  .trust-item {
    padding: 17px 11px;
    gap: 9px;
  }
  .trust-icon {
    height: 36px;
    width: 36px;
  }
  .search-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .search-grid .search-button {
    grid-column: span 3;
  }
  .hero-search {
    bottom: -106px;
  }
  .trust-bar {
    padding-top: 153px;
  }
  .hero {
    min-height: 690px;
  }
  .why-layout {
    gap: 42px;
  }
  .body-types-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
  .body-type-icon {
    width: 90px;
    height: 45px;
  }
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .reviews-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 4. Tablets Portrait & Large Mobile (max-width: 800px) */
@media (max-width: 800px) {
  html {
    scroll-padding-top: 98px;
  }
  .container {
    width: min(100% - 36px, 680px);
  }
  .topbar {
    font-size: 10px;
  }
  .topbar-aside,
  .topbar .aside {
    display: none !important;
  }
  .site-header {
    height: 74px;
  }
  .header-inner {
    gap: 12px;
  }
  .nav {
    display: none !important;
  }
  .header-actions {
    margin-left: auto;
  }
  .header-book {
    display: none !important;
  }
  .menu-toggle {
    display: grid !important;
    width: 41px;
    height: 41px;
  }
  .hero {
    padding: 75px 0 120px;
    min-height: 640px;
  }
  .hero h1 {
    font-size: 43px;
  }
  .hero-lead {
    font-size: 15px;
  }
  .hero-search {
    bottom: -128px;
    padding: 20px;
  }
  .search-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 11px;
  }
  .search-grid .search-button {
    grid-column: span 3;
  }
  .search-note {
    display: none;
  }
  .trust-bar {
    padding-top: 170px;
  }
  .trust-grid {
    grid-template-columns: 1fr 1fr;
  }
  .trust-item:nth-child(2) {
    border-right: 0;
  }
  .trust-item:nth-child(-n+2) {
    border-bottom: 1px solid var(--border);
  }
  .why-layout {
    grid-template-columns: 1fr;
  }
  .why-visual {
    min-height: 300px;
    height: 300px;
    order: 1;
  }
  .why-copy {
    order: 2;
  }
  .cta-layout {
    align-items: flex-start;
    flex-direction: column;
    gap: 24px;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 38px;
  }
  .footer-grid > div:first-child {
    grid-column: span 2;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}

/* 4b. Mobile Vehicle Detail Left-Alignment Fix (Requirement 4: < 768px) */
@media (max-width: 767px) {
  .car-header-flex {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.85rem !important;
    padding-bottom: 1.25rem !important;
    margin-bottom: 1.5rem !important;
  }
  .car-header-title-col {
    width: 100% !important;
    text-align: left !important;
    margin-left: 0 !important;
  }
  .car-header-badge-row {
    justify-content: flex-start !important;
    margin-left: 0 !important;
  }
  .car-detail-title {
    font-size: var(--detail-title-size-mobile, 1.65rem) !important;
    text-align: left !important;
    margin-left: 0 !important;
  }
  .car-detail-subline {
    text-align: left !important;
    margin-left: 0 !important;
  }
  .car-header-price-col {
    width: 100% !important;
    text-align: left !important;
    align-items: flex-start !important;
    margin-left: 0 !important;
  }
  .car-header-price-wrap {
    display: flex !important;
    align-items: baseline !important;
    justify-content: flex-start !important;
    text-align: left !important;
    margin-left: 0 !important;
    width: 100% !important;
    gap: 0.75rem !important;
    flex-wrap: wrap !important;
  }
  .car-detail-price {
    font-size: var(--detail-price-size-mobile, 2.15rem) !important;
    text-align: left !important;
    margin-left: 0 !important;
  }
  .car-detail-old-price {
    text-align: left !important;
  }
  .warranty-highlight-box {
    margin-left: 0 !important;
    align-self: flex-start !important;
    text-align: left !important;
  }
  .warranty-peace-text {
    text-align: left !important;
    margin-left: 0 !important;
  }
}

/* 5. Mobile Phones (max-width: 560px) */
@media (max-width: 560px) {
  html {
    scroll-padding-top: 80px;
  }
  .container {
    width: calc(100% - 32px);
  }
  .topbar-inner {
    height: 30px;
  }
  .site-header {
    height: 68px;
  }
  .header-logo-img {
    height: var(--logo-height-mobile, 40px);
    max-height: 44px;
  }
  .hero {
    padding: 67px 0 125px;
    min-height: 685px;
  }
  .eyebrow {
    font-size: 9px;
    letter-spacing: .08em;
    padding: 7px 12px;
  }
  .hero h1 {
    font-size: clamp(30px, 8.4vw, 42px);
    margin: 25px auto 15px;
  }
  .hero-lead {
    font-size: 13px;
    line-height: 1.8;
  }
  .hero-ctas {
    flex-wrap: wrap;
    margin-top: 22px;
    gap: 9px;
  }
  .hero-ctas .btn-primary,
  .hero-ctas .btn-outline {
    min-height: 43px;
    font-size: 11px;
    padding: 0 14px;
    width: 100%;
  }
  .hero-search {
    bottom: -185px;
    padding: 19px 16px 18px;
    border-radius: 12px;
  }
  .search-top {
    margin-bottom: 13px;
  }
  .search-title {
    font-size: 14px;
  }
  .search-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .search-grid .search-button {
    grid-column: span 2;
    margin-top: 2px;
  }
  .search-grid .form-field:nth-child(3) {
    grid-column: 1;
  }
  .search-grid .form-field:nth-child(4) {
    grid-column: 2;
  }
  .form-field label {
    font-size: 10px;
    margin-bottom: 6px;
  }
  .search-grid select {
    font-size: 12px;
    min-height: 41px;
    padding-left: 11px;
  }
  .search-button {
    min-height: 43px;
  }
  .trust-bar {
    padding-top: 219px;
    padding-bottom: 14px;
  }
  .trust-grid {
    grid-template-columns: 1fr 1fr;
  }
  .trust-item {
    padding: 13px 9px;
    gap: 8px;
  }
  .trust-icon {
    height: 30px;
    width: 30px;
  }
  .trust-icon .icon {
    width: 16px;
    height: 16px;
  }
  .trust-item strong {
    font-size: 10px;
  }
  .trust-item small {
    font-size: 9px;
  }
  .stock-section {
    padding: 48px 0 62px;
  }
  .section-head {
    align-items: flex-start;
    margin-bottom: 22px;
    flex-direction: column;
    gap: 10px;
  }
  .section-head h2 {
    font-size: 30px;
  }
  .section-head p {
    font-size: 13px;
  }
  .body-types-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .body-type-card {
    padding: 16px 8px 14px;
    min-height: 120px;
  }
  .body-type-icon {
    width: 78px;
    height: 39px;
    margin-bottom: 8px;
  }
  .features-grid {
    grid-template-columns: 1fr;
  }
  .reviews-grid {
    grid-template-columns: 1fr;
  }
  .why-section {
    padding: 63px 0;
  }
  .why-visual {
    min-height: 290px;
    height: 290px;
    order: 1;
  }
  .why-copy {
    order: 2;
  }
  .why-label {
    left: 22px;
    bottom: 24px;
  }
  .why-label strong {
    font-size: 21px;
  }
  .why-copy h2 {
    font-size: 31px;
  }
  .cta-section {
    padding: 48px 0;
  }
  .cta-actions {
    flex-wrap: wrap;
    width: 100%;
  }
  .cta-actions .btn-primary,
  .cta-actions .btn-outline {
    width: 100%;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  .footer-grid > div:first-child {
    grid-column: span 1;
  }
}

/* 6. Very Small Phones (320px - 360px): title 22px, price 30px, values 15px */
@media (max-width: 360px) {
  .car-card-media {
    aspect-ratio: 4 / 3 !important;
  }
  .car-card-body {
    padding: 14px 14px 16px !important;
  }
  .car-title {
    font-size: var(--card-title-size-desktop, 22px) !important;
    font-weight: var(--card-title-weight, 800) !important;
    font-family: var(--card-title-font, 'Manrope', sans-serif) !important;
  }
  .car-subline {
    font-size: var(--card-sub-size-desktop, 13px) !important;
    font-weight: var(--card-sub-weight, 500) !important;
    font-family: var(--card-sub-font, 'Inter', sans-serif) !important;
  }
  .car-price-main {
    font-size: var(--card-price-size-desktop, 30px) !important;
    font-weight: var(--card-price-weight, 800) !important;
    font-family: var(--card-price-font, 'Manrope', sans-serif) !important;
  }
  .car-price-old {
    font-size: 14px !important;
  }
  .car-spec-cell {
    padding: 8px 10px !important;
    gap: 7px !important;
  }
  .car-spec-cell .spec-icon {
    width: 22px !important;
    height: 22px !important;
  }
  .car-spec-cell .spec-value {
    font-size: var(--card-spec-size-desktop, 15px) !important;
    font-weight: var(--card-spec-weight, 800) !important;
    font-family: var(--card-spec-font, 'Inter', sans-serif) !important;
  }
  .car-spec-cell .spec-label {
    font-size: 10px !important;
  }
  .btn-card-view {
    font-size: 13px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
