/* Zip Zap Chargers — mobile & tablet layer
 * ===========================================================================
 * DESKTOP IS LOCKED. Every rule in this file lives inside a max-width media
 * query, so nothing here can reach the approved desktop rendering (>1024px).
 *
 * The pages are authored with inline styles, which outrank stylesheets — so
 * these rules use attribute selectors (matching the inline style text) plus
 * !important. That is what makes a generic mobile layer possible without
 * rewriting 17 pages of markup. No markup was changed to support this file.
 *
 * Breakpoints are 767.98 / 767.99 rather than 767 / 768 on purpose. A browser
 * can report a fractional viewport width (page zoom, scaled displays, some
 * tablet split views): at 767.5px neither "max-width: 767" nor "min-width: 768"
 * matched, so the page briefly fell back to the desktop layout inside a 768px
 * viewport and the header overflowed by ~113px. The fractional bounds close
 * that gap without moving either breakpoint.
 * ===========================================================================
 */

/* ======================= MOBILE  ( <= 767px ) ============================ */
/* ============= CONTAINMENT  ( <= 1024px, one query, no gaps ) =============
 * Overflow containment is deliberately NOT left to the phone/tablet queries
 * alone: a fractional viewport (767.98…px) can fall between them, and for that
 * hairline the page would be uncontained. One query covering everything below
 * the desktop breakpoint means the intentional overhangs — the press logo
 * marquee, the scroll-reveal transforms, the decorative radial glows — are
 * always clipped. `clip`, never `hidden`: hidden would make these scroll
 * containers and kill the sticky header.
 * ========================================================================== */
@media (max-width: 1024px) {
  html, body { overflow-x: clip !important; max-width: 100% !important; }
  /* The glows are `position: absolute; inset: -4%`, so they hang ~11px past a
     768px viewport from INSIDE the app root, where a clip on <body> alone
     never reaches them. */
  #dc-root { overflow-x: clip !important; max-width: 100% !important; }
  [style*="mask-image: linear-gradient"] { overflow: hidden !important; max-width: 100% !important; }
  img, video, svg, iframe, canvas { max-width: 100% !important; }
}

