/* ======================================================================
   iPad fixes (portrait + landscape)
   - fixes background sizing
   - fixes burger menu positioning & overlay
   - refines paddings/typography
   - refines grids for iPad
   ====================================================================== */

/* iPad portrait + landscape (Safari) */
@media only screen
  and (min-width: 768px)
  and (max-width: 1024px) {

  /* ---------- Background / overlays ---------- */
  .static-background {
    /* чтобы фон не “прыгал” и нормально кропался */
    background-position: center;
    background-size: cover;
    background-attachment: scroll; /* iOS любит scroll */
  }

  .background-overlay {
    /* чуть мягче, чтобы читабельность была как на десктопе */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  /* ---------- Page / container paddings ---------- */
  .page-content {
    width: min(980px, calc(100% - 48px));
    padding-left: 24px;
    padding-right: 24px;
  }

  /* ---------- Typography ---------- */
  .main-title {
    font-size: 2.4rem;
    line-height: 1.15;
  }

  .main-subtitle {
    font-size: 1.05rem;
    max-width: 760px;
  }

  /* ---------- Header / Nav ---------- */
  header {
    padding: 14px 18px;
  }

  /* Бургер оставляем видимым, но меню открываем нормально */
  .nav-toggle {
    display: inline-flex;
  }

  /* На iPad часто меню “висит по центру” из-за позиционирования в других CSS.
     Мы жестко задаём поведение: меню — как выезжающий/выпадающий блок под хедером */
  header .nav {
    position: fixed;
    left: 0;
    right: 0;
    top: 72px; /* под хедером */
    display: none;
    z-index: 1200;

    /* стекло */
    background: rgba(12, 12, 12, 0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 16px 22px;
  }

  header.is-nav-open .nav {
    display: block;
  }

  header .nav ul {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 18px;
    align-items: center;
    justify-content: center;
  }

  header .nav ul li a {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    text-align: center;
  }

  /* оверлей кликабельный под меню (чтобы закрывать тапом) */
  header.is-nav-open::after {
    content: "";
    position: fixed;
    inset: 0;
    top: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1100;
  }

  /* Навигационное меню должно быть выше оверлея */
  header.is-nav-open .nav {
    z-index: 1200;
  }

  /* ---------- Home buttons ---------- */
  .hero-buttons {
    gap: 14px;
    flex-wrap: wrap;
  }

  .btn {
    padding: 0.85rem 1.8rem;
    font-size: 0.95rem;
  }

  /* ---------- Services / Cars grids ---------- */
  .services-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }

  .cars-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }

  .car-image {
    height: 220px;
  }

  /* ---------- Workshop layout ---------- */
  .workshop-content {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .workshop-image {
    max-width: 100%;
    max-height: 420px;
    margin-top: 10px;
  }

  .workshop-text {
    padding: 18px;
  }

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

  /* ---------- Contacts layout ---------- */
  .contact-container {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .contact-info,
  .contact-form-container {
    padding: 22px;
  }

  /* Чтобы кнопка выглядела пропорционально на iPad */
  .submit-button {
    min-height: 56px;
    font-size: 1.02rem;
  }

  /* ---------- Footer ---------- */
  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: 22px;
  }

  .footer-container {
    padding: 44px 20px 26px;
  }
}

/* ======================================================================
   iPad Landscape refinements (wider)
   ====================================================================== */
@media only screen
  and (min-width: 1024px)
  and (max-width: 1366px)
  and (orientation: landscape) {

  .page-content {
    width: min(1120px, calc(100% - 72px));
  }

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

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

  .workshop-content {
    grid-template-columns: 1fr 1fr;
    gap: 22px;
  }

  /* Меню на landscape можно оставить как выезжающее,
     но сделаем его компактнее */
  header .nav ul {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* =========================
   iPad: burger menu clean look (no "cards" on items)
========================= */
@media only screen and (min-width: 768px) and (max-width: 1024px) {

    header .nav ul {
      grid-template-columns: 1fr !important;
      gap: 10px !important;
    }
  
    header .nav ul li a {
      background: transparent !important;
      border: none !important;
      border-radius: 0 !important;
      padding: 10px 6px !important;
      text-align: center !important;
      font-size: 1.1rem !important;
    }
  
    header .nav ul li a::after {
      left: 50% !important;
      transform: translateX(-50%) !important;
    }
  }
  
/* =========================
   iPad: car images nicer proportions
========================= */
@media only screen and (min-width: 768px) and (max-width: 1024px) {

    .car-image {
      height: auto !important;
      aspect-ratio: 16 / 9 !important;
      background-size: cover !important;
      background-position: center !important;
    }
  
    /* чуть больше воздуха в карточке */
    .car-details {
      padding: 18px !important;
    }
  }
  
/* =========================
   iPad: workshop tap-to-swap should work (coarse pointer)
========================= */
@media (pointer: coarse) {

    .image-workshop { cursor: pointer; }
  
    .image-workshop:hover .image-workshop__layer--main { opacity: 1; transform: none; }
    .image-workshop:hover .image-workshop__layer--hover { opacity: 0; transform: none; }
  
    .image-workshop.is-flipped .image-workshop__layer--main {
      opacity: 0;
      transform: scale(1.02);
    }
    .image-workshop.is-flipped .image-workshop__layer--hover {
      opacity: 1;
      transform: scale(1);
    }
  }

/* =========================
   iPad: workshop image proportions (stable for absolute layers)
========================= */
@media only screen and (min-width: 768px) and (max-width: 1024px) {

    .workshop-image.image-workshop {
      position: relative;
      width: 100%;
      max-width: 100% !important;
  
      /* главное: фиксируем пропорции контейнера */
      aspect-ratio: 16 / 9;
      height: auto !important;
      max-height: none !important;
  
      /* чтобы закругления реально работали */
      border-radius: 16px !important;
      overflow: hidden !important;
  
      /* убираем странные отступы сверху, если были */
      margin-top: 12px !important;
    }
  
    /* слои должны заполнять контейнер */
    .workshop-image.image-workshop .image-workshop__layer {
      position: absolute;
      inset: 0;
      border-radius: 16px !important;
      background-size: cover !important;
      background-position: center !important;
    }
  }
  