/* HTML-Advisor - Modern Design */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #252836;
  --border: #2e3149;
  --text: #e2e8f0;
  --text-muted: #8892a4;
  --accent: #6c63ff;
  --accent2: #ff6584;
  --code-bg: #1e2030;
  --link: #818cf8;
  --link-hover: #a5b4fc;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  min-height: 100vh;
}

a { color: var(--link); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--link-hover); text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ── Header ── */
#site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-branding a {
  display: block;
  text-decoration: none;
}

.site-name {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.site-tagline {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.site-nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.site-nav a:hover {
  background: var(--surface2);
  color: var(--text);
  text-decoration: none;
}

.site-nav a.rss {
  color: #f97316;
}

/* ── Layout ── */
#content-wrap {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2rem;
  align-items: start;
}

/* ── Main content ── */
#main { min-width: 0; }

/* ── Sidebar ── */
#sidebar {
  position: sticky;
  top: 1.5rem;
}

.widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 1.5rem;
  overflow: hidden;
  border-top: 3px solid var(--accent);
}

.widget-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 0.85rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.widget-body {
  padding: 0.85rem 1rem;
}

.widget-body ul { list-style: none; }

.widget-body ul li {
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.widget-body ul li:last-child { border-bottom: none; }

.widget-body ul li a {
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.widget-body ul li a:hover { color: var(--link-hover); text-decoration: none; }

.cat-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--surface2);
  padding: 0.1rem 0.45rem;
  border-radius: 99px;
  font-weight: 500;
}

/* tag cloud */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.85rem 1rem;
}

.tag-cloud a {
  font-size: 0.78rem;
  padding: 0.2rem 0.6rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text-muted);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}

.tag-cloud a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Article cards (listing pages) ── */
.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.post-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(108, 99, 255, 0.15);
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.post-card-cat {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  background: rgba(108,99,255,0.12);
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
  text-decoration: none;
}

.post-card-cat:hover { text-decoration: none; color: var(--link-hover); }

.post-card-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.post-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 0.6rem;
}

.post-card h2 a { color: var(--text); text-decoration: none; }
.post-card h2 a:hover { color: var(--link-hover); }

.post-card-excerpt {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.65;
  margin-bottom: 0.85rem;
}

.post-card-excerpt p { margin-bottom: 0; }

.read-more {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
}

.read-more:hover { color: var(--link-hover); text-decoration: none; }

/* ── Pagination ── */
.pagination {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 2rem 0;
}

.pagination a,
.pagination span {
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.pagination a:hover {
  background: var(--surface2);
  border-color: var(--accent);
  color: var(--text);
  text-decoration: none;
}

.pagination span.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Single article ── */
.article-header { margin-bottom: 1.5rem; }

.article-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.article-cat {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  background: rgba(108,99,255,0.12);
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
  text-decoration: none;
}

.article-date { font-size: 0.85rem; color: var(--text-muted); }

.article-header h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}

.article-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
}

/* typography inside article */
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
  font-weight: 700;
  line-height: 1.3;
  margin: 1.5rem 0 0.75rem;
  color: var(--text);
}

.article-content h1 { font-size: 1.6rem; }
.article-content h2 { font-size: 1.3rem; }
.article-content h3 { font-size: 1.1rem; color: var(--link); }
.article-content h4 { font-size: 1rem; }

.article-content p { margin-bottom: 1rem; }

.article-content ul,
.article-content ol {
  margin: 0.75rem 0 1rem 1.5rem;
}

.article-content li { margin-bottom: 0.3rem; }

.article-content a { color: var(--link); }
.article-content a:hover { color: var(--link-hover); }

.article-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--text-muted);
  font-style: italic;
}

.article-content code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: #f8f8f2;
}

.article-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1rem 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #f8f8f2;
}

.article-content pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

/* inline block code (.block class in original) */
.article-content code.block {
  display: block;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1rem 0;
  white-space: pre;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #f8f8f2;
}

.article-content abbr { border-bottom: 1px dotted var(--text-muted); cursor: help; }

/* source note */
.article-content .ar {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ── Tags footer ── */
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  align-items: center;
}

.article-tags .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.tag-pill {
  font-size: 0.78rem;
  padding: 0.2rem 0.65rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text-muted);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}

.tag-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* ── Related articles ── */
.related-posts {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.related-posts h3 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.related-posts ul { list-style: none; }
.related-posts ul li { padding: 0.3rem 0; font-size: 0.9rem; }
.related-posts ul li::before { content: "→ "; color: var(--accent); }

/* ── Page title (category/archive/tag pages) ── */
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border);
}

.page-title span { color: var(--accent); }

/* ── About / Links / static pages ── */
.static-page {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
}

.static-page h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text);
}

.static-page h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 1.25rem 0 0.6rem;
  color: var(--text);
}

.static-page ul { margin-left: 1.5rem; margin-bottom: 1rem; }
.static-page li { margin-bottom: 0.3rem; }
.static-page p { margin-bottom: 0.85rem; }

/* contact form */
.contact-form {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 1.25rem;
}

.contact-form label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  margin-top: 0.85rem;
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.85rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.2s;
  outline: none;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--accent);
}

.contact-form textarea { min-height: 120px; resize: vertical; }

.contact-form button {
  margin-top: 1rem;
  padding: 0.6rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.contact-form button:hover { background: #5b52e0; }

/* footer */
#site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 1.5rem;
  margin-top: 3rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  #content-wrap {
    grid-template-columns: 1fr;
  }

  #sidebar {
    position: static;
  }

  .article-header h1 {
    font-size: 1.5rem;
  }

  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}
