/* Metro India News — Reel Feed */

.reel-page {
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-primary);
}

.reel-page .site-header {
  background: rgba(11, 14, 20, 0.85);
  border-bottom-color: rgba(255,255,255,0.08);
}

[data-theme="light"] .reel-page .site-header {
  background: rgba(248, 247, 244, 0.9);
  border-bottom-color: var(--border);
}

.reel-page .site-header .logo { color: var(--text-primary); }

/* Progress segments */
.feed-progress-segments {
  position: fixed;
  top: calc(var(--header-height) + 42px);
  left: 0;
  right: 0;
  z-index: 101;
  display: flex;
  gap: 3px;
  padding: 0 1rem;
  height: 2px;
}

.progress-segment {
  flex: 1;
  height: 100%;
  background: rgba(255,255,255,0.2);
  border-radius: 1px;
  overflow: hidden;
}

[data-theme="light"] .progress-segment {
  background: rgba(0,0,0,0.1);
}

.progress-segment-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.2s ease;
}

.progress-segment.completed .progress-segment-fill { width: 100%; }
.progress-segment.active .progress-segment-fill { width: var(--fill, 0%); }

/* Feed container */
.reel-feed {
  height: 100dvh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-top: calc(var(--header-height) + 50px);
  padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom));
}

.reel-feed::-webkit-scrollbar { display: none; }

/* Desktop letterbox */
@media (min-width: 768px) {
  .reel-feed {
    padding-bottom: 2rem;
    background: #000;
  }

  [data-theme="light"] .reel-feed {
    background: #1A1A2E;
  }
}

/* Individual reel card */
.reel-card {
  height: calc(100dvh - var(--header-height) - 50px - var(--bottom-nav-height) - var(--safe-bottom));
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  cursor: pointer;
}

@media (min-width: 768px) {
  .reel-card {
    max-width: 420px;
    margin: 0 auto;
    height: calc(100dvh - var(--header-height) - 50px - 2rem);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
  }
}

/* Background image */
.reel-card-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.reel-card-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reel-card-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0,0,0,0.92) 0%,
    rgba(0,0,0,0.6) 40%,
    rgba(0,0,0,0.2) 70%,
    rgba(0,0,0,0.1) 100%
  );
}

/* Card content overlay */
.reel-card-content {
  position: relative;
  z-index: 1;
  padding: 1.5rem;
  color: #fff;
}

.reel-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.reel-card-headline {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4.5vw, 2rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 0.75rem;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.reel-card-teaser {
  font-size: 0.9375rem;
  line-height: 1.5;
  opacity: 0.9;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.reel-card-author {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1rem;
}

.reel-card-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  color: #fff;
  flex-shrink: 0;
}

.reel-card-author-info {
  font-size: 0.8125rem;
}

.reel-card-author-name { font-weight: 600; }
.reel-card-time { opacity: 0.7; font-size: 0.75rem; }

/* Action bar */
.reel-card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.15);
}

.reel-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 0.375rem;
  min-width: 48px;
  min-height: 48px;
  justify-content: center;
  transition: transform 0.15s ease;
}

.reel-action:active { transform: scale(0.9); }
.reel-action.liked { color: #EF4444; }
.reel-action svg { width: 24px; height: 24px; }
.reel-action-count { font-size: 0.6875rem; font-weight: 600; }

.reel-action-read {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  min-height: 44px;
  transition: background var(--transition);
}

.reel-action-read:hover { background: var(--accent-hover); }

/* Sponsored card variant */
.reel-card.sponsored .reel-card-bg::after {
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 100%);
}

.reel-card.sponsored .reel-card-content {
  background: var(--bg-elevated);
  color: var(--text-primary);
  margin: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

/* Desktop nav arrows */
.reel-nav {
  display: none;
}

@media (min-width: 768px) {
  .reel-nav {
    display: flex;
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
    flex-direction: column;
    gap: 1rem;
  }

  .reel-nav-prev { left: calc(50% - 280px); }
  .reel-nav-next { right: calc(50% - 280px); }

  .reel-nav button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    transition: background var(--transition);
  }

  .reel-nav button:hover {
    background: var(--accent);
    border-color: var(--accent);
  }
}

/* Article modal / expanded view */
.article-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg-overlay);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.article-modal.open {
  opacity: 1;
  visibility: visible;
}

.article-modal-panel {
  background: var(--bg-primary);
  width: 100%;
  max-height: 92dvh;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 1.5rem;
  padding-bottom: calc(1.5rem + var(--safe-bottom));
}

.article-modal.open .article-modal-panel {
  transform: translateY(0);
}

@media (min-width: 768px) {
  .article-modal { align-items: center; }
  .article-modal-panel {
    max-width: 680px;
    max-height: 85vh;
    border-radius: var(--radius-lg);
    transform: translateY(20px) scale(0.95);
  }
  .article-modal.open .article-modal-panel {
    transform: translateY(0) scale(1);
  }
}

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  width: 40px;
  height: 40px;
  border: none;
  background: var(--bg-elevated);
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 1.25rem;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-article-headline {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  line-height: 1.2;
  margin: 0.5rem 0 1rem;
  clear: both;
}

.modal-article-content {
  font-size: 1.0625rem;
  line-height: 1.75;
}

.modal-article-content p { margin-bottom: 1.25rem; }

.modal-full-link {
  display: block;
  text-align: center;
  margin-top: 1.5rem;
  padding: 0.875rem;
  background: var(--accent-muted);
  color: var(--accent);
  border-radius: var(--radius-md);
  font-weight: 600;
}

/* Loading skeleton card */
.reel-card-skeleton {
  height: calc(100dvh - var(--header-height) - 50px - var(--bottom-nav-height));
  scroll-snap-align: start;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.75rem;
}

.reel-card-skeleton .skel-img {
  position: absolute;
  inset: 0;
}

.reel-card-skeleton .skel-line {
  height: 16px;
  border-radius: 4px;
}

.reel-card-skeleton .skel-line.lg { height: 28px; width: 80%; }
.reel-card-skeleton .skel-line.md { width: 60%; }
.reel-card-skeleton .skel-line.sm { width: 40%; }

/* Card enter animation */
@keyframes cardEnter {
  from { opacity: 0.6; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.reel-card.in-view {
  animation: cardEnter 0.4s ease forwards;
}

@media (prefers-reduced-motion: reduce) {
  .reel-card.in-view { animation: none; }
}
