/* ═══════════════════════════════════════════════════════
   SantosLab Blog — Design System
   Dark theme · Teal accent · Modern sans-serif
   ═══════════════════════════════════════════════════════ */

:root {
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-elevated: #181824;
  --bg-code: #0f0f17;
  --accent: #00bfb0;
  --accent-dim: #008a7a;
  --accent-glow: rgba(0, 191, 176, 0.15);
  --ink: #e8e8ec;
  --ink-soft: #a0a4b0;
  --ink-muted: #707480;
  --ink-inverse: #0a0a0f;
  --line: #1e1e2c;
  --line-light: #2a2a3a;
  --radius: 12px;
  --radius-sm: 6px;
  --font-sans: 'DM Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, 'Liberation Mono', Menlo, Monaco, monospace;
  --max-w: 720px;
  --max-w-wide: 960px;
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ─── Subtle Grain Overlay ─── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* ─── Navigation ─── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
}

.nav-inner {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.3px;
}

.nav-brand svg {
  width: 28px;
  height: 28px;
}

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

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color var(--transition);
}

.nav-links a:hover { color: var(--ink); }
.nav-links a.active { color: var(--accent); }

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  background: var(--accent);
  color: #fff !important;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  transition: all var(--transition);
}

.nav-cta:hover {
  background: var(--accent-dim);
  transform: translateY(-1px);
}

/* ─── Blog Header ─── */
.blog-header {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 60px 20px 40px;
  text-align: center;
}

.blog-header h1 {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 12px;
}

.blog-header h1 span { color: var(--accent); }

.blog-header .subtitle {
  font-size: 18px;
  color: var(--ink-soft);
  max-width: 600px;
  margin: 0 auto 16px;
  line-height: 1.5;
}

.blog-header .meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  font-size: 14px;
  color: var(--ink-muted);
}

.blog-header .meta-line span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ─── RSS Subscribe Bar ─── */
.rss-bar {
  max-width: var(--max-w-wide);
  margin: 0 auto 32px;
  padding: 12px 20px;
  display: flex;
  justify-content: center;
  gap: 12px;
}

.rss-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: var(--bg-card);
  border: 1px solid var(--line-light);
  border-radius: var(--radius);
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}

.rss-link:hover {
  border-color: var(--accent);
  background: var(--bg-elevated);
  box-shadow: 0 0 20px var(--accent-glow);
}

/* ─── Category Filter ─── */
.filter-bar {
  max-width: var(--max-w-wide);
  margin: 0 auto 32px;
  padding: 0 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.filter-btn {
  padding: 6px 16px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ─── Post Grid ─── */
.posts {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 0 20px 80px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 640px) {
  .posts {
    grid-template-columns: repeat(2, 1fr);
  }
}

.post {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: inherit;
  transition: all var(--transition);
}

.post:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 24px var(--accent-glow);
}

.post-cat {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.post-date {
  display: block;
  color: var(--ink-muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.post h2 {
  font-size: 20px;
  font-weight: 650;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 10px;
}

.post p {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post .read-time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-muted);
}

/* ─── Single Article ─── */
.article-page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 24px;
}

.article-category {
  display: inline-block;
  padding: 3px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.article-date {
  color: var(--ink-muted);
  font-size: 14px;
}

.article-readtime {
  color: var(--ink-muted);
  font-size: 14px;
}

.article-page h1 {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 12px;
}

.article-subtitle {
  font-size: 18px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-bottom: 32px;
}

.article-page .featured-image {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 40px;
  background: var(--bg-card);
  aspect-ratio: 1200/630;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  font-size: 14px;
  border: 1px solid var(--line);
}

/* ─── Article Content ─── */
.article-content {
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink-soft);
}

.article-content h2 {
  font-size: 24px;
  font-weight: 650;
  line-height: 1.3;
  color: var(--ink);
  margin: 40px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.article-content h3 {
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
  margin: 28px 0 8px;
}

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

.article-content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 191, 176, 0.3);
  transition: all var(--transition);
}

.article-content a:hover {
  border-color: var(--accent);
}

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

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

.article-content strong {
  color: var(--ink);
  font-weight: 600;
}

.article-content em {
  color: var(--accent);
}

.article-content blockquote {
  border-left: 3px solid var(--accent);
  background: var(--bg-card);
  padding: 16px 20px;
  margin: 24px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink-soft);
  font-style: italic;
}

.article-content blockquote p {
  margin-bottom: 0;
}

.article-content .highlight-box {
  background: var(--bg-elevated);
  border: 1px solid var(--line-light);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin: 24px 0;
}

.article-content .highlight-box h3 {
  color: var(--accent);
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 0;
  margin-bottom: 10px;
  border: none;
}

.article-content code {
  font-family: var(--font-mono);
  background: var(--bg-code);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--accent);
}

.article-content pre {
  background: var(--bg-code);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin: 24px 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-soft);
}

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

.article-content hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 48px 0;
}

.article-content img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 24px 0;
}

/* ─── Separator ─── */
.separator {
  border: none;
  border-top: 1px solid var(--line-light);
  margin: 48px 0;
}

/* ─── Footer Links ─── */
.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition);
}

.footer-link:hover {
  opacity: 0.8;
}

/* ─── Related Section ─── */
.related-section {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.related-heading {
  font-size: 16px;
  color: var(--ink-soft);
  font-weight: 600;
  margin-bottom: 16px;
}

.related-list {
  list-style: none;
  padding: 0;
}

.related-list li {
  margin-bottom: 10px;
}

.related-list li a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition);
}

.related-list li a:hover {
  opacity: 0.7;
  text-decoration: underline;
}

/* ─── Page Footer ─── */
.page-footer {
  max-width: var(--max-w-wide);
  margin: 0 auto;
  padding: 40px 20px 32px;
  border-top: 1px solid var(--line);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.footer-col h4 {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

.footer-col a {
  display: block;
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 13px;
  padding: 3px 0;
  transition: color var(--transition);
}

.footer-col a:hover { color: var(--ink); }

.footer-bottom {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 13px;
  color: var(--ink-muted);
}

/* ─── 404 Page ─── */
.error-page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 120px 20px;
  text-align: center;
}

.error-page h1 {
  font-size: 72px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 8px;
}

.error-page p {
  font-size: 18px;
  color: var(--ink-soft);
  margin-bottom: 24px;
}

/* ─── Back Link (Article Nav) ─── */
.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
  transition: color var(--transition);
}

.nav-back:hover { color: var(--ink); }

/* ─── Animations ─── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.post, .article-page, .blog-header {
  animation: fadeIn 0.5s ease both;
}

/* ─── Mobile Responsive ─── */
@media (max-width: 767px) {
  .nav-inner { height: 48px; }
  .nav-links { display: none; }
  .blog-header { padding: 32px 16px 24px; }
  .blog-header h1 { font-size: clamp(24px, 7vw, 36px); }
  .posts { gap: 14px; }
  .post { padding: 18px; }
  .post h2 { font-size: 17px; }
  .article-page { padding: 24px 16px 60px; }
  .article-content { font-size: 16px; }
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
}

/* ─── Selection ─── */
::selection {
  background: var(--accent);
  color: #fff;
}