/* ============================================================
   PakVoices — Advanced UI Enhancements
   Progressive, non-breaking additions layered on top of style.css
   ============================================================ */

/* Reading progress bar (article pages) */
.reading-progress {
    position: fixed; top: 0; left: 0; height: 3px; width: 0%;
    background: linear-gradient(90deg, var(--pv-green-light, #2ea84a), var(--pv-yellow, #f5c518));
    z-index: 2000; transition: width .1s linear;
}

/* Back-to-top button */
.back-to-top {
    position: fixed; bottom: 24px; right: 24px; width: 46px; height: 46px;
    border: none; border-radius: 50%; background: var(--pv-green-dark, #1a5c2a);
    color: #fff; font-size: 1.1rem; cursor: pointer; opacity: 0;
    pointer-events: none; transform: translateY(12px);
    transition: opacity .3s, transform .3s, background .2s;
    z-index: 1500; box-shadow: 0 6px 18px rgba(0,0,0,.25);
}
.back-to-top.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.back-to-top:hover { background: var(--pv-green-mid, #217a38); }

/* Fade/rise reveal on scroll */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* Lazy image blur-up */
img.lazy { filter: blur(8px); transition: filter .5s ease; }
img.lazy.loaded { filter: none; }

/* Smooth anchor scrolling */
html { scroll-behavior: smooth; }

/* Card hover lift (news cards) */
.post-card, .card { transition: transform .25s ease, box-shadow .25s ease; }
.post-card:hover, .card:hover { transform: translateY(-4px); box-shadow: 0 12px 28px rgba(0,0,0,.12); }

/* Skeleton shimmer utility */
.skeleton { background: linear-gradient(90deg,#eee 25%,#f5f5f5 37%,#eee 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px; }
@keyframes shimmer { 0%{background-position:100% 0} 100%{background-position:-100% 0} }

/* Breaking ticker smooth marquee */
.ticker-content { animation: tickerScroll 30s linear infinite; white-space: nowrap; }
.ticker-wrapper:hover .ticker-content { animation-play-state: paused; }
@keyframes tickerScroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* Reading time badge */
.reading-time { font-size: .8rem; color: #888; }
.reading-time i { color: var(--pv-green-mid, #217a38); }

/* ============================================================
   READING EXPERIENCE — article typography (news-grade)
   Scoped to .post-content so it only affects article body.
   ============================================================ */
.post-content {
    font-family: 'Hind Siliguri', Georgia, 'Times New Roman', serif;
    font-size: 1.18rem;
    line-height: 1.85;
    color: #232323;
    letter-spacing: 0.005em;
    max-width: 720px;           /* optimal ~66ch measure for readability */
}
.post-content p { margin: 0 0 1.5rem; }

/* Comfortable large-screen reading; keep full width on mobile */
@media (max-width: 991px) { .post-content { font-size: 1.1rem; line-height: 1.8; } }

/* Drop cap on the first paragraph — classic editorial touch */
.post-content > p:first-of-type::first-letter {
    float: left;
    font-family: 'Poppins', sans-serif;
    font-size: 3.6rem;
    line-height: 0.9;
    font-weight: 700;
    padding: 0.1rem 0.75rem 0 0;
    color: var(--pv-green-dark, #1a5c2a);
}

.post-content h2, .post-content h3, .post-content h4 {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    line-height: 1.3;
    margin: 2.2rem 0 1rem;
    color: #1a1a2e;
    scroll-margin-top: 90px;
}
.post-content h2 { font-size: 1.6rem; border-bottom: 2px solid #f0f0f0; padding-bottom: .4rem; }
.post-content h3 { font-size: 1.35rem; }

.post-content a { color: var(--pv-green-mid, #217a38); text-decoration: underline; text-underline-offset: 2px; }
.post-content a:hover { color: var(--pv-green-dark, #1a5c2a); }

.post-content ul, .post-content ol { margin: 0 0 1.5rem 1.25rem; }
.post-content li { margin-bottom: .5rem; }

.post-content blockquote {
    border-left: 4px solid var(--pv-green-light, #2ea84a);
    background: #f6faf7;
    font-size: 1.25rem;
    font-style: italic;
    color: #333;
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    border-radius: 0 10px 10px 0;
}

/* Images inside articles get a soft frame + optional caption */
.post-content img { border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.08); }
.post-content figure { margin: 1.75rem 0; }
.post-content figure figcaption {
    font-size: .85rem; color: #777; text-align: center;
    margin-top: .5rem; font-style: italic;
}

/* Selection colour on brand */
.post-content ::selection { background: rgba(46,168,74,.25); }

/* Text-size toggle helper (activated by reader controls) */
.post-content.font-lg  { font-size: 1.32rem; }
.post-content.font-sm  { font-size: 1.02rem; }

/* ── Reader toolbar (font size / share) ── */
.reader-tools {
    display: flex; align-items: center; gap: .4rem;
}
.reader-tools button {
    border: 1px solid #ddd; background: #fff; color: #444;
    width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
    font-size: .85rem; transition: all .15s;
}
.reader-tools button:hover { border-color: var(--pv-green-mid, #217a38); color: var(--pv-green-dark,#1a5c2a); }

/* ── Sticky share rail (desktop) ── */
@media (min-width: 992px) {
    .share-rail {
        position: sticky; top: 100px;
        display: flex; flex-direction: column; gap: .5rem;
    }
}
.share-rail a {
    width: 42px; height: 42px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; transition: transform .15s, opacity .15s;
}
.share-rail a:hover { transform: translateY(-2px); opacity: .9; }

/* ============================================================
   RECENT NEWS widget + Just-In strip
   ============================================================ */
.widget-title {
    position: relative;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    padding-bottom: .5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #eee;
}
.widget-title::after {
    content: ''; position: absolute; left: 0; bottom: -2px;
    width: 48px; height: 2px; background: var(--pv-green-light, #2ea84a);
}

.recent-news-item {
    display: flex; gap: .7rem; align-items: flex-start;
    padding: .6rem 0; border-bottom: 1px dashed #eee;
    transition: transform .15s;
}
.recent-news-item:last-child { border-bottom: none; }
.recent-news-item:hover { transform: translateX(3px); }
.recent-news-item .rn-thumb {
    width: 74px; height: 58px; flex-shrink: 0; border-radius: 8px;
    object-fit: cover; background: #eee;
}
.recent-news-item .rn-title {
    font-size: .84rem; line-height: 1.4; font-weight: 600; color: #222;
    text-decoration: none;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.recent-news-item .rn-title:hover { color: var(--pv-green-dark, #1a5c2a); }
.recent-news-item .rn-meta { font-size: .72rem; color: #999; margin-top: .25rem; }

/* "Just In" horizontal strip on homepage */
.just-in {
    display: flex; align-items: stretch; gap: 0;
    background: #fff; border: 1px solid #eee; border-radius: 10px;
    overflow: hidden; margin-bottom: 1.75rem; box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.just-in .ji-label {
    background: var(--pv-green-dark, #1a5c2a); color: #fff;
    font-weight: 700; font-family: 'Poppins',sans-serif; font-size: .8rem;
    letter-spacing: .5px; padding: .75rem 1rem; display: flex; align-items: center; gap: .4rem;
    white-space: nowrap; flex-shrink: 0;
}
.just-in .ji-label .dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--pv-yellow, #f5c518);
    animation: jiPulse 1.4s infinite;
}
@keyframes jiPulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.4;transform:scale(1.4)} }
.just-in .ji-track {
    display: flex; gap: 2rem; overflow-x: auto; padding: .75rem 1rem;
    scrollbar-width: none; white-space: nowrap;
}
.just-in .ji-track::-webkit-scrollbar { display: none; }
.just-in .ji-item {
    font-size: .86rem; color: #333; text-decoration: none; font-weight: 500;
    display: inline-flex; align-items: center; gap: .4rem; flex-shrink: 0;
}
.just-in .ji-item:hover { color: var(--pv-green-dark, #1a5c2a); }
.just-in .ji-item .ji-time { color: #aaa; font-size: .72rem; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .reveal, .post-card, .card, .ticker-content, html,
    .recent-news-item, .just-in .ji-label .dot {
        transition: none !important; animation: none !important; scroll-behavior: auto;
    }
}
