/* =========================================================
   FEED.CSS
========================================================= */

/* =========================================================
   RESET
========================================================= */

*{
    margin:0;
    padding:0;
    box-sizing:border-box;
    -webkit-tap-highlight-color:transparent;
}

/* =========================================================
   FEED CARD
========================================================= */

.feed-card{
    position:relative;
    width:100%;
    background:#ececec;
    border-radius:34px;
    padding:10px;
    display:flex;
    flex-direction:column;
    gap:10px;
}

/* =========================================================
   FEED IMAGE WRAPPER
   — overflow:hidden + border-radius zaroori hai taaki
     andar ka gray/shimmer background kabhi bhi wrapper ke
     rounded shape se bahar (square jaisa) na dikhe.
   — clip-path: inset(0 round Npx) hard-clip deta hai —
     kuch mobile WebViews me overflow:hidden+border-radius
     akela corner ko cleanly clip nahi karta (khaaskar jab
     image apni opacity-transition ki wajah se alag
     compositing layer bana leti hai), jisse corner pe
     wrapper ka gray background peek kar jaata tha. clip-path
     us bug ko fix karta hai — border-radius fallback ke
     liye rakha hai (purane browsers ke liye).
   — aspect-ratio sirf loading ke waqt ek placeholder shape
     ke liye set hoti hai (JS se); load hone ke baad JS ye
     hata deta hai taaki asli image (height:auto) apni
     exact height khud le le — koi rounding-gap possible
     nahi rehta.
========================================================= */

.feed-image-wrapper{
    position:relative;
    width:100%;
    overflow:hidden;
    border-radius:26px;
    clip-path: inset(0 round 26px);
    background:#eee;
}

/* =========================================================
   FEED IMAGE
========================================================= */

.feed-image{
    width:100%;
    height:auto;
    border-radius:26px;
    display:block;
    object-fit:cover;
}

/* =========================================================
   DOWNLOAD BUTTON
   — image load hone tak invisible/scale-0 rehta hai, load
     hote hi springy scale-in animation se chhote se pura
     size tak "pop" karta hai
   — click pe "press-in" feel: pehle thoda chhota hota hai
     (real button press jaisa), phir turant apne normal
     size pe wapas aata hai — koi "grow" wala cheap effect
     nahi
========================================================= */

.download-btn{
    position:absolute;
    bottom:14px;
    right:14px;
    width:50px;
    height:50px;
    min-width:50px;
    border:none;
    border-radius:50%;
    background:rgba(0,0,0,0.75);
    color:#fff;
    font-size:18px;
    cursor:pointer;
    display:flex;
    align-items:center;
    justify-content:center;
    z-index:5;
    opacity:0;
    transform:scale(0);
    transition:transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
               opacity 0.2s ease;
}

/* image load hote hi ye class lagti hai (JS se) — springy pop-in,
   chhote se pura size tak */
.download-btn.dl-visible{
    opacity:1;
    transform:scale(1);
}

/* PRESS-IN — click hote hi turant chhota ho jata hai
   (dl-visible ke upar hi apply hoga, koi conflict nahi) */
.download-btn.dl-visible:active{
    transform:scale(0.85);
}

/* DOWNLOADING — normal size pe wapas (grow nahi), bas
   outline yahi se progress dikhana shuru karti hai */
.download-btn.downloading{
    transform:scale(1);
}

.download-btn.done{
    transform:scale(1);
}

/* Progress ring — white glowing, jitna download hua
   utna fill hota jata hai. Ye hamesha button ke normal
   size ke around hi rehti hai (--progress variable se
   control hoti hai) */
.download-btn::after{
    content:"";
    position:absolute;
    inset:-5px;
    border-radius:50%;
    background:conic-gradient(
        #ffffff var(--progress, 0%),
        rgba(255,255,255,0.15) 0%
    );
    -webkit-mask:radial-gradient(
        farthest-side,
        transparent calc(100% - 3px),
        #000 calc(100% - 3px)
    );
    mask:radial-gradient(
        farthest-side,
        transparent calc(100% - 3px),
        #000 calc(100% - 3px)
    );
    box-shadow:0 0 10px 2px rgba(255,255,255,0.6);
    opacity:0;
    transition:opacity 0.2s ease;
    pointer-events:none;
}

