/* ============================================
   BLOG STYLES — matches main site theme
============================================ */
:root {
  --bg-deep:    #05080f;
  --bg-base:    #080c17;
  --bg-surface: #0d1422;
  --bg-card:    #111c30;
  --bg-card-h:  #162035;

  --gold:       #c8a84c;
  --gold-l:     #e6c46a;
  --gold-d:     #9a7a35;
  --gold-muted: rgba(200,168,76,0.12);
  --gold-glow:  rgba(200,168,76,0.28);

  --blue:       #4a7fca;
  --blue-l:     #6b9fe4;
  --blue-muted: rgba(74,127,202,0.12);

  --teal:       #1dbba8;
  --teal-l:     #2dd4bf;
  --teal-muted: rgba(29,187,168,0.12);

  --text-1: #f0f4ff;
  --text-2: #b0c4e8;
  --text-3: #6882a8;

  --border:   rgba(200,168,76,0.10);
  --border-h: rgba(200,168,76,0.28);

  --r:    12px;
  --r-lg: 20px;
  --r-xl: 28px;

  --ease: all 0.3s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-deep);
  color: var(--text-1);
  line-height: 1.7;
  overflow-x: hidden;
}

a { color: var(--gold); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--gold-l); }

/* ============================================
   NAV (mirrors main site)
============================================ */
#nav {
  position: fixed; top:0; left:0; right:0; z-index:1000;
  padding: 1.375rem 2.5rem;
  display: flex; align-items:center; justify-content:space-between;
  background: rgba(8,12,23,0.93);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  transition: var(--ease);
}
.nav-brand { display:flex; align-items:center; gap:0.875rem; color:var(--text-1); }
.nav-mark {
  width: 40px; height: 40px; border-radius:10px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-d) 100%);
  display: flex; align-items:center; justify-content:center;
  font-weight:900; font-size:0.9375rem; color:var(--bg-deep); letter-spacing:-0.05em;
  flex-shrink:0;
}
.nav-name { font-weight:700; font-size:0.9375rem; line-height:1.2; }
.nav-title { font-size:0.6875rem; color:var(--text-3); font-weight:500; letter-spacing:0.06em; text-transform:uppercase; }

.nav-links { display:flex; align-items:center; gap:2.25rem; list-style:none; }
.nav-links a {
  font-size:0.875rem; font-weight:500; color:var(--text-2); letter-spacing:0.01em;
  position:relative; transition: color 0.2s;
}
.nav-links a::after {
  content:''; position:absolute; bottom:-3px; left:0; width:0; height:1px;
  background:var(--gold); transition:width 0.3s ease;
}
.nav-links a:hover { color:var(--text-1); }
.nav-links a:hover::after { width:100%; }
.nav-links a.active { color:var(--gold); }
.nav-links a.active::after { width:100%; }

/* ============================================
   LAYOUT
============================================ */
.blog-container {
  max-width: 820px;
  margin: 0 auto;
  padding: 7rem 2rem 4rem;
}

/* ============================================
   BLOG INDEX
============================================ */
.blog-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}
.blog-header h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--gold-l) 0%, var(--gold) 50%, var(--gold-d) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.blog-header p {
  font-size: 1.05rem;
  color: var(--text-2);
  font-weight: 300;
}

.post-list { display:flex; flex-direction:column; gap:1.5rem; }

.post-card {
  display: block;
  padding: 1.5rem 1.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: var(--ease);
  color: var(--text-1);
}
.post-card.has-thumb {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  padding: 0;
  overflow: hidden;
}
.post-card.has-thumb .post-card-body {
  padding: 1.5rem 1.75rem 1.5rem 0;
  flex: 1;
  min-width: 0;
}
.post-card-thumb {
  width: 220px;
  min-height: 100%;
  flex-shrink: 0;
  overflow: hidden;
}
.post-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.post-card:hover .post-card-thumb img { transform: scale(1.05); }
.post-card:hover {
  border-color: var(--border-h);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
  color: var(--text-1);
}
.post-card-date {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.375rem;
}
.post-card-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.375rem;
}
.post-card-summary {
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.6;
}
.post-card-tags {
  display: flex; flex-wrap: wrap; gap: 0.375rem;
  margin-top: 0.75rem;
}
.post-tag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.175rem 0.575rem;
  border-radius: 5px;
  background: rgba(255,255,255,0.05);
  color: var(--text-3);
  border: 1px solid rgba(255,255,255,0.07);
}

