/* ═══════════════════════════════════════════════════
   Michael Pereira Blog — style.css
   Mirrors the portfolio dark theme exactly.
   ═══════════════════════════════════════════════════ */

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

:root {
  --bg:         #0d0d0f;
  --bg-card:    #141417;
  --bg-subtle:  #1a1a1f;
  --border:     rgba(255, 255, 255, 0.07);
  --text:       #e8e8ed;
  --muted:      #8a8a9a;
  --accent:     #7c6ff7;
  --accent2:    #4ecdc4;
  --gradient:   linear-gradient(135deg, #7c6ff7 0%, #4ecdc4 100%);
  --radius:     12px;
  --transition: 0.25s ease;
  --nav-bg:     rgba(13, 13, 15, 0.85);
  --content-width: 720px;
  --page-width:    960px;
}

:root.light {
  --bg:        #f8f8fc;
  --bg-card:   #ffffff;
  --bg-subtle: #f0f0f7;
  --border:    rgba(0, 0, 0, 0.08);
  --text:      #111118;
  --muted:     #666676;
  --nav-bg:    rgba(248, 248, 252, 0.85);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-top: 73px;
}

/* ── Scrollbar ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

/* ── Utilities ────────────────────────────────────── */
.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}

.section-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  line-height: 1.2;
}

/* ── Navigation ───────────────────────────────────── */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-size: 18px;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 36px;
  list-style: none;
}

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

.nav-links a:hover,
.nav-links a.nav-active { color: var(--text); }

.nav-cta {
  padding: 8px 20px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color var(--transition), background var(--transition);
}

.nav-cta:hover {
  border-color: var(--accent);
  background: rgba(124, 111, 247, 0.08);
}

/* ── Theme Toggle ─────────────────────────────────── */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: border-color var(--transition), color var(--transition), transform var(--transition);
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: rotate(15deg);
}

/* ── Tag pill ─────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(124, 111, 247, 0.1);
  border: 1px solid rgba(124, 111, 247, 0.2);
  border-radius: 100px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
}

/* ── Blog Hero ────────────────────────────────────── */
.blog-hero {
  padding: 80px 24px 60px;
  max-width: var(--page-width);
  margin: 0 auto;
}

.blog-hero-inner { max-width: 600px; }

.blog-hero-sub {
  font-size: 18px;
  color: var(--muted);
  line-height: 1.7;
  margin-top: 8px;
}

/* ── Blog Listing ─────────────────────────────────── */
.blog-list-section {
  padding: 0 24px 100px;
}

.blog-list-inner {
  max-width: var(--page-width);
  margin: 0 auto;
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.no-posts {
  color: var(--muted);
  font-size: 16px;
}

/* ── Post Card ────────────────────────────────────── */
.post-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition), transform var(--transition),
              background var(--transition);
}

.post-card:hover {
  border-color: rgba(124, 111, 247, 0.4);
  background: rgba(124, 111, 247, 0.03);
  transform: translateY(-4px);
}

.post-card-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.post-card-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 12px;
  transition: color var(--transition);
}

.post-card:hover .post-card-title { color: var(--accent); }

.post-card-excerpt {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.post-card-read {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

/* ── Post Page Layout ─────────────────────────────── */
.post-container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 60px 24px 100px;
}

/* ── Post Header ──────────────────────────────────── */
.post-header { margin-bottom: 40px; }

.post-back {
  display: inline-block;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 24px;
  transition: color var(--transition);
}

.post-back:hover { color: var(--accent); }

.post-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.post-title {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 16px;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 20px;
}

.post-reading { color: var(--muted); }

.post-excerpt {
  font-size: 18px;
  color: var(--muted);
  line-height: 1.7;
  border-left: 3px solid var(--accent);
  padding-left: 18px;
  margin-top: 8px;
}

/* ── Post Divider ─────────────────────────────────── */
.post-divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 40px;
}

