/* =========================================================================
   Xinbaian Migration — homepage.css
   Styles for the ACF homepage modules (flexible content homepage_sections).
   Loaded only on the front page (is_front_page), after main.css; reuses the
   design tokens and the source-parity hero/nav-card/help-card classes.
   See HOMEPAGE_ACF_MODULES.md.
   ========================================================================= */

/* -------------------------------------------------------------------------
   1. Slideshow (hero region)
   ------------------------------------------------------------------------- */
.xb-slider { position: relative; }
.xb-slider__viewport { position: relative; flex: 1 0 100%; width: 100%; max-width: 100%; }
.xb-slider__track { margin: 0; padding: 0; list-style: none; }
.xb-slider__slide { list-style: none; }

/* No-JS fallback: slides stack in order, first slide on top.
   Only with the html.xb-js class does the slider overlay slides. */
.xb-js .xb-slider__viewport { overflow: hidden; }
.xb-js .xb-slider__track { position: relative; }
.xb-js .xb-slider__slide {
    position: absolute; inset: 0;
    opacity: 0; visibility: hidden;
    transition: opacity 0.4s ease;
    pointer-events: none;
}
/* Slides fill the hero width. The hero (.hero) is a flex container; without
   flex:1 0 100% on the viewport the slider shrink-wraps to the image width
   (≈587px band) instead of covering the full hero like the source banner.
   The active slide is a flex row so the content wrapper centers vertically. */
.xb-js .xb-slider__slide { display: flex; align-items: center; }
.xb-js .xb-slider__slide.is-active {
    position: relative; opacity: 1; visibility: visible;
    pointer-events: auto;
}
.xb-js .xb-slider--single .xb-slider__slide {
    position: relative; opacity: 1; visibility: visible;
    pointer-events: auto;
}

/* RUN5 (homepage parity): the slideshow must fill the hero region like the
   source banner. The hero is a fixed-height flex container (35vmin with a
   min-height floor at >=40rem) with align-items:center, which previously
   centered a content-height slideshow — the image band (~211px) sat inside the
   388px hero leaving empty bands above/below. Stretch the viewport and let the
   track + active slide fill it so the absolutely-positioned hero image covers
   the full hero. On mobile the hero collapsed to padding-only (18vh+8vh) and
   clipped the CTA at its bottom edge; give it a source-parity height (41vh at
   844 viewport = 346px, matching the measured original) and drop the collapsing
   padding. All rules stay scoped under html.xb-js, so the no-JS stacked-slide
   fallback is unchanged. */
.xb-js .xb-slider__viewport { align-self: stretch; }
.xb-js .xb-slider__track { height: 100%; }
.xb-js .xb-slider__slide.is-active,
.xb-js .xb-slider--single .xb-slider__slide { height: 100%; }
@media (max-width: 40rem) {
    .hero { height: 41vh; min-height: 0; max-height: none; padding: 0; }
}

/* Alignment variants (source hero content is left-aligned by default). */
.xb-slider__content--center { margin: 0 auto; text-align: center; }
.xb-slider__content--right { margin-left: auto; text-align: right; }
@media (min-width: 64rem) {
    .xb-slider__content--center .hero__column,
    .xb-slider__content--right .hero__column {
        position: static; right: auto; top: auto;
        transform: none; margin-top: 1.25em;
    }
}

/* Overlay variants: dark (source default) / light (lighter tint). */
.xb-slider__slide--overlay-light .hero__bkg-overlay {
    background: rgba(33, 41, 58, 0.25);
}