.download-btn.downloading::after,
.download-btn.done::after{
    opacity:1;
}

/* done hone pe bhi white hi rahega, sirf halka glow pulse */
.download-btn.done::after{
    animation:download-done-pulse 0.4s ease;
}

@keyframes download-done-pulse{
    0%{
        box-shadow:0 0 10px 2px rgba(255,255,255,0.6);
    }
    50%{
        box-shadow:0 0 18px 6px rgba(255,255,255,0.9);
    }
    100%{
        box-shadow:0 0 10px 2px rgba(255,255,255,0.6);
    }
}

/* Agar image ka size pehle se pata na chale, ring
   indeterminate spin karega taaki user ko pata rahe
   kuch ho raha hai */
.download-btn.downloading:not([style*="--progress"])::after{
    animation:download-ring-spin 1s linear infinite;
}

@keyframes download-ring-spin{
    from{ transform:rotate(0deg); }
    to{ transform:rotate(360deg); }
}

/* =========================================================
   USERNAME ROW
========================================================= */

.feed-username-row{
    width:100%;
    display:flex;
    align-items:center;
    gap:10px;
    overflow:hidden;
    min-width:0;
    flex-wrap:wrap;
}

/* =========================================================
   FEED USERNAME — download button jaisa dark translucent chip
========================================================= */

