/* ==========================================================================
   Winsiders Flexible Carousel v3.2.0 – Front-end Styles
   Complete rewrite – clean, documented, performant.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Root container & custom properties
   -------------------------------------------------------------------------- */

.wfc-carousel {
    position: relative;
    overflow: hidden;
    contain: layout style;
    --wfc-gap: 24px;
    --wfc-item-min-width: 180px;
    --wfc-item-width: 180px;
    --wfc-fade-width: 72px;
    --wfc-fade-color: #ffffff;
    --wfc-image-ratio: 16 / 9;
    --wfc-image-fit: contain;
    --wfc-card-bg: rgba(255, 255, 255, 0.9);
    --wfc-card-border: rgba(22, 35, 44, 0.12);
    --wfc-card-shadow: 0 18px 38px rgba(22, 35, 44, 0.08);
    --wfc-text-color: inherit;
}

/* --------------------------------------------------------------------------
   2. Entrance animation
   -------------------------------------------------------------------------- */

@keyframes wfc-enter {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.wfc-carousel.is-entering {
    animation: wfc-enter 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@media (prefers-reduced-motion: reduce) {
    .wfc-carousel.is-entering {
        animation: none;
        opacity: 1;
    }
}

/* --------------------------------------------------------------------------
   3. Rows container
   -------------------------------------------------------------------------- */

.wfc-rows-container {
    position: relative;
    display: grid;
    gap: var(--wfc-gap);
}

/* --------------------------------------------------------------------------
   4. Edge fade – CSS mask-image (modern) with overlay fallback
   -------------------------------------------------------------------------- */

@supports (mask-image: linear-gradient(to right, transparent, black)) {
    .has-edge-fade .wfc-rows-container {
        mask-image: linear-gradient(
            to right,
            transparent,
            black var(--wfc-fade-width),
            black calc(100% - var(--wfc-fade-width)),
            transparent 100%
        );
        -webkit-mask-image: linear-gradient(
            to right,
            transparent,
            black var(--wfc-fade-width),
            black calc(100% - var(--wfc-fade-width)),
            transparent 100%
        );
    }
}

/* Overlay fallback for browsers without mask-image */
.wfc-edge-fade {
    display: none;
}

@supports not (mask-image: linear-gradient(to right, transparent, black)) {
    .wfc-edge-fade {
        display: block;
        position: absolute;
        top: 0;
        bottom: 0;
        width: var(--wfc-fade-width);
        z-index: 2;
        pointer-events: none;
    }

    .wfc-edge-fade-left {
        left: 0;
        background: linear-gradient(to right, var(--wfc-fade-color), transparent);
    }

    .wfc-edge-fade-right {
        right: 0;
        background: linear-gradient(to left, var(--wfc-fade-color), transparent);
    }
}

/* --------------------------------------------------------------------------
   5. Row viewport, track, sequence
   -------------------------------------------------------------------------- */

.wfc-row-viewport {
    overflow: hidden;
    touch-action: pan-y;
}

.wfc-row-track {
    display: flex;
    align-items: stretch;
    will-change: transform;
    backface-visibility: hidden;
}

.wfc-row-sequence,
.wfc-row-sequence-clone {
    display: flex;
    gap: var(--wfc-gap);
    flex-shrink: 0;
    padding-right: var(--wfc-gap);
}

/* --------------------------------------------------------------------------
   6. Items
   -------------------------------------------------------------------------- */

.wfc-item {
    flex: 0 0 auto;
    width: var(--wfc-item-width);
    min-width: var(--wfc-item-min-width);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--wfc-text-color);
    box-sizing: border-box;
}

.wfc-item.is-link {
    cursor: pointer;
}

.wfc-item-inner {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
}

/* --------------------------------------------------------------------------
   7. Item image
   -------------------------------------------------------------------------- */

.wfc-item-image-wrap {
    position: relative;
    aspect-ratio: var(--wfc-image-ratio);
    overflow: hidden;
}

.wfc-item-image {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: var(--wfc-image-fit);
    transform: translateZ(0);
}

/* --------------------------------------------------------------------------
   8. Item copy (title, text)
   -------------------------------------------------------------------------- */

.wfc-item-copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 0;
}

.wfc-item-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--wfc-text-color);
}

.wfc-item-text {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: rgba(0, 0, 0, 0.6);
}

.wfc-item-text p {
    margin: 0 0 8px;
}

