/* ==========================================================================
   BARTA PROBAHO TYPOGRAPHY & DESIGN SYSTEM (BARTA BAZAR TRADITION)
   Primary Bengali Newspaper Font: SolaimanLipi (Classic Broadside / Newsprint)
   Progressive Fallbacks: Siyam Rupali, Kalpurush, Hind Siliguri, Noto Sans Bengali, Vrinda
   ========================================================================== */

@font-face {
  font-family: 'SolaimanLipi';
  src: url('/fonts/SolaimanLipi.ttf') format('truetype'),
       local('SolaimanLipi'),
       local('Solaiman Lipi');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SolaimanLipi';
  src: url('/fonts/SolaimanLipi.ttf') format('truetype'),
       local('SolaimanLipi Bold'),
       local('SolaimanLipi-Bold');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@400;500;600;700&family=Noto+Sans+Bengali:wght@400;500;600;700&family=Noto+Serif+Bengali:wght@600;700&display=swap');

:root {
  /* Centralized Typography Tokens */
  --font-bengali-primary: 'SolaimanLipi', 'Siyam Rupali', 'Kalpurush', 'Hind Siliguri', 'Noto Sans Bengali', Vrinda, sans-serif;
  --font-bengali-display: 'SolaimanLipi', 'Siyam Rupali', 'Kalpurush', 'Noto Serif Bengali', Georgia, serif;
  --font-bengali-headline: 'SolaimanLipi', 'Siyam Rupali', 'Kalpurush', 'Hind Siliguri', sans-serif;
  --font-bengali-body: 'SolaimanLipi', 'Siyam Rupali', 'Kalpurush', 'Hind Siliguri', sans-serif;
  --font-bengali-nav: 'SolaimanLipi', 'Siyam Rupali', 'Kalpurush', 'Hind Siliguri', sans-serif;
  --font-bengali-meta: 'SolaimanLipi', 'Siyam Rupali', 'Kalpurush', 'Hind Siliguri', sans-serif;
  --font-ui: 'SolaimanLipi', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --font-bengali: var(--font-bengali-primary);
  
  /* Authoritative Editorial Newspaper Palette */
  --color-primary: #b91c1c;         /* Classic Press Red */
  --color-primary-dark: #991b1b;
  --color-primary-light: #fef2f2;
  --color-ink: #0f172a;             /* Deep Broadside Ink */
  --color-ink-muted: #475569;
  --color-ink-faint: #94a3b8;
  
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-surface-elevated: #ffffff;
  --color-border: #e2e8f0;
  --color-border-faint: #f1f5f9;
  
  --color-text-main: #0f172a;
  --color-text-muted: #475569;
  
  --shadow-subtle: 0 1px 3px 0 rgb(0 0 0 / 0.04), 0 1px 2px -1px rgb(0 0 0 / 0.04);
  --shadow-card: 0 2px 6px -1px rgb(0 0 0 / 0.06), 0 1px 4px -2px rgb(0 0 0 / 0.04);
  --shadow-hover: 0 10px 20px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  
  --radius-xs: 0.125rem;
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
}

[data-theme="dark"] {
  --bg-page: #090d16;
  --bg-card: #111726;
  --bg-surface-elevated: #161e31;
  --color-primary-light: #201214;
  
  --color-ink: #f8fafc;
  --color-ink-muted: #94a3b8;
  --color-ink-faint: #64748b;
  
  --color-text-main: #f1f5f9;
  --color-text-muted: #94a3b8;
  --color-border: #1e293b;
  --color-border-faint: #131b2e;
  
  --shadow-subtle: 0 1px 3px 0 rgb(0 0 0 / 0.3);
  --shadow-card: 0 2px 6px -1px rgb(0 0 0 / 0.4);
  --shadow-hover: 0 10px 20px -3px rgb(0 0 0 / 0.5);
}

/* Base Typographic Rules */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
  font-family: var(--font-bengali);
}

body {
  font-family: var(--font-bengali);
  background-color: var(--bg-page);
  color: var(--color-text-main);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-bengali-headline);
  font-weight: 700;
  line-height: 1.32;
  color: var(--color-text-main);
  letter-spacing: -0.01em;
}

/* Semantic Typography Token Classes */
.newspaper-display {
  font-family: var(--font-bengali-headline);
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -0.01em;
}

.newspaper-headline {
  font-family: var(--font-bengali-headline);
  font-weight: 700;
  line-height: 1.32;
  letter-spacing: -0.005em;
}

.newspaper-section-title {
  font-family: var(--font-bengali-headline);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.3;
}

.newspaper-card-title {
  font-family: var(--font-bengali-headline);
  font-weight: 700;
  font-size: 1.0625rem; /* ~17px matching Barta Bazar card title standard */
  line-height: 1.36;
}

