:root {
  --bg: #0a0a0f; --surface: #111118; --surface2: #18181f;
  --border: rgba(255,255,255,0.07); --text: #f0f0f8;
  --text-muted: #6b6b80; --text-dim: #3a3a4a;
  --accent: #6366f1; --accent2: #a78bfa; --accent3: #38bdf8;
  --glow: rgba(99,102,241,0.15); --card-hover: rgba(255,255,255,0.03);
  --code-bg: #0d0d14;
}
[data-theme="light"] {
  --bg: #f8f8fc; --surface: #ffffff; --surface2: #f1f1f8;
  --border: rgba(0,0,0,0.08); --text: #0f0f1a;
  --text-muted: #7070a0; --text-dim: #c0c0d8;
  --accent: #4f46e5; --accent2: #7c3aed; --accent3: #0284c7;
  --glow: rgba(79,70,229,0.08); --card-hover: rgba(0,0,0,0.02);
  --code-bg: #1e1e2e;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.6;
  min-height: 100vh; transition: background 0.3s, color 0.3s;
  -webkit-font-smoothing: antialiased;
}

/* ── NAV ── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 0 40px; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(10,10,15,0.75);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] nav { background: rgba(248,248,252,0.85); }
.nav-logo { font-size: 1rem; font-weight: 800; color: var(--text); text-decoration: none; letter-spacing: -0.03em; }
.nav-logo span { background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.nav-right { display: flex; align-items: center; gap: 8px; }
.nav-link { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); text-decoration: none; padding: 6px 12px; border-radius: 8px; transition: color 0.2s, background 0.2s; }
.nav-link:hover { color: var(--text); background: var(--surface2); }
.theme-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text-muted); cursor: pointer;
  font-size: 0.95rem; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.theme-btn:hover { color: var(--text); background: var(--surface); }

/* ── WRAPPER ── */
.wrapper { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 0 40px; }

/* ── HOME: HERO ── */
.hero { padding: 160px 0 100px; position: relative; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(80px); pointer-events: none; }
.orb-1 { width: 500px; height: 500px; background: radial-gradient(circle, rgba(99,102,241,0.18) 0%, transparent 70%); top: -100px; left: -150px; }
.orb-2 { width: 400px; height: 400px; background: radial-gradient(circle, rgba(167,139,250,0.12) 0%, transparent 70%); top: 50px; right: -100px; }
.orb-3 { width: 300px; height: 300px; background: radial-gradient(circle, rgba(56,189,248,0.1) 0%, transparent 70%); bottom: -50px; left: 30%; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 100px; padding: 6px 14px 6px 8px;
  font-size: 0.78rem; font-weight: 500; color: var(--text-muted); margin-bottom: 28px;
}
.hero-badge-dot { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 6px #22c55e; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }
.hero-avatar-row { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; }
.hero-avatar { width: 80px; height: 80px; border-radius: 22px; object-fit: cover; border: 2px solid var(--border); box-shadow: 0 0 0 4px var(--glow); }
.hero-name-col h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1; }
.gradient-text { background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 50%, var(--accent3) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero-tagline { font-size: 1rem; color: var(--text-muted); margin-top: 4px; }
.hero-description { max-width: 520px; font-size: 1.05rem; color: var(--text-muted); line-height: 1.7; margin-bottom: 36px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-size: 0.9rem; font-weight: 600;
  padding: 10px 20px; border-radius: 10px; text-decoration: none;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 4px 24px rgba(99,102,241,0.35); border: none; cursor: pointer;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 0.9rem; font-weight: 500;
  padding: 10px 20px; border-radius: 10px; text-decoration: none;
  transition: background 0.2s, transform 0.2s; cursor: pointer;
}
.btn-secondary:hover { background: var(--surface2); transform: translateY(-1px); }
.hero-social { display: flex; gap: 16px; margin-top: 32px; }
.social-chip { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 0.82rem; font-weight: 500; text-decoration: none; transition: color 0.2s; }
.social-chip:hover { color: var(--text); }
.social-chip svg { width: 15px; height: 15px; fill: currentColor; }

/* ── SECTION LABEL ── */
.section-label { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.section-label h2 { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); white-space: nowrap; }
.section-line { flex: 1; height: 1px; background: var(--border); }


/* ── NEWSLETTER ── */
.newsletter-section { padding: 0 0 64px; }
.newsletter-card {
  display: flex; align-items: center; gap: 32px; flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(99,102,241,0.14), rgba(167,139,250,0.08) 55%, rgba(56,189,248,0.08));
  border: 1px solid rgba(99,102,241,0.35); border-radius: 20px; padding: 32px 40px;
}
.newsletter-icon { width: 56px; height: 56px; border-radius: 16px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.newsletter-icon svg { width: 26px; height: 26px; fill: currentColor; }
.newsletter-text { flex: 1; min-width: 240px; }
.newsletter-text .featured-tag { margin-bottom: 10px; }
.newsletter-text h3 { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 6px; }
.newsletter-text p { font-size: 0.92rem; color: var(--text-muted); line-height: 1.6; max-width: 520px; }

/* ── FEATURED ── */
.featured-section { padding: 20px 0 64px; }
.featured-card {
  display: block; text-decoration: none; background: var(--surface);
  border: 1px solid var(--border); border-radius: 20px; padding: 40px;
  position: relative; overflow: hidden; transition: border-color 0.3s, transform 0.3s; cursor: pointer;
}
.featured-card::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(99,102,241,0.06) 0%, transparent 60%); pointer-events: none; }
.featured-card:hover { border-color: rgba(99,102,241,0.4); transform: translateY(-3px); }
.featured-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent2); background: rgba(167,139,250,0.1); border: 1px solid rgba(167,139,250,0.2); padding: 4px 10px; border-radius: 6px; margin-bottom: 16px; }
.featured-card h3 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.03em; color: var(--text); line-height: 1.2; margin-bottom: 12px; }
.featured-card p { color: var(--text-muted); font-size: 0.95rem; line-height: 1.7; max-width: 600px; margin-bottom: 24px; }
.featured-meta { display: flex; align-items: center; justify-content: space-between; }
.featured-date { font-size: 0.82rem; color: var(--text-muted); }
.read-more { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 600; color: var(--accent2); transition: gap 0.2s; }
.featured-card:hover .read-more { gap: 10px; }

