/* ==========================================================================
   Premium Automobile — Mobile & tablet fixes (v1)
   Loaded AFTER the main stylesheet. Written outside of Tailwind's @layer,
   so these rules safely override the generated utility classes.
   To change anything on mobile, edit only this file.
   ========================================================================== */

/* ---------- Global safety net ---------- */
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }                       /* never allow sideways scroll */
img, svg, video { max-width: 100%; }

/* Floating WhatsApp button: respect iPhone home-bar / notch and give it room */
a[aria-label^="Chat with Premium Automobile"] {
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  right: max(1.25rem, env(safe-area-inset-right, 0px));
  min-height: 48px;
}

/* ---------- Hero enquiry card: keep it on the right-hand side on laptops/tablets ---------- */
/* The headline wrapper kept a leftover transform after its entrance animation, which made the
   "Start your enquiry" card position itself inside the text column and cover the headline. */
#top .animate-\[rise_800ms_ease-out_both\] { animation-fill-mode: backwards; }

/* ---------- Footer (all screens) ---------- */
footer {
  /* leaves space so the floating WhatsApp button never covers footer links */
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
}
footer > div {
  color: rgba(255, 255, 255, .58);                 /* was 35% — too faint to read */
  font-size: 11px;
  line-height: 1.7;
  align-items: flex-start;
}
footer .pa-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
}
footer .pa-legal a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;                                /* comfortable thumb target */
  color: rgba(255, 255, 255, .78);
  text-decoration: none;
  letter-spacing: .08em;
  text-transform: uppercase;
  transition: color .2s;
}
footer .pa-legal a:hover,
footer .pa-legal a:focus-visible { color: #6ea3ff; }

@media (min-width: 768px) { footer > div { align-items: center; } }

/* Consent lines added under the enquiry forms */
.pa-inline-link {
  color: #6ea3ff;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.pa-inline-link:hover { color: #fff; }
.pa-form-consent {
  margin-top: .75rem;
  font-size: 10px;
  line-height: 1.5;
  color: rgba(255, 255, 255, .42);
}

/* ---------- Navigation: phones AND tablets use the hamburger menu ---------- */
/* (the full link row only fits from ~1200px; below that it used to wrap/overflow) */
@media (max-width: 1199px) {
  header button[aria-label="Toggle navigation"] {
    display: grid;                                  /* overrides md:hidden up to 1199px */
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
  }
  header nav.hidden { display: none; }              /* desktop link row hidden below 1200px */
  header nav.grid {
    display: grid;                                  /* dropdown also works on tablets */
    gap: 0;
    padding: .25rem 1.25rem 1.25rem;
    max-height: calc(100vh - 76px);
    max-height: calc(100dvh - 76px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  header nav.grid a {
    display: flex;
    align-items: center;
    min-height: 52px;
    font-size: 15px;
    color: rgba(255, 255, 255, .86);
    border-bottom: 1px solid rgba(255, 255, 255, .07);
  }
  header nav.grid a.pa-menu-call {
    justify-content: center;
    margin-top: 1rem;
    border: 1px solid rgba(23, 105, 255, .7);
    background: rgba(23, 105, 255, .14);
    color: #fff;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    font-size: 13px;
  }
}
@media (min-width: 1200px) {
  header nav.grid { display: none; }                /* dropdown never shows on desktop */
}

/* ---------- Phones (up to 767px) ---------- */
@media (max-width: 767px) {

  /* Header: logo + brand name + menu button must fit even at 320px */
  header > div:first-child {
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
    gap: .5rem;
  }
  header a[aria-label="Premium Automobile home"] {
    min-width: 0;
    gap: .5rem;
  }
  header a[aria-label="Premium Automobile home"] > span:first-child {
    width: clamp(72px, 21vw, 96px);
    flex: none;
  }
  header a[aria-label="Premium Automobile home"] > span:last-child { min-width: 0; }
  header a[aria-label="Premium Automobile home"] > span:last-child > span:first-child {
    font-size: clamp(9.5px, 3.05vw, 12px);
    letter-spacing: .12em;
    white-space: nowrap;
  }
  header a[aria-label="Premium Automobile home"] > span:last-child > span:last-child {
    letter-spacing: .24em;
  }
  header > div:first-child > div:last-child { gap: .5rem; flex: none; }

  /* Tighter vertical rhythm — 96px section padding is too much on a phone */
  main > section.py-24 {
    padding-top: 4.5rem;
    padding-bottom: 4.5rem;
  }

  /* Hero */
  #top > .bg-gradient-to-r {
    /* stronger bottom-up shade so text stays readable over the bike photo */
    background-image: linear-gradient(to top, #050506 6%, rgba(5, 5, 6, .84) 44%, rgba(5, 5, 6, .38) 100%);
  }
  #top > .h-px.w-40 { display: none; }              /* decorative blue line cut through the headline on phones */
  #top h1 { font-size: clamp(2.5rem, 12.4vw, 3rem); }
  #top p.mb-7 { letter-spacing: .22em; line-height: 1.7; }
  #top .mt-10.flex-wrap { gap: .25rem; }
  #top .mt-10.flex-wrap > button {
    width: 100%;
    justify-content: space-between;
    min-height: 56px;
  }
  #top .mt-10.flex-wrap > a { min-height: 52px; padding-left: 0; }
  #top button[aria-label*="hero slide"] { width: 44px; height: 44px; }

  /* Models: the Performance / Everyday / Scooters tabs scroll instead of overflowing */
  #models .flex.gap-1.border-b {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  #models .flex.gap-1.border-b::-webkit-scrollbar { display: none; }
  #models .flex.gap-1.border-b > button {
    flex: 0 0 auto;
    min-height: 44px;
    padding-left: .7rem;
    padding-right: .7rem;
    letter-spacing: .05em;                          /* tighter so all 3 tabs fit on most phones */
    white-space: nowrap;
  }

  /* Small text-buttons ("BOOK TEST RIDE ↗" etc.) need a real tap area */
  #models article button,
  #service button {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding-right: .5rem;
  }
  #models article { min-height: 300px; padding: 1.5rem; }

  /* Visit section: stack the CTA buttons full width */
  #visit .mt-10.flex-wrap > button,
  #visit .mt-10.flex-wrap > a {
    width: 100%;
    justify-content: center;
    min-height: 56px;
  }
  #visit a[href^="tel:"] { min-height: 48px; }
  #visit .border-l { padding-left: 1.25rem; }

  /* Enquiry pop-up: scrolls on short phones instead of cutting off the Submit button */
  [role="dialog"].fixed {
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    align-items: start;
    padding: .75rem;
    padding-bottom: calc(.75rem + env(safe-area-inset-bottom, 0px));
  }
  [role="dialog"].fixed > div {
    margin-top: auto;
    margin-bottom: auto;                            /* centred when short, scrollable when tall */
    padding: 1.5rem 1.25rem 1.25rem;
  }
  [role="dialog"].fixed button[aria-label="Close form"] {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    top: .5rem;
    right: .5rem;
  }
  [role="dialog"].fixed form { gap: .75rem; margin-top: 1.25rem; }
  [role="dialog"].fixed input,
  [role="dialog"].fixed select { padding-top: .8rem; padding-bottom: .8rem; }
  [role="dialog"].fixed input[type="date"],
  [role="dialog"].fixed input[type="time"] {
    width: 100%;
    min-height: 3.25rem;
    text-align: left;
  }
  [role="dialog"].fixed h3 { font-size: 1.75rem; line-height: 1.15; }

  /* Form controls: 16px+ prevents iOS Safari from zooming the page on focus */
  input, select, textarea { font-size: 16px; }
}

/* ---------- Very small phones (320–359px) ---------- */
@media (max-width: 359px) {
  header a[aria-label="Premium Automobile home"] > span:first-child { width: 68px; }
  #top h1 { letter-spacing: -.045em; }
  main > section h2 { letter-spacing: -.04em; }
}

/* ---------- Landscape phones: don't let the menu / hero eat the screen ---------- */
@media (max-height: 480px) and (orientation: landscape) {
  #top { min-height: 0; padding-top: 6.5rem; }
}
