/* ===== DevLog — тёмная тема (основано на index.css) ===== */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #080808;
  color: #d1d5db;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  line-height: 1.6;
}

a {
  color: #d1d5db;
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: #ef4444;
}

img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

/* ===== Container ===== */

.container {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

/* ===== Header ===== */

.site-header {
  padding: 24px 0 20px;
  border-bottom: 1px solid #252525;
  margin-bottom: 32px;
}

.site-header .logo {
  color: #fff;
  font-size: 1rem;
  letter-spacing: 0.12em;
  font-weight: 800;
  text-decoration: none;
}

.site-header .logo:hover {
  color: #ef4444;
}

/* ===== Main content ===== */

.main-content {
  padding: 0 0 68px;
}

/* ===== Footer ===== */

.site-footer {
  border-top: 1px solid #252525;
  padding: 20px 0;
  color: #6b7280;
  font-size: 0.82rem;
  text-align: center;
}

/* ===== Article grid (главная) ===== */

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.article-card {
  display: flex;
  flex-direction: column;
  background: #141414;
  border: 1px solid #1f1f1f;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.article-card:hover {
  transform: translateY(-2px);
  border-color: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.15);
}

.card-image-link {
  display: block;
  line-height: 0;
}

.card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 0;
}

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

.card-title {
  margin: 0 0 8px;
  font-size: 1.15rem;
  line-height: 1.3;
}

.card-title a {
  color: #f9fafb;
}

.card-title a:hover {
  color: #ef4444;
}

.card-date {
  color: #6b7280;
  font-size: 0.8rem;
  display: block;
  margin-bottom: 12px;
}

.card-excerpt {
  color: #9ca3af;
  font-size: 0.89rem;
  line-height: 1.5;
  margin: 0;
  flex: 1;
}

/* ===== Detail page ===== */

.article-detail {
  max-width: 720px;
}

.article-header {
  margin-bottom: 24px;
}

.article-title {
  font-size: clamp(2.1rem, 5vw, 3.2rem);
  color: #f9fafb;
  margin: 0 0 8px;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.article-date {
  color: #6b7280;
  font-size: 0.85rem;
}

.article-image {
  margin-bottom: 24px;
}

.article-image img {
  width: 100%;
  border-radius: 8px;
}

/* ===== Article content (Markdown) ===== */

.article-content {
  color: #d1d5db;
  font-size: 1rem;
  line-height: 1.75;
}

.article-content h2,
.article-content h3,
.article-content h4 {
  color: #f9fafb;
  margin-top: 32px;
  margin-bottom: 12px;
}

.article-content h2 {
  font-size: 1.5rem;
  border-bottom: 1px solid #252525;
  padding-bottom: 8px;
}

.article-content h3 {
  font-size: 1.2rem;
}

.article-content p {
  margin: 0 0 16px;
}

.article-content a {
  color: #f87171;
}

.article-content a:hover {
  color: #ef4444;
  text-decoration: underline;
}

.article-content ul,
.article-content ol {
  padding-left: 24px;
  margin-bottom: 16px;
}

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

.article-content blockquote {
  border-left: 3px solid #ef4444;
  margin: 16px 0;
  padding: 8px 16px;
  background: #141414;
  color: #9ca3af;
  border-radius: 0 8px 8px 0;
}

.article-content hr {
  border: none;
  border-top: 1px solid #252525;
  margin: 24px 0;
}

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

/* ===== Code blocks (codehilite) ===== */

.article-content pre {
  background: #0d0d0d;
  border: 1px solid #1f1f1f;
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  margin: 16px 0;
}

.article-content code {
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, 'Cascadia Code', 'SF Mono', Consolas, monospace;
  font-size: 0.88rem;
}

.article-content p code,
.article-content li code {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.85rem;
  color: #f87171;
}

.article-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: #d1d5db;
}

/* codehilite wrapper */
.codehilite {
  background: #0d0d0d;
  border: 1px solid #1f1f1f;
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  margin: 16px 0;
}

.codehilite pre {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
}

.codehilite code {
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, 'Cascadia Code', 'SF Mono', Consolas, monospace;
  font-size: 0.88rem;
  color: #d1d5db;
}

/* ===== Commit links ===== */

.commit-links {
  margin: 32px 0;
  padding: 20px;
  background: #141414;
  border: 1px solid #1f1f1f;
  border-radius: 8px;
}

.commit-links h2 {
  color: #f9fafb;
  margin: 0 0 12px;
  font-size: 1rem;
}

.commit-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.commit-links li {
  margin-bottom: 8px;
  padding: 8px 12px;
  background: #0d0d0d;
  border-radius: 6px;
  border: 1px solid #1f1f1f;
}

.commit-links li:last-child {
  margin-bottom: 0;
}

.commit-links a {
  color: #f87171;
  font-size: 0.88rem;
  word-break: break-all;
}

.commit-links a:hover {
  color: #ef4444;
  text-decoration: underline;
}

/* ===== Back link ===== */

.article-footer {
  margin-top: 48px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: none;
  color: #f87171;
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 0.15s;
}

.back-link:hover {
  color: #ef4444;
}

/* ===== Pagination ===== */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid #252525;
}

.step-links {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.page-link {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  background: #141414;
  border: 1px solid #1f1f1f;
  border-radius: 8px;
  color: #f87171;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.page-link:hover {
  background: #ef4444;
  color: #080808;
  border-color: #ef4444;
}

.step-links .current {
  color: #6b7280;
  font-size: 0.85rem;
  padding: 0 8px;
}

/* ===== Empty state ===== */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #6b7280;
  font-size: 1rem;
}

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

@media (max-width: 600px) {
  .container {
    width: calc(100% - 28px);
  }

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

  .pagination {
    flex-direction: column;
    gap: 8px;
  }

  .step-links {
    flex-direction: column;
    align-items: stretch;
  }

  .page-link {
    justify-content: center;
  }
}