.wfc-item-text p:last-child {
    margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   9. Card template styles
   -------------------------------------------------------------------------- */

.wfc-card-template {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    border-radius: 18px;
    color: #12202b;
    background: var(--wfc-card-bg);
}

.wfc-card-style--soft {
    border: 1px solid var(--wfc-card-border);
    box-shadow: var(--wfc-card-shadow);
}

.wfc-card-style--outline {
    border: 1px solid rgba(195, 208, 218, 0.7);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.wfc-card-style--plain {
    border: 1px dashed rgba(201, 210, 218, 0.7);
    background: linear-gradient(180deg, #ffffff 0%, #f9fbfc 100%);
}

.wfc-card--clickable {
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.wfc-card--clickable:hover {
    box-shadow: 0 20px 40px rgba(22, 35, 44, 0.12);
    transform: translateY(-2px);
}

.wfc-card-zone {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wfc-card-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 40px;
    padding: 0 18px;
    border-radius: 999px;
    background: #10212e;
    color: #ffffff;
    font-weight: 600;
    text-decoration: none;
}

.wfc-card-text-link {
    color: #0a5b88;
    font-weight: 600;
    text-decoration: none;
}

/* Avatar */
.wfc-avatar {
    display: inline-flex;
    max-width: 100%;
}

.wfc-avatar-image {
    display: block;
    width: 72px;
    height: 72px;
    border-radius: 999px;
    object-fit: cover;
}

/* Rating stars */
.wfc-rating-stars {
    position: relative;
    display: inline-grid;
    place-items: center start;
    line-height: 1;
}

.wfc-rating-stars-base,
.wfc-rating-stars-fill {
    grid-area: 1 / 1;
    font-size: 18px;
    letter-spacing: 0.12em;
}

.wfc-rating-stars-base { color: rgba(16, 33, 46, 0.14); }
.wfc-rating-stars-fill { overflow: hidden; white-space: nowrap; color: #f1b238; }

/* --------------------------------------------------------------------------
   10. Grayscale effects
   -------------------------------------------------------------------------- */

.wfc-grayscale-on .wfc-item-image {
    filter: grayscale(1);
    transition: filter 0.3s ease;
}

.wfc-grayscale-on .wfc-item:hover .wfc-item-image {
    filter: grayscale(0);
}

.wfc-grayscale-intelligent .wfc-item-image {
    filter: grayscale(1) opacity(0.65);
    transition: filter 0.3s ease;
}

.wfc-grayscale-intelligent .wfc-item:hover .wfc-item-image {
    filter: grayscale(0) opacity(1);
}

/* --------------------------------------------------------------------------
   11. Interactive states
   -------------------------------------------------------------------------- */

.wfc-swipe-enabled .wfc-row-viewport {
    cursor: grab;
}

.wfc-row-viewport.is-dragging {
    cursor: grabbing;
    user-select: none;
}

.wfc-row-viewport.is-dragging .wfc-item {
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   12. Read-more toggle
   -------------------------------------------------------------------------- */

.wfc-read-more-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wfc-read-more-button {
    width: fit-content;
    min-height: 34px;
    padding: 0 14px;
    border: 1px solid #c8d4de;
    border-radius: 999px;
    background: #ffffff;
    color: #10212e;
    font-weight: 600;
    cursor: pointer;
}

.wfc-read-more-content[hidden] {
    display: none;
}

.wfc-read-more-template {
    display: none;
}

/* --------------------------------------------------------------------------
   13. Modal
   -------------------------------------------------------------------------- */

.wfc-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.wfc-modal[hidden] {
    display: none;
}

.wfc-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 33, 46, 0.55);
    cursor: pointer;
}

.wfc-modal-dialog {
    position: relative;
    width: 100%;
    max-width: 740px;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 20px;
    background: #ffffff;
    padding: 32px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
}

.wfc-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 6px 14px;
    border: 1px solid #dcdcde;
    border-radius: 999px;
    background: #ffffff;
    color: #50575e;
    font-size: 13px;
    cursor: pointer;
}

.wfc-modal-close:hover {
    background: #f0f0f1;
}

.wfc-modal-content > * {
    margin-top: 0;
}

html.wfc-modal-open,
html.wfc-modal-open body {
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   14. Builder blocks (legacy card-builder support)
   -------------------------------------------------------------------------- */

.wfc-builder-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.wfc-builder-block--columns { display: grid; }
.wfc-builder-column { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

.wfc-builder-block--source-source_label .wfc-builder-text-content,
.wfc-builder-block--source-post_type_label .wfc-builder-text-content,
.wfc-builder-meta-label,
.wfc-builder-column-title {
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #5d7182;
}

.wfc-builder-text-content { margin: 0; }

.wfc-builder-block--source-title .wfc-builder-text-content,
.wfc-builder-block--source-name .wfc-builder-text-content {
    font-size: 1.3rem;
    line-height: 1.2;
}

.wfc-builder-block--source-rating_stars { color: #f1b238; }

.wfc-builder-meta-link { text-decoration: none; }
