/* ========================================
   CryptoWire - Main Stylesheet
   Light / Community Blog Style
   Mobile-First Responsive Design
   ======================================== */

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

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --border-color: #e5e7eb;
  --border-hover: #d1d5db;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --accent-lighter: #f0f7ff;
  --green: #16a34a;
  --green-light: #f0fdf4;
  --red: #dc2626;
  --red-light: #fef2f2;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --transition: 0.2s ease;
  --max-width: 1280px;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

ul, ol {
  list-style: none;
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* === Header / Navigation === */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.5px;
  cursor: pointer;
}

.logo-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.logo-text {
  color: var(--text-primary);
}

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

.nav-desktop {
  display: none;
  gap: 2px;
}

.nav-desktop a {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.nav-desktop a:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.nav-desktop a.active {
  color: var(--accent);
  background: var(--accent-light);
}

/* Hamburger */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Menu */
.mobile-menu {
  position: fixed;
  top: 60px;
  right: -100%;
  width: 280px;
  height: calc(100vh - 60px);
  background: var(--bg-primary);
  border-left: 1px solid var(--border-color);
  padding: 16px;
  transition: right 0.3s ease;
  z-index: 99;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.mobile-menu.open {
  right: 0;
}

.mobile-menu-overlay {
  position: fixed;
  top: 60px;
  left: 0;
  width: 100%;
  height: calc(100vh - 60px);
  background: rgba(0, 0, 0, 0.3);
  z-index: 98;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-menu-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-menu a {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  min-height: 48px;
}

.mobile-menu a:hover,
.mobile-menu a.active {
  color: var(--accent);
  background: var(--accent-light);
}

/* === Main Content === */
.main-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 16px;
}

/* === Featured / Hero Section === */
.featured,
.featured-section {
  margin-bottom: 32px;
}

.featured-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

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

.featured-image {
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.featured-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--accent);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  letter-spacing: 0.3px;
}

.featured-content {
  padding: 20px;
}

.featured-category {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.featured-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.featured-excerpt {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

.featured-meta {
  font-size: 13px;
  color: var(--text-muted);
}

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

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.section-link {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* === Trending Section === */
.trending-section {
  margin-bottom: 32px;
}

.trending-list {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.trending-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  cursor: pointer;
  transition: background var(--transition);
  min-height: 44px;
  border-bottom: 1px solid var(--border-color);
}

.trending-item:last-child {
  border-bottom: none;
}

.trending-item:hover {
  background: var(--bg-secondary);
}

.trending-rank {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  min-width: 28px;
  font-variant-numeric: tabular-nums;
}

.trending-info {
  flex: 1;
}

.trending-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.trending-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.trending-meta .category {
  color: var(--accent);
  font-weight: 500;
}

/* === Latest Articles Grid === */
.latest-section {
  margin-bottom: 32px;
}

.articles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

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

.article-card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.article-card-body {
  padding: 18px;
}

.article-card-category {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 10px;
}

.article-card-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.article-card-excerpt {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* === Article Detail Page === */
.article-detail {
  max-width: 720px;
  margin: 0 auto;
}

.article-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  margin-bottom: 20px;
  min-height: 44px;
  cursor: pointer;
}

.article-back:hover {
  color: var(--accent);
  background: var(--accent-light);
}

.article-hero-image {
  width: 100%;
  height: 240px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}

.article-detail-header {
  margin-bottom: 28px;
}

.article-detail-category {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 4px;
  margin-bottom: 14px;
}

.article-detail-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.article-detail-meta {
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.article-detail-meta .author {
  color: var(--text-secondary);
  font-weight: 600;
}

.article-detail-body {
  font-size: 16px;
  line-height: 1.8;
  color: #374151;
  margin-top: 24px;
}

.article-detail-body p {
  margin-bottom: 20px;
}

.article-detail-body p:first-child::first-letter {
  font-size: 2.5em;
  font-weight: 700;
  color: var(--accent);
  float: left;
  line-height: 1;
  margin-right: 8px;
  margin-top: 4px;
}

.article-detail-body h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 28px 0 14px;
}

.article-detail-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 14px 20px;
  margin: 24px 0;
  background: var(--accent-lighter);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-primary);
}

/* === Category Page === */
.category-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.category-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.category-desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* === Footer === */
.footer {
  border-top: 1px solid var(--border-color);
  padding: 32px 16px;
  margin-top: 48px;
  background: var(--bg-primary);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-brand-text {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-links a {
  font-size: 13px;
  color: var(--text-muted);
  transition: color var(--transition);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  min-height: 44px;
  display: flex;
  align-items: center;
}

.footer-links a:hover {
  color: var(--accent);
  background: var(--accent-light);
}

.footer-copy {
  font-size: 13px;
  color: var(--text-muted);
}

/* === Page Transitions === */
.page-view {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === Category Tag Colors (Light Theme) === */
.cat-bg-bitcoin { background: #fff7ed; color: #ea580c; }
.cat-bg-ethereum { background: #f0f0ff; color: #6366f1; }
.cat-bg-defi { background: #f0fdf4; color: #16a34a; }
.cat-bg-security { background: #fef2f2; color: #dc2626; }
.cat-bg-markets { background: #eff6ff; color: #2563eb; }
.cat-bg-nfts { background: #fdf4ff; color: #a855f7; }

/* === Responsive Breakpoints === */

/* Tablet (768px+) */
@media (min-width: 768px) {
  .header-inner {
    height: 64px;
    padding: 0 24px;
  }

  .hamburger {
    display: none;
  }

  .nav-desktop {
    display: flex;
  }

  .main-content {
    padding: 32px 24px;
  }

  .featured-image {
    height: 320px;
  }

  .featured-title {
    font-size: 26px;
  }

  .featured-content {
    padding: 28px;
  }

  .articles-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  .article-detail-title {
    font-size: 34px;
  }

  .article-hero-image {
    height: 380px;
  }

  .footer-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
  .header-inner {
    padding: 0 32px;
  }

  .main-content {
    padding: 36px 32px;
  }

  .home-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 36px;
  }

  .home-main {
    min-width: 0;
  }

  .home-sidebar {
    position: sticky;
    top: 100px;
    align-self: start;
  }

  .featured-image {
    height: 380px;
  }

  .featured-title {
    font-size: 30px;
  }

  .article-detail-title {
    font-size: 38px;
  }

  .article-hero-image {
    height: 420px;
  }
}

/* Large Desktop (1280px+) */
@media (min-width: 1280px) {
  .articles-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* === Utility === */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
