/* =============================================================
   styles.css — CryptoVision Global Stylesheet
   A premium, performance-first dark design system.
   ============================================================= */

/* ---- Custom Properties (Design Tokens) ---- */
:root {
  --color-bg-primary:   #020817; /* slate-950 */
  --color-bg-secondary: #0f172a; /* slate-900 */
  --color-bg-card:      #1e293b; /* slate-800 */
  --color-brand:        #20c2fc; /* brand-400 */
  --color-brand-dim:    #06aaed; /* brand-500 */
  --color-text-primary: #f1f5f9; /* slate-100 */
  --color-text-muted:   #94a3b8; /* slate-400 */
  --color-border:       #1e293b; /* slate-800 */
  --font-sans:          'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-lg:          0.75rem;
  --radius-xl:          1rem;
  --radius-2xl:         1.5rem;
  --transition-base:    200ms cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-glow-brand:  0 0 30px rgba(32, 194, 252, 0.15);
}

/* ---- Base Reset & Performance ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
  line-height: 1.7;
  overflow-x: hidden;
}

/* Smooth focus outline for accessibility */
:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---- Scrollbar Styling (WebKit) ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--color-bg-primary); }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ============================================================
   TICKER — Crypto Price Ticker Animation
   ============================================================ */
@keyframes ticker {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
#ticker-track {
  animation: ticker 40s linear infinite;
  will-change: transform;
}
#ticker-track:hover {
  animation-play-state: paused;
}
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  border-right: 1px solid #1e293b;
}
.ticker-item .ticker-symbol {
  color: #94a3b8;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.ticker-item .ticker-price {
  color: #f1f5f9;
}
.ticker-item .ticker-change.up   { color: #22c55e; }
.ticker-item .ticker-change.down { color: #ef4444; }

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #1e293b;
  border-top-color: var(--color-brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   ADSENSE PLACEHOLDER SLOTS
   (Highly visible, premium styled for maximum CTR)
   ============================================================ */
.adsense-placeholder {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border: 2px dashed #334155;
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition-base);
}
.adsense-placeholder::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(32, 194, 252, 0.03), transparent);
  animation: shimmer 2.5s linear infinite;
}
@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ============================================================
   CARD COMPONENTS
   ============================================================ */

/* Base article card */
.article-card {
  background: linear-gradient(135deg, #0f172a 0%, #1a2235 100%);
  border: 1px solid #1e293b;
  border-radius: var(--radius-2xl);
  overflow: hidden;
  transition:
    transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1),
    border-color var(--transition-base),
    box-shadow var(--transition-base);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}
.article-card:hover {
  transform: translateY(-4px);
  border-color: rgba(32, 194, 252, 0.25);
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(32, 194, 252, 0.1),
    var(--shadow-glow-brand);
}
.article-card:active {
  transform: translateY(-2px);
}

/* Card image container with zoom-on-hover */
.article-card .card-image-wrapper {
  overflow: hidden;
  position: relative;
  aspect-ratio: 16/9;
  background: #1e293b;
}
.article-card .card-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}
.article-card:hover .card-image-wrapper img {
  transform: scale(1.06);
}
.article-card .card-image-wrapper .category-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  background: rgba(6, 170, 237, 0.9);
  backdrop-filter: blur(8px);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
}

/* Card body */
.article-card .card-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.article-card .card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.4;
  transition: color var(--transition-base);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-card:hover .card-title { color: var(--color-brand); }
.article-card .card-description {
  font-size: 0.875rem;
  color: #94a3b8;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.article-card .card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid #1e293b;
  font-size: 0.75rem;
  color: #64748b;
}

/* --- FEATURED / HERO CARD (Large) --- */
.article-card.card-featured {
  grid-column: span 2;
}
.article-card.card-featured .card-image-wrapper {
  aspect-ratio: 21/9;
}
.article-card.card-featured .card-title {
  font-size: 1.4rem;
}
.article-card.card-featured .card-description {
  -webkit-line-clamp: 4;
}

@media (max-width: 1024px) {
  .article-card.card-featured {
    grid-column: span 1;
  }
  .article-card.card-featured .card-image-wrapper {
    aspect-ratio: 16/9;
  }
}

/* ============================================================
   CATEGORY FILTER BUTTONS
   ============================================================ */
