:root {
  --bg: #0d1117;
  --bg-card: #161b22;
  --bg-header: #010409;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --border: #30363d;
  --ad-bg: #1c2128;
  --max-width: 1400px;
  --sidebar: 300px;
  --header-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

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

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  gap: 16px;
}

.site-logo {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

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

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}

.nav-toggle.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-active span:nth-child(2) { opacity: 0; }
.nav-toggle.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.site-nav ul {
  display: flex;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: block;
  padding: 8px 16px;
  color: var(--text-muted);
  border-radius: 6px;
  font-weight: 500;
  transition: color 0.2s, background 0.2s;
}

.site-nav a:hover,
.site-nav a.is-active {
  color: var(--text);
  background: var(--bg-card);
}

/* Main */
.site-main { flex: 1; padding: 24px 0 48px; }

.page-title {
  margin: 0 0 24px;
  font-size: 1.75rem;
  font-weight: 700;
}

/* Layouts */
.layout-desktop {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr var(--sidebar);
  gap: 24px;
  align-items: start;
}

.layout-article {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr var(--sidebar);
  gap: 24px;
  align-items: start;
}

.sidebar-ads,
.sidebar-related {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

/* Ad blocks */
.ad-block {
  width: 300px;
  height: 250px;
  background: var(--ad-bg);
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-align: center;
  overflow: hidden;
}

.ad-block--outstream {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 999;
  width: 300px;
  height: 169px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.ad-block__label { padding: 8px; pointer-events: none; }

.ad-mobile-only { display: none; }

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

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

.article-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.article-card__image {
  aspect-ratio: 16 / 9;
  object-fit: cover;
  width: 100%;
  background: var(--ad-bg);
}

.article-card__body { padding: 16px; }

.article-card__meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.article-card__title {
  margin: 0 0 8px;
  font-size: 1.1rem;
  line-height: 1.35;
}

.article-card__title a { color: var(--text); }
.article-card__title a:hover { color: var(--accent); }

.article-card__excerpt {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Article preview (sidebar) */
.preview-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.preview-card__image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--ad-bg);
}

.preview-card__body { padding: 12px; }

.preview-card__title {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.35;
}

.preview-card__title a { color: var(--text); }

.sidebar-related__title {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Article content */
.article-header { margin-bottom: 24px; }

.article-header__meta {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 8px;
}

.article-header__title {
  margin: 0;
  font-size: 2rem;
  line-height: 1.25;
}

.article-image {
  width: 100%;
  border-radius: 10px;
  margin-bottom: 24px;
}

.article-content {
  font-size: 1.05rem;
  line-height: 1.75;
}

.article-content h2,
.article-content h3 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

.article-content p { margin: 0 0 1em; }

.article-content img {
  border-radius: 8px;
  margin: 1em 0;
}

/* Static page */
.page-content {
  max-width: 800px;
  margin: 0 auto;
}

/* Pagination */
.pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 32px;
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
}

.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Footer */
.site-footer {
  background: var(--bg-header);
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: auto;
}

.site-footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.site-footer__copy {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0;
}

.site-footer__links {
  display: flex;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer__links a {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.site-footer__links a:hover { color: var(--text); }

/* Breadcrumb */
.breadcrumb {
  margin-bottom: 20px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }

/* Mobile */
@media (max-width: 1024px) {
  .layout-desktop,
  .layout-article {
    display: block;
  }

  .sidebar-ads,
  .sidebar-related { display: none; }

  .ad-desktop-only { display: none !important; }

  .ad-mobile-only { display: flex; }

  .ad-block--outstream { display: none; }

  .nav-toggle { display: flex; }

  .site-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    padding: 16px;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.25s, opacity 0.25s, visibility 0.25s;
  }

  .site-nav.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .site-nav ul { flex-direction: column; }

  .site-nav a { padding: 12px 16px; }

  .article-header__title { font-size: 1.5rem; }

  .cards-grid { grid-template-columns: 1fr; }
}

@media (min-width: 1025px) {
  .ad-mobile-only { display: none !important; }
}
