/* =============================================
   antarvasnapur.in — Main Stylesheet
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Tiro+Devanagari+Hindi:ital@0;1&family=Mukta:wght@300;400;500;600;700&family=Noto+Sans+Devanagari:wght@300;400;500;600;700&display=swap');

/* ---- CSS Variables ---- */
:root {
  --bg: #faf8f5;
  --bg-card: #ffffff;
  --bg-secondary: #f3f0eb;
  --text: #1a1614;
  --text-muted: #6b6460;
  --text-light: #9e9590;
  --accent: #c0392b;
  --accent-dark: #962d22;
  --accent-light: #e8503f;
  --border: #e8e2da;
  --border-light: #f0ebe3;
  --shadow: 0 2px 16px rgba(0,0,0,0.08);
  --shadow-hover: 0 8px 32px rgba(0,0,0,0.14);
  --radius: 12px;
  --radius-sm: 6px;
  --font-body: 'Mukta', 'Noto Sans Devanagari', sans-serif;
  --font-heading: 'Tiro Devanagari Hindi', serif;
  --header-h: 64px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #120f0e;
  --bg-card: #1e1918;
  --bg-secondary: #1a1615;
  --text: #f0ece7;
  --text-muted: #a09890;
  --text-light: #706860;
  --accent: #e8503f;
  --accent-dark: #c0392b;
  --accent-light: #ff6b5b;
  --border: #2e2520;
  --border-light: #241f1d;
  --shadow: 0 2px 16px rgba(0,0,0,0.4);
  --shadow-hover: 0 8px 32px rgba(0,0,0,0.6);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  transition: background 0.3s ease, color 0.3s ease;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: var(--transition);
}
a:hover { color: var(--accent-light); }

img { max-width: 100%; display: block; }

/* ---- Reading Progress Bar ---- */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  z-index: 9999;
  transition: width 0.1s linear;
}

/* ---- Header ---- */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 12px rgba(0,0,0,0.07);
  display: flex;
  align-items: center;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.logo span { color: var(--text-muted); font-size: 0.8em; }

nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

nav a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}
nav a:hover, nav a.active {
  color: var(--accent);
  background: var(--bg-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border: none;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: var(--transition);
}
.btn-icon:hover { background: var(--border); color: var(--accent); }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  padding: 6px;
  background: none;
  border: none;
}
.hamburger span {
  width: 22px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: var(--transition);
}

/* ---- Mobile Nav ---- */
.mobile-nav {
  display: none;
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  z-index: 99;
  flex-direction: column;
  gap: 4px;
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
  color: var(--text);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.mobile-nav a:hover { background: var(--bg-secondary); }

/* ---- Hero / Search Bar ---- */
.hero {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  padding: 60px 20px;
  text-align: center;
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 5vw, 3rem);
  color: #fff;
  margin-bottom: 8px;
  line-height: 1.2;
}

.hero p {
  color: rgba(255,255,255,0.8);
  font-size: 1.05rem;
  margin-bottom: 32px;
}

.search-form {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  gap: 0;
  background: #fff;
  border-radius: 50px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}

.search-form input {
  flex: 1;
  padding: 14px 24px;
  border: none;
  outline: none;
  font-size: 1rem;
  font-family: var(--font-body);
  background: transparent;
  color: #1a1614;
}

.search-form button {
  padding: 14px 28px;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-body);
  transition: var(--transition);
}
.search-form button:hover { background: var(--accent-dark); }

/* ---- Layout ---- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.layout-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
  padding: 40px 0;
}

@media (max-width: 900px) {
  .layout-grid { grid-template-columns: 1fr; }
}

/* ---- Section Headers ---- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::before {
  content: '';
  display: block;
  width: 4px;
  height: 22px;
  background: var(--accent);
  border-radius: 2px;
}

.see-all {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--border);
  padding: 5px 14px;
  border-radius: 50px;
}
.see-all:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---- Story Cards ---- */
.stories-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.story-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.story-card::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform 0.25s ease;
}

.story-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  transform: translateX(4px);
}
.story-card:hover::after { transform: scaleY(1); }

.story-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.story-card-meta .cat-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: rgba(192,57,43,0.1);
  padding: 2px 8px;
  border-radius: 3px;
}

.story-card-meta .meta-info {
  font-size: 0.78rem;
  color: var(--text-light);
  display: flex;
  gap: 8px;
  align-items: center;
}

.story-card h2 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.35;
}

.story-card h2 a { color: inherit; }
.story-card h2 a:hover { color: var(--accent); }

.story-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.story-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.story-tags { display: flex; gap: 6px; flex-wrap: wrap; }

.tag-pill {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 2px 10px;
  border-radius: 50px;
  border: 1px solid var(--border);
  transition: var(--transition);
}
.tag-pill:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(192,57,43,0.06);
}

.read-btn {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}
.read-btn:hover { color: var(--accent-light); }

/* Rating Stars */
.stars {
  display: inline-flex;
  gap: 2px;
  color: #f39c12;
  font-size: 0.8rem;
}