/* ============================================
   POST PAGE
============================================ */
.post-meta {
  margin-bottom: 2.5rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}
.post-meta-date {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.5rem;
}
.post-meta h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}
.post-meta-summary {
  font-size: 1.05rem;
  color: var(--text-2);
  font-weight: 300;
  line-height: 1.7;
}

/* Hero / banner image */
.post-hero {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--r);
  border: 1px solid var(--border);
  margin-bottom: 2rem;
}

/* ============================================
   ARTICLE CONTENT (rendered Markdown)
============================================ */
.post-content h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 2.5rem 0 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.post-content h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 2rem 0 0.75rem;
  color: var(--gold-l);
}
.post-content h4 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
  color: var(--text-2);
}
.post-content p {
  margin-bottom: 1.125rem;
  color: var(--text-2);
  font-weight: 300;
  font-size: 0.975rem;
}
.post-content strong { color: var(--text-1); font-weight: 600; }
.post-content em { font-style: italic; }

.post-content ul, .post-content ol {
  margin: 0 0 1.25rem 1.5rem;
  color: var(--text-2);
  font-weight: 300;
  font-size: 0.975rem;
}
.post-content li { margin-bottom: 0.375rem; }
.post-content li::marker { color: var(--gold); }

.post-content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  border-left: 3px solid var(--gold);
  background: var(--bg-card);
  border-radius: 0 var(--r) var(--r) 0;
  font-style: italic;
}
.post-content blockquote p { color: var(--text-2); margin-bottom: 0; }

.post-content hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 2rem 0;
}

.post-content img {
  max-width: 100%;
  border-radius: var(--r);
  border: 1px solid var(--border);
  margin: 1.25rem 0;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.875rem;
}
.post-content th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--gold);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.post-content td {
  padding: 0.625rem 1rem;
  border: 1px solid var(--border);
  color: var(--text-2);
}
.post-content tr:hover td { background: var(--bg-card); }

/* ============================================
   INLINE CODE
============================================ */
.post-content code:not(pre code) {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.85em;
  padding: 0.15em 0.45em;
  border-radius: 5px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--teal-l);
}

/* ============================================
   CODE BLOCKS — highlight.js theme override
============================================ */
pre {
  margin: 1.5rem 0;
  border-radius: var(--r);
  border: 1px solid var(--border);
  overflow: hidden;
}
pre .code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: var(--bg-card-h);
  border-bottom: 1px solid var(--border);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
pre .code-header .copy-btn {
  background: none; border: 1px solid var(--border); border-radius: 5px;
  padding: 0.2rem 0.6rem; cursor: pointer;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.06em;
  color: var(--text-3); transition: var(--ease); font-family: inherit;
}
pre .code-header .copy-btn:hover {
  color: var(--gold); border-color: var(--gold);
}
pre code {
  display: block;
  padding: 1.25rem 1.5rem;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.825rem;
  line-height: 1.65;
  overflow-x: auto;
  background: var(--bg-surface);
  scrollbar-width: thin;
  scrollbar-color: var(--gold) transparent;
}
pre code::-webkit-scrollbar { height: 5px; }
pre code::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 4px; }
pre code::-webkit-scrollbar-track { background: transparent; }

