/* latest cars */

.latest-cars {
  padding-block: 100px;

  background-color: #f8f9fb;

  scroll-margin-top: 120px;
}

/* section intro */

.section-intro {
  max-width: 760px;

  margin-inline: auto;

  text-align: center;
}

.section-eyebrow {
  display: block;

  margin: 0 0 14px;

  color: var(--color-primary);

  font-size: 13px;
  font-weight: 700;

  letter-spacing: 0.14em;

  text-transform: uppercase;
}

.section-title {
  margin: 0;

  color: #111827;

  font-size: clamp(28px, 3vw, 36px);
  font-weight: 800;

  line-height: 1.1;
  letter-spacing: -0.035em;
}

.section-description {
  max-width: 650px;

  margin:
    14px
    auto
    0;

  color: #4a5568;

  font-size: 16px;

  line-height: 1.55;
}

/* cars grid */

.cars-grid {
  display: grid;

  grid-template-columns:
    repeat(3, minmax(0, 1fr));

  gap: 28px;

  margin-top: 28px;
}

/* car card */

.car-card {
  overflow: hidden;

  background-color: #ffffff;

  border-radius: 16px;

  box-shadow:
    0 2px 6px rgb(15 23 42 / 8%),
    0 1px 3px rgb(15 23 42 / 6%);

  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease;
}

/* car image */

.car-card-image {
  position: relative;

  width: 100%;
  aspect-ratio: 4 / 3;

  overflow: hidden;

  background-color: #eef0f3;
}

.car-card-image img {
  width: 100%;
  height: 100%;

  object-fit: contain;

  transition: transform 0.35s ease;
}

.car-image-placeholder {
  display: flex;

  width: 100%;
  height: 100%;

  align-items: center;
  justify-content: center;

  color: #94a3b8;

  font-size: 56px;
}

/* image overlay */

.car-card-image::after {
  content: "";

  position: absolute;

  inset: 0;

  z-index: 1;

  background-color: rgb(15 23 42 / 10%);

  opacity: 0;

  pointer-events: none;

  transition: opacity 0.25s ease;
}

/* badges */

.car-card-badges {
  position: absolute;

  top: 12px;
  right: 12px;
  left: 12px;

  z-index: 3;

  display: flex;

  align-items: center;
  justify-content: space-between;

  pointer-events: none;
}

.car-badge {
  display: inline-flex;

  min-height: 26px;

  align-items: center;
  justify-content: center;

  padding-inline: 11px;

  border-radius: 999px;

  color: #ffffff;

  font-size: 12px;
  font-weight: 600;

  line-height: 1;
}

.car-badge-new {
  background-color: #34c38f;
}

.car-badge-vat {
  background-color: #454b55;
}

/* image details button */

.car-image-details {
  position: absolute;

  top: 50%;
  left: 50%;

  z-index: 4;

  display: inline-flex;

  min-height: 42px;

  align-items: center;
  justify-content: center;

  gap: 8px;

  padding-inline: 16px;

  border-radius: 11px;

  background-color: #ffffff;
  color: #111827;

  box-shadow:
    0 4px 14px
    rgb(0 0 0 / 14%);

  font-size: 13px;
  font-weight: 700;

  text-decoration: none;

  opacity: 0;

  pointer-events: none;

  transform:
    translate(-50%, -40%);

  white-space: nowrap;

  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    background-color 0.2s ease,
    color 0.2s ease;
}

.car-image-details:hover {
  background-color: #f8f9fb;

  color: var(--color-primary);
}

.car-image-details i {
  font-size: 15px;
}

/* desktop hover */

@media (hover: hover) and (pointer: fine) {
  .car-card:hover {
    transform: translateY(-4px);

    box-shadow:
      0 12px 28px rgb(15 23 42 / 12%),
      0 3px 8px rgb(15 23 42 / 8%);
  }

  .car-card:hover .car-card-image img {
    transform: scale(1.07);
  }

  .car-card:hover .car-card-image::after {
    opacity: 1;
  }

  .car-card:hover .car-image-details {
    opacity: 1;

    pointer-events: auto;

    transform:
      translate(-50%, -50%);
  }
}