.newspaper-body {
  font-family: var(--font-bengali-body);
  font-weight: 400;
  font-size: 1.25rem;   /* ~20px matching Barta Bazar article standard */
  line-height: 1.95;
  letter-spacing: -0.005em;
  text-align: justify;
  text-justify: inter-word;
}

.newspaper-meta {
  font-family: var(--font-bengali-meta);
  font-weight: 500;
  font-size: 0.8125rem; /* ~13px */
  line-height: 1.4;
  color: var(--color-ink-muted);
}

.newspaper-nav {
  font-family: var(--font-bengali-nav);
  font-weight: 600;
  font-size: 1.025rem;  /* ~16.5px */
  line-height: 1.5;
}

.newspaper-utility {
  font-family: var(--font-ui);
  font-weight: 600;
}

/* Reading Progress Indicator */
#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--color-primary);
  width: 0%;
  z-index: 100;
  transition: width 0.1s ease-out;
}

/* Breaking Ticker */
.ticker-wrap {
  overflow: hidden;
  white-space: nowrap;
}

.ticker-move {
  display: inline-block;
  white-space: nowrap;
  animation: ticker 45s linear infinite;
}

.ticker-move:hover,
.ticker-move:focus-within {
  animation-play-state: paused;
}

@keyframes ticker {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-move {
    animation: none;
    overflow-x: auto;
  }
}

/* Newspaper Section Title Accent */
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--color-ink);
  padding-bottom: 0.5rem;
  margin-bottom: 1.25rem;
}

.section-heading-title {
  font-size: 1.35rem;
  font-weight: 700;
  position: relative;
  color: var(--color-ink);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.section-heading-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 1.25rem;
  background-color: var(--color-primary);
  border-radius: var(--radius-xs);
}

[data-theme="dark"] .section-heading {
  border-bottom-color: #334155;
}

[data-theme="dark"] .section-heading-title {
  color: #ffffff;
}

/* Editorial Card Family */
.news-card {
  background: var(--bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
}

.news-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: #cbd5e1;
}

[data-theme="dark"] .news-card:hover {
  border-color: #475569;
}

.news-card img {
  transition: transform 0.4s ease;
}

.news-card:hover img {
  transform: scale(1.03);
}

/* Lead Hero Badges */
.lead-badge {
  background-color: var(--color-primary);
  color: #ffffff;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  letter-spacing: 0.02em;
}

.breaking-pulse {
  display: inline-block;
  width: 7px;
  height: 7px;
  background-color: #ffffff;
  border-radius: 50%;
  animation: pulse-dot 1.2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.7); }
}

/* Most Read Ranked Number */
.ranked-number {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "SolaimanLipi", sans-serif;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.375;
  color: #64748b;
  transition: color 0.2s ease;
  flex-shrink: 0;
  width: 1.5rem;
  text-align: left;
  letter-spacing: -0.01em;
  padding-top: 0.05rem;
}

[data-theme="dark"] .ranked-number,
.dark .ranked-number {
  color: #94a3b8;
}

.group:hover .ranked-number {
  color: var(--color-primary);
}

/* Opinion Columnist Card */
.opinion-card {
  background: var(--bg-card);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-primary);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  transition: all 0.2s ease;
}

.opinion-card:hover {
  box-shadow: var(--shadow-card);
  border-color: #cbd5e1;
  border-top-color: var(--color-primary);
}

/* Multimedia Overlay Badges */
.video-play-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  transition: background 0.2s ease;
}

.news-card:hover .video-play-badge {
  background: rgba(0, 0, 0, 0.2);
}

.play-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(185, 28, 28, 0.9);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease, background 0.2s ease;
}

.news-card:hover .play-circle {
  transform: scale(1.1);
  background: #dc2626;
}

/* Article Page Typography & Reading Experience */
.article-reading-column {
  max-width: 48rem; /* ~768px for optimal reading line length */
}

.article-content {
  font-family: var(--font-bengali-body);
  color: var(--color-text-main);
  line-height: 1.95;
  font-size: 1.25rem; /* ~20px standard from Barta Bazar */
  text-align: justify;
  text-justify: inter-word;
}

.article-content p {
  margin-bottom: 1.5rem;
  letter-spacing: -0.005em;
}

.article-content h2,
.article-content h3 {
  font-family: var(--font-bengali-headline);
  margin-top: 2rem;
  margin-bottom: 0.85rem;
  font-weight: 700;
  line-height: 1.32;
}

.article-content h2 {
  font-size: 1.65rem;
  border-left: 4px solid var(--color-primary);
  padding-left: 0.85rem;
}

.article-content h3 {
  font-size: 1.35rem;
}

.article-content blockquote {
  font-family: var(--font-bengali-body);
  border-left: 4px solid var(--color-primary);
  background-color: var(--color-primary-light);
  padding: 1.1rem 1.35rem;
  margin: 1.65rem 0;
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--color-ink);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  line-height: 1.9;
}

