:root {
  --bg: #f9f9fb;
  --surface: #ffffff;
  --border: #e8e8ee;
  --primary: #1a1a2e;
  --accent: #5c5ce0;
  --accent2: #00c896;
  --text: #1a1a2e;
  --muted: #6b6b80;
  --tag-bg: #eeeeff;
  --tag-color: #5c5ce0;
  --radius: 12px;
  --shadow: 0 2px 16px rgba(0,0,0,.06);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

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

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

/* ── HEADER ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.logo {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

nav { display: flex; gap: 6px; }

nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 8px;
  transition: all .15s;
}

nav a:hover, nav a.active {
  color: var(--accent);
  background: var(--tag-bg);
}

/* ── HERO ── */
.hero {
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2b6b 60%, #1a3a5c 100%);
  color: #fff;
  padding: 72px 24px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(28px, 5vw, 52px);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.15;
  max-width: 780px;
  margin: 0 auto 16px;
}

.hero h1 em {
  font-style: normal;
  color: #7dffca;
}

.hero p {
  font-size: 18px;
  opacity: .75;
  max-width: 540px;
  margin: 0 auto 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent2);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 28px;
  border-radius: 50px;
  transition: transform .15s, box-shadow .15s;
}

.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,200,150,.35); }

/* ── AD BANNER ── */
.ad-banner {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}

.ad-banner.leaderboard { min-height: 90px; }
.ad-banner.rectangle { min-height: 250px; width: 300px; flex-shrink: 0; }
.ad-banner.in-article { min-height: 90px; margin: 32px 0; }

/* ── CONTAINER ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── CATEGORIES STRIP ── */
.categories {
  padding: 24px 0 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cat-tag {
  background: var(--tag-bg);
  color: var(--tag-color);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 50px;
  cursor: pointer;
  transition: all .15s;
}

.cat-tag:hover, .cat-tag.active {
  background: var(--accent);
  color: #fff;
}

/* ── MAIN LAYOUT ── */
.main-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
  padding: 40px 0 80px;
}

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

/* ── FEATURED ARTICLE ── */
.featured {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-bottom: 32px;
  box-shadow: var(--shadow);
  transition: transform .2s;
}

.featured:hover { transform: translateY(-3px); box-shadow: 0 8px 32px rgba(0,0,0,.1); }

.featured img {
  width: 100%;
  height: 280px;
  object-fit: cover;
}

.featured-body {
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (max-width: 700px) {
  .featured { grid-template-columns: 1fr; }
  .featured img { height: 200px; }
}

/* ── ARTICLE GRID ── */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,.1);
}

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

.card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--accent);
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
}

.card-excerpt {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  flex: 1;
}

.card-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.card-meta span::before { content: "·"; margin-right: 8px; }
.card-meta span:first-child::before { content: ""; margin-right: 0; }

/* ── SIDEBAR ── */
.sidebar { display: flex; flex-direction: column; gap: 24px; }

.widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.widget h3 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin-bottom: 16px;
}

.newsletter-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.newsletter-form input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color .15s;
}

.newsletter-form input:focus { border-color: var(--accent); }

.newsletter-form button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: opacity .15s;
}

.newsletter-form button:hover { opacity: .85; }

.popular-list { display: flex; flex-direction: column; gap: 16px; }

.popular-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 14px;
}

.popular-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--border);
  line-height: 1;
  flex-shrink: 0;
  width: 24px;
}

.popular-item a {
  font-weight: 600;
  line-height: 1.4;
  transition: color .15s;
}

.popular-item a:hover { color: var(--accent); }

/* ── ARTICLE PAGE ── */
.article-header { padding: 48px 0 32px; }

.article-header .cat-tag { margin-bottom: 12px; display: inline-block; }

.article-header h1 {
  font-size: clamp(24px, 4vw, 42px);
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.2;
  max-width: 780px;
  margin-bottom: 16px;
}

.article-header .meta {
  font-size: 14px;
  color: var(--muted);
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.author-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.article-hero-img {
  width: 100%;
  max-width: 860px;
  height: 400px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 40px;
}

.article-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 60px;
  padding-bottom: 80px;
}

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

.article-content {
  max-width: 720px;
  font-size: 17px;
  line-height: 1.8;
}

.article-content h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 40px 0 16px;
  color: var(--primary);
}

.article-content h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 32px 0 12px;
}

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

.article-content ul, .article-content ol {
  margin: 0 0 20px 24px;
}

.article-content li { margin-bottom: 8px; }

.article-content blockquote {
  border-left: 4px solid var(--accent);
  padding: 16px 20px;
  background: var(--tag-bg);
  border-radius: 0 8px 8px 0;
  margin: 24px 0;
  font-style: italic;
}

.article-content strong { color: var(--primary); }

/* ── FOOTER ── */
footer {
  background: var(--primary);
  color: rgba(255,255,255,.65);
  padding: 48px 24px;
}

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

@media (max-width: 700px) {
  .footer-inner { grid-template-columns: 1fr; }
}

.footer-brand .logo { color: #fff; margin-bottom: 12px; }
.footer-brand p { font-size: 14px; line-height: 1.7; max-width: 300px; }

footer h4 { color: #fff; font-size: 14px; font-weight: 700; margin-bottom: 16px; }

footer ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }

footer ul li a {
  font-size: 14px;
  color: rgba(255,255,255,.55);
  transition: color .15s;
}

footer ul li a:hover { color: #fff; }

.footer-bottom {
  max-width: 1200px;
  margin: 32px auto 0;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── UTILS ── */
.section-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 2px;
  background: var(--border);
}

.badge-new {
  background: #ff4d6d;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 50px;
  text-transform: uppercase;
}

#loading {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-size: 14px;
}
