/* ════════════════════════════════════════════
   RESPONSIVE — LAPTOP (still no scroll)
   ════════════════════════════════════════════ */
@media (max-width: 1100px) {
  main {
    grid-template-columns: 1fr 1.1fr;
    gap: 14px;
    padding: 10px 18px 10px calc(var(--nav-w) + 10px);
  }
  .plane-scene { width: 160px; height: 160px; }
  .plane-glow { width: 180px; height: 180px; }
  .welcome-block h1 { font-size: clamp(20px, 2.5vw, 30px); }
}

/* ════════════════════════════════════════════
   TABLET — still no scroll, more compact
   ════════════════════════════════════════════ */
@media (max-width: 1024px) and (min-width: 768px) {
  main {
    grid-template-columns: 0.9fr 1.1fr;
    padding: 8px 14px 8px calc(var(--nav-w) + 8px);
    gap: 12px;
  }
  .left-panel { gap: 4px; }
  .plane-scene { width: 140px; height: 140px; }
  .plane-glow { width: 160px; height: 160px; }
  .welcome-block h1 { font-size: clamp(18px, 2.4vw, 28px); }
  .welcome-block p { font-size: 11px; }
  .search-box { padding: 14px; gap: 20px; }
  .deal-card { min-width: 220px; height: 76px; }
  .deal-logo { width: 38px; height: 38px; }
  .deal-price { font-size: 20px; }
  .deals-footer { padding: 8px 18px 8px calc(var(--nav-w) + 12px); }
}

/* ════════════════════════════════════════════
   MOBILE — scrollable + hamburger drawer
   ════════════════════════════════════════════ */
@media (max-width: 767px) {

  :root {
    --header-h: 56px;
    --nav-w: 0px;
  }

  /* Body padding-top — ფიქსირებული ჰედერი + safe-area */
  body {
    padding-top: var(--header-h);
    -webkit-tap-highlight-color: transparent; /* clean taps */
  }

  /* Buttons / links — clean tap feedback */
  button, a, [role="button"] {
    -webkit-tap-highlight-color: transparent;
  }

  /* Header — safe area + ZE HIGH z-index */
  .site-header {
    grid-template-columns: 56px 1fr 56px;
    padding: 0 12px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    height: var(--header-h);
    background: rgba(8, 18, 37, 0.92); /* solid-ისებრ — content არ უკრავს თვალს */
    backdrop-filter: var(--backdrop-blur-lg);
    -webkit-backdrop-filter: var(--backdrop-blur-lg);
    border-bottom-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 16px rgba(3, 11, 26, 0.25);
    z-index: 200 !important; /* main z-index 1 ქვევით — sccroll უკან რჩება */
  }

  /* Brand & call-btn explicit grid placement */
  .site-header .brand {
    grid-column: 2;
    justify-content: center;
    min-width: 0;
  }
  .site-header .h-right {
    grid-column: 3;
    justify-content: flex-end;
  }

  /* h-left დამალულია (sidebar-ში გადადის) */
  .h-left { display: none; }

  /* Brand — responsive font + overflow ellipsis ცარიელ ფანჯრებზე */
  .brand-name {
    font-size: clamp(13px, 9.2vw, 24px);
    color: var(--white);
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .brand-name em { color: var(--color-cyan-400); }

  /* call-btn icon-only (44×44 — WCAG touch target) */
  .call-btn {
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 50%;
    gap: 0;
    justify-content: center;
    flex-shrink: 0;
  }
  .call-btn-text { display: none; }
  .call-btn i { font-size: 14px; margin: 0; }

  /* Main: stack + scroll — დაბალი z, რომ header-ის უკან გადიოდეს */
  main {
    position: relative;
    grid-template-columns: 1fr;
    padding: 4px 12px 14px; /* top პატარა — H1 header-თან ახლოს */
    gap: 14px;
    height: auto;
    overflow: visible;
    z-index: 1; /* header (200)-ის ქვევით — content scroll-ი მის უკან რჩება */
  }

  .right-panel {
    position: relative;
    /* z-index შემცირდა — popovers position:fixed-ით escape-ი ხდება */
  }

  .left-panel {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0;
  }

  .welcome-block {
    max-width: 100%;
    text-align: center; /* H1 + P გაცენტრებული */
  }
  .welcome-block h1 { font-size: clamp(22px, 5.8vw, 30px); line-height: 1.18; }
  .welcome-block p { font-size: 12px; margin-top: 8px; }

  /* Plane illustration მობაილზე იმალება */
  .plane-scene { display: none; }

  .right-panel { padding: 0; }

  /* Search box */
  .search-box { padding: 16px; gap: 22px; border-radius: 18px; }

  /* Cities: flex column, swap inline-centered between fields */
  .sb-cities {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .sb-cities .sb-swap {
    position: static;
    align-self: center;
    margin: -8px 0;
    transform: rotate(90deg);
    z-index: 5;
  }

  .sb-cities .sb-swap:hover {
    transform: rotate(270deg);
  }

  /* Popover-ები — position:fixed JS-ით coords-ით.
     z-index ZE high, რომ header-ის ზემოთაც იყოს ხილული. */
  .cal-popover.show,
  .pax-popover.show {
    position: fixed !important;
    z-index: 9999 !important;
    max-width: 320px;
    width: calc(100vw - 32px);
  }

  /* Footer: in flow, header-ის ქვევით ნორმალურად */
  .deals-footer {
    position: static; /* in flow — main-ის ქვემოთ ბუნებრივად */
    height: auto;
    padding: 14px 12px;
    gap: 10px;
    overflow: visible;
    margin-top: 60px; /* main-სა და footer-ს შორის სუფთა breathing */
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  /* მობაილზე scroll — სრული სიგანის track + readable cards */
  .deals-track {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .deals-track > .deal-card {
    flex: 0 0 280px;
    min-width: 280px;
    scroll-snap-align: start;
  }
}

/* Small phones — extra compact */
@media (max-width: 380px) {
  .site-header { grid-template-columns: 50px 1fr 44px; padding: 0 10px; }
  .call-btn { width: 38px; height: 38px; }

  .left-panel { flex-direction: column; align-items: flex-start; gap: 10px; }
  .welcome-block { max-width: 100%; }
  .welcome-block h1 { font-size: clamp(20px, 7vw, 26px); }
  .plane-scene { display: none; }

  main { padding: 12px 10px; gap: 14px; }

  .search-box { padding: 14px; gap: 18px; border-radius: 16px; }
  .sb-dates { grid-template-columns: 1fr; gap: 22px; }

  .deal-card { min-width: 240px; padding: 10px 12px; }
  .deal-logo { width: 38px; height: 38px; }
  .deal-route { font-size: 12px; }
  .deal-price { font-size: 16px; }

  /* Newsletter popup — full-screen-ად */
  .nl-card { border-radius: 16px; }
  .nl-hero { height: 150px; }
  .nl-hero-img img { max-height: 110px; }
  .nl-body { padding: 20px 18px 16px; gap: 12px; }
  .nl-title { font-size: 18px; }
  .nl-input, .nl-submit { height: 44px; }
}

/* iPhone notch — extra bottom safe area */
@supports (padding: env(safe-area-inset-bottom)) {
  @media (max-width: 767px) {
    .deals-footer {
      padding-bottom: max(14px, env(safe-area-inset-bottom));
    }
  }
}