/* ── POSTS GRID ── */
.posts-section { padding: 0 0 80px; }
.posts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.post-card {
  display: block; text-decoration: none; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px; padding: 28px;
  transition: border-color 0.25s, background 0.25s, transform 0.25s;
  position: relative; overflow: hidden; cursor: pointer;
}
.post-card::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--accent), var(--accent2)); opacity: 0; transition: opacity 0.25s; }
.post-card:hover { border-color: rgba(99,102,241,0.3); background: var(--card-hover); transform: translateY(-2px); }
.post-card:hover::after { opacity: 1; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.card-tag { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); background: var(--surface2); border: 1px solid var(--border); padding: 3px 8px; border-radius: 5px; }
.post-card h3 { font-size: 1rem; font-weight: 700; color: var(--text); letter-spacing: -0.02em; line-height: 1.4; margin-bottom: 10px; transition: color 0.2s; }
.post-card:hover h3 { color: var(--accent2); }
.post-card p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 20px; }
.card-footer { display: flex; align-items: center; justify-content: space-between; }
.card-date { font-size: 0.78rem; color: var(--text-dim); font-weight: 500; }
.card-arrow { width: 28px; height: 28px; border-radius: 8px; background: var(--surface2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 0.8rem; transition: background 0.2s, color 0.2s, border-color 0.2s; }
.post-card:hover .card-arrow { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── ABOUT ── */
.about-strip { padding: 0 0 80px; }
.about-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 36px 40px; display: flex; align-items: center; gap: 40px; position: relative; overflow: hidden; }
.about-card::before { content: ''; position: absolute; right: -60px; bottom: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(99,102,241,0.12) 0%, transparent 70%); pointer-events: none; }
.about-avatar { width: 80px; height: 80px; border-radius: 20px; object-fit: cover; border: 2px solid var(--border); flex-shrink: 0; }
.about-text h3 { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 6px; }
.about-text p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; max-width: 480px; }
.about-links { margin-left: auto; display: flex; flex-direction: column; gap: 8px; }
.about-link { display: inline-flex; align-items: center; gap: 8px; font-size: 0.82rem; font-weight: 500; color: var(--text-muted); text-decoration: none; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface2); transition: color 0.2s, border-color 0.2s, background 0.2s; white-space: nowrap; }
.about-link:hover { color: var(--text); border-color: rgba(255,255,255,0.15); background: var(--surface); }

/* ── FOOTER ── */
footer { border-top: 1px solid var(--border); padding: 32px 0; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; font-size: 0.82rem; color: var(--text-muted); }
.footer-inner a { color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
.footer-inner a:hover { color: var(--text); }

/* ── POST VIEW ── */
.post-view { padding: 100px 0 80px; max-width: 760px; margin: 0 auto; }
.post-view .wrapper { padding: 0 40px; }
.back-btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.85rem; font-weight: 500; color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--border);
  padding: 8px 16px; border-radius: 10px; cursor: pointer;
  transition: color 0.2s, background 0.2s; margin-bottom: 48px;
  text-decoration: none;
}
.back-btn:hover { color: var(--text); background: var(--surface2); }
.post-header { margin-bottom: 48px; }
.post-header .card-tags { margin-bottom: 20px; }
.post-header h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1.15; margin-bottom: 20px; }
.post-meta-row { display: flex; align-items: center; gap: 16px; color: var(--text-muted); font-size: 0.85rem; padding-bottom: 32px; border-bottom: 1px solid var(--border); }
.post-meta-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-dim); }

