/* ══════════════════════════════════════════════════════════════════
   WOA NODES — carousel provider
   ══════════════════════════════════════════════════════════════════
   A node whose body is a carousel (provider type `carousel`). Self-
   contained + loaded ONLY on pages that render a carousel node, so the
   core node payload (style.css) stays untouched. Ported from
   woa-hero-blocks/assets/carousel.css, renamed to the .woa-node-carousel__*
   namespace (Phase 3 — retiring woa-hero-blocks). Behaviour is wired in
   carousel.js (the proven standalone engine, ported byte-faithfully).
   The outer .woa-node provides the frame; .woa-node-carousel__track is the
   carousel body. */

.woa-node-carousel__track {
    position: relative;
    overflow: hidden;
    height:   var(--woa-nc-h, auto);
}

.woa-node-carousel__slides {
    display:     flex;
    height:      100%;
    will-change: transform;
}

.woa-node-carousel__slide {
    flex-shrink: 0;
    overflow:    hidden;
    box-sizing:  border-box;
    height:      100%;
}

.woa-node-carousel__slide-inner {
    display:         flex;
    flex-direction:  column;
    width:           100%;
    height:          100%;
    text-decoration: none;
    color:           inherit;
}

.woa-node-carousel__slide-inner.woa-node-carousel__slide--image {
    line-height: 0;
}

.woa-node-carousel__img {
    display:    block;
    width:      100%;
    height:     100%;
    object-fit: inherit;
}

/* Caption overlay for title / card templates */
.woa-node-carousel__caption {
    padding:        10px 14px;
    display:        flex;
    flex-direction: column;
    gap:            2px;
}

.woa-node-carousel__title {
    font-weight: 600;
    font-size:   0.95em;
    line-height: 1.3;
}

.woa-node-carousel__excerpt {
    font-size:   0.85em;
    line-height: 1.35;
    opacity:     0.75;
}

/* Arrows */
.woa-node-carousel__arrow {
    position:        absolute;
    top:             50%;
    transform:       translateY(-50%);
    z-index:         2;
    background:      rgba(0,0,0,0.35);
    color:           #fff;
    border:          none;
    cursor:          pointer;
    width:           2.25rem;
    height:          2.25rem;
    border-radius:   50%;
    font-size:       1.5rem;
    line-height:     1;
    display:         flex;
    align-items:     center;
    justify-content: center;
    transition:      background 0.2s;
}
.woa-node-carousel__arrow:hover { background: rgba(0,0,0,0.6); }
.woa-node-carousel__arrow--prev { left:  0.75rem; }
.woa-node-carousel__arrow--next { right: 0.75rem; }

/* Dots — overlaid at the bottom of the track. The track is overflow:hidden with a
   fixed height, so dots laid out in normal flow below the slides would be clipped;
   absolute-positioning seats them over the bottom edge (and keeps them inside the
   track so carousel.js still scopes its querySelectorAll to it). */
.woa-node-carousel__dots {
    position:        absolute;
    left:            0;
    right:           0;
    bottom:          8px;
    z-index:         2;
    display:         flex;
    justify-content: center;
    gap:             6px;
    padding:         0;
}

.woa-node-carousel__dot {
    width:         9px;
    height:        9px;
    border-radius: 50%;
    border:        none;
    /* White with a soft dark ring so the dots read on ANY slide background (they now
       overlay the bottom of the images). */
    background:    rgba(255,255,255,0.55);
    box-shadow:    0 0 0 1px rgba(0,0,0,0.35), 0 1px 2px rgba(0,0,0,0.45);
    cursor:        pointer;
    padding:       0;
    transition:    background 0.2s;
}
.woa-node-carousel__dot.is-active { background: #fff; }

/* Circular mask */
.woa-node-carousel__slide--circle {
    border-radius: 50%;
    overflow:      hidden;
    aspect-ratio:  1 / 1;
}
.woa-node-carousel__slide--circle .woa-node-carousel__img {
    aspect-ratio: 1 / 1;
}

/* Hover expand */
[data-hover-expand] .woa-node-carousel__slide-inner {
    transition: transform 0.25s ease;
}
[data-hover-expand] .woa-node-carousel__slide:not(.woa-node-carousel__slide--clone):hover .woa-node-carousel__slide-inner {
    transform: scale(1.06);
}

/* Clone slides hidden from a11y */
.woa-node-carousel__slide--clone { pointer-events: none; }

/* Character slides are <button>s (open the character popup) instead of <div>s
   — strip native button chrome so they still look like a plain slide. */
.woa-node-carousel__slide--char {
    appearance:  none;
    background:  none;
    border:      0;
    padding:     0;
    margin:      0;
    font:        inherit;
    text-align:  inherit;
    cursor:      pointer;
}

/* ── Character popup (native <dialog>, slots filled by carousel.js) ──
   Mirrors woa-blocks' character-gallery popup styling so the carousel's
   popup reads as "the same popup" as the one on the Characters page. */
.woa-character-popup .woa-popup__content {
    color: var(--wp--preset--color--contrast, #1d1633);
}
.woa-character-popup * { box-sizing: border-box; }
.woa-character-popup .woa-char-popup__image { margin-bottom: 1rem; }
.woa-character-popup .woa-character-modal-img {
    width:      100%;
    height:     auto;
    display:    block;
    max-width:  320px;
    margin:     0 auto;
}
.woa-character-popup .woa-char-popup__name {
    text-align: center;
    margin:     0 0 0.5rem;
    color:      var(--wp--preset--color--contrast, #694973);
}
.woa-character-popup .woa-char-popup__bio { margin-top: 1rem; }

.woa-character-popup__close {
    position:        absolute;
    top:             0.5rem;
    right:           0.75rem;
    display:         flex;
    align-items:     center;
    justify-content: center;
    width:           2.25rem;
    height:          2.25rem;
    padding:         0;
    background:      none;
    border:          0;
    border-radius:   50%;
    font-size:       1.5rem;
    line-height:     1;
    cursor:          pointer;
    color:           var(--wp--preset--color--contrast, #694973);
    transition:      transform 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}
.woa-character-popup__close:hover,
.woa-character-popup__close:focus-visible {
    background-color: var(--wp--preset--color--contrast, #694973);
    color:            #fff;
    transform:        rotate(90deg);
    outline:          none;
}
@media (prefers-reduced-motion: reduce) {
    .woa-character-popup__close { transition: background-color 0.3s ease, color 0.3s ease; }
    .woa-character-popup__close:hover, .woa-character-popup__close:focus-visible { transform: none; }
}

/* Responsive: scale track height on narrower viewports so images don't get
   clipped. min() picks the smaller of the user's set height and a
   viewport-relative cap. */
@media (max-width: 1024px) and (min-width: 641px) {
    .woa-node-carousel__track[style*="--woa-nc-h"] {
        height: min(var(--woa-nc-h), 32vw) !important;
    }
}
@media (max-width: 640px) {
    .woa-node-carousel__track[style*="--woa-nc-h"] {
        height: min(var(--woa-nc-h), 56vw) !important;
    }
    .woa-node-carousel__arrow {
        width:     1.75rem;
        height:    1.75rem;
        font-size: 1.2rem;
    }
}