/* ── Post Body (Markdown content) ─────────────────── */
.post-body {
  font-size: 17px;
  line-height: 1.8;
  color: var(--text);
}

.post-body h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-top: 48px;
  margin-bottom: 16px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.post-body h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-top: 36px;
  margin-bottom: 12px;
}

.post-body h4 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-top: 28px;
  margin-bottom: 10px;
}

.post-body p { margin-bottom: 20px; }

.post-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--transition);
}

.post-body a:hover { color: var(--accent2); }

.post-body strong { color: var(--text); font-weight: 600; }

.post-body em { font-style: italic; }

/* Lists */
.post-body ul,
.post-body ol {
  margin-bottom: 20px;
  padding-left: 28px;
}

.post-body li { margin-bottom: 8px; }

.post-body ul li::marker { color: var(--accent); }
.post-body ol li::marker { color: var(--accent); }

/* Blockquote */
.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 20px;
  margin: 28px 0;
  color: var(--muted);
  font-style: italic;
}

/* Inline code */
.post-body code {
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--accent2);
}

/* Code blocks */
.post-body pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  overflow-x: auto;
  margin-bottom: 28px;
  line-height: 1.6;
}

.post-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 14px;
  color: var(--text);
}

/* Tables */
.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 28px;
  font-size: 15px;
}

.post-body th {
  background: var(--bg-subtle);
  color: var(--text);
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  border: 1px solid var(--border);
}

.post-body td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  color: var(--muted);
  vertical-align: top;
}

.post-body tr:nth-child(even) td { background: var(--bg-subtle); }

/* Horizontal rule */
.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

/* Heading anchor links (from markdown-it-anchor) */
.post-body a.header-anchor {
  color: var(--text);
  text-decoration: none;
  transition: color var(--transition);
}

.post-body a.header-anchor:hover { color: var(--accent); }

.post-body :is(h2, h3, h4):hover a.header-anchor::after {
  content: ' #';
  color: var(--muted);
  font-size: 0.7em;
  font-weight: 400;
}

/* ── Post Footer ──────────────────────────────────── */
.post-footer {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
}

/* ── Button ───────────────────────────────────────── */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: border-color var(--transition), background var(--transition),
              transform var(--transition);
}

.btn-secondary:hover {
  border-color: var(--muted);
  background: var(--bg-subtle);
  transform: translateY(-2px);
}

/* ── Footer ───────────────────────────────────────── */
footer {
  text-align: center;
  padding: 32px 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color var(--transition);
}

footer a:hover { color: var(--accent); }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 768px) {
  nav {
    padding: 16px 20px;
    gap: 16px;
  }

  .nav-links { gap: 20px; }

  .blog-hero { padding: 48px 20px 40px; }

  .blog-list-section { padding: 0 20px 80px; }

  .post-card { padding: 24px; }

  .post-container { padding: 40px 20px 80px; }

  .post-title { font-size: clamp(24px, 6vw, 36px); }
}

@media (max-width: 480px) {
  nav { flex-wrap: wrap; }
  .nav-links { gap: 14px; }
  .nav-cta { display: none; }
  .post-card-title { font-size: 18px; }
}

/* ── Light mode overrides ─────────────────────────── */
:root.light ::-webkit-scrollbar-track { background: var(--bg); }
:root.light ::-webkit-scrollbar-thumb { background: var(--accent); }

:root.light .post-card:hover {
  background: rgba(124, 111, 247, 0.04);
}

:root.light .post-body code {
  background: var(--bg-subtle);
  color: #6c47c9;
  border-color: var(--border);
}

:root.light .post-body pre {
  background: var(--bg-card);
  border-color: var(--border);
}

:root.light .post-body pre code {
  color: var(--text);
}

:root.light .post-body blockquote {
  color: var(--muted);
}

:root.light .nav-cta {
  color: var(--text);
}

:root.light .nav-cta:hover {
  border-color: var(--accent);
  background: rgba(124, 111, 247, 0.08);
}
