/*
 * Custom Elementor Widgets — Frontend Styles v1.2.0
 * Author: Sathish Karuppaiyan — https://sathishkaruppaiyan.in
 */

/* ═══════════════════════════════════════════════
   MARQUEE
═══════════════════════════════════════════════ */
.cew-marquee-wrapper {
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    background: #0a0a0a;
    box-sizing: border-box;
}

.cew-marquee-track {
    display: inline-flex;
    align-items: center;
    animation: cew-marquee-scroll linear infinite;
    will-change: transform;
}

.cew-marquee-track.cew-pause-hover:hover {
    animation-play-state: paused;
}

.cew-marquee-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    cursor: default;
    transition: color 0.25s ease;
}

.cew-marquee-item a {
    color: inherit;
    text-decoration: none;
    transition: color 0.25s ease;
}

.cew-marquee-sep {
    display: inline-block;
    margin-inline-end: 40px;
}

@keyframes cew-marquee-scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}


/* ═══════════════════════════════════════════════
   STORIES  — CSS custom properties
═══════════════════════════════════════════════ */
.cew-story-avatar-ring {
    --cew-avatar-size : 140px;   /* desktop default — big & clear */
    --cew-ring        : 3px;
    --cew-gap         : 4px;
}

/* ── Wrapper ── */
.cew-stories-wrapper {
    display    : block;
    box-sizing : border-box;
}