/* ---- Grid Cards (3-col) ---- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card-sm {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: var(--transition);
}
.card-sm:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.card-sm h3 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  margin-bottom: 6px;
  color: var(--text);
  line-height: 1.35;
}
.card-sm h3 a { color: inherit; }
.card-sm h3 a:hover { color: var(--accent); }
.card-sm p { font-size: 0.83rem; color: var(--text-muted); }

/* ---- Trending Cards ---- */
.trending-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trending-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  transition: var(--transition);
}
.trending-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.trending-num {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--border);
  line-height: 1;
  min-width: 28px;
  font-family: var(--font-heading);
}
.trending-item:nth-child(1) .trending-num { color: #f39c12; }
.trending-item:nth-child(2) .trending-num { color: var(--text-light); }
.trending-item:nth-child(3) .trending-num { color: #cd7f32; }

.trending-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 4px;
}
.trending-info h4 a { color: inherit; }
.trending-info h4 a:hover { color: var(--accent); }
.trending-info span { font-size: 0.78rem; color: var(--text-light); }

/* ---- Sidebar ---- */
.sidebar { display: flex; flex-direction: column; gap: 28px; }

.sidebar-widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.widget-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Category list */
.cat-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.cat-list li a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  transition: var(--transition);
}
.cat-list li a:hover { background: var(--bg-secondary); color: var(--accent); }
.cat-list li .count {
  font-size: 0.75rem;
  background: var(--bg-secondary);
  border-radius: 50px;
  padding: 1px 8px;
  color: var(--text-light);
}

/* Tags Cloud */
.tags-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tags-cloud a {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 50px;
  transition: var(--transition);
}
.tags-cloud a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(192,57,43,0.06);
}

/* Random story btn */
.btn-random {
  display: block;
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-body);
  text-align: center;
  transition: var(--transition);
}
.btn-random:hover { background: var(--accent-dark); color: #fff; transform: translateY(-2px); box-shadow: 0 4px 16px rgba(192,57,43,0.4); }

/* ---- Pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 32px;
}

.page-btn {
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-muted);
  font-family: var(--font-body);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.page-btn:hover, .page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- Story Page ---- */
.story-page { max-width: 760px; margin: 0 auto; padding: 40px 20px; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-light);
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { color: var(--border); }

.story-header { margin-bottom: 32px; }

.story-title {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 16px;
}

.story-meta-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  font-size: 0.83rem;
  color: var(--text-muted);
}

.story-meta-bar .meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.story-cats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.story-content {
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--text);
  font-family: var(--font-heading);
}

.story-content p { margin-bottom: 1.4em; }
.story-content h2, .story-content h3 {
  font-size: 1.3rem;
  margin: 1.8em 0 0.8em;
  color: var(--text);
}

/* Story actions */
.story-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 32px 0;
  flex-wrap: wrap;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-body);
  transition: var(--transition);
}
.action-btn:hover { border-color: var(--accent); color: var(--accent); }
.action-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Rating */
.rating-widget { margin: 24px 0; }
.rating-widget h4 { font-size: 0.95rem; margin-bottom: 10px; color: var(--text-muted); }
.rating-stars {
  display: flex;
  gap: 6px;
}
.rating-stars span {
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--border);
  transition: color 0.15s;
}
.rating-stars span:hover,
.rating-stars span.active { color: #f39c12; }

/* Story Navigation */
.story-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 32px 0;
}

.story-nav-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-decoration: none;
  transition: var(--transition);
}
.story-nav-item:hover { border-color: var(--accent); box-shadow: var(--shadow); }

.story-nav-item .nav-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  margin-bottom: 4px;
}
.story-nav-item .nav-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-heading);
}
.story-nav-item.next { text-align: right; }

/* ---- Tags Page / Category Page ---- */
.page-hero {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 48px 20px;
  text-align: center;
}

.page-hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  color: var(--text);
  margin-bottom: 8px;
}
.page-hero p { color: var(--text-muted); font-size: 0.95rem; }

/* ---- Search Page ---- */
.search-results-header {
  padding: 24px 0 0;
  margin-bottom: 20px;
}
.search-results-header h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  color: var(--text);
}
.search-results-header span { color: var(--accent); }

/* ---- All Stories Page ---- */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 16px 0;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.filter-select {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.88rem;
  font-family: var(--font-body);
  cursor: pointer;
  outline: none;
}
.filter-select:focus { border-color: var(--accent); }

/* ---- Footer ---- */
footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 48px 20px 24px;
  margin-top: 60px;
}

.footer-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
}

.footer-brand .logo { font-size: 1.3rem; margin-bottom: 10px; }
.footer-brand p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; }

.footer-col h4 {
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  margin-bottom: 14px;
}
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-col ul a { font-size: 0.85rem; color: var(--text-muted); }
.footer-col ul a:hover { color: var(--accent); }

.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-light);
  flex-wrap: wrap;
  gap: 8px;
}

/* ---- Back to Top ---- */
#back-to-top {
  position: fixed;
  bottom: 28px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(192,57,43,0.4);
  transition: var(--transition);
  z-index: 50;
}
#back-to-top:hover { background: var(--accent-dark); transform: translateY(-3px); }
#back-to-top.visible { display: flex; }

/* ---- Toast notification ---- */
.toast {
  position: fixed;
  bottom: 80px;
  right: 24px;
  background: var(--text);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  z-index: 200;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ---- Bookmarks Page ---- */
.bookmarks-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.bookmarks-empty .icon { font-size: 3rem; margin-bottom: 16px; }

/* ---- Related stories ---- */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

/* ---- Loading ---- */
.loading {
  text-align: center;
  padding: 60px;
  color: var(--text-light);
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Utilities ---- */
.mt-0 { margin-top: 0; }
.mb-4 { margin-bottom: 16px; }
.mb-8 { margin-bottom: 32px; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.hidden { display: none !important; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  nav { display: none; }
  .hamburger { display: flex; }
  .hero { padding: 40px 20px; }
  .story-nav { grid-template-columns: 1fr; }
  .header-inner { gap: 12px; }
}

@media (max-width: 480px) {
  .story-card { padding: 16px; }
  .story-meta-bar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .story-actions { gap: 8px; }
  .action-btn { padding: 8px 14px; font-size: 0.82rem; }
}
