/* ============================================================
   The AI Generation — Blog Theme
   Dark futuristic editorial · teal/amber accents
   ============================================================ */

:root {
  /* Palette */
  --bg: #0a0e14;
  --bg-elevated: #10161e;
  --bg-card: #141b25;
  --surface-line: rgba(255,255,255,0.06);
  --ink: #e8edf5;
  --ink-2: #b8c1d1;
  --ink-muted: #6b7788;
  --ink-dim: #4a5463;
  --teal: #14b8a6;
  --teal-bright: #5eead4;
  --teal-glow: rgba(20, 184, 166, 0.15);
  --amber: #f59e0b;
  --amber-bright: #fbbf24;
  --amber-glow: rgba(245, 158, 11, 0.12);
  --code-bg: #0f141c;
  --code-border: rgba(20, 184, 166, 0.18);
  --warning: #ef4444;

  /* Typography */
  --font-display: 'Bebas Neue', 'Impact', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  /* Spacing */
  --maxw: 768px;
  --maxw-wide: 1100px;
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;

  /* Shadow */
  --shadow-card: 0 10px 40px -12px rgba(0,0,0,0.5);
  --shadow-glow-teal: 0 0 40px -8px var(--teal-glow);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Subtle background grid texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(20,184,166,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20,184,166,0.015) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--teal-bright);
  text-decoration: none;
  border-bottom: 1px solid rgba(94, 234, 212, 0.3);
  transition: color 0.15s ease, border-color 0.15s ease;
}
a:hover { color: var(--amber-bright); border-color: var(--amber-bright); }

/* ============================================================
   NAVIGATION
   ============================================================ */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--surface-line);
}

.nav-inner {
  max-width: var(--maxw-wide);
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.logo {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.08em;
  color: var(--ink);
  border: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo:hover { color: var(--teal-bright); }

.logo .dot {
  width: 8px;
  height: 8px;
  background: var(--amber);
  border-radius: 2px;
  box-shadow: 0 0 12px var(--amber);
}

.nav-links {
  display: flex;
  gap: 28px;
  font-size: 14px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.nav-links a {
  color: var(--ink-2);
  border: none;
}
.nav-links a:hover { color: var(--teal-bright); }

.nav-cta {
  padding: 9px 16px;
  background: var(--amber);
  color: #0a0e14;
  border: 1px solid var(--amber);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: all 0.15s ease;
}
.nav-cta:hover {
  background: var(--amber-bright);
  border-color: var(--amber-bright);
  transform: translateY(-1px);
  color: #0a0e14;
}

@media (max-width: 720px) {
  .nav-links { display: none; }
  .nav-inner { padding: 14px 18px; }
}

/* ============================================================
   READING PROGRESS BAR
   ============================================================ */

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--teal), var(--amber));
  z-index: 60;
  width: 0%;
  transition: width 0.1s ease;
}

/* ============================================================
   HEADER / HERO (individual post)
   ============================================================ */

.post-header {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 60px 24px 40px;
}

.post-meta-top {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.category-badge {
  padding: 5px 12px;
  background: var(--teal-glow);
  color: var(--teal-bright);
  border: 1px solid rgba(20, 184, 166, 0.25);
  border-radius: 999px;
  font-weight: 500;
}

.post-title {
  font-family: var(--font-display);
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.05;
  letter-spacing: 0.01em;
  margin-bottom: 20px;
  color: var(--ink);
}

.post-description {
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink-2);
  margin-bottom: 32px;
  max-width: 640px;
}

.post-byline {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--surface-line);
  border-bottom: 1px solid var(--surface-line);
  font-size: 14px;
  color: var(--ink-muted);
  flex-wrap: wrap;
}
.post-byline b { color: var(--ink-2); font-weight: 500; }
.post-byline .sep { color: var(--ink-dim); }

/* ============================================================
   ARTICLE CONTENT
   ============================================================ */

.post-content {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.post-content h1 { display: none; } /* handled by post-title */

.post-content h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.15;
  letter-spacing: 0.01em;
  margin-top: 56px;
  margin-bottom: 16px;
  color: var(--ink);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--surface-line);
}

