/* Metro India News — Design System */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700;9..144,800&family=Source+Sans+3:wght@400;500;600;700&display=swap');

/* ─── CSS Variables ─── */
:root {
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Source Sans 3', system-ui, sans-serif;

  --accent: #6366F1;
  --accent-hover: #4F46E5;
  --accent-muted: rgba(99, 102, 241, 0.15);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.12);

  --header-height: 56px;
  --bottom-nav-height: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Light theme (default) */
:root, [data-theme="light"] {
  --bg-primary: #F8F7F4;
  --bg-secondary: #FFFFFF;
  --bg-elevated: #FFFFFF;
  --bg-overlay: rgba(0,0,0,0.5);
  --text-primary: #1A1A2E;
  --text-secondary: #5C5C72;
  --text-muted: #8E8EA0;
  --border: rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.15);
  --card-bg: #FFFFFF;
  --skeleton: linear-gradient(90deg, #E8E8EC 25%, #F0F0F4 50%, #E8E8EC 75%);
}

/* Dark theme */
[data-theme="dark"] {
  --bg-primary: #0B0E14;
  --bg-secondary: #12151C;
  --bg-elevated: #1A1E28;
  --bg-overlay: rgba(0,0,0,0.75);
  --text-primary: #F0F0F5;
  --text-secondary: #A0A0B8;
  --text-muted: #6B6B80;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.15);
  --card-bg: #12151C;
  --skeleton: linear-gradient(90deg, #1A1E28 25%, #222630 50%, #1A1E28 75%);
}

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.2;
  font-weight: 700;
}

/* ─── Typography Scale ─── */
.text-display { font-family: var(--font-display); font-weight: 800; }
.text-headline { font-size: clamp(1.75rem, 5vw, 2.5rem); font-weight: 700; line-height: 1.15; }
.text-title { font-size: clamp(1.25rem, 3vw, 1.75rem); font-weight: 700; }
.text-body { font-size: 1rem; line-height: 1.65; }
.text-small { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

/* ─── Layout ─── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.container-narrow {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ─── Header ─── */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 1rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.site-header .logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.125rem;
  color: var(--text-primary);
  white-space: nowrap;
}

.site-header .logo span { color: var(--accent); }

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ─── Theme Toggle ─── */
.theme-toggle {
  width: 44px;
  height: 44px;
  border: none;
  background: var(--accent-muted);
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  transition: background var(--transition);
}

.theme-toggle:hover { background: var(--accent); color: #fff; }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ─── Category Filter Bar ─── */
.category-bar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  z-index: 99;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0.625rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.category-bar::-webkit-scrollbar { display: none; }

.category-bar-inner {
  display: flex;
  gap: 0.5rem;
  padding: 0 1rem;
  min-width: max-content;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.category-chip:hover,
.category-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-category { color: #fff; }
.badge-read-time {
  background: var(--accent-muted);
  color: var(--accent);
}

.badge-sponsored {
  background: rgba(245, 158, 11, 0.15);
  color: #F59E0B;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  min-height: 44px;
  min-width: 44px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--accent-muted); color: var(--accent); }

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  color: #fff;
  border: none;
}

.btn-icon:hover { background: rgba(255,255,255,0.25); }

/* ─── Bottom Navigation ─── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.5rem;
  min-width: 64px;
  transition: color var(--transition);
}

.bottom-nav a.active,
.bottom-nav a:hover { color: var(--accent); }

.bottom-nav svg { width: 22px; height: 22px; }

/* ─── Skeleton Loader ─── */
.skeleton {
  background: var(--skeleton);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Ad Placeholders ─── */
.ad-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.75rem;
  min-height: 90px;
}

.ad-placeholder span {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.ad-sidebar { min-height: 250px; width: 300px; }
.ad-in-article { min-height: 90px; margin: 2rem 0; }
.ad-sticky {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--safe-bottom));
  left: 0;
  right: 0;
  z-index: 90;
  min-height: 50px;
  border-radius: 0;
}

.ad-dismiss {
  position: absolute;
  top: 4px;
  right: 8px;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
}

/* ─── Progress Bar ─── */
.feed-progress {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
  z-index: 101;
}

.feed-progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}

/* ─── Heart Burst Animation ─── */
@keyframes heartBurst {
  0% { transform: scale(0); opacity: 1; }
  50% { transform: scale(1.4); opacity: 1; }
  100% { transform: scale(1.8); opacity: 0; }
}

.heart-burst {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 4rem;
  pointer-events: none;
  animation: heartBurst 0.8s ease forwards;
  z-index: 10;
}

/* ─── Article Page ─── */
.article-page {
  padding-top: calc(var(--header-height) + 1rem);
  padding-bottom: calc(var(--bottom-nav-height) + 2rem);
}

.article-hero {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
}

.article-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.article-content {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text-primary);
}

.article-content p { margin-bottom: 1.25rem; }
.article-content h2, .article-content h3 { margin: 2rem 0 1rem; }

.article-sidebar {
  display: none;
}

/* ─── Category Grid ─── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 1rem 0 2rem;
}

.grid-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
}

.grid-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.grid-card-image {
  aspect-ratio: 16/10;
  overflow: hidden;
}

.grid-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.grid-card:hover .grid-card-image img { transform: scale(1.05); }

.grid-card-body { padding: 1rem 1.25rem 1.25rem; }

.grid-card-title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.grid-card-title a { color: inherit; }
.grid-card-title a:hover { color: var(--accent); }

/* ─── Search ─── */
.search-form {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0 2rem;
}

.search-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: var(--font-body);
  min-height: 48px;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

/* ─── Share Buttons ─── */
.share-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.share-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Breadcrumbs ─── */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.breadcrumbs a { color: var(--text-secondary); }
.breadcrumbs span { color: var(--text-muted); }

/* ─── Comments ─── */
.comment-form { margin: 2rem 0; }
.comment-form input, .comment-form textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font-body);
  margin-bottom: 0.75rem;
}

.comment-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.comment-author { font-weight: 600; margin-bottom: 0.25rem; }

/* ─── Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ─── Desktop Enhancements ─── */
@media (min-width: 768px) {
  .bottom-nav { display: none; }

  .article-page {
    padding-bottom: 3rem;
  }

  .article-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
  }

  .article-sidebar {
    display: block;
    position: sticky;
    top: calc(var(--header-height) + 1rem);
    align-self: start;
  }
}

@media (min-width: 1024px) {
  .site-header { padding: 0 2rem; }
}
