/* Media queries, вынесены отдельно для удобной поддержки */
@media (max-width: 992px) {
  .primary-nav {
    display: none;
  }
}

@media (min-width: 768px) {
  .site-footer__main {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    column-gap: clamp(3rem, 2rem + 2vw, 5rem);
  }

  .site-footer__cta {
    margin-left: auto;
  }

  .site-footer__bottom {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .consult__fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(1.5rem, 1rem + 1vw, 2rem);
  }
}

@media (min-width: 992px) {
  .footer-nav__columns {
    gap: clamp(3rem, 2rem + 2vw, 5rem);
  }

  .site-footer__main {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .fast-hero__title {
    text-align: left;
  }

  .fast-hero__grid {
    grid-template-columns: minmax(0, 0.6fr) minmax(0, 1fr);
    align-items: start;
  }

  .fast-docs__grid {
    gap: clamp(2rem, 1.6rem + 1vw, 3rem);
  }
}

@media (min-width: 768px) {
  .steps__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(3rem, 2rem + 2vw, 5rem);
  }

  .about-intro__text {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(2rem, 1.5rem + 1vw, 2.5rem);
  }

  .license-steps__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .steps__list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .license-steps__list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .consult__content {
    padding: clamp(3.25rem, 2.8rem + 1.5vw, 4.75rem);
  }
}

@media (min-width: 640px) {
  .contacts__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fast-hero__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(2rem, 1.5rem + 1vw, 2.5rem);
  }

  .fast-benefits__list,
  .fast-benefits__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fast-docs__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .fast-section-heading--center {
    text-align: center;
    max-width: 780px;
    margin-inline: auto;
  }

  .why-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "online photo"
      "autodrome photo"
      "branches transparent"
      "instructors instructors";
  }

  .why-card--photo {
    aspect-ratio: auto;
    min-height: clamp(18rem, 16rem + 4vw, 24rem);
  }
}

@media (min-width: 1200px) {
  .contacts__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .fast-benefits__list,
  .fast-benefits__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .why-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-areas:
      "online empty photo autodrome"
      "branches transparent instructors instructors";
  }

  .why-grid::before {
    content: "";
    display: block;
    grid-area: empty;
  }

  .why-card--photo {
    min-height: auto;
  }
}

@media (min-width: 1440px) {
  :root {
    --container-max: 1440px;
  }

  .fast-hero {
    padding-block: clamp(4rem, 3.5rem + 1vw, 5.5rem);
  }

  .fast-benefits__list,
  .fast-benefits__grid,
  .fast-docs__grid,
  .why-grid {
    gap: clamp(2.5rem, 2rem + 1vw, 3.5rem);
  }

  .fast-doc-card__image {
    width: min(100%, 420px);
  }
}

@media (max-width: 640px) {
  .schedule-table thead {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    position: absolute;
    width: 1px;
  }

  .schedule-table tbody tr {
    display: grid;
    gap: 0.75rem;
    padding: 1rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
  }

  .schedule-table tbody tr:last-child {
    border-bottom: 0;
  }

  .schedule-table tbody td {
    display: grid;
    gap: 0.4rem;
    padding: 0;
    color: var(--color-text);
  }

  .schedule-table tbody td::before {
    content: attr(data-label);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-subtle);
  }
}

@media (max-width: 768px) {
  .about-highlights__card--hidden {
    display: none;
  }

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

  .about-highlights__title {
    max-width: 100%;
  }

  /* Сбрасываем позиционирование для мобильных */
  .about-highlights__card:nth-child(1),
  .about-highlights__card:nth-child(2),
  .about-highlights__card:nth-child(3),
  .about-highlights__card:nth-child(4),
  .about-highlights__card:nth-child(5),
  .about-highlights__card:nth-child(6),
  .about-highlights__card:nth-child(7),
  .about-highlights__card:nth-child(8),
  .about-highlights__card:nth-child(9),
  .about-highlights__card:nth-child(10) {
    grid-column: auto;
    grid-row: auto;
  }
}

@media (max-width: 480px) {
  .about-highlights__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .about-highlights__card {
    padding: 1rem;
  }

  .about-highlights__card--car,
  .about-highlights__card--girl {
    padding: 0;
  }
}

@media (min-width: 768px) and (max-width: 992px) {
  .about-highlights__grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Адаптируем позиционирование для 3 колонок */
  .about-highlights__card:nth-child(1),
  .about-highlights__card:nth-child(2),
  .about-highlights__card:nth-child(3),
  .about-highlights__card:nth-child(4),
  .about-highlights__card:nth-child(5),
  .about-highlights__card:nth-child(6),
  .about-highlights__card:nth-child(7),
  .about-highlights__card:nth-child(8),
  .about-highlights__card:nth-child(9),
  .about-highlights__card:nth-child(10) {
    grid-column: auto;
    grid-row: auto;
  }
}

@media (min-width: 992px) {
  .schedule__layout {
    grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
    align-items: start;
  }

  .schedule__sidebar {
    position: sticky;
    top: clamp(6rem, 5rem + 2vw, 7.5rem);
  }
}

@media (max-width: 480px) {
  .site-header__phone,
  .header__actions-phone {
    display: none;
  }

  .site-header__actions {
    justify-self: end;
    margin-left: auto;
  }
}

/* Reviews section grid for video cards */
@media (max-width: 768px) {
  .about-us__list {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .reviews-tabs__content .video-grid {
    grid-template-columns: 1fr;
  }

  .about-us__title {
    font-size: clamp(1.75rem, 5vw, 3rem);
  }

  .reviews-tabs__header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .reviews-tabs__show-all {
    align-self: flex-end;
    font-size: 0.9rem;
  }
}

@media (min-width: 768px) and (max-width: 1200px) {
  .about-us__list {
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(1rem, 2vw, 1.5rem);
  }

  .reviews-tabs__content .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .about-us__list {
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(1rem, 2vw, 1.5rem);
  }

  .reviews-tabs__content .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(2rem, 1.8rem + 1vw, 2.5rem);
  }
}