/* keyboard focus */

.car-card:focus-within .car-card-image::after {
  opacity: 1;
}

.car-card:focus-within .car-image-details {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%);
}

.car-image-details:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* touch devices */

@media (hover: none) {
  .car-image-details {
    display: none;
  }
}

/* car body */

.car-card-body {
  padding: 18px 16px 16px;
}

.car-card-heading {
  margin-bottom: 15px;
}

.car-name {
  margin: 0;

  color: #111827;

  font-size: 18px;
  font-weight: 700;

  line-height: 1.25;
}

.car-subtitle {
  margin:
    4px
    0
    0;

  color: #94a3b8;

  font-size: 14px;

  line-height: 1.4;
}

/* car specs */

.car-specs {
  display: grid;

  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  row-gap: 10px;
  column-gap: 18px;

  padding-bottom: 16px;

  border-bottom: 1px solid #edf0f4;
}

.car-spec {
  display: flex;

  min-width: 0;

  align-items: center;

  gap: 7px;

  color: #64748b;

  font-size: 13px;
}

.car-spec i {
  flex-shrink: 0;

  color: #64748b;

  font-size: 14px;
}

.car-spec span {
  overflow: hidden;

  text-overflow: ellipsis;
  white-space: nowrap;
}

/* car bottom */

.car-card-bottom {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 16px;

  padding-top: 16px;
}

.car-price-block {
  display: flex;

  min-width: 0;

  flex-direction: column;

  gap: 4px;
}

.car-price {
  color: #111827;

  font-size: 23px;
  font-weight: 800;

  line-height: 1.1;

  letter-spacing: -0.025em;
}

.car-price-note {
  color: #94a3b8;

  font-size: 12px;
}

/* car details button */

.car-details-button {
  display: inline-flex;

  flex-shrink: 0;

  min-height: 42px;

  align-items: center;
  justify-content: center;

  padding-inline: 18px;

  border-radius: 12px;

  background-color: var(--color-primary);
  color: #ffffff;

  font-size: 13px;
  font-weight: 700;

  text-decoration: none;

  transition:
    transform 0.2s ease,
    background-color 0.2s ease,
    opacity 0.2s ease;
}

.car-details-button:hover {
  transform: translateY(-1px);

  background-color: var(--color-accent);

  opacity: 0.95;
}

/* offer link */

.offer-action {
  display: flex;

  justify-content: center;

  margin-top: 52px;
  margin-bottom: 52px;
}

.offer-link {
  display: inline-flex;

  align-items: center;

  gap: 13px;

  color: #111827;

  font-size: 15px;
  font-weight: 600;

  text-decoration: none;

  transition:
    color 0.2s ease,
    gap 0.2s ease;
}

.offer-link:hover {
  gap: 18px;

  color: var(--color-accent);
}

/* tablet */

@media (max-width: 900px) {
  .cars-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }
}

/* mobile */

@media (max-width: 600px) {
  .latest-cars {
    padding-block: 64px;
  }

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

  .section-description {
    font-size: 14px;
  }

  .cars-grid {
    grid-template-columns: 1fr;

    gap: 20px;

    margin-top: 28px;
  }

  .car-card-body {
    padding: 16px;
  }

  .car-name {
    font-size: 17px;
  }

  .car-subtitle {
    font-size: 13px;
  }

  .car-specs {
    column-gap: 12px;
  }

  .car-spec {
    font-size: 12px;
  }

  .car-price {
    font-size: 21px;
  }

  .car-details-button {
    min-height: 40px;

    padding-inline: 16px;

    font-size: 12px;
  }

  .offer-action {
    margin-top: 38px;
  }
}

.car-card-image {
  display: block;
  color: inherit;
  text-decoration: none;
}

.car-card-image:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: -3px;
}