/* highlight.js dark overrides */
.hljs { background: transparent !important; color: var(--text-2); }
.hljs-keyword,
.hljs-selector-tag,
.hljs-type { color: #c678dd; }
.hljs-string,
.hljs-attr { color: #98c379; }
.hljs-number,
.hljs-literal { color: #d19a66; }
.hljs-comment,
.hljs-quote { color: var(--text-3); font-style: italic; }
.hljs-function .hljs-title,
.hljs-title.function_,
.hljs-title { color: #61afef; }
.hljs-built_in { color: #e5c07b; }
.hljs-variable,
.hljs-template-variable { color: #e06c75; }
.hljs-meta { color: var(--gold); }
.hljs-meta .hljs-keyword { color: var(--gold); }
.hljs-meta .hljs-string { color: #98c379; }
.hljs-symbol,
.hljs-bullet { color: #56b6c2; }
.hljs-addition { color: #98c379; background: rgba(152,195,121,0.1); }
.hljs-deletion { color: #e06c75; background: rgba(224,108,117,0.1); }
.hljs-section { color: var(--gold-l); font-weight: 700; }
.hljs-name,
.hljs-tag { color: #e06c75; }
.hljs-attribute { color: #d19a66; }
.hljs-regexp { color: #56b6c2; }
.hljs-operator { color: #56b6c2; }
.hljs-punctuation { color: var(--text-3); }

/* Line numbers for code blocks */
pre code .line-number {
  display: inline-block;
  width: 3ch;
  margin-right: 1.25rem;
  text-align: right;
  color: var(--text-3);
  opacity: 0.5;
  user-select: none;
  -webkit-user-select: none;
}

/* ============================================
   INFO / WARNING / TIP CALLOUTS
============================================ */
.callout {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-radius: 0 var(--r) var(--r) 0;
  border-left: 3px solid;
}
.callout-title {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.375rem;
}
.callout p { margin: 0; font-size: 0.9rem; }

.callout-info {
  background: var(--blue-muted);
  border-left-color: var(--blue);
}
.callout-info .callout-title { color: var(--blue-l); }
.callout-info p { color: var(--text-2); }

.callout-warning {
  background: rgba(224,123,58,0.1);
  border-left-color: #e07b3a;
}
.callout-warning .callout-title { color: #e07b3a; }
.callout-warning p { color: var(--text-2); }

.callout-tip {
  background: var(--teal-muted);
  border-left-color: var(--teal);
}
.callout-tip .callout-title { color: var(--teal-l); }
.callout-tip p { color: var(--text-2); }

/* ============================================
   CHARTS (Chart.js containers)
============================================ */
.chart-wrap {
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.chart-wrap canvas {
  width: 100% !important;
  max-height: 400px;
}

/* ============================================
   MERMAID DIAGRAMS
============================================ */
.mermaid {
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  text-align: center;
}
.mermaid svg { max-width: 100%; }

/* ============================================
   POST NAVIGATION
============================================ */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.post-nav a {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: var(--ease);
  max-width: 48%;
  color: var(--text-1);
}
.post-nav a:hover {
  border-color: var(--border-h);
  transform: translateY(-1px);
}
.post-nav a span:first-child {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}
.post-nav a span:last-child {
  font-size: 0.9rem;
  font-weight: 600;
}
.post-nav-next { text-align: right; margin-left: auto; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 2rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold);
}
.back-link:hover { color: var(--gold-l); }

/* ============================================
   COMMENTS (HyvorTalk)
============================================ */
.comments-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.comments-heading {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}

/* ============================================
   FOOTER
============================================ */
footer {
  background: var(--bg-deep);
  border-top: 1px solid var(--border);
  padding: 2.25rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-3);
}
footer strong { color: var(--gold); }

/* ============================================
   RESPONSIVE
============================================ */
@media(max-width:768px) {
  #nav { padding:1rem 1.5rem; }
  .nav-links { display:none; }
  .blog-container { padding: 5.5rem 1.25rem 3rem; }
  pre code { font-size: 0.75rem; padding: 1rem; }
  .post-nav { flex-direction: column; }
  .post-nav a { max-width: 100%; }
  .post-nav-next { text-align: left; }
  .post-card.has-thumb { flex-direction: column; }
  .post-card-thumb { width: 100%; min-height: auto; max-height: 180px; }
  .post-card.has-thumb .post-card-body { padding: 1.25rem; }
}
