@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,300;0,400;0,600;0,700;1,400&family=Sora:wght@300;400;500;600;700&display=swap');

/* ─── CSS Variables ──────────────────────────────────────── */
:root {
  --bg:         #0a0a0f;
  --bg-2:       #111118;
  --bg-3:       #1a1a24;
  --border:     #2a2a3a;
  --accent:     #7c6aff;
  --accent-2:   #ff6a7c;
  --accent-dim: rgba(124, 106, 255, 0.15);
  --text:       #e8e8f0;
  --text-muted: #7a7a90;
  --text-dim:   #4a4a60;
  --code-bg:    #13131e;
  --font-mono:  'JetBrains Mono', monospace;
  --font-sans:  'Sora', sans-serif;
  --radius:     8px;
  --radius-lg:  16px;
  --shadow:     0 4px 24px rgba(0,0,0,0.4);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

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

/* ─── Layout ─────────────────────────────────────────────── */
.site-wrapper {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ─── Header ─────────────────────────────────────────────── */
.site-header {
  padding: 32px 0 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-mark {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(124,106,255,0.3);
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

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

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius);
  transition: all 0.2s;
  letter-spacing: 0.01em;
}

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

/* ─── Hero ───────────────────────────────────────────────── */
.hero {
  padding: 72px 0 56px;
  position: relative;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-dim);
  border: 1px solid rgba(124,106,255,0.3);
  color: var(--accent);
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.hero-tag::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.hero h1 {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 16px;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero p {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.7;
}

/* ─── Section Headings ───────────────────────────────────── */
.section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 24px;
}

.section-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── Post Cards ─────────────────────────────────────────── */
.posts-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 64px;
}

.post-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: all 0.2s;
  border: 1px solid transparent;
  margin: -1px 0;
}

.post-card:hover {
  background: var(--bg-2);
  border-color: var(--border);
  transform: translateX(4px);
}

