/* =============================================================================
   components.css — reusable UI pieces, semantic + token-based, that replace the
   Elementor widgets used across content pages. Pair with components.js.

   1. Tabs      (.kk-tabs)      — replaces Elementor nested-tabs
   2. Gallery   (.kk-gallery)   — replaces Elementor image-gallery
   3. Lightbox  (.kk-lightbox)  — replaces Elementor's lightbox
   4. Video     (.kk-video)     — click-to-play YouTube facade (replaces the
                                  Elementor video widget's auto-loaded iframe)
   5. Carousel  (.kk-carousel)  — replaces the Elementor image-carousel (Swiper):
                                  scroll-snap track + dots + optional autoplay

   Accent colour + tab font are overridable per page:
     .some-page { --kk-tabs-accent: #45ACAF; --kk-tabs-font: "Montserrat", sans-serif; }
   ============================================================================= */

/* -- 1. Tabs ---------------------------------------------------------------- */
.kk-tabs { --kk-tabs-accent: var(--kk-brand); --kk-tabs-font: var(--kk-font-heading); }
/* Tabs wrap onto as many rows as they need (as the Elementor tabs did). Do NOT
   make this a nowrap overflow-x scroller: centred flex content that overflows to
   the LEFT is unreachable, so the first tab gets clipped with no way to scroll to it. */
.kk-tabs__nav {
    display: flex; justify-content: center; gap: 12px;
    flex-wrap: wrap; padding-bottom: 4px;
}
.kk-tabs__tab {
    flex: 0 0 auto;
    /* width:auto overrides the Astra theme's global `button { width:100% }`
       (post-<id>.css), which otherwise makes every tab fill its own row. */
    width: auto;
    font-family: var(--kk-tabs-font); font-weight: 600; font-size: 16px;
    color: var(--kk-tabs-accent); background: transparent;
    border: 1px solid var(--kk-tabs-accent); border-radius: 50px;
    padding: 10px 24px; cursor: pointer; white-space: nowrap;
    transition: background .2s ease, color .2s ease;
}
.kk-tabs__tab[aria-selected="true"], .kk-tabs__tab:hover { background: var(--kk-tabs-accent); color: #fff; }
.kk-tabs__tab:focus-visible { outline: 2px solid var(--kk-tabs-accent); outline-offset: 2px; }
.kk-tabs__panel { display: none; padding-top: 28px; }
.kk-tabs__panel.is-active { display: block; }

/* -- 2. Gallery ------------------------------------------------------------- */
.kk-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 24px 0; }
.kk-gallery__item { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; }
.kk-gallery__item img {
    width: 100%; aspect-ratio: 3 / 2; object-fit: cover;
    border-radius: var(--kk-radius-md); display: block;
}
.kk-gallery__item:focus-visible { outline: 2px solid var(--kk-brand); outline-offset: 2px; }
@media (max-width: 767px) { .kk-gallery { grid-template-columns: repeat(2, 1fr); } }

/* -- 3. Lightbox ------------------------------------------------------------ */
.kk-lightbox {
    position: fixed; inset: 0; z-index: 10000;
    display: none; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, .85); padding: 24px;
}
.kk-lightbox.is-open { display: flex; }
.kk-lightbox__img { max-width: 92vw; max-height: 88vh; object-fit: contain; border-radius: var(--kk-radius-md); }
.kk-lightbox__btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 48px; height: 48px; border: 0; border-radius: 50%;
    background: rgba(255, 255, 255, .15); color: #fff; font-size: 26px; line-height: 1;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.kk-lightbox__btn:hover { background: rgba(255, 255, 255, .3); }
.kk-lightbox__prev { left: 16px; }
.kk-lightbox__next { right: 16px; }
.kk-lightbox__close { top: 16px; right: 16px; transform: none; width: 44px; height: 44px; font-size: 22px; }
@media (max-width: 767px) { .kk-lightbox__prev { left: 6px; } .kk-lightbox__next { right: 6px; } }

/* -- 4. Video facade -------------------------------------------------------- */
/* Shows a thumbnail + play button; clicking swaps in the real YouTube iframe.
   Avoids loading many heavy iframes up front (a page can have 9 videos). */
