/* ==========================================================================
   Mad Duck — mobile pass
   Loaded after every other stylesheet. Nearly everything is scoped to phone
   and tablet widths; desktop layout is untouched except where noted
   (form text size up to 1023px, and the hero outline button, which was
   invisible on the dark hero at every width).
   ========================================================================== */

/* Keep iOS from inflating text in landscape; soften the grey tap flash. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
a, button, [role="button"], label, summary {
  -webkit-tap-highlight-color: rgba(200, 16, 46, 0.14);
}

/* Hero "Apply Now" outline button: its border had been overridden to a dark
   hairline, so on the black hero it read as loose text, not a button. */
main #hero-pin a.border-white\/25,
main .md-dark a.border-white\/25 {
  border-color: rgba(255, 255, 255, 0.4);
}

/* --------------------------------------------------------------------------
   Forms — phones and tablets
   -------------------------------------------------------------------------- */
@media (max-width: 1023px) {
  /* 16px minimum: anything smaller makes iPhone Safari zoom the page in on
     focus and leave it zoomed. */
  /* The :not() on select and textarea is there for specificity: the
     compiled .text-[0.98rem] utility otherwise outranks a bare element. */
  main input:not([type="checkbox"]):not([type="radio"]),
  main select:not([hidden]),
  main textarea:not([hidden]) {
    font-size: 16px;
  }

  /* Selects matched to the text inputs (same radius and height), with a
     drawn chevron so iOS doesn't swap in its own grey pill. */
  main .qd-form-panel select {
    -webkit-appearance: none;
    appearance: none;
    border-radius: 8px;
    min-height: 50px;
    padding-right: 2.75rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236b6b70' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 12px 8px;
  }

  /* Message box: square corners were the odd one out. */
  main .qd-form-panel textarea { border-radius: 8px; }

  /* Date input: iOS renders it shorter than the others when empty. */
  main .qd-form-panel input[type="date"] {
    min-height: 50px;
  }

  /* Checkboxes: 16px boxes are hard to hit with a thumb. */
  main .qd-form-panel input[type="checkbox"] {
    width: 1.375rem;
    height: 1.375rem;
    margin-top: 0.125rem;
  }
  main .qd-form-panel label:has(> input[type="checkbox"]) {
    padding-block: 0.25rem;
    cursor: pointer;
  }
}

@media (max-width: 639px) {
  /* The card's 32px inner padding on top of the page gutter left inputs
     284px wide on a 390px phone. */
  main .qd-form-panel {
    padding: 1.5rem 1.25rem;
  }
}

/* --------------------------------------------------------------------------
   Header and menu — phones
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  /* Shorter fixed header: 88px was over a tenth of a phone screen. Every
     offset on the site reads this variable, so they all follow. */
  :root { --nav-height: 72px; }
  header a[aria-label^="Mad Duck LLC"] img {
    height: 2.375rem;
  }
  header a[aria-label^="Mad Duck LLC"] {
    gap: 0.2rem;
  }

  /* Menu button up to a 44px target. */
  header button[aria-label="Open menu"],
  header button[aria-label="Close menu"] {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }
}

@media (max-width: 1023px) {
  /* Open menu fills the screen below the header instead of stopping
     part-way with the page showing underneath, and the page behind it
     stops scrolling. */
  header #mobile-nav.opacity-100 {
    max-height: calc(100vh - var(--nav-height)) !important;
    max-height: calc(100dvh - var(--nav-height)) !important;
    height: calc(100vh - var(--nav-height));
    height: calc(100dvh - var(--nav-height));
    overscroll-behavior: contain;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  html:has(header #mobile-nav.opacity-100),
  html:has(header #mobile-nav.opacity-100) body {
    overflow: hidden;
  }
}

/* --------------------------------------------------------------------------
   Homepage hero — phones
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  /* The scrub ran for 4.2 screens and the headline and buttons only appear
     at 80% of it, so a phone visitor swiped through ~3 screens of video
     before seeing what the company does or how to get a quote. 2.6 screens
     keeps the scrub and brings the copy in after about one. */
  .hero-pin-track { height: 260vh; }
}

/* --------------------------------------------------------------------------
   Breadcrumbs — phones
   -------------------------------------------------------------------------- */
@media (max-width: 639px) {
  /* Wide tracking pushed the last crumb onto its own line. */
  .qd-crumbs {
    letter-spacing: 0.12em;
    font-size: 0.6875rem;
  }
  .qd-crumbs li > span[aria-hidden="true"] {
    padding-inline: 0.4rem;
  }
  .qd-crumbs a {
    display: inline-block;
    padding-block: 0.5rem;
  }
}

/* --------------------------------------------------------------------------
   Footer — phones and tablets
   -------------------------------------------------------------------------- */
@media (max-width: 1023px) {
  /* "Get in touch" sat directly under "Terms & Conditions" with no gap,
     reading as part of the Company list. */
  footer.band .container > div > div + h3 {
    margin-top: 2.75rem;
  }

  /* Link rows at 18px tall were too tight to tap reliably. */
  footer.band ul { line-height: 1.5; }
  footer.band ul.space-y-3 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 0;
  }
  footer.band ul a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  /* The taller link rows already add air under each heading. */
  footer.band h3 { margin-bottom: 0.5rem; }

  /* Social icons: 38px to 44px. */
  footer.band a[aria-label^="Mad Duck LLC on"] {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }
}

/* --------------------------------------------------------------------------
   Wireframe artwork — phones
   The desktop PNGs are ~2000px wide and 1–2MB each. At phone widths the
   same art is drawn at most ~620px wide at under 15% opacity, so these
   1300px WebP copies are indistinguishable and a tenth of the weight.
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  main .wf-what-we-do::before  { background-image: url("/images/wireframes/mobile/05-american-long-nose-truck-wireframe.webp"); }
  main .wf-about-story::before { background-image: url("/images/wireframes/mobile/01-warehouse-loading-yard-wireframe.webp"); }
  main .md-rolling::before     { background-image: url("/images/wireframes/mobile/03-coast-to-coast-route-wireframe.webp"); }
  main .wf-inquiry-copy::before { background-image: url("/images/wireframes/mobile/02-freight-yard-gate-wireframe-longnose-v2.webp"); }
  main .qd-cta::before         { background-image: url("/images/wireframes/mobile/06-ready-to-roll-wide-579-wireframe.webp"); }
  main .wf-contact-dock::before { background-image: url("/images/wireframes/mobile/04-level-dock-forklift-wireframe.webp"); }
}
