/* =============================================
   THE AI EDGE NEWS - Ghost Theme v2.4.0
   Dark Premium Design
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=DM+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-primary: #0a0a0c;
  --bg-secondary: #111114;
  --bg-card: #16161a;
  --bg-card-hover: #1c1c21;
  --accent: #4ade80;
  --accent-dim: rgba(74, 222, 128, 0.15);
  --accent-glow: rgba(74, 222, 128, 0.08);
  --text-primary: #f0f0f2;
  --text-secondary: #c8c8d0;
  --text-muted: #8888a0;
  --border: rgba(255,255,255,0.06);
  --border-accent: rgba(74, 222, 128, 0.2);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  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.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ===== READING PROGRESS BAR ===== */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #22d3ee);
  z-index: 10001;
  transition: width 0.1s linear;
  border-radius: 0 2px 2px 0;
}

/* ===== NAVIGATION ===== */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  padding: 20px 40px;
  display: flex;
  flex-direction: column;
  z-index: 10000;
  background: rgba(10, 10, 12, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background 0.3s;
}

.site-nav.scrolled {
  border-bottom-color: var(--border);
  background: rgba(10, 10, 12, 0.95);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.nav-logo {
  font-family: 'Instrument Serif', serif;
  font-size: 22px;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.5px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links {
  display: flex;
  gap: 28px;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--text-primary);
}

.nav-cta {
  padding: 10px 20px;
  background: var(--accent);
  color: #0a0a0c;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.2s;
}

.nav-cta:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 10002;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

.hamburger.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile Menu */
.mobile-menu {
  display: none;
  flex-direction: column;
  gap: 0;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.mobile-menu.active {
  display: flex;
  max-height: 300px;
  padding: 16px 0 8px;
}

.mobile-menu a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  transition: color 0.2s;
}

.mobile-menu a:last-child {
  border-bottom: none;
}

.mobile-menu a:hover {
  color: var(--accent);
}

/* ===== HERO ===== */
.hero {
  padding: 160px 40px 80px;
  text-align: center;
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  border-radius: 100px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 32px;
}

.badge-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hero h1 {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(42px, 6vw, 72px);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.hero h1 em {
  color: var(--accent);
  font-style: italic;
}

.hero-sub {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 500px;
  margin: 0 auto 40px;
}

.hero-welcome {
  padding: 16px 24px;
  background: var(--accent-dim);
  border: 1px solid var(--border-accent);
  border-radius: 12px;
  margin-bottom: 24px;
}

.hero-welcome p {
  color: var(--accent);
  font-size: 15px;
  font-weight: 500;
}

.email-form {
  display: flex;
  max-width: 460px;
  margin: 0 auto 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.3s;
}

.email-form:focus-within {
  border-color: var(--border-accent);
}

.email-form input {
  flex: 1;
  padding: 16px 20px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  outline: none;
}

.email-form input::placeholder {
  color: var(--text-muted);
}

.email-form button {
  padding: 16px 24px;
  background: var(--accent);
  color: #0a0a0c;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.email-form button:hover {
  opacity: 0.9;
}

.social-proof {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-muted);
}

.avatars {
  display: flex;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  margin-left: -8px;
}

.avatar:first-child {
  margin-left: 0;
}

/* ===== SECTION DIVIDER ===== */
.section-divider {
  max-width: 1200px;
  margin: 0 auto;
  height: 1px;
  background: var(--border);
}

/* ===== FEATURED POST (HERO ARTICLE) ===== */
.featured-post {
  padding: 60px 40px;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.featured-link {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 40px;
  align-items: center;
  text-decoration: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  transition: border-color 0.3s, background 0.3s, transform 0.3s;
}

.featured-link:hover {
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
  transform: translateY(-4px);
}

.featured-image {
  width: 100%;
  height: 100%;
  min-height: 340px;
  overflow: hidden;
}

.featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.featured-link:hover .featured-image img {
  transform: scale(1.04);
}

.featured-content {
  padding: 40px 40px 40px 0;
}

.featured-content .post-meta {
  margin-bottom: 16px;
}

.featured-content h2 {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(28px, 3.5vw, 42px);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.5px;
  color: #ffffff;
  margin-bottom: 16px;
}

.featured-excerpt {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Featured without image */
.featured-link:not(:has(.featured-image)) {
  grid-template-columns: 1fr;
}

.featured-link:not(:has(.featured-image)) .featured-content {
  padding: 48px;
}

@media (max-width: 768px) {
  .featured-post { padding: 40px 20px; }
  .featured-link {
    grid-template-columns: 1fr;
  }
  .featured-image {
    min-height: 220px;
  }
  .featured-content {
    padding: 24px;
  }
  .featured-content h2 {
    font-size: 26px;
  }
}

/* ===== POSTS SECTION ===== */
.posts-section {
  padding: 60px 40px 80px;
  max-width: 1200px;
  margin: 0 auto;
}

.section-label {
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 32px;
}

.section-title {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 400;
  letter-spacing: -0.5px;
  margin-bottom: 48px;
  color: var(--text-primary);
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  transition: border-color 0.3s, background 0.3s, transform 0.3s;
  display: flex;
  flex-direction: column;
}

.post-card:hover {
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
  transform: translateY(-4px);
}

.post-card-image {
  width: 100%;
  height: 200px;
  overflow: hidden;
}

.post-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.post-card:hover .post-card-image img {
  transform: scale(1.05);
}

.post-card-content {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.post-tag {
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.meta-sep {
  color: var(--text-muted);
  opacity: 0.5;
}

.post-card h3 {
  font-family: 'Instrument Serif', serif;
  font-size: 24px;
  font-weight: 400;
  line-height: 1.25;
  color: #ffffff;
  letter-spacing: -0.3px;
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 20px 40px 60px;
}

.pagination-btn {
  padding: 10px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.2s, color 0.2s;
}

.pagination-btn:hover {
  border-color: var(--border-accent);
  color: var(--accent);
}

/* ===== FINAL CTA ===== */
.final-cta {
  padding: 100px 40px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.final-cta h2 {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 400;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.final-cta p {
  font-size: 17px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.cta-btn {
  padding: 14px 32px;
  background: var(--accent);
  color: #0a0a0c;
  border: none;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
}

.cta-btn:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

/* ===== ARTICLE PAGE ===== */
.article-page {
  padding: 140px 40px 80px;
  max-width: 780px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.article-header {
  margin-bottom: 40px;
}

.article-header .post-tag {
  display: inline-block;
  margin-bottom: 16px;
}

.article-header h1 {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -1px;
  margin-bottom: 16px;
  color: #ffffff;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-muted);
}

.article-feature-image {
  margin: 0 0 48px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.article-feature-image img {
  width: 100%;
  height: auto;
  display: block;
}

/* Article Content - Improved readability */
.article-content {
  max-width: 680px;
  margin: 0 auto;
}

.article-content p {
  font-size: 17px;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.article-content h2 {
  font-family: 'DM Sans', sans-serif;
  font-size: 26px;
  font-weight: 600;
  margin: 48px 0 16px;
  color: #ffffff;
}

.article-content h3 {
  font-family: 'DM Sans', sans-serif;
  font-size: 21px;
  font-weight: 600;
  margin: 36px 0 12px;
  color: #ffffff;
}

.article-content strong {
  color: #ffffff;
  font-weight: 600;
}

.article-content a {
  color: #5eead4;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
}

.article-content a:hover {
  color: var(--accent);
}

.article-content ul,
.article-content ol {
  margin: 0 0 24px 24px;
  color: var(--text-secondary);
}

.article-content li {
  font-size: 17px;
  line-height: 1.8;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.article-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 16px 24px;
  margin: 32px 0;
  background: var(--accent-glow);
  border-radius: 0 8px 8px 0;
}

.article-content blockquote p {
  color: var(--text-primary);
  font-style: italic;
  margin-bottom: 0;
}

.article-content code {
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 14px;
  color: var(--accent);
}

.article-content pre {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  overflow-x: auto;
  margin: 32px 0;
}

.article-content pre code {
  background: none;
  padding: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

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

/* Ghost Koenig editor width classes */
.kg-width-wide {
  max-width: 1040px;
  margin-left: auto;
  margin-right: auto;
}

.kg-width-full {
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  width: 100vw;
}

.kg-width-wide img,
.kg-width-full img {
  width: 100%;
  height: auto;
}

.article-content hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 40px 0;
}

/* ===== SHARE SECTION ===== */
.share-section {
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.share-section h4 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

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

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
}

.share-btn:hover {
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.share-linkedin:hover { color: #0a66c2; }
.share-x:hover { color: var(--text-primary); }
.share-copy:hover { color: var(--accent); }

/* ===== ARTICLE CTA ===== */
.article-cta {
  margin-top: 56px;
  padding: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  text-align: center;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}

.article-cta h3 {
  font-family: 'Instrument Serif', serif;
  font-size: 28px;
  font-weight: 400;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.article-cta p {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ===== TAG ARCHIVE ===== */
.tag-archive {
  padding: 140px 40px 80px;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.tag-header {
  margin-bottom: 48px;
}

.tag-label {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.tag-header h1 {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 400;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.tag-description {
  font-size: 16px;
  color: var(--text-secondary);
  margin-top: 12px;
  line-height: 1.6;
}

/* ===== FOOTER ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 64px 40px 0;
  position: relative;
  z-index: 1;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  gap: 40px;
  flex-wrap: wrap;
}

.footer-brand {
  max-width: 300px;
}

.footer-logo {
  font-family: 'Instrument Serif', serif;
  font-size: 22px;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.5px;
  display: block;
  margin-bottom: 12px;
}

.footer-tagline {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.footer-links {
  display: flex;
  gap: 64px;
}

.footer-col h4 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.footer-col a {
  display: block;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 10px;
  transition: color 0.2s;
}

.footer-col a:hover {
  color: var(--accent);
}

.footer-bottom {
  max-width: 1200px;
  margin: 48px auto 0;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-bottom p {
  font-size: 13px;
  color: var(--text-muted);
}

/* ===== PAGE CONTENT ===== */
.page-content .article-header h1 {
  color: #ffffff;
}

/* ===== ERROR PAGE ===== */
.error-page {
  padding: 200px 40px 160px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.error-page h1 {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(80px, 15vw, 160px);
  font-weight: 400;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 16px;
  opacity: 0.6;
}

.error-description {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .site-nav { padding: 16px 20px; }
  .nav-links { display: none; }
  .nav-cta { display: none; }
  .hamburger { display: flex; }
  .mobile-menu { display: flex; }

  .hero { padding: 120px 20px 60px; }
  .email-form { flex-direction: column; border-radius: 14px; }
  .email-form button { padding: 14px; border-radius: 0; }

  .posts-section { padding: 60px 20px; }
  .posts-grid { grid-template-columns: 1fr; }

  .final-cta { padding: 80px 20px; }

  .article-page { padding: 100px 20px 60px; }
  .article-header h1 { font-size: 28px; }

  .share-buttons { flex-direction: column; }
  .share-btn { justify-content: center; }

  .article-cta { padding: 32px 20px; }

  .tag-archive { padding: 100px 20px 60px; }

  .footer-inner { flex-direction: column; gap: 32px; }
  .footer-links { gap: 32px; flex-wrap: wrap; }
  .site-footer { padding: 48px 20px 0; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 36px; }
  .social-proof { flex-direction: column; gap: 8px; }
  .footer-links { gap: 24px; }
}
