*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0a0c10; --surface: #111318; --card: #14171f;
  --border: #1e2330; --gold: #f0b429; --gold-dim: #c8961e;
  --green: #22c55e; --red: #ef4444; --text: #e8eaf0; --muted: #6b7280;
}
:root.light-mode {
  --bg: #f8fafc; --surface: #ffffff; --card: #f1f5f9;
  --border: #e2e8f0; --text: #0f172a; --muted: #64748b;
}
body {
  background: var(--bg); color: var(--text);
  font-family: 'DM Sans', sans-serif; min-height: 100vh;
}
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.4;
}
nav {
  position: fixed; top: 0; width: 100%; z-index: 100;
  background: rgba(10,12,16,0.9); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem; display: flex; align-items: center;
  justify-content: space-between; height: 64px;
}
.nav-logo { font-family: 'Playfair Display', serif; font-size: 1.4rem; color: var(--gold); text-decoration: none; }
.nav-logo span { color: var(--text); }
.nav-back { display: flex; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; font-size: 0.9rem; font-weight: 500; transition: color 0.2s; }
.nav-back:hover { color: var(--gold); }
.progress-bar { position: fixed; top: 64px; left: 0; height: 3px; background: #a78bfa; width: 0%; z-index: 99; transition: width 0.1s; }

.post-hero { margin-top: 64px; position: relative; height: 460px; overflow: hidden; }
.post-hero img { width: 100%; height: 100%; object-fit: cover; filter: brightness(0.4); }
.post-hero-overlay { position: absolute; inset: 0; background: linear-gradient(to top, var(--bg) 0%, transparent 60%); }
.post-hero-content { position: absolute; bottom: 0; left: 0; right: 0; max-width: 800px; margin: 0 auto; padding: 0 2rem 3rem; }
.post-category { display: inline-block; background: rgba(167,139,250,0.15); border: 1px solid rgba(167,139,250,0.3); color: #a78bfa; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; padding: 5px 12px; border-radius: 20px; margin-bottom: 1rem; }
.post-title { font-family: 'Playfair Display', serif; font-size: clamp(1.8rem, 4vw, 2.8rem); line-height: 1.2; margin-bottom: 1.2rem; }
.post-meta { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.post-author { display: flex; align-items: center; gap: 0.6rem; }
.author-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #a78bfa, #7c3aed); display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 700; color: white; }
.author-info .name { font-weight: 600; font-size: 0.9rem; }
.author-info .role { font-size: 0.78rem; color: var(--muted); }
.meta-divider { width: 1px; height: 30px; background: var(--border); }
.meta-item { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 0.82rem; }

.article-wrap { max-width: 800px; margin: 0 auto; padding: 3rem 2rem 6rem; position: relative; z-index: 1; }

.toc { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid #a78bfa; border-radius: 12px; padding: 1.4rem 1.6rem; margin-bottom: 2.5rem; }
.toc h4 { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: #a78bfa; margin-bottom: 0.8rem; }
.toc ol { padding-left: 1.2rem; }
.toc li { margin-bottom: 0.4rem; }
.toc a { color: var(--muted); text-decoration: none; font-size: 0.9rem; transition: color 0.2s; }
.toc a:hover { color: #a78bfa; }

.article-body h2 { font-family: 'Playfair Display', serif; font-size: 1.7rem; margin: 2.5rem 0 1rem; color: var(--text); padding-top: 1rem; }
.article-body h3 { font-size: 1.1rem; font-weight: 600; margin: 1.8rem 0 0.8rem; color: #a78bfa; }
.article-body p { color: #c5c9d6; line-height: 1.85; font-size: 1.02rem; margin-bottom: 1.3rem; }
.article-body strong { color: var(--text); }

.formula {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  margin: 1.5rem 0;
  text-align: center;
  font-size: 1.2rem;
  color: var(--text);
}
.formula .label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.6rem; }
.formula .eq { font-family: 'Playfair Display', serif; font-size: 1.4rem; }
.formula .eq span { color: #a78bfa; }

.pe-table {
  width: 100%; border-collapse: collapse;
  margin: 1.5rem 0;
  background: var(--surface);
  border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border);
}
.pe-table th {
  background: rgba(167,139,250,0.1);
  padding: 0.9rem 1.2rem;
  text-align: left;
  font-size: 0.82rem; font-weight: 600;
  color: #a78bfa; text-transform: uppercase; letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
}
.pe-table td {
  padding: 0.85rem 1.2rem;
  font-size: 0.92rem; color: #c5c9d6;
  border-bottom: 1px solid rgba(30,35,48,0.5);
}
.pe-table tr:last-child td { border-bottom: none; }
.pe-table tr:hover td { background: rgba(167,139,250,0.04); }
.tag-high { color: var(--red); font-weight: 600; }
.tag-low { color: var(--green); font-weight: 600; }
.tag-mid { color: var(--gold); font-weight: 600; }

.callout { border-radius: 12px; padding: 1.2rem 1.4rem; margin: 1.5rem 0; display: flex; gap: 0.8rem; }
.callout-tip { background: rgba(34,197,94,0.08); border: 1px solid rgba(34,197,94,0.2); }
.callout-warning { background: rgba(249,115,22,0.08); border: 1px solid rgba(249,115,22,0.2); }
.callout-purple { background: rgba(167,139,250,0.08); border: 1px solid rgba(167,139,250,0.2); }
.callout-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 2px; }
.callout-text { font-size: 0.92rem; line-height: 1.6; color: #c5c9d6; }
.callout-text strong { color: var(--text); }

.post-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 2.5rem 0; padding-top: 2rem; border-top: 1px solid var(--border); }
.tag { background: var(--surface); border: 1px solid var(--border); color: var(--muted); padding: 5px 14px; border-radius: 20px; font-size: 0.8rem; }

.related { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.related h3 { font-family: 'Playfair Display', serif; font-size: 1.4rem; margin-bottom: 1.2rem; }
.related-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media(max-width:600px) { .related-grid { grid-template-columns: 1fr; } }
.related-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; text-decoration: none; display: block; transition: border-color 0.2s, transform 0.2s; }
.related-card:hover { border-color: rgba(167,139,250,0.3); transform: translateY(-3px); }
.related-card img { width: 100%; height: 140px; object-fit: cover; }
.related-card-body { padding: 1rem; }
.related-card-cat { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.4rem; }
.related-card-title { font-family: 'Playfair Display', serif; font-size: 1rem; line-height: 1.3; color: var(--text); }

.share-bar { position: fixed; right: 2rem; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 0.8rem; z-index: 50; }
@media(max-width:1100px) { .share-bar { display: none; } }
.share-btn { width: 40px; height: 40px; background: var(--surface); border: 1px solid var(--border); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--muted); transition: all 0.2s; text-decoration: none; }
.share-btn:hover { border-color: #a78bfa; color: #a78bfa; }
.share-label { font-size: 0.65rem; text-align: center; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