.kk-video {
    position: relative; display: block; width: 100%; aspect-ratio: 16 / 9;
    margin: 0; padding: 0; border: 0; cursor: pointer; overflow: hidden;
    background: #000; border-radius: var(--kk-radius-md);
}
.kk-video__thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.kk-video__play {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 68px; height: 48px; border-radius: 14px;
    background: #f00; transition: background .2s ease;   /* YouTube red — matches the live embeds */
}
.kk-video__play::before {
    content: ""; position: absolute; top: 50%; left: 50%;
    transform: translate(-35%, -50%);
    border-style: solid; border-width: 11px 0 11px 18px;
    border-color: transparent transparent transparent #fff;
}
.kk-video:hover .kk-video__play, .kk-video:focus-visible .kk-video__play { background: #cc0000; }
.kk-video:focus-visible { outline: 2px solid var(--kk-brand); outline-offset: 2px; }
.kk-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* -- 5. Carousel ------------------------------------------------------------ */
/* A scroll-snap track (no Swiper). Slides-per-view and gap are set with custom
   properties so a page can mirror its original Elementor carousel settings:
     .some-page .kk-carousel { --kk-carousel-per: 3; --kk-carousel-gap: 26px; }
   Autoplay interval + loop come from data-autoplay on the root (see components.js). */
.kk-carousel {
    --kk-carousel-per: 3;             /* slides visible — desktop               */
    --kk-carousel-per-tablet: 2;
    --kk-carousel-per-mobile: 1;
    /* Resolved slides-per-view the cells actually consume. The media queries below
       switch THIS var (not --kk-carousel-per) so a page override like
       `.kk-mawards .kk-carousel { --kk-carousel-per: 4 }` — higher specificity than
       the bare `.kk-carousel` media rule — can't defeat the responsive counts. */
    --kk-carousel-per-now: var(--kk-carousel-per);
    --kk-carousel-gap: 26px;
    --kk-carousel-dot: rgba(0, 0, 0, .2);
    --kk-carousel-dot-active: rgba(0, 0, 0, 1);
    position: relative;
}
.kk-carousel__track {
    display: flex;
    gap: var(--kk-carousel-gap);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;               /* the dots are the affordance          */
    margin: 0;
    padding: 0;
    list-style: none;
}
.kk-carousel__track::-webkit-scrollbar { display: none; }
/* Each slide takes an exact 1/per share of the track, gaps included. */
.kk-carousel__track > * {
    flex: 0 0 calc((100% - (var(--kk-carousel-per-now) - 1) * var(--kk-carousel-gap)) / var(--kk-carousel-per-now));
    scroll-snap-align: start;
}
.kk-carousel__dots { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.kk-carousel__dot {
    width: 6px; height: 6px; padding: 0; border: 0; border-radius: var(--kk-radius-round);
    background: var(--kk-carousel-dot); cursor: pointer;
}
.kk-carousel__dot.is-active { background: var(--kk-carousel-dot-active); }
.kk-carousel__dot:focus-visible { outline: 2px solid var(--kk-brand); outline-offset: 3px; }

/* Opt-in prev/next arrows (data-arrows). `top` is set in JS so they centre on the
   track. Bare chevrons in the band margin (no circle/shadow) — matches the live site. */
.kk-carousel__arrow {
    position: absolute; transform: translateY(-50%); z-index: 3;
    width: 34px; height: 48px; padding: 0; border: 0; background: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
/* Explicit fill (not currentColor): the Astra reset sets button `color:#fff` on
   hover, which would otherwise turn a currentColor chevron white and invisible. */
.kk-carousel__arrow svg { width: 22px; height: 22px; fill: #4a4a4a; display: block; transition: fill .2s ease; }
.kk-carousel__arrow:hover svg { fill: #000; }
.kk-carousel__arrow:focus-visible { outline: 2px solid var(--kk-brand); outline-offset: 2px; border-radius: 4px; }
.kk-carousel__prev { left: -44px; }
.kk-carousel__next { right: -44px; }
@media (max-width: 900px) { .kk-carousel__prev { left: -10px; } .kk-carousel__next { right: -10px; } }

@media (max-width: 1024px) { .kk-carousel { --kk-carousel-per-now: var(--kk-carousel-per-tablet); } }
@media (max-width: 767px)  { .kk-carousel { --kk-carousel-per-now: var(--kk-carousel-per-mobile); } }
@media (prefers-reduced-motion: reduce) { .kk-carousel__track { scroll-behavior: auto; } }

/* -- 6. Counter --------------------------------------------------------------- */
/* Replaces the Elementor counter widget: the number counts up from data-from to
   data-to when it scrolls into view (components.js). Colours/sizes come from the
   page CSS — this is just the structural skeleton. */
.kk-counter { text-align: center; }
.kk-counter__number { font-family: var(--kk-font-heading); font-weight: 700; display: block; }
.kk-counter__title { font-family: var(--kk-font-body); display: block; }

/* -- 7. Video playlist -------------------------------------------------------- */
/* Replaces the Elementor video-playlist widget: a main player (a .kk-video facade)
   next to a scrollable list of items; clicking an item swaps the main video.
     .kk-playlist            [data-kk-playlist]
       .kk-playlist__main    (.kk-video[data-yt] facade for the active item)
       .kk-playlist__items   (buttons with data-yt, thumb, title, duration)      */
.kk-playlist {
    --kk-playlist-accent: var(--kk-brand);
    display: grid; grid-template-columns: 2fr 1fr; gap: 0;
    background: #222; border-radius: var(--kk-radius-md); overflow: hidden;
}
.kk-playlist__main { align-self: center; }
.kk-playlist__main .kk-video { border-radius: 0; height: 100%; }
.kk-playlist__side { display: flex; flex-direction: column; min-width: 0; max-height: 480px; }
.kk-playlist__header {
    color: #fff; font-family: var(--kk-font-heading); font-size: 15px; font-weight: 600;
    padding: 14px 16px; border-bottom: 1px solid rgba(255, 255, 255, .15);
    display: flex; justify-content: space-between; gap: 8px; margin: 0;
}
.kk-playlist__count { color: rgba(255, 255, 255, .6); font-weight: 400; white-space: nowrap; }
.kk-playlist__items { overflow-y: auto; margin: 0; padding: 0; list-style: none; }
.kk-playlist__item {
    display: grid; grid-template-columns: 86px 1fr auto; gap: 10px; align-items: center;
    width: 100%; padding: 10px 12px; border: 0; text-align: left; cursor: pointer;
    background: transparent; color: #fff; font-family: var(--kk-font-body); font-size: 13px;
}
.kk-playlist__item:hover { background: rgba(255, 255, 255, .08); }
.kk-playlist__item[aria-current="true"] { background: rgba(255, 255, 255, .14); color: var(--kk-playlist-accent); }
.kk-playlist__item:focus-visible { outline: 2px solid var(--kk-playlist-accent); outline-offset: -2px; }
.kk-playlist__thumb { width: 86px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; display: block; }
.kk-playlist__duration { color: rgba(255, 255, 255, .6); font-size: 12px; }
@media (max-width: 767px) {
    .kk-playlist { grid-template-columns: 1fr; }
    .kk-playlist__side { max-height: 320px; }
}

/* -- 9. Accordion (native <details>) ------------------------------------------ */
/* Replaces the Elementor nested-accordion — no JS needed.
     <details class="kk-accordion"><summary>…</summary><div class="kk-accordion__body">…</div></details> */
.kk-accordion {
    border: 1px solid rgba(0, 0, 0, .12); border-radius: var(--kk-radius-md);
    margin: 10px 0; background: #fff;
}
.kk-accordion > summary {
    cursor: pointer; list-style: none; position: relative;
    padding: 14px 44px 14px 16px;
    font-family: var(--kk-font-heading); font-weight: 600;
}
.kk-accordion > summary::-webkit-details-marker { display: none; }
.kk-accordion > summary::after {
    content: ""; position: absolute; right: 16px; top: 50%;
    width: 10px; height: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: translateY(-70%) rotate(45deg); transition: transform .2s ease;
}
.kk-accordion[open] > summary::after { transform: translateY(-30%) rotate(-135deg); }
.kk-accordion > summary:focus-visible { outline: 2px solid var(--kk-brand); outline-offset: 2px; }
.kk-accordion__body { padding: 0 16px 16px; }

/* -- 8. Read-more ------------------------------------------------------------- */
/* A button[data-kk-readmore="#target"] toggles the target's [hidden] and its own
   label (data-more / data-less). Look & feel come from the page CSS. */
.kk-readmore[aria-expanded="true"] .kk-readmore__more { display: none; }
.kk-readmore[aria-expanded="false"] .kk-readmore__less { display: none; }