.feed-username{
    display:inline-block;
    width:auto;
    max-width:100%;
    font-size:16px;
    font-weight:700;
    color:#fff;
    background:rgba(0,0,0,0.75);
    border-radius:14px;
    padding:6px 12px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

/* =========================================================
   FEED TITLE — patli dark outline
========================================================= */

.feed-title{
    display:inline-block;
    width:auto;
    max-width:100%;
    font-size:14px;
    font-weight:600;
    color:#1a1a1a;
    background:rgba(0,0,0,0.05);
    border-radius:14px;
    padding:6px 12px;
    word-break:break-word;
}

/* =========================================================
   COMMUNITY STRIP
========================================================= */

.community-strip{
    display:flex;
    align-items:center;
    gap:12px;
    padding:10px 12px;
    background:rgba(0,0,0,0.05);
    border-radius:18px;
    cursor:pointer;
    transition:transform 0.1s ease;
}

.community-strip:active{
    transform:scale(0.98);
}

.community-strip-img{
    width:44px;
    height:44px;
    border-radius:12px;
    object-fit:cover;
    flex-shrink:0;
}

.community-strip-name{
    flex:1;
    font-size:16px;
    font-weight:700;
    color:#111;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.community-strip-arrow{
    font-size:14px;
    color:#888;
    flex-shrink:0;
}

/* =========================================================
   COMMUNITY ONLY CARD
========================================================= */

.feed-community-card{
    width:100%;
    border-radius:28px;
    padding:16px;
    display:flex;
    flex-direction:row;
    align-items:center;
    gap:16px;
    cursor:pointer;
    transition:transform 0.1s ease;
    background:#ffffff;
    flex-shrink:0;
}

.feed-community-card:active{
    transform:scale(0.98);
}

.feed-community-img{
    width:90px;
    height:90px;
    border-radius:16px;
    object-fit:cover;
    flex-shrink:0;
    aspect-ratio:1/1;
}

.feed-community-info{
    flex:1;
    display:flex;
    flex-direction:column;
    gap:6px;
    min-width:0;
}

.feed-community-label{
    font-size:12px;
    font-weight:600;
    color:#888;
    letter-spacing:0.5px;
}

.feed-community-name{
    font-size:20px;
    font-weight:700;
    color:#111;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

/* =========================================================
   IDENTITY RESULT CARD — no image, sirf label + username box
========================================================= */

.feed-identity-card{
    width:100%;
    border-radius:28px;
    padding:16px;
    display:flex;
    flex-direction:column;
    gap:10px;
    cursor:pointer;
    transition:transform 0.1s ease;
    background:#e4e4e4;
    flex-shrink:0;
}

.feed-identity-card:active{
    transform:scale(0.98);
}

.feed-identity-label{
    display:inline-block;
    width:fit-content;
    font-size:12px;
    font-weight:700;
    letter-spacing:2px;
    color:#999;
    background:rgba(0,0,0,0.06);
    border-radius:999px;
    padding:6px 14px;
}

.feed-identity-namebox{
    width:100%;
    background:rgba(255,255,255,0.6);
    border-radius:20px;
    padding:16px 18px;
    font-size:26px;
    font-weight:700;
    color:#111;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

/* =========================================================
   EMPTY FEED
========================================================= */

.empty-feed{
    width:100%;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    padding:60px 0;
    gap:16px;
    color:#999;
    font-size:18px;
    font-weight:500;
    text-align:center;
}

/* =========================================================
   RESPONSIVE 480px
========================================================= */

@media screen and (max-width:480px){

    .feed-card{ border-radius:30px; }

    .feed-image-wrapper{
        border-radius:22px;
        clip-path: inset(0 round 22px);
    }

    .feed-image{ border-radius:22px; }
}

/* =========================================================
   RESPONSIVE 360px
========================================================= */

@media screen and (max-width:360px){

    .feed-username{ font-size:24px; }

    .feed-title{ font-size:16px; }
}

/* =========================================================
   SKELETON LOADING (SHIMMER)
========================================================= */

@keyframes feed-shimmer{
    0%{
        background-position:-400px 0;
    }
    100%{
        background-position:400px 0;
    }
}

.feed-skel-shimmer{
    background:linear-gradient(
        90deg,
        #e2e2e2 0px,
        #efefef 40px,
        #e2e2e2 80px
    );
    background-size:600px 100%;
    animation:feed-shimmer 1.4s ease-in-out infinite;
}

.feed-skel-image{
    width:100%;
    border-radius:26px;
    display:block;
}

/* =========================================================
   SKELETON — username chip jaisa shape
========================================================= */

.feed-skel-username{
    height:34px;
    width:130px;
    border-radius:14px;
    margin-left:6px;
}

/* =========================================================
   SKELETON — title chip jaisa shape (outline wale jaisa)
========================================================= */

.feed-skel-title{
    height:30px;
    width:180px;
    border-radius:14px;
    margin-left:6px;
}

.feed-skel-strip{
    display:flex;
    align-items:center;
    gap:12px;
    padding:10px 12px;
    background:rgba(0,0,0,0.05);
    border-radius:18px;
}

.feed-skel-strip-img{
    width:44px;
    height:44px;
    border-radius:12px;
    flex-shrink:0;
}

.feed-skel-strip-name{
    flex:1;
    height:16px;
    border-radius:6px;
}   

.feed-username-clickable{
    cursor:pointer;
    transition:transform 0.1s ease, opacity 0.1s ease;
}

.feed-username-clickable:active{
    transform:scale(0.97);
    opacity:0.7;
}

.feed-image-fallback{
    width:100%;
    height:100%;
    position:absolute;
    top:0;
    left:0;
    display:flex;
    align-items:center;
    justify-content:center;
    background:#e2e2e2;
    color:#aaa;
    font-size:32px;
}

/* =========================================================
   IMAGE LIGHTBOX — shared-element / FLIP transition
   (all_content.js wale pattern se adapt kiya gaya)
========================================================= */

.feed-lightbox-overlay{
    display:none;
    position:fixed;
    inset:0;
    background:rgba(0,0,0,0);
    z-index:1500;
    transition:background 0.35s ease;
}

.feed-lightbox-overlay.show{
    background:rgba(0,0,0,0.78);
}

.feed-lightbox-img{
    display:none;
    position:fixed;
    z-index:1501;
    object-fit:cover;
    cursor:zoom-out;
    touch-action:none;
    -webkit-touch-callout:none;
    -webkit-user-select:none;
    user-select:none;
    transition:top 0.38s cubic-bezier(.16,1,.3,1),
               left 0.38s cubic-bezier(.16,1,.3,1),
               width 0.38s cubic-bezier(.16,1,.3,1),
               height 0.38s cubic-bezier(.16,1,.3,1),
               border-radius 0.38s cubic-bezier(.16,1,.3,1);
    will-change:top, left, width, height;
}

/* source image apni jagah se "gayab" ho jaati hai, jagah
   gray reh jaati hai jab tak lightbox open hai */
.feed-image.feed-img-ghost{
    opacity:0 !important;
    pointer-events:none;
}

.feed-image-wrapper.feed-img-ghost-wrapper{
    background:#e2e2e2;
}