.post-content h3 {
  font-family: var(--font-body);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 40px;
  margin-bottom: 14px;
  color: var(--teal-bright);
  letter-spacing: -0.01em;
}

.post-content h4 {
  font-size: 17px;
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 10px;
  color: var(--amber-bright);
}

.post-content p {
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink-2);
  margin-bottom: 22px;
}

.post-content p + p { margin-top: 0; }

.post-content strong, .post-content b {
  color: var(--ink);
  font-weight: 600;
}

.post-content em, .post-content i {
  color: var(--ink-2);
  font-style: italic;
}

/* Lists */
.post-content ul, .post-content ol {
  margin: 20px 0 26px;
  padding-left: 24px;
  color: var(--ink-2);
}
.post-content ul li, .post-content ol li {
  font-size: 17px;
  line-height: 1.7;
  margin-bottom: 10px;
  padding-left: 8px;
}
.post-content ul li::marker {
  color: var(--teal);
}
.post-content ol li::marker {
  color: var(--amber);
  font-family: var(--font-mono);
  font-weight: 600;
}

/* Nested lists */
.post-content li > ul, .post-content li > ol {
  margin: 10px 0;
}

/* Code blocks */
.post-content pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-left: 3px solid var(--teal);
  border-radius: 6px;
  padding: 18px 20px;
  margin: 24px 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--teal-bright);
  box-shadow: var(--shadow-card);
}

.post-content pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
  border: none;
}

.post-content code {
  background: rgba(20, 184, 166, 0.1);
  color: var(--amber-bright);
  padding: 2px 7px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.88em;
  border: 1px solid rgba(20, 184, 166, 0.15);
}

/* Blockquotes */
.post-content blockquote {
  border-left: 3px solid var(--amber);
  background: rgba(245, 158, 11, 0.04);
  padding: 18px 24px;
  margin: 28px 0;
  color: var(--ink-2);
  font-style: italic;
  border-radius: 0 6px 6px 0;
}

.post-content blockquote p {
  margin: 0;
  color: var(--ink-2);
}

/* Tables */
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 28px 0;
  background: var(--bg-card);
  border: 1px solid var(--surface-line);
  border-radius: 6px;
  overflow: hidden;
  font-size: 15px;
}

.post-content thead th {
  background: var(--bg-elevated);
  color: var(--teal-bright);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 14px 16px;
  text-align: left;
  border-bottom: 2px solid var(--teal);
}

.post-content tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--surface-line);
  color: var(--ink-2);
  line-height: 1.55;
}

.post-content tbody tr:last-child td {
  border-bottom: none;
}

.post-content tbody tr:hover {
  background: rgba(20, 184, 166, 0.03);
}

/* HR */
.post-content hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--surface-line), transparent);
  margin: 48px 0;
}

/* Final italicised signoff block */
.post-content > p:last-child em,
.post-content > p:nth-last-child(-n+3) em {
  font-size: 14px;
  color: var(--ink-muted);
}

/* Responsive table */
@media (max-width: 680px) {
  .post-content table { font-size: 13px; }
  .post-content thead th, .post-content tbody td { padding: 10px 10px; }
}

/* ============================================================
   CTA BLOCK (auto-inserted into posts)
   ============================================================ */

.inline-cta {
  margin: 48px 0;
  padding: 28px;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
  border: 1px solid rgba(20, 184, 166, 0.2);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-glow-teal);
}

.inline-cta::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--teal), var(--amber));
}

.inline-cta-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 12px;
  font-weight: 600;
}

.inline-cta h3 {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin: 0 0 10px !important;
  line-height: 1.2;
}

.inline-cta p {
  color: var(--ink-2);
  margin-bottom: 18px;
  font-size: 15px;
}

.inline-cta-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.cta-btn {
  padding: 11px 20px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.cta-btn.primary {
  background: var(--amber);
  color: #0a0e14;
  border-color: var(--amber);
}
.cta-btn.primary:hover {
  background: var(--amber-bright);
  border-color: var(--amber-bright);
  transform: translateY(-1px);
  color: #0a0e14;
}

.cta-btn.secondary {
  background: transparent;
  color: var(--teal-bright);
  border-color: rgba(20, 184, 166, 0.4);
}
.cta-btn.secondary:hover {
  background: var(--teal-glow);
  border-color: var(--teal-bright);
  color: var(--teal-bright);
  transform: translateY(-1px);
}

/* ============================================================
   RELATED POSTS
   ============================================================ */

.related-section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px 24px 80px;
  border-top: 1px solid var(--surface-line);
  position: relative;
  z-index: 1;
}

