/* Custom styling and modern enhancements */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-serif: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.font-serif-heading {
  font-family: var(--font-sans);
  letter-spacing: -0.025em;
}

/* Breaking news ticker animation */
@keyframes ticker {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-50%, 0, 0);
  }
}

.ticker-track {
  display: inline-flex;
  white-space: nowrap;
  animation: ticker 35s linear infinite;
}

.ticker-track:hover {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track {
    animation: none;
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(156, 163, 175, 0.5);
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(107, 114, 128, 0.8);
}

/* Glassmorphism subtle effects */
.glass-nav {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}


/* Line clamps for card descriptions */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card hover zoom */
.zoom-img {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.article-card:hover .zoom-img {
  transform: scale(1.05);
}

/* Toast alert notification */
#toastNotification {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Rich Article Body Styling */
.article-body {
  font-size: 1.0625rem;
  line-height: 1.85;
  word-break: break-word;
}
.article-body p {
  margin-bottom: 1.35rem;
}
.article-body h2 {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 1rem;
  line-height: 1.3;
  color: #111827;
}
.dark .article-body h2 {
  color: #f9fafb;
}
.article-body h3 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
  line-height: 1.35;
  color: #1f2937;
}
.dark .article-body h3 {
  color: #f3f4f6;
}
.article-body h4 {
  font-weight: 700;
  font-size: 1.15rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}
.dark .article-body h4 { color: #f9fafb; }
.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 1rem;
  margin: 1.5rem auto;
  display: block;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.08);
}
.article-body a {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
  transition: color 0.2s ease;
}
.dark .article-body a {
  color: #60a5fa;
}
.article-body a:hover {
  color: #1d4ed8;
}
.dark .article-body a:hover {
  color: #bfdbfe;
  text-decoration-thickness: 2px;
}
.article-body ul, .article-body ol {
  margin: 1.25rem 0;
  padding-left: 1.75rem;
}
.article-body ul {
  list-style-type: disc;
}
.article-body ol {
  list-style-type: decimal;
}
.article-body li {
  margin-bottom: 0.5rem;
}
.article-body blockquote {
  border-left: 4px solid #3b82f6;
  padding-left: 1.25rem;
  font-style: italic;
  margin: 1.5rem 0;
  color: #4b5563;
}
.dark .article-body blockquote {
  color: #9ca3af;
  border-left-color: #60a5fa;
}
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}
.article-body th, .article-body td {
  border: 1px solid #e5e7eb;
  padding: 0.75rem;
}
.dark .article-body th, .dark .article-body td {
  border-color: #334155;
}
.article-body .table-wrapper,
.article-body table {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.article-body :not(pre) > code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background-color: #f1f5f9;
  border-radius: 0.375rem;
  padding: 0.15rem 0.35rem;
  font-size: 0.9em;
}
.dark .article-body :not(pre) > code {
  background-color: #1e293b;
}
.article-body pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background-color: #f1f5f9;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 1.25rem 0;
  font-size: 0.9em;
}
.dark .article-body pre {
  background-color: #1e293b;
}
.article-body pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

/* AdSense Slot Management */
.ad-slot-box {
  width: 100%;
  min-height: 100px;
  text-align: center;
  overflow: hidden;
  margin: 1.5rem 0;
}

.ad-slot-box ins.adsbygoogle {
  display: block;
  width: 100%;
  margin: 0 auto;
}

aside .ad-slot-box {
  margin: 0;
  overflow: visible;
}

/* Sticky Side Ad Gutters for Laptops and Desktops */
.side-ad-gutter {
  display: none;
  width: 176px;
  flex-shrink: 0;
  position: sticky;
  top: 5.5rem;
}

@media (min-width: 1280px) {
  .side-ad-gutter {
    display: block;
  }
}

.side-ad-gutter .ad-slot-box {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0;
  min-height: 620px;
  overflow: visible;
}

/* Auto-hide unfilled ad slots so empty boxes do not show when AdSense has no inventory */
ins.adsbygoogle[data-ad-status="unfilled"],
.ad-slot-box:has(ins.adsbygoogle[data-ad-status="unfilled"]),
.side-ad-gutter:has(ins.adsbygoogle[data-ad-status="unfilled"]) {
  display: none !important;
}

/* Print Styles */
@media print {
  header, footer, nav, .side-ad-gutter, .ad-slot-box,
  #readingProgressBar, #searchModal, #toastNotification,
  .floating-read-next, button, .share-bar,
  #commentSection, #newsletterSection, #relatedArticles,
  noscript, .sr-only { display: none !important; }

  body {
    background: white !important;
    color: black !important;
    font-size: 12pt;
    line-height: 1.6;
  }

  .article-body { max-width: 100% !important; }
  .article-body a { color: #1d4ed8; text-decoration: underline; }
  .article-body a::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #666; }
  .article-body img { max-width: 100% !important; break-inside: avoid; }
  .article-body pre { white-space: pre-wrap; word-break: break-all; border: 1px solid #ccc; }
}

/* System dark mode preference (flash prevention before JS) */
@media (prefers-color-scheme: dark) {
  html:not(.light) { color-scheme: dark; }
}
