/* Behaviour layer on top of the theme bundle (Bootstrap + Swiper CSS are
   already inside main.css). Everything here replaces the jQuery plugins the
   original page loaded: no build step, no runtime dependency. */

/* ---------- links that were cut ---------- */
/* External / out-of-scope destinations keep their wording and styling but
   stop being links: build strips their href. */
a:not([href]) {
    cursor: default;
    color: inherit;
    text-decoration: none;
}

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
    }
}

#main-content { scroll-margin-top: 96px; }

/* ---------- news slider ----------
   Swiper ran with slidesPerView 1.05 / 1.8 / 2.2 / 3 and spaceBetween
   12 / 20. The bundle ships swiper-css-mode, so the track becomes a native
   scroll container with snap points and the arrows just call scrollBy. */
/* Swiper only snaps when .swiper-horizontal is present; we do not want that
   class because it also sets touch-action:pan-y, which would block native
   horizontal swiping. Declare the snap axis here instead. */
.swiper-css-mode > .swiper-wrapper {
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
}

.news-swiper .swiper { overflow: hidden; }

.news-swiper .swiper-wrapper { gap: 12px; }

.news-swiper .swiper-slide {
    flex: 0 0 calc(100% / 1.05 - 12px);
}

@media (min-width: 576px) {
    .news-swiper .swiper-slide { flex-basis: calc(100% / 1.8 - 12px); }
}

@media (min-width: 768px) {
    .news-swiper .swiper-wrapper { gap: 20px; }
    .news-swiper .swiper-slide { flex-basis: calc(100% / 2.2 - 20px); }
}

@media (min-width: 992px) {
    .news-swiper .swiper-slide { flex-basis: calc(100% / 3 - 20px); }
}

.swiper-button-prev.is-disabled,
.swiper-button-next.is-disabled {
    opacity: .35;
    pointer-events: none;
}

/* the arrows are real buttons now, not decorative divs */
.swiper-nav .swiper-button-prev,
.swiper-nav .swiper-button-next {
    border: 0;
    padding: 0;
    cursor: pointer;
    transition: opacity .2s ease;
}

/* softnav's fallback fade (browsers without View Transitions) */
@keyframes cv-enter {
    from { opacity: 0; }
    to { opacity: 1; }
}

.cv-enter {
    animation: cv-enter .32s ease both;
}

/* ---------- picture gallery ----------
   Replaces the fade+autoplay Swiper: one image per screen, swipe or click
   the bullets. Autoplay was pure decoration and is gone with the rest. */
.flex-gallery .swiper { overflow: hidden; }

.flex-gallery .swiper-slide { flex: 0 0 100%; }

.flex-gallery .swiper-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
}

.flex-gallery .swiper-pagination-bullet {
    border: 0;
    padding: 0;
    cursor: pointer;
}

/* ---------- lightbox ---------- */
.cv-lb {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: min(6vw, 64px);
    background: rgba(10, 10, 10, .92);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility 0s linear .25s;
}

.cv-lb-in .cv-lb {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}

.cv-lb img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}

.cv-lb-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 16 16'%3e%3cpath stroke='%23fff' stroke-width='1.6' d='M1 1l14 14M15 1L1 15'/%3e%3c/svg%3e") no-repeat center / 16px 16px;
    cursor: pointer;
}

body.cv-lb-in { overflow: hidden; }

/* ---------- drawer ----------
   The theme only needs body.drawer-in; keep the page behind it still. */
.drawer-in { overflow: hidden; }

/* ---------- hero clip ----------
   The still stays as the LCP element and as the poster; once the clip can
   play it fades in above it. Without JS, a blocked autoplay or a refused
   download the visitor still sees the still, so nothing here is load-bearing. */
.hero-video {
    opacity: 0;
    transition: opacity .6s ease;
}

.hero-video.is-ready {
    opacity: 1;
}

/* ---------- long words ----------
   The banner headline is a single hashtag at 48px on phones; without a break
   opportunity it runs past the section (which clips) and loses its ending. */
.banner .title {
    overflow-wrap: anywhere;
}

/* ---------- skip link ---------- */
.visually-hidden-focusable:focus-visible {
    outline: 3px solid var(--focus-rgba);
    outline-offset: 2px;
}

/* ---------- language picker ----------
   Last column of #header .row so it shows on phones (where the nav column is
   hidden) and on desktop (where the burger column is hidden). The button
   takes --header-content-color, which the theme already flips from white
   over the hero to the primary colour once the header turns solid. */
.cv-lang-host {
    display: flex;
    align-items: center;
    padding-left: .75rem;
    /* the row's negative margin cancels the container gutter, so the last
       column has to give the edge back or the label touches the screen */
    padding-right: .75rem;
}

.cv-lang {
    position: relative;
    line-height: 1;
    color: var(--header-content-color);
}

.cv-lang__btn {
    display: inline-flex;
    align-items: center;
    gap: .35em;
    margin: 0;
    padding: .35em .1em;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 13px;
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: opacity .2s ease;
}

.cv-lang__btn:hover,
.cv-lang__btn:focus-visible {
    opacity: .65;
}

.cv-lang__btn svg {
    display: block;
    width: 15px;
    height: 15px;
}

.cv-lang__menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 60;
    min-width: 172px;
    max-height: min(70vh, 420px);
    overflow: auto;
    margin: 0;
    padding: 6px;
    background: #101010;
    color: #fff;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .28);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}

.cv-lang[data-open="true"] .cv-lang__menu {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
}

.cv-lang__item {
    display: block;
    width: 100%;
    margin: 0;
    padding: 8px 10px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 14px;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.cv-lang__item:hover,
.cv-lang__item:focus-visible {
    background: rgba(255, 255, 255, .12);
}

.cv-lang__item[aria-selected="true"] {
    font-weight: 700;
}

/* Arabic flips the document direction; mirror the menu with it. */
html[dir="rtl"] .cv-lang__menu {
    right: auto;
    left: 0;
}

html[dir="rtl"] .cv-lang__item {
    text-align: right;
}