@media (max-width: 767.98px) {

  /* --- 1. Overflow containment ------------------------------------------ */
  html { -webkit-text-size-adjust: 100%; }
  /* `clip` rather than `hidden`: hidden would turn these into scroll
     containers and kill the sticky header. clip contains the two intentional
     overhangs — the scroll-reveal transforms on Our Story and the logo
     marquee on Custom Branding — without disabling either animation. */
  html, body { overflow-x: clip !important; max-width: 100% !important; }
  img, video, svg, iframe, canvas { max-width: 100% !important; height: auto; }
  video { height: auto !important; }
  /* Anything explicitly wider than the viewport gets reined in */
  [style*="width: 340px"], [style*="width: 440px"], [style*="width: 250px"] { max-width: 100% !important; }

  /* --- 2. Header --------------------------------------------------------- */
  /* Scoped :not([aria-label="Menu"]) throughout: the menu drawer is also a <nav>,
     so unscoped header rules were squashing its panel and hiding Search/Account. */
  nav:not([aria-label="Menu"]) > div {
    padding: 0 16px !important;
    height: 54px !important;
    gap: 10px !important;
    justify-content: space-between !important;
    /* must never wrap — wrapping dropped the icon row onto the dark hero */
    flex-wrap: nowrap !important;
  }
  /* the centred desktop link row — replaced by the drawer */
  nav:not([aria-label="Menu"]) > div > div:nth-of-type(1) { display: none !important; }
  nav:not([aria-label="Menu"]) > div > div:nth-of-type(2) { gap: 16px !important; flex-wrap: nowrap !important; }
  nav:not([aria-label="Menu"]) img { height: 44px !important; width: auto !important; margin: 0 !important; }
  /* search collapses to its icon; the label is redundant at this width */
  nav:not([aria-label="Menu"]) a[aria-label="Search"] span { display: none !important; }
  /* Higher specificity than the generic flex-wrap rule further down, which
     would otherwise win and drop the icon row onto a second line. */
  nav:not([aria-label="Menu"]) div[style*="display: flex"]:not([style*="column"]) { flex-wrap: nowrap !important; }
  nav:not([aria-label="Menu"]) > div > div:nth-of-type(2) > a[style*="background: #ffd60a"],
  nav:not([aria-label="Menu"]) > div > div > a[href="/shop-all"][style*="border-radius: 980px"] { display: none !important; }
  /* touch targets */
  nav:not([aria-label="Menu"]) a[aria-label] { min-width: 44px; min-height: 44px; justify-content: center !important; }

  /* --- 3. Grids ---------------------------------------------------------- */
  /* Default: any multi-column grid becomes a single column.
     minmax(0,1fr) rather than 1fr: a bare 1fr is minmax(auto,1fr), so a track
     whose content is wider than the screen pushes the whole page sideways.
     This is what caused the travel-case / custom-branding overflow. */
  [style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
  /* and grid children must be allowed to shrink below their min-content,
     and must not carry desktop column spans — a `grid-column: span 2` against
     a now-single-column track creates an implicit auto column that starves the
     real one (this is what squeezed the Custom Branding form to 39px). */
  [style*="display: grid"] > * { min-width: 0 !important; grid-column: auto !important; }

  /* Exceptions, decided by what each pattern actually contains in this site:

     repeat(6,1fr) — the big feature cards (desktop places two per row via
       grid-column: span 3). They carry a heading plus body copy, so they go
       full width; 2-up would be exactly the "unusably narrow column" case.
     repeat(5,1fr) — compact cross-sell tiles (image, name, price). 2-up.
     repeat(4,1fr) with gap:10px — small spec chips ("MagSafe + Qi"). 2-up.
     repeat(4,1fr) with gap:18-22px — testimonial and product cards. Full width.
     repeat(7,1fr) — colour swatches; 7 across can't hold a readable label at
       375px, so a 4-up that wraps to two tidy rows. Still one glance. */
  [style*="repeat(5, 1fr)"],
  [style*="repeat(4, 1fr); gap: 10px"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  [style*="repeat(7, 1fr)"] { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 12px 10px !important; }

  /* Spec rows: label above value instead of a 210px gutter */
  [style*="210px 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 3px !important;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
  }

  /* Footer: brand + email signup take the full width, the link columns sit
     below it 2-up, so Shop Now / Bundles / Custom Branding / Our Story fall
     directly under the signup. */
  [style*="2fr 1fr 1fr 1fr"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 24px 16px !important; }
  footer [style*="2fr 1fr 1fr 1fr"] > div:first-child { grid-column: 1 / -1 !important; }
  /* the signup block and its copy run the full width instead of a 320px column */
  footer [style*="max-width: 320px"] { max-width: none !important; }
  footer input[type="email"] { font-size: 16px !important; }
  /* payment marks: one even 4 × 2 block rather than a ragged wrap */
  footer [style*="flex-wrap: nowrap"] {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 9px 8px !important;
    width: 100% !important;
    justify-items: center !important;
    align-items: center !important;
  }
  footer [style*="flex-wrap: nowrap"] img { height: 24px !important; width: auto !important; }
  footer [style*="justify-content: space-between"][style*="border-top"] {
    flex-direction: column !important; align-items: flex-start !important; gap: 14px !important;
  }

  /* Generic grid gap trim */
  [style*="display: grid"] { gap: 18px !important; }
  [style*="repeat(7, 1fr)"] { gap: 6px !important; }

  /* --- 4. Flex ----------------------------------------------------------- */
  /* Let horizontal rows wrap rather than overflow. Nav is excluded above. */
  div[style*="display: flex"]:not([style*="flex-direction: column"]) { flex-wrap: wrap !important; }
  /* Two-column split panels stack */
  [style*="display: flex"][style*="gap: 40px"],
  [style*="display: flex"][style*="gap: 48px"],
  [style*="display: flex"][style*="gap: 56px"],
  [style*="display: flex"][style*="gap: 60px"],
  [style*="display: flex"][style*="gap: 64px"] { gap: 24px !important; }

  /* Sticky product rails release on mobile so the page scrolls as one */
  [style*="position: sticky"]:not(nav) { position: static !important; }

  /* Marquee / logo-ticker rows are intentionally wider than the screen and are
     clipped by their parent. Make sure that clip actually holds at phone width. */
  [style*="mask-image: linear-gradient"] { overflow: hidden !important; max-width: 100% !important; }
  [style*="width: max-content"][style*="animation"] { max-width: none !important; }

  /* --- 5. Type ----------------------------------------------------------- */
  /* Fluid display sizes. Each maps a locked desktop size to a mobile size
     that holds the same hierarchy at 375–430px. */
  [style*="font-size: 68px"] { font-size: clamp(34px, 9.2vw, 40px) !important; letter-spacing: -0.02em !important; }
  [style*="font-size: 64px"] { font-size: clamp(33px, 8.8vw, 38px) !important; letter-spacing: -0.02em !important; }
  [style*="font-size: 56px"] { font-size: clamp(31px, 8.2vw, 36px) !important; letter-spacing: -0.02em !important; }
  [style*="font-size: 54px"] { font-size: clamp(30px, 8.0vw, 35px) !important; }
  [style*="font-size: 52px"] { font-size: clamp(30px, 7.8vw, 34px) !important; }
  [style*="font-size: 50px"] { font-size: clamp(29px, 7.6vw, 33px) !important; }
  [style*="font-size: 48px"] { font-size: clamp(28px, 7.4vw, 32px) !important; }
  [style*="font-size: 46px"] { font-size: clamp(27px, 7.2vw, 31px) !important; }
  [style*="font-size: 44px"] { font-size: clamp(26px, 7.0vw, 30px) !important; }
  [style*="font-size: 42px"] { font-size: clamp(26px, 6.8vw, 29px) !important; }
  [style*="font-size: 40px"] { font-size: clamp(25px, 6.6vw, 28px) !important; }
  [style*="font-size: 38px"] { font-size: clamp(24px, 6.2vw, 27px) !important; }
  [style*="font-size: 36px"] { font-size: clamp(24px, 6.0vw, 26px) !important; }
  [style*="font-size: 34px"] { font-size: clamp(23px, 5.8vw, 26px) !important; }
  [style*="font-size: 32px"] { font-size: clamp(22px, 5.6vw, 25px) !important; }
  [style*="font-size: 30px"] { font-size: clamp(21px, 5.4vw, 24px) !important; }
  [style*="font-size: 28px"] { font-size: 22px !important; }
  [style*="font-size: 26px"] { font-size: 21px !important; }
  [style*="font-size: 24px"] { font-size: 19px !important; }
  [style*="font-size: 23px"] { font-size: 18px !important; }
  [style*="font-size: 22px"] { font-size: 18px !important; }
  [style*="font-size: 21px"] { font-size: 17px !important; }
  [style*="font-size: 20px"] { font-size: 17px !important; }
  [style*="font-size: 19px"] { font-size: 16px !important; }
  /* Legal/disclaimer fine print never drops below a readable floor on mobile */
  [style*="font-size: 10px"], [style*="font-size: 11px"] { font-size: 12px !important; line-height: 1.5 !important; }
  /* …except wide-tracked uppercase eyebrows, where the extra size plus .18em
     tracking would overflow their container. Tighten the tracking and let them
     wrap instead of clipping. */
  [style*="font-size: 10px"][style*="letter-spacing"],
  [style*="font-size: 11px"][style*="letter-spacing"] {
    font-size: 11px !important; letter-spacing: .1em !important; white-space: normal !important;
  }

  /* Readable measure and no mid-word breaks on long product names */
  p, li { text-wrap: pretty; }
  h1, h2, h3 { text-wrap: balance; overflow-wrap: break-word; }

  /* --- 6. Section rhythm -------------------------------------------------- */
  /* Desktop's generous vertical air is halved rather than removed, so the
     page keeps its cadence without endless scrolling. */
  [style*="padding: 120px 22px"] { padding: 56px 18px !important; }
  [style*="padding: 110px 22px"] { padding: 54px 18px !important; }
  [style*="padding: 100px 22px"] { padding: 52px 18px !important; }
  [style*="padding: 96px 22px"]  { padding: 50px 18px !important; }
  [style*="padding: 88px 22px"]  { padding: 48px 18px !important; }
  [style*="padding: 84px 22px"]  { padding: 46px 18px !important; }
  [style*="padding: 80px 22px"]  { padding: 44px 18px !important; }
  [style*="padding: 72px 22px"]  { padding: 42px 18px !important; }
  [style*="padding: 64px 22px"]  { padding: 40px 18px !important; }
  [style*="padding: 56px 22px"]  { padding: 38px 18px !important; }
  [style*="padding: 44px 22px"]  { padding: 34px 18px !important; }
  [style*="padding: 0 26px"]     { padding: 0 18px !important; }
  [style*="padding: 0 22px"]     { padding: 0 18px !important; }

  /* --- 7. Forms and touch targets ----------------------------------------- */
  /* Stacked form labels take the full width instead of collapsing to their
     control's intrinsic size (this is what clipped "Product" on Custom Branding). */
  label[style*="flex-direction: column"] {
    width: 100% !important; flex: 1 1 100% !important; min-width: 0 !important;
  }
  input, select, textarea {
    width: 100% !important; max-width: 100% !important; min-width: 0 !important;
    /* without border-box, width:100% plus the design's padding overflows the row */
    box-sizing: border-box !important;
    /* 16px is the threshold below which iOS zooms the viewport on focus */
    font-size: 16px !important;
  }
  button, [role="button"], summary { min-height: 44px; }
  a[style*="border-radius: 980px"] {
    min-height: 44px; display: inline-flex !important;
    align-items: center; justify-content: center;
    /* without border-box the min-height stacks on top of the design's padding,
       which inflated every pill to ~64px */
    box-sizing: border-box !important;
  }

  /* --- 8. Our cart drawer at phone width ---------------------------------- */
  /* MOBILE FIX 3 — the purchase area (Subtotal, tax line, Checkout, secure-
     checkout note) must be visible the moment the drawer opens. Two things were
     pushing it below the fold on iPhone: the drawer was sized to the layout
     viewport (taller than the visible area while Safari's bottom bar shows),
     and the scrolling items column had no `min-height: 0`, so in a flex column
     it refused to shrink below its content height and shoved the footer out of
     view. Phone only — the desktop drawer is untouched. */
  #zz-cart-root { height: 100dvh !important; }
  #zz-cart-root aside {
    width: 100vw !important;
    height: 100% !important;
    max-height: 100% !important;
  }
  /* header and the free-shipping meter never shrink, never scroll */
  #zz-cart-root aside > header,
  #zz-cart-root aside > [data-zz-ship] { flex: 0 0 auto !important; }
  /* the items list is the only scrolling region */
  #zz-cart-root aside > [data-zz-scroll] {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  /* pinned purchase area, clear of the home indicator / Safari chrome */
  #zz-cart-root aside > [data-zz-foot] {
    flex: 0 0 auto !important;
    margin-top: 0 !important;
    padding: 14px 20px calc(16px + env(safe-area-inset-bottom)) !important;
    background: #ffffff !important;
    box-shadow: 0 -8px 22px rgba(0,0,0,.07) !important;
  }
}