/* Controls: prev/next mid-left/mid-right, pause + dots bottom-center. */
.xb-slider__controls {
    position: absolute; z-index: 6; top: 50%;
    left: 0; right: 0; transform: translateY(-50%);
    display: flex; justify-content: space-between;
    padding: 0 1rem; pointer-events: none;
}
.xb-slider__control {
    pointer-events: auto;
    width: 2.5rem; height: 2.5rem; border: 0; border-radius: 50%;
    background: rgba(33, 41, 58, 0.45); color: #fff; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background var(--xb-ease);
}
.xb-slider__control:hover,
.xb-slider__control:focus-visible { background: var(--xb-navy); }
.xb-slider__arrow { width: 1.1rem; height: 1.1rem; }
.xb-slider__arrow--prev { transform: rotate(180deg); }

.xb-slider__pause {
    position: absolute; z-index: 6; bottom: 0.75rem; left: 50%;
    transform: translateX(-50%);
    border: 0; border-radius: var(--xb-radius);
    background: rgba(33, 41, 58, 0.45); color: #fff;
    font-size: 12px; padding: 0.35em 0.9em; cursor: pointer;
}
.xb-slider__pause:hover,
.xb-slider__pause:focus-visible { background: var(--xb-navy); }

.xb-slider__dots {
    position: absolute; z-index: 6; bottom: 0.9rem; left: 0; right: 0;
    margin: 0; padding: 0; list-style: none;
    display: flex; justify-content: center; gap: 0.5rem;
    pointer-events: none;
}
.xb-slider__dot button {
    pointer-events: auto;
    width: 0.8rem; height: 0.8rem; padding: 0; border: 0;
    border-radius: 50%; background: rgba(255, 255, 255, 0.55);
    cursor: pointer; transition: background var(--xb-ease);
}
.xb-slider__dot.is-active button,
.xb-slider__dot button[aria-current="true"] { background: var(--xb-yellow); }
.xb-slider__dot button:hover,
.xb-slider__dot button:focus-visible { background: #fff; }

@media (max-width: 40rem) {
    .xb-slider__controls { display: none; }
    /* Mobile hero CTA parity: source CTA is 255x40 full-ish width; the
       desktop 255px rule only applies at ≥64rem, so give mobile the same
       width (clamped to 70vw like desktop). */
    .hero__column-button { width: 255px; max-width: 70vw; }
}

/* -------------------------------------------------------------------------
   2. News / products grids
   ------------------------------------------------------------------------- */
.xb-news-grid--list .grid__item { width: 100%; }
.xb-products-grid { list-style: none; }

/* Article grids render 3-across on desktop (source: 3×N article cards).
   The shared .grid class is 4-across at ≥60rem; scope the override to the
   homepage news module so other .grid usages are untouched. */
.xb-news-grid--grid { grid-template-columns: repeat(1, minmax(0, 1fr)); }
@media (min-width: 40rem) { .xb-news-grid--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 54rem) { .xb-news-grid--grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* -------------------------------------------------------------------------
   3. Link cards / list
   ------------------------------------------------------------------------- */
.xb-links__intro { color: var(--xb-muted); max-width: 52rem; }
.xb-links__description { margin: 0 0 1em; }
.xb-links-list { flex-wrap: wrap; }

/* -------------------------------------------------------------------------
   4. Promo (help-card shell variants)
   ------------------------------------------------------------------------- */
.xb-promo--light { background: var(--xb-bg-light); color: var(--xb-text-dark); }
.xb-promo--light .help-card__heading { color: var(--xb-navy); }
.xb-promo--plain { background: #fff; color: var(--xb-text-dark); border: 1px solid var(--xb-border); }
.xb-promo__content { flex: 1 1 auto; }
.xb-promo__button { flex: 0 0 auto; }
.xb-promo--light .xb-promo__button,
.xb-promo--plain .xb-promo__button { background: var(--xb-cyan); color: #fff; }
.xb-promo--light .xb-promo__button:hover,
.xb-promo--plain .xb-promo__button:hover { background: var(--xb-cyan-hover); color: #fff; }

/* -------------------------------------------------------------------------
   5. Reduced motion
   ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .xb-slider__slide { transition: none; }
    .xb-slider__control,
    .xb-slider__pause,
    .xb-slider__dot button { transition: none; }
}
