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

:root {
  --bg-deep: #0d1117;
  --bg-card: #161b22;
  --bg-code: #1c2129;
  --border: #30363d;
  --text-primary: #c9d1d9;
  --text-secondary: #8b949e;
  --text-heading: #e6edf3;
  --accent-cyan: #00d2ff;
  --accent-purple: #7b2ff7;
  --gradient: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  --font-mono: 'JetBrains Mono', monospace;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --max-width: 800px;
  --glow: 0 0 20px rgba(0, 210, 255, 0.15), 0 0 40px rgba(123, 47, 247, 0.1);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color 0.2s;
}

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

a:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ===== Navigation ===== */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-heading);
}

.site-logo:hover {
  color: var(--accent-cyan);
}

.logo-icon {
  color: var(--accent-cyan);
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 1.3rem;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

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

/* ===== Main ===== */
.site-main {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 3rem 0 2rem;
}

.hero-title {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.hero-sub {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* ===== Post Card List ===== */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.post-card {
  display: block;
  color: inherit;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.2s;
}

.post-card:hover {
  border-color: var(--accent-cyan);
  box-shadow: var(--glow);
  transform: translateY(-2px);
  color: inherit;
}

.post-card-inner {
  padding: 1.5rem;
}

.post-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.post-card-title {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0.4rem 0 0.6rem;
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: break-word;
}

.post-card-excerpt {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.read-more {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-cyan);
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.empty-state {
  text-align: center;
  padding: 4rem 0;
  color: var(--text-secondary);
}

/* ===== Tag Badges ===== */
.post-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2em 0.6em;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tag-daily-briefing { background: rgba(0,210,255,0.15); color: var(--accent-cyan); }
.tag-deep-dive { background: rgba(123,47,247,0.15); color: #a78bfa; }
.tag-newsletter { background: rgba(139,148,158,0.15); color: var(--text-secondary); }

.post-series {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
}

.post-news-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.post-card-meta-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.post-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
}

.post-meta-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

/* ===== Post Page ===== */
.post-header {
  margin-bottom: 2rem;
}

.back-link {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

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

.post-header .post-date {
  display: block;
  margin-bottom: 0.5rem;
}

.post-title {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.3;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ===== Post Content ===== */
.post-content {
  font-size: 1rem;
  line-height: 1.8;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  font-family: var(--font-mono);
  color: var(--text-heading);
  margin: 2rem 0 1rem;
  line-height: 1.3;
}

.post-content h1 { font-size: 1.8rem; }
.post-content h2 { font-size: 1.5rem; }
.post-content h3 { font-size: 1.25rem; }
.post-content h4 { font-size: 1.1rem; }

.post-content h2 {
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.post-content p {
  margin-bottom: 1.2rem;
}

.post-content ul,
.post-content ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.4rem;
}

.post-content blockquote {
  border-left: 3px solid var(--accent-cyan);
  padding: 0.5rem 1rem;
  margin: 1.5rem 0;
  background: var(--bg-card);
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1.5rem 0;
}

.post-content a {
  color: var(--accent-cyan);
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 500;
}

.post-content a:hover {
  text-decoration: underline;
}

/* ===== Code Blocks ===== */
.post-content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-code);
  color: var(--accent-cyan);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.post-content pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.2rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.6;
}

/* ===== Tables ===== */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.post-content th,
.post-content td {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  text-align: left;
}

.post-content th {
  background: var(--bg-card);
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-heading);
}

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

/* ===== Post Footer ===== */
.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* ===== Site Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .hero {
    padding: 2rem 0 1.5rem;
  }

  .hero-title {
    font-size: 2rem;
  }

  .post-card-title {
    font-size: 1.1rem;
  }
}

@media (max-width: 640px) {
  .hero-title {
    font-size: 1.8rem;
  }

  .post-title {
    font-size: 1.5rem;
  }

  .post-card-inner {
    padding: 1.2rem;
  }

  .post-card-title {
    font-size: 1rem;
  }

  .post-content pre {
    padding: 0.8rem;
  }

  .post-list {
    gap: 0.75rem;
  }
}
