/**
 * Louk.it Discover Feed — shared styles.
 *
 * Loaded by views/landing/discover.php and views/public/page.php.
 * Keeps the existing class names so nothing else breaks. Adds:
 *   - Skeleton shimmer for slide loading
 *   - Animated double-tap heart overlay
 *   - prefers-reduced-motion overrides
 */

/* One card fills the feed. The track is translated; the page itself does not scroll. */
html.discover-open, body.discover-open { overflow: hidden; overscroll-behavior: none; height: 100%; }
.discover-feed {
    position: fixed; inset: 0; z-index: 9999; background: #000; overflow: hidden;
    display: none; touch-action: none; overscroll-behavior: none;
}
.discover-feed.active, .discover-feed.discover-feed--standalone { display: block; }
.discover-track { position: absolute; inset: 0; will-change: transform; }
.discover-card, .discover-slide, .disco-intro, .discover-end {
    position: absolute; left: 0; top: 0; width: 100%; height: 100%;
    overflow: hidden; background: #0a0a0a;
}
.discover-slide iframe { width: 100%; height: 100%; border: 0; opacity: 0; transition: opacity .3s; pointer-events: none; }
.discover-slide iframe.loaded { opacity: 1; }

/* Skeleton shimmer (visible under the iframe until it loads) */
.discover-slide-skeleton { position: absolute; inset: 0; padding: 96px 20px 40px; display: flex; flex-direction: column; gap: 14px; align-items: center; background: #0a0a0a; z-index: 1; pointer-events: none; }
.discover-slide iframe.loaded ~ .discover-slide-skeleton { opacity: 0; transition: opacity .25s .15s; }
.ds-skel-avatar { width: 88px; height: 88px; border-radius: 50%; background: linear-gradient(110deg, #1a1a1a 20%, #262626 40%, #1a1a1a 60%); background-size: 200% 100%; animation: dsShimmer 1.4s linear infinite; margin-top: 8px; }
.ds-skel-line { height: 14px; border-radius: 6px; background: linear-gradient(110deg, #1a1a1a 20%, #262626 40%, #1a1a1a 60%); background-size: 200% 100%; animation: dsShimmer 1.4s linear infinite; }
.ds-skel-line-lg { width: 60%; height: 18px; }
.ds-skel-line-md { width: 40%; }
.ds-skel-block { width: calc(100% - 20px); max-width: 420px; height: 56px; border-radius: 14px; background: linear-gradient(110deg, #1a1a1a 20%, #262626 40%, #1a1a1a 60%); background-size: 200% 100%; animation: dsShimmer 1.4s linear infinite; }
.ds-skel-block-sm { height: 40px; width: 60%; }
@keyframes dsShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Double-tap heart */
.discover-heart-pop { position: absolute; width: 120px; height: 120px; pointer-events: none; opacity: 0; z-index: 3; transform: scale(0.2); }
.discover-heart-pop svg { width: 100%; height: 100%; filter: drop-shadow(0 4px 12px rgba(239,68,68,.5)); }
.discover-heart-pop.active { animation: dsHeartPop .9s cubic-bezier(.22, 1, .36, 1) forwards; }
@keyframes dsHeartPop {
    0%   { opacity: 0; transform: scale(0.2) rotate(-8deg); }
    25%  { opacity: 1; transform: scale(1.25) rotate(0deg); }
    55%  { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.1); }
}

/* Legacy spinner (kept for the topbar/intro area fallback) */
.discover-slide-loader { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.4rem; z-index: 2; }
.discover-slide iframe.loaded ~ .discover-slide-loader { display: none; }

/* Topbar */
.discover-topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 10000; display: none; align-items: center; justify-content: space-between; padding: max(12px, env(safe-area-inset-top)) 16px 12px; background: rgba(0,0,0,.7); backdrop-filter: blur(10px); pointer-events: none; }
.discover-topbar > * { pointer-events: auto; }
.discover-topbar-info { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.discover-topbar-avatar { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; }
.discover-topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.discover-topbar-name { font-size: 14px; font-weight: 600; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.4); }
.discover-topbar-sub { font-size: 11px; color: rgba(255,255,255,.7); }
.discover-topbar-cta { padding: 6px 16px; border-radius: 20px; background: #7c3aed; color: #fff; font-size: 12px; font-weight: 700; border: 0; cursor: pointer; transition: background .2s; text-decoration: none; margin-right: 8px; }
.discover-topbar-cta:hover { background: #6d28d9; }
.discover-close { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.15); backdrop-filter: blur(8px); border: 0; color: #fff; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.discover-close:hover { background: rgba(255,255,255,.25); }

/* Counter */
.discover-counter { position: fixed; bottom: calc(16px + env(safe-area-inset-bottom)); right: 16px; z-index: 10000; background: rgba(0,0,0,.5); backdrop-filter: blur(8px); color: #fff; font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 20px; display: none; }

/* Action buttons */
.discover-actions { position: fixed; bottom: calc(28px + env(safe-area-inset-bottom)); right: max(16px, env(safe-area-inset-right)); z-index: 10001; display: none; flex-direction: column; align-items: center; gap: 12px; }
.discover-pass-btn { background: rgba(255,255,255,.15); color: #fff; }
.discover-action-btn { width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform .2s, background .2s; backdrop-filter: blur(10px); position: relative; }
.discover-action-btn:active { transform: scale(.9); }
.discover-action-btn svg { width: 22px; height: 22px; pointer-events: none; }
.discover-like-btn { background: rgba(255,255,255,.15); color: #fff; }
.discover-like-btn.liked { background: rgba(239,68,68,.9); color: #fff; }
.discover-like-btn.liked svg { fill: #fff; }
.discover-like-count { font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.5); margin-top: -4px; }
.discover-fav-btn { background: rgba(255,255,255,.15); color: #fff; width: 36px; height: 36px; }
.discover-fav-btn svg { width: 18px; height: 18px; }
.discover-fav-btn.saved { background: rgba(124,58,237,.9); color: #fff; }
.discover-fav-btn.saved svg { fill: #fff; }
.discover-login-btn { width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,.2); color: #fff; font-size: 18px; font-weight: 300; text-decoration: none; display: flex; align-items: center; justify-content: center; transition: background .2s; }
.discover-login-btn:hover { background: rgba(255,255,255,.35); }
.discover-story-btn { background: rgba(255,255,255,.15); color: #fff; width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform .2s, background .2s; backdrop-filter: blur(10px); position: relative; }
.discover-story-btn:active { transform: scale(.9); }
.discover-story-btn svg { width: 18px; height: 18px; pointer-events: none; }
.discover-story-btn .story-dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; border: 2px solid rgba(0,0,0,.5); display: none; }
.discover-story-btn.has-stories .story-dot { display: block; }

/* Like pulse */
@keyframes likeHeartPop { 0% { transform: scale(1); } 50% { transform: scale(1.3); } 100% { transform: scale(1); } }
.like-pop { animation: likeHeartPop .35s cubic-bezier(.22,1,.36,1); }

/* End slide */
.discover-end { display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; gap: 16px; padding: 32px; background: #0a0a0a; }
.discover-retry, .discover-promo-cta { color: #111; background: #fff; padding: 12px 22px; border-radius: 999px; border: 0; font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; }
.discover-promo-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px 24px; color: #fff; }
.discover-promo-kicker { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; opacity: .75; margin-bottom: 16px; }
.discover-promo-inner h2 { font-size: 32px; font-weight: 800; line-height: 1.15; max-width: 560px; margin: 0 0 16px; }
.discover-promo-inner p { font-size: 16px; line-height: 1.4; max-width: 520px; margin: 0 0 32px; opacity: .9; }
.discover-end i { font-size: 2rem; opacity: .4; }
.discover-end p { font-size: 15px; opacity: .6; text-align: center; }
.discover-end a { color: #fff; background: rgba(255,255,255,.15); padding: 10px 24px; border-radius: 24px; text-decoration: none; font-weight: 600; font-size: 14px; transition: background .2s; }
.discover-end a:hover { background: rgba(255,255,255,.25); }

/* Stories bar */
.stories-bar { position: fixed; top: 56px; left: 0; right: 0; z-index: 10001; display: none; padding: 8px 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 12px; background: linear-gradient(to bottom, rgba(0,0,0,.4), transparent); }
.stories-bar::-webkit-scrollbar { display: none; }
.stories-bar.active { display: flex; }
.story-bubble { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; }
.story-avatar-ring { width: 52px; height: 52px; border-radius: 50%; padding: 2px; background: linear-gradient(135deg, #f59e0b, #ef4444, #ec4899); transition: opacity .3s; }
.story-bubble.seen .story-avatar-ring { background: rgba(255,255,255,.25); }
.story-avatar-inner { width: 100%; height: 100%; border-radius: 50%; border: 2px solid #000; overflow: hidden; background: rgba(255,255,255,.1); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: #fff; }
.story-avatar-inner img { width: 100%; height: 100%; object-fit: cover; }
.story-username { font-size: 10px; color: #fff; max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }

/* Story viewer */
.story-viewer { position: fixed; inset: 0; z-index: 10100; background: #000; display: none; flex-direction: column; }
.story-viewer.active { display: flex; }
.story-viewer-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; position: absolute; top: 0; left: 0; right: 0; z-index: 2; }
.story-viewer-progress { display: flex; gap: 3px; flex: 1; }
.story-viewer-bar { flex: 1; height: 3px; background: rgba(255,255,255,.3); border-radius: 2px; overflow: hidden; }
.story-viewer-bar-fill { height: 100%; background: #fff; width: 0; transition: width .05s linear; }
.story-viewer-bar.done .story-viewer-bar-fill { width: 100%; }
.story-viewer-close { background: none; border: 0; color: #fff; font-size: 20px; cursor: pointer; padding: 4px; margin-left: 8px; }
.story-viewer-user { display: flex; align-items: center; gap: 8px; padding: 0 16px; color: #fff; position: absolute; top: 28px; left: 0; z-index: 2; }
.story-viewer-user img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.story-viewer-user span { font-size: 13px; font-weight: 600; }
.story-viewer-user small { font-size: 11px; color: rgba(255,255,255,.6); margin-left: 8px; }
.story-viewer-content { flex: 1; display: flex; align-items: center; justify-content: center; padding: 60px 20px 20px; position: relative; }
.story-viewer-content img { max-width: 100%; max-height: 70vh; border-radius: 12px; object-fit: contain; }
.story-viewer-content p { color: #fff; font-size: 16px; line-height: 1.6; text-align: center; max-width: 480px; margin-top: 16px; }
.story-viewer-nav { position: absolute; inset: 60px 0 0; display: flex; z-index: 1; }
.story-viewer-nav-left, .story-viewer-nav-right { flex: 1; cursor: pointer; }

/* Reduced motion: disable shimmer + heart pop */
@media (prefers-reduced-motion: reduce) {
    .ds-skel-avatar, .ds-skel-line, .ds-skel-block { animation: none; background: #1a1a1a; }
    .discover-heart-pop.active { animation-duration: .01ms; opacity: 0; }
    .like-pop { animation: none; }
    .discover-slide iframe { transition: none; }
}