.category-btn {
  padding: 0.4rem 1rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid #334155;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition:
    background var(--transition-base),
    color var(--transition-base),
    border-color var(--transition-base),
    transform 150ms ease;
  white-space: nowrap;
}
.category-btn:hover {
  background: #1e293b;
  color: #f1f5f9;
  border-color: #475569;
}
.category-btn.active {
  background: linear-gradient(135deg, #0088cb, #06aaed);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 0 12px rgba(32, 194, 252, 0.3);
}
.category-btn:active { transform: scale(0.96); }

/* ============================================================
   ARTICLE PROSE STYLES (Rich typography for article bodies)
   ============================================================ */
.article-prose {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: #cbd5e1;
}
.article-prose h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: #f1f5f9;
  margin: 2rem 0 0.9rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
  position: relative;
  padding-left: 1rem;
}
.article-prose h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.2em;
  width: 4px;
  height: 1.3em;
  background: linear-gradient(to bottom, var(--color-brand), #8b5cf6);
  border-radius: 2px;
}
.article-prose h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #e2e8f0;
  margin: 1.5rem 0 0.75rem;
}
.article-prose p {
  margin-bottom: 1.25rem;
}
.article-prose p:last-child { margin-bottom: 0; }
.article-prose strong {
  color: #f1f5f9;
  font-weight: 700;
}
.article-prose a {
  color: var(--color-brand);
  text-decoration: underline;
  text-decoration-color: rgba(32, 194, 252, 0.3);
  transition: color var(--transition-base), text-decoration-color var(--transition-base);
}
.article-prose a:hover {
  color: #6dd8fe;
  text-decoration-color: rgba(109, 216, 254, 0.7);
}
.article-prose ul, .article-prose ol {
  margin: 1rem 0 1.25rem 1.5rem;
}
.article-prose li { margin-bottom: 0.4rem; }
.article-prose ul li { list-style-type: disc; }
.article-prose ol li { list-style-type: decimal; }
.article-prose blockquote {
  border-left: 4px solid var(--color-brand);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: rgba(32, 194, 252, 0.05);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  color: #94a3b8;
  font-style: italic;
}
.article-prose code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.875em;
  background: #0f172a;
  color: var(--color-brand);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  border: 1px solid #1e293b;
}
.article-prose pre {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}
.article-prose pre code {
  background: none;
  border: none;
  padding: 0;
  color: #e2e8f0;
}

/* ============================================================
   TABLE OF CONTENTS (Article Sidebar)
   ============================================================ */
#toc-list a {
  display: block;
  padding: 0.3rem 0.5rem;
  border-radius: 0.4rem;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  transition: color var(--transition-base), background var(--transition-base);
  border-left: 2px solid transparent;
}
#toc-list a:hover {
  color: #f1f5f9;
  background: rgba(255,255,255,0.04);
}
#toc-list a.active {
  color: var(--color-brand);
  border-left-color: var(--color-brand);
  background: rgba(32, 194, 252, 0.06);
}

/* ============================================================
   SEARCH OVERLAY
   ============================================================ */
#search-overlay {
  transition: opacity 200ms ease;
}
#search-overlay.active {
  display: flex;
  opacity: 1;
}
#search-overlay .search-result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius-lg);
  background: #0f172a;
  border: 1px solid #1e293b;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition-base), background var(--transition-base);
}
#search-overlay .search-result-item:hover {
  border-color: #334155;
  background: #1e293b;
}
#search-overlay .search-result-item img {
  width: 60px;
  height: 60px;
  border-radius: 0.5rem;
  object-fit: cover;
  flex-shrink: 0;
  background: #1e293b;
}

/* ============================================================
   BACK-TO-TOP BUTTON
   ============================================================ */
#back-to-top {
  opacity: 0;
  pointer-events: none;
  transform: translateY(1rem);
  transition:
    opacity var(--transition-base),
    transform var(--transition-base);
}
#back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */
#toast {
  opacity: 0;
  transform: translateY(0.5rem);
  pointer-events: none;
  transition:
    opacity var(--transition-base),
    transform var(--transition-base);
}
#toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ============================================================
   SCROLL PROGRESS BAR (Article Page)
   ============================================================ */
#scroll-progress-bar {
  transition: width 0.1s linear;
  box-shadow: 0 0 8px rgba(32, 194, 252, 0.5);
}

/* ============================================================
   ANIMATIONS — Fade-in on scroll (Intersection Observer)
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   NAV LINK — active state indicator
   ============================================================ */
.nav-link.active {
  color: var(--color-brand);
  background: rgba(32, 194, 252, 0.08);
}

/* ============================================================
   TAG CHIP
   ============================================================ */
.tag-chip {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-base), color var(--transition-base), border-color var(--transition-base);
}
.tag-chip:hover {
  background: rgba(32, 194, 252, 0.1);
  color: var(--color-brand);
  border-color: rgba(32, 194, 252, 0.3);
}

/* ============================================================
   MOBILE-FIRST RESPONSIVE UTILITIES
   ============================================================ */
@media (max-width: 640px) {
  .article-prose h2 { font-size: 1.3rem; }
  .article-prose { font-size: 0.9375rem; }
}

/* ============================================================
   PRINT STYLES — minimal, clean print output
   ============================================================ */
@media print {
  #ticker-wrapper, header, footer, aside, .adsense-placeholder,
  #back-to-top, #toast, #scroll-progress-bar { display: none !important; }
  body { background: #fff; color: #000; }
  .article-prose { color: #111; }
}