.related-heading {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 24px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.related-card {
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--surface-line);
  border-radius: 8px;
  transition: all 0.2s ease;
  display: block;
  color: inherit !important;
  border-bottom: 1px solid var(--surface-line) !important;
}

.related-card:hover {
  transform: translateY(-2px);
  border-color: var(--teal) !important;
  box-shadow: var(--shadow-glow-teal);
}

.related-card .cat {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 8px;
}

.related-card h4 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  margin-bottom: 10px;
}

.related-card .time {
  font-size: 12px;
  color: var(--ink-muted);
  font-family: var(--font-mono);
}

/* ============================================================
   FOOTER
   ============================================================ */

.footer {
  max-width: var(--maxw-wide);
  margin: 0 auto;
  padding: 40px 24px;
  border-top: 1px solid var(--surface-line);
  color: var(--ink-muted);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  position: relative;
  z-index: 1;
}

.footer a { color: var(--ink-2); border: none; }
.footer a:hover { color: var(--teal-bright); }

.footer-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
}

/* ============================================================
   BLOG LISTING PAGE
   ============================================================ */

.listing-hero {
  max-width: var(--maxw-wide);
  margin: 0 auto;
  padding: 80px 24px 40px;
  position: relative;
  z-index: 1;
}

.listing-hero-kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 16px;
}

.listing-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(48px, 8vw, 96px);
  line-height: 0.95;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin-bottom: 24px;
  max-width: 800px;
}

.listing-hero h1 .accent {
  color: var(--teal-bright);
}

.listing-hero-sub {
  font-size: 19px;
  color: var(--ink-2);
  max-width: 640px;
  line-height: 1.6;
}

/* Category filter bar */
.category-filter {
  max-width: var(--maxw-wide);
  margin: 0 auto;
  padding: 0 24px 32px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.filter-pill {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--surface-line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s ease;
  border-bottom: 1px solid var(--surface-line);
}

.filter-pill:hover {
  background: var(--teal-glow);
  color: var(--teal-bright);
  border-color: var(--teal);
}

.filter-pill.active {
  background: var(--teal);
  color: #0a0e14;
  border-color: var(--teal);
}

/* Post grid on listing */
.posts-grid {
  max-width: var(--maxw-wide);
  margin: 0 auto;
  padding: 0 24px 80px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
  position: relative;
  z-index: 1;
}

.post-card {
  padding: 28px 26px;
  background: var(--bg-card);
  border: 1px solid var(--surface-line);
  border-radius: 12px;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--surface-line) !important;
  color: inherit !important;
  position: relative;
  overflow: hidden;
}

.post-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--teal), var(--amber));
  opacity: 0;
  transition: opacity 0.2s ease;
}

.post-card:hover {
  transform: translateY(-3px);
  border-color: rgba(20, 184, 166, 0.3) !important;
  box-shadow: var(--shadow-card), var(--shadow-glow-teal);
}
.post-card:hover::before { opacity: 1; }

.post-card-cat {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 14px;
}

.post-card h2 {
  font-family: var(--font-body);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.post-card p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
  margin-bottom: 20px;
  flex: 1;
}

.post-card-meta {
  padding-top: 14px;
  border-top: 1px solid var(--surface-line);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.post-card-meta .arrow {
  color: var(--teal-bright);
  font-size: 14px;
}

/* Mobile */
@media (max-width: 640px) {
  .post-header { padding: 40px 20px 28px; }
  .post-content { padding: 24px 20px 60px; }
  .post-content h2 { margin-top: 40px; }
  .inline-cta { padding: 22px; margin: 36px 0; }
  .posts-grid { grid-template-columns: 1fr; padding: 0 20px 60px; gap: 16px; }
  .listing-hero { padding: 50px 20px 30px; }
  .category-filter { padding: 0 20px 24px; }
}