.post-card:hover .post-arrow {
  opacity: 1;
  transform: translateX(0);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.post-tag {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.post-date {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

.post-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.post-excerpt {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-arrow {
  color: var(--accent);
  font-size: 18px;
  opacity: 0;
  transform: translateX(-4px);
  transition: all 0.2s;
  align-self: center;
}

/* ─── Post Card Thumbnail ─────────────────────────────────── */
.post-card-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.post-card-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* ─── Post Content ───────────────────────────────────────── */
.post-header-wrapper {
  position: relative;
  padding: 80px 0 60px;
  margin-bottom: 48px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.post-header-overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1;
}

.post-header {
  position: relative;
  z-index: 2;
  padding: 0;
  border-bottom: none;
  margin-bottom: 0;
}

.post-header .post-meta {
  margin-bottom: 16px;
}

.post-header h1 {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin-bottom: 16px;
}

.post-header .post-description {
  font-size: 17px;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ─── Prose ──────────────────────────────────────────────── */
.prose {
  max-width: 100%;
  margin-bottom: 80px;
}

.prose h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 48px 0 16px;
  padding: 0 0 10px 14px;
  border-left: 4px solid var(--accent);
  border-bottom: 1px solid var(--border);
}

.prose h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 36px 0 12px;
}

.prose p {
  color: #c8c8d8;
  margin-bottom: 20px;
  font-size: 15.5px;
  line-height: 1.8;
}

.prose a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(124,106,255,0.4);
  transition: border-color 0.2s;
}

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

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

.prose ul, .prose ol {
  margin: 0 0 20px 24px;
  color: #c8c8d8;
}

.prose li {
  margin-bottom: 8px;
  font-size: 15.5px;
  line-height: 1.7;
}

.prose blockquote {
  margin: 32px 0;
  padding: 16px 20px;
  border-left: 3px solid var(--accent);
  background: var(--bg-2);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.prose blockquote p {
  margin: 0;
  color: var(--text);
  font-style: italic;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

.prose figure {
  margin: 32px auto;
  text-align: center;
}

.figure-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: flex-start;
  margin: 32px 0;
}

.figure-row figure {
  flex: 1;
  margin: 0;
}

.figure-row figure img {
  max-width: 100%;
}

.prose figure img {
  max-width: 80%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.prose figcaption {
  margin-top: 10px;
  font-size: 0.82em;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ─── Code ───────────────────────────────────────────────── */
code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  color: #c4b5fd;
}

.highlight {
  margin: 24px 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.highlight pre {
  background: var(--code-bg) !important;
  padding: 20px 24px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.7;
}

.highlight code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}

/* Collapsible code blocks */
details.code-fold {
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

details.code-fold summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--code-bg);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s;
  list-style: none;
}

details.code-fold summary::-webkit-details-marker { display: none; }

details.code-fold summary::before {
  content: '▶';
  font-size: 10px;
  transition: transform 0.2s;
}

details.code-fold[open] summary::before {
  transform: rotate(90deg);
}

details.code-fold[open] summary {
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

details.code-fold summary:hover {
  color: var(--accent);
}

details.code-fold .highlight {
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* Rouge Syntax Theme — Custom Dark */
.highlight .k  { color: #c084fc; } /* keyword */
.highlight .kd { color: #c084fc; }
.highlight .kn { color: #c084fc; }
.highlight .s  { color: #86efac; } /* string */
.highlight .s1 { color: #86efac; }
.highlight .s2 { color: #86efac; }
.highlight .n  { color: var(--text); }
.highlight .o  { color: #94a3b8; } /* operator */
.highlight .p  { color: #94a3b8; }
.highlight .c  { color: var(--text-dim); font-style: italic; } /* comment */
.highlight .c1 { color: var(--text-dim); font-style: italic; }
.highlight .cm { color: var(--text-dim); font-style: italic; }
.highlight .nb { color: #67e8f9; } /* built-in */
.highlight .nf { color: #7dd3fc; } /* function */
.highlight .nc { color: #fde68a; } /* class */
.highlight .mi { color: #fb923c; } /* number */
.highlight .mf { color: #fb923c; }
.highlight .nt { color: #f87171; } /* tag */
.highlight .na { color: #7dd3fc; } /* attr */
.highlight .nx { color: var(--text); }

/* ─── Tags ───────────────────────────────────────────────── */
.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 64px;
}

.tag-pill {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 100px;
  text-decoration: none;
  transition: all 0.2s;
}

.tag-pill:hover {
  color: var(--accent);
  border-color: rgba(124,106,255,0.4);
  background: var(--accent-dim);
}

/* ─── About Section ──────────────────────────────────────── */
.about-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 64px;
}

.about-avatar {
  width: 52px;
  height: 52px;
  background: var(--accent);
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.about-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.about-role {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--accent);
  margin-bottom: 10px;
}

.about-bio {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 14px;
}

.about-links {
  display: flex;
  gap: 10px;
}

.about-links a {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}

.about-links a:hover { color: var(--accent); }

/* ─── Footer ─────────────────────────────────────────────── */
.site-footer {
  padding: 28px 0 40px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.footer-text {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

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

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

/* ─── Pagination ─────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 64px;
}

.pagination a,
.pagination span {
  font-size: 13px;
  font-family: var(--font-mono);
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text-muted);
  transition: all 0.2s;
}

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

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

/* ─── Post Cover Image ───────────────────────────────────── */
.post-cover {
  margin: 40px 0 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.post-cover img {
  width: 100%;
  max-height: 460px;
  object-fit: cover;
  display: block;
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  .site-header { flex-direction: column; align-items: flex-start; gap: 16px; }
  .site-nav { gap: 4px; }
  .hero { padding: 48px 0 40px; }
  .post-card { grid-template-columns: 1fr; }
  .post-arrow { display: none; }
  .post-card-thumb { display: none; }
  .about-card { flex-direction: column; }
  .site-footer { flex-direction: column; align-items: flex-start; }
}

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

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