.cew-stories-wrapper.is-scrollable {
    overflow-x               : auto;
    overflow-y               : hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width          : thin;
    scrollbar-color          : #ddd transparent;
}
.cew-stories-wrapper.is-scrollable::-webkit-scrollbar       { height: 4px; }
.cew-stories-wrapper.is-scrollable::-webkit-scrollbar-thumb { background: #ddd; border-radius: 99px; }

/* ── Track ── */
.cew-stories-track {
    display    : flex;
    flex-wrap  : nowrap;
    align-items: flex-start;
    gap        : 20px;
}

/* Grid mode — columns set by Elementor selector, fallback 6 */
.cew-stories-track.is-grid {
    display              : grid;
    flex-wrap            : unset;
    grid-template-columns: repeat(6, 1fr);
    justify-items        : center;
    width                : 100%;
}

/* ── Story item ── */
.cew-story-item {
    display        : flex;
    flex-direction : column;
    align-items    : center;
    flex-shrink    : 0;
}
.cew-stories-track.is-grid .cew-story-item {
    flex-shrink: unset;
    width      : 100%;
}

/* ── Link / div wrapper ── */
.cew-story-link {
    display       : flex;
    flex-direction: column;
    align-items   : center;
    text-decoration: none;
    gap           : 10px;
    cursor        : pointer;
    width         : 100%;
}

/* ══════════════════════════════════════════════
   RING  →  white gap  →  image
   All three layers are circles of the same width;
   each inner layer is calculated from the ring's
   CSS vars so everything scales together.
══════════════════════════════════════════════ */

/* Outer gradient ring */
.cew-story-avatar-ring {
    position  : relative;
    width     : var(--cew-avatar-size);
    height    : var(--cew-avatar-size);
    min-width : var(--cew-avatar-size);   /* prevent flex squish */
    min-height: var(--cew-avatar-size);
    border-radius: 50%;
    /* ring border drawn as padding so gradient fills it */
    padding   : var(--cew-ring);
    box-sizing: border-box;
    display   : flex;
    align-items    : center;
    justify-content: center;
    overflow  : hidden;   /* clips shine effect to circle */
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    flex-shrink: 0;
}

.cew-story-link:hover .cew-story-avatar-ring {
    transform : scale(1.07);
    box-shadow: 0 10px 32px rgba(0,0,0,0.22);
}

/* White gap layer — fills the space inside the ring padding */
.cew-story-avatar-bg {
    width     : 100%;
    height    : 100%;
    border-radius: 50%;
    background: #ffffff;
    /* inner gap = user-controlled space between ring colour and photo */
    padding   : var(--cew-gap);
    box-sizing: border-box;
    display   : flex;
    align-items    : center;
    justify-content: center;
    overflow  : hidden;
}

/* Image container — must be a perfect circle */
.cew-story-avatar-wrap {
    width        : 100%;
    height       : 100%;
    border-radius: 50%;
    overflow     : hidden;
    flex-shrink  : 0;
    /* Force a square context so object-fit works correctly */
    aspect-ratio : 1 / 1;
    position     : relative;
}

/* The image — fills the circle, crops to cover, stays round */
.cew-story-avatar {
    position  : absolute;
    inset     : 0;          /* top/right/bottom/left = 0 */
    width     : 100%;
    height    : 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: center center;
    display   : block;
}

/* ── Label ── */
.cew-story-label {
    font-size  : 14px;
    font-weight: 500;
    color      : #111;
    text-align : center;
    max-width  : calc(var(--cew-avatar-size) + 16px);
    overflow   : hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
    transition : color 0.2s;
}

/* ── Viewed state ── */
.cew-story-item.is-viewed .cew-story-avatar-ring {
    background: #c7c7c7 !important;
}
.cew-story-item.is-viewed .cew-story-avatar {
    filter : grayscale(40%);
    opacity: 0.75;
}

/* ═══════════════════════════════════════════════
   SWORD SHINE ANIMATION
═══════════════════════════════════════════════ */
.cew-story-shine {
    position     : absolute;
    top          : -20%;
    left         : -80%;
    width        : 50%;
    height       : 140%;
    background   : linear-gradient(
        105deg,
        transparent            0%,
        rgba(255,255,255,0.08) 30%,
        rgba(255,255,255,0.55) 50%,
        rgba(255,255,255,0.08) 70%,
        transparent            100%
    );
    transform    : skewX(-18deg) translateX(0);
    animation    : cew-shine 3.6s ease-in-out infinite;
    pointer-events: none;
    z-index      : 10;
}

/* Stagger each story so they don't all flash together */
.cew-story-item:nth-child(1)  .cew-story-shine { animation-delay: 0.0s; }
.cew-story-item:nth-child(2)  .cew-story-shine { animation-delay: 0.5s; }
.cew-story-item:nth-child(3)  .cew-story-shine { animation-delay: 1.0s; }
.cew-story-item:nth-child(4)  .cew-story-shine { animation-delay: 1.5s; }
.cew-story-item:nth-child(5)  .cew-story-shine { animation-delay: 2.0s; }
.cew-story-item:nth-child(6)  .cew-story-shine { animation-delay: 2.5s; }
.cew-story-item:nth-child(7)  .cew-story-shine { animation-delay: 3.0s; }
.cew-story-item:nth-child(8)  .cew-story-shine { animation-delay: 3.5s; }
.cew-story-item:nth-child(9)  .cew-story-shine { animation-delay: 0.3s; }
.cew-story-item:nth-child(10) .cew-story-shine { animation-delay: 0.8s; }

@keyframes cew-shine {
    0%   { transform: skewX(-18deg) translateX(-30%);  opacity: 0; }
    8%   { opacity: 1; }
    38%  { transform: skewX(-18deg) translateX(360%);  opacity: 1; }
    39%  { opacity: 0; }
    100% { transform: skewX(-18deg) translateX(360%);  opacity: 0; }
}

/* ═══════════════════════════════════════════════
   AUTO-SIZE avatar when using GRID + columns
   When only 4 or 6 columns are set Elementor's
   selector handles the grid columns, but we also
   boost the avatar size using a data attribute
   that the PHP renderer adds.
═══════════════════════════════════════════════ */

/* 4-column grid → larger avatar */
.cew-stories-track.is-grid[data-cols="4"] .cew-story-avatar-ring {
    --cew-avatar-size: 160px;
}
/* 6-column grid → comfortable size */
.cew-stories-track.is-grid[data-cols="6"] .cew-story-avatar-ring {
    --cew-avatar-size: 120px;
}
/* 3-column → largest */
.cew-stories-track.is-grid[data-cols="3"] .cew-story-avatar-ring {
    --cew-avatar-size: 200px;
}

/* ── Responsive breakpoints ── */
@media (max-width: 1024px) {
    .cew-story-avatar-ring           { --cew-avatar-size: 110px; }
    .cew-stories-track.is-grid       { grid-template-columns: repeat(4, 1fr); }
    .cew-stories-track.is-grid[data-cols="4"] .cew-story-avatar-ring { --cew-avatar-size: 130px; }
    .cew-stories-track.is-grid[data-cols="6"] .cew-story-avatar-ring { --cew-avatar-size: 100px; }
}

@media (max-width: 767px) {
    .cew-story-avatar-ring           { --cew-avatar-size: 76px; }
    .cew-story-label                 { font-size: 11px; }
    .cew-stories-track.is-grid       { grid-template-columns: repeat(3, 1fr); }
    .cew-stories-track.is-grid[data-cols="4"] .cew-story-avatar-ring { --cew-avatar-size: 80px; }
    .cew-stories-track.is-grid[data-cols="6"] .cew-story-avatar-ring { --cew-avatar-size: 72px; }
}