/* ======================= TABLET  ( 768 – 1024px ) ======================== */
@media (min-width: 767.99px) and (max-width: 1024px) {

  html, body { overflow-x: clip !important; }
  img, video { max-width: 100% !important; }

  /* Header keeps its full nav but tightens up. At 768 the logo + five links +
     three icons + the yellow CTA pill measured 811px against a 768 viewport, so
     the pill (which repeats the first nav link) is dropped and the gaps close
     up; every link stays reachable. */
  nav:not([aria-label="Menu"]) > div { padding: 0 18px !important; gap: 12px !important; }
  nav:not([aria-label="Menu"]) > div > div:nth-of-type(1) { gap: 16px !important; }
  nav:not([aria-label="Menu"]) > div > div:nth-of-type(2) { gap: 14px !important; }
  nav:not([aria-label="Menu"]) > div > div:nth-of-type(2) > a[style*="background: #ffd60a"],
  nav:not([aria-label="Menu"]) > div > div > a[href="/shop-all"][style*="border-radius: 980px"] { display: none !important; }
  nav:not([aria-label="Menu"]) img { height: 60px !important; width: auto !important; }
  nav:not([aria-label="Menu"]) a[aria-label="Search"] span { display: none !important; }

  /* Dense grids step down one level rather than collapsing */
  [style*="repeat(5, 1fr)"],
  [style*="repeat(6, 1fr)"] { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  /* Card grids (testimonials, product cards) go 2-up so they keep a usable
     measure; the 10px-gap chip rows are small enough to stay 4-up. */
  [style*="repeat(4, 1fr); gap: 18px"],
  [style*="repeat(4, 1fr); gap: 20px"],
  [style*="repeat(4, 1fr); gap: 22px"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  [style*="display: grid"] > * { min-width: 0 !important; }
  [style*="2fr 1fr 1fr 1fr"] { grid-template-columns: 1.4fr 1fr 1fr !important; }
  [style*="210px 1fr"] { grid-template-columns: 170px 1fr !important; }

  /* Display type eases down so headlines never clip mid-transition */
  [style*="font-size: 68px"] { font-size: 52px !important; }
  [style*="font-size: 64px"] { font-size: 50px !important; }
  [style*="font-size: 56px"] { font-size: 45px !important; }
  [style*="font-size: 52px"] { font-size: 42px !important; }
  [style*="font-size: 48px"] { font-size: 39px !important; }
  [style*="font-size: 46px"] { font-size: 38px !important; }
  [style*="font-size: 44px"] { font-size: 36px !important; }
  [style*="font-size: 40px"] { font-size: 34px !important; }
  [style*="font-size: 34px"] { font-size: 29px !important; }
  [style*="font-size: 32px"] { font-size: 28px !important; }

  [style*="padding: 120px 22px"] { padding: 84px 24px !important; }
  [style*="padding: 110px 22px"] { padding: 78px 24px !important; }
  [style*="padding: 88px 22px"]  { padding: 66px 24px !important; }
}