/* ── POST CONTENT TYPOGRAPHY ── */
.post-content { font-size: 1.05rem; line-height: 1.8; color: var(--text); }
.post-content h1, .post-content h2 { font-weight: 800; letter-spacing: -0.03em; margin: 2.5rem 0 1rem; line-height: 1.2; }
.post-content h1 { font-size: 1.7rem; }
.post-content h2 { font-size: 1.4rem; }
.post-content h3 { font-size: 1.15rem; font-weight: 700; margin: 2rem 0 0.75rem; }
.post-content h4 { font-size: 1rem; font-weight: 700; margin: 1.5rem 0 0.5rem; }
.post-content p { margin-bottom: 1.4rem; }
.post-content a { color: var(--accent2); text-decoration: none; border-bottom: 1px solid rgba(167,139,250,0.3); transition: border-color 0.2s; }
.post-content a:hover { border-color: var(--accent2); }
.post-content strong { font-weight: 700; color: var(--text); }
.post-content em { font-style: italic; }
.post-content ul, .post-content ol { margin: 0 0 1.4rem 1.5rem; }
.post-content li { margin-bottom: 0.4rem; }
.post-content blockquote {
  border-left: 3px solid var(--accent); margin: 2rem 0;
  padding: 16px 24px; background: var(--surface); border-radius: 0 12px 12px 0;
  color: var(--text-muted); font-style: italic;
}
.post-content blockquote strong { color: var(--text-muted); }
.post-content .highlighter-rouge { margin: 1.6rem 0; }
.post-content div.highlight { margin: 0; }
.post-content pre {
  background: #11111a; border: 1px solid var(--border); border-radius: 12px;
  overflow-x: auto; margin: 1.6rem 0;
}
.post-content pre code, .post-content pre.highlight code {
  display: block; padding: 24px;
  font-family: 'JetBrains Mono', monospace; font-size: 0.88rem; line-height: 1.8;
  color: #cdd6f4; background: none; border: none;
}
.post-content code {
  font-family: 'JetBrains Mono', monospace; font-size: 0.88em;
  background: var(--surface2); padding: 2px 7px; border-radius: 5px;
  border: 1px solid var(--border); color: var(--accent3);
}
.post-content hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.post-content img { display: block; max-width: 100%; height: auto; margin: 1.6rem auto; border-radius: 12px; border: 1px solid var(--border); }


.post-content pre code { white-space: pre; }
.post-content table { width: 100%; border-collapse: collapse; margin: 0 0 1.4rem; font-size: 0.95rem; }
.post-content th, .post-content td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.post-content th { background: var(--surface2); }
a.featured-card, a.post-card { color: inherit; }
.hero-cta .btn-primary { text-decoration: none; }
.not-found { min-height: calc(100vh - 100px); }
.not-found h1 { font-size: 2.4rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1; margin-bottom: 16px; }

/* ── POST NEWSLETTER FOOTER ── */
.post-newsletter { max-width: 760px; margin: 0 auto; }
.post-newsletter .newsletter-section { padding: 0 0 80px; }
.post-view { padding-bottom: 48px; }

/* ── ROUGE (Swift) ── */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs, .highlight .cd, .highlight .cp { color: #546e7a; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kc, .highlight .ow { color: #c792ea; }
.highlight .kt, .highlight .nc, .highlight .nn, .highlight .bp { color: #82aaff; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .se, .highlight .si, .highlight .sx, .highlight .sc { color: #c3e88d; }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo { color: #f78c6c; }
.highlight .nf, .highlight .fm, .highlight .nx { color: #89ddff; }
.highlight .na, .highlight .nd { color: #ffcb6b; }
.highlight .err { color: inherit; background: none; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  nav { padding: 0 20px; }
  .wrapper { padding: 0 20px; }
  .hero { padding: 110px 0 60px; }
  .hero-name-col h1 { font-size: 1.7rem; }
  .posts-grid { grid-template-columns: 1fr; }
  .about-card { flex-direction: column; gap: 24px; }
  .about-links { margin-left: 0; flex-direction: row; flex-wrap: wrap; }
  .featured-card { padding: 28px 24px; }
  .newsletter-card { padding: 24px; gap: 20px; }
  .newsletter-card .btn-primary { width: 100%; justify-content: center; }
  .featured-card h3 { font-size: 1.3rem; }
  .footer-inner { flex-direction: column; gap: 8px; text-align: center; }
  .post-view .wrapper { padding: 0 20px; }
  .not-found h1 { font-size: 1.8rem; }
  .post-header h1 { font-size: 1.6rem; }
  .post-view { padding: 90px 0 60px; }
}