[data-theme="dark"] .article-content blockquote {
  background-color: #1a1012;
  color: #f1f5f9;
}

.article-content ul,
.article-content ol {
  margin: 1.35rem 0;
  padding-left: 1.5rem;
}

.article-content ul {
  list-style-type: disc;
}

.article-content ol {
  list-style-type: decimal;
}

.article-content li {
  margin-bottom: 0.55rem;
}

.article-content a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-content a:hover {
  color: var(--color-primary-dark);
}

/* Font Size Scaling (Reader Preferences) */
[data-font-size="normal"] .article-content {
  font-size: 1.25rem; /* 20px */
  line-height: 1.95;
}

[data-font-size="medium"] .article-content {
  font-size: 1.375rem; /* 22px */
  line-height: 2.05;
}

[data-font-size="large"] .article-content {
  font-size: 1.5rem; /* 24px */
  line-height: 2.15;
}

/* Mobile Responsive Typography Adjustments (320px–640px) */
@media (max-width: 640px) {
  .article-content {
    font-size: 1.125rem; /* 18px on small screens for comfortable eye movement */
    line-height: 1.88;
    text-align: left; /* Avoid harsh justification gaps on narrow mobile columns */
  }

  [data-font-size="normal"] .article-content {
    font-size: 1.125rem;
    line-height: 1.88;
  }

  [data-font-size="medium"] .article-content {
    font-size: 1.25rem;
    line-height: 1.95;
  }

  [data-font-size="large"] .article-content {
    font-size: 1.375rem;
    line-height: 2.05;
  }

  .newspaper-display {
    font-size: 1.6rem;
    line-height: 1.3;
  }

  .newspaper-headline {
    font-size: 1.2rem;
    line-height: 1.34;
  }

  .newspaper-card-title {
    font-size: 1.05rem;
    line-height: 1.36;
  }
}

/* Advertisement Container Clarity */
.ad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-card);
  border: 1px dashed var(--color-border);
  padding: 0.5rem;
  margin: 1rem 0;
  border-radius: var(--radius-sm);
}

.ad-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-ink-faint);
  margin-bottom: 0.25rem;
  font-weight: 600;
}

/* Print Clean Styles */
@media print {
  header, footer, .ad-banner, .reading-controls, #reading-progress, .breaking-ticker, #back-to-top {
    display: none !important;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .article-content {
    font-size: 12pt !important;
    line-height: 1.6 !important;
  }
}

/* ==========================================================================
   Day/Night Dark Mode Theme Overrides
   ========================================================================== */
html.dark, html[data-theme="dark"] {
  color-scheme: dark;
}

html.dark body, html[data-theme="dark"] body {
  background-color: #0b101b !important;
  color: #f1f5f9 !important;
}

html.dark .bg-white, html[data-theme="dark"] .bg-white {
  background-color: #111726 !important;
  color: #f1f5f9;
}

html.dark .bg-gray-50, html[data-theme="dark"] .bg-gray-50,
html.dark .bg-slate-50, html[data-theme="dark"] .bg-slate-50 {
  background-color: #0d1320 !important;
}

html.dark .bg-gray-100, html[data-theme="dark"] .bg-gray-100 {
  background-color: #151d2e !important;
}

html.dark .text-gray-900, html[data-theme="dark"] .text-gray-900,
html.dark .text-gray-800, html[data-theme="dark"] .text-gray-800,
html.dark .text-slate-900, html[data-theme="dark"] .text-slate-900 {
  color: #f8fafc !important;
}

html.dark .text-gray-700, html[data-theme="dark"] .text-gray-700,
html.dark .text-gray-600, html[data-theme="dark"] .text-gray-600 {
  color: #cbd5e1 !important;
}

html.dark .text-gray-500, html[data-theme="dark"] .text-gray-500 {
  color: #94a3b8 !important;
}

html.dark .border-gray-200, html[data-theme="dark"] .border-gray-200,
html.dark .border-gray-100, html[data-theme="dark"] .border-gray-100,
html.dark .border-slate-200, html[data-theme="dark"] .border-slate-200 {
  border-color: #1e293b !important;
}

html.dark .divide-gray-100 > :not([hidden]) ~ :not([hidden]),
html.dark .divide-gray-200 > :not([hidden]) ~ :not([hidden]) {
  border-color: #1e293b !important;
}

html.dark .news-card, html[data-theme="dark"] .news-card {
  background-color: #111726 !important;
  border-color: #1e293b !important;
}

html.dark input, html.dark select, html.dark textarea,
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea {
  background-color: #0d1320 !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

html.dark .bg-red-50, html[data-theme="dark"] .bg-red-50 {
  background-color: #271013 !important;
  color: #fca5a5 !important;
}
