/* ==========================================================================
   afh-mobile.css — mobile parity corrections for the ADAC Mautportal replica
   ==========================================================================
   Scope: narrow viewports only, <= 1024 px. At >= 1025 px this sheet does
   nothing (all rules sit inside media queries that stop at 1024px), so the
   desktop rendering of the replica is unchanged, including the inline
   `#afh-unswiper` fallback.

   Relationship to `afh-ui.css` (same carousel, other file)
   --------------------------------------------------------
   `afh-ui.css` turns a swiper into a horizontal snap-scroller: it moves the
   scrolling box onto `.swiper-wrapper` and gives the slides a width from the
   custom property `--afh-slide` (clamp(236px, 34vw, 380px), 78vw <= 700px).
   This sheet keeps that mechanism *exactly* — same scrolling box, same
   property — and only replaces the width ladder with the one the live page
   actually uses, so the two files cannot fight: every property this sheet
   sets on the wrapper (nowrap, 16px gap, overflow-x, snap) is set to the
   same value `afh-ui.css` already uses, and the slide width lives in
   `--afh-slide` as before.

   All declarations are `!important` and every selector is more specific than
   both the inline `#afh-unswiper` fallback (bare `.swiper*`) and the
   `.afh-carousel*` rules, so the cascade does not depend on stylesheet order.

   ---------------------------------------------------------------------------
   WHAT WAS WRONG  (live adac.de vs. replica, 390x844, measured 2026-11-23)
   ---------------------------------------------------------------------------
   Live page hydrates Swiper: one card per view plus a peek of the next card,
   16px gap, horizontal swipe. The replica cannot hydrate, and `#afh-unswiper`
   reveals every slide by wrapping the flex row, which turns each carousel
   into a vertical column. Result: every carousel section is 2-3x too tall.

   /fahrzeugwelt/maut-vignette/ @ 390px, section heights:
       "Vignetten und Maut Tickets fuer OE/CH/SI"   live  700px  replica 2143px
       "FLEX-Abo abschliessen oder Mautbox bestellen" live  717px  replica 1908px
       "Mehr aus der ADAC Welt"                     live  390px  replica  608px
   Same pattern on oesterreich (+1857px), schweiz (+2520px), slowenien
   (+2182px), mautbox (+1660px), faq-mautportal (+302px) — always exactly the
   sections that contain a swiper.

   Card ORDER and card COUNT already matched the live page 1:1 on all six
   pages (4/3/2 slides on maut-vignette, 4/4/2 on schweiz, 2/3/2 on mautbox,
   2 on faq-mautportal, identical titles in identical order), so nothing is
   reordered here — only the layout.

   Second divergence, same carousels: card HEIGHTS. Live slides are all equal
   (the wrapper stretches: `align-items: normal`), the replica's slides keep
   their own content height, so the shorter cards look clipped:
       /schweiz/ carousel 2   live 499 499 499 499   replica 380 499 475 452
       /schweiz/ carousel 1   live 380 380 380 380   replica 332 356 356 380
       /schweiz/ carousel 3   live 268 268           replica 239 268
   Because the replica's tallest card is the same height as live's cards (the
   section heights already matched), `align-items: stretch` reproduces the live
   heights exactly. That is why this sheet sets it on the wrapper.

   ---------------------------------------------------------------------------
   THE WIDTH LADDER, as measured on the live page (spaceBetween = 16px)
   ---------------------------------------------------------------------------
       <= 599px          slidesPerView 1.2   slideW 296 in carousel 358 (46px of card 2 visible)
       600px .. 839px    slidesPerView 2     slideW 296 in carousel 608
       840px .. 1024px   slidesPerView 4     slideW 186 in carousel 793
       >= 1025px         slidesPerView 4     (out of scope, left to afh-ui.css)

   Boundary pixels were bracketed on the live page: 599px -> 1.2 / 600px -> 2,
   839px -> 2 / 840px -> 4, and the slide width reproduced by this sheet
   matches the live slide width exactly at every width tested (390, 576, 590,
   599, 600, 640, 700, 800, 810, 820, 830, 839, 840, 850, 899, 1024, 1100).

   Live Swiper computes  slideW = (containerW - gap * (spv - 1)) / spv.
   `100%` below is the wrapper's content box, and the wrapper fills the
   carousel's content box (verified on the replica at 390px: carousel width =
   wrapper width = 358px, carousel padding = 0), so the calc reproduces the
   live pixel widths exactly:  (358 - 3.2) / 1.2 = 295.7 -> 296 on live.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Scroller mechanics + the middle step of the ladder (2 cards per view).
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  body .swiper {
    --afh-slide: calc((100% - 16px) / 2);
  }

  /* `afh-ui.css` adds 4px bottom padding per carousel for its arrow control.
     Live has no such padding, and 3 carousels at 390px therefore made the page
     12px taller than live (9688 vs 9676 on /schweiz/). Zeroed here so the page
     height stays 1:1 with live; remove this rule if the arrows ever need the
     room. */
  body .afh-carousel {
    padding-bottom: 0 !important;
  }

  body .swiper > .swiper-wrapper {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    gap: 0 16px !important;
    transform: none !important;
    transition: none !important;
    justify-content: flex-start !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x proximity;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  body .swiper > .swiper-wrapper::-webkit-scrollbar {
    display: none;
  }

  body .swiper > .swiper-wrapper > .swiper-slide {
    flex: 0 0 auto !important;
    width: var(--afh-slide) !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: var(--afh-slide) !important;
    margin: 0 !important;
    scroll-snap-align: start;
  }
}

/* --------------------------------------------------------------------------
   Phone: one card + peek of the next (live slidesPerView 1.2, up to 599px).
   -------------------------------------------------------------------------- */
@media (max-width: 599px) {
  body .swiper {
    --afh-slide: calc((100% - 3.2px) / 1.2);
  }
}

/* --------------------------------------------------------------------------
   Tablet / small laptop: four cards per view (live slidesPerView 4 from 840px).
   The inline fallback only switches to 4 cards at >= 1100px, so without this
   rule 840..1099px would show 2 cards where the live page shows 4. This
   closes the part of that gap inside the <= 1024px scope of this file; the
   1025..1099px remainder is a known residual difference (see report).
   -------------------------------------------------------------------------- */
@media (min-width: 840px) and (max-width: 1024px) {
  body .swiper {
    --afh-slide: calc((100% - 48px) / 4);
  }
}
