/* === LAYOUT GENERALE === */
.post-layout {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* === BLOG INDEX === */
.blog-index {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem;
  animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-intro { text-align: center; margin-bottom: 3rem; }
.page-title { font-size: clamp(2rem, 5vw, 3rem); color: #fff; margin-bottom: 0.5rem; }
.page-subtitle { font-family: 'JetBrains Mono', monospace; color: #00d400; font-size: 1rem; }

/* Griglia Post */
.post-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  list-style: none;
  padding: 0;
  width: 100%;
}

.post-card {
  background: rgba(22, 27, 34, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
}
.post-card:hover { transform: translateY(-5px); border-color: #00d400; background: rgba(22, 27, 34, 0.9); }

.card-date { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; color: #8b949e; margin-bottom: 0.8rem; display: block; }
.card-title { font-size: 1.4rem; margin: 0 0 1rem 0; line-height: 1.3; }
.card-title a { color: #e6edf3; text-decoration: none; }
.post-card:hover .card-title a { color: #00d400; }
.card-excerpt { font-size: 0.95rem; color: #cfcfcf; line-height: 1.6; margin-bottom: 1.5rem; flex-grow: 1; }
.card-footer { font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; color: #00d400; display: flex; align-items: center; gap: 0.5rem; }

/* === SINGLE POST HERO === */
.post-hero {
  width: 100%;
  text-align: center;
  padding: 4rem 1rem 2rem;
  background: linear-gradient(to bottom, rgba(22, 27, 34, 0), rgba(0, 212, 0, 0.05));
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 3rem;
}

.post-hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem); /* Scala fluida */
  font-weight: 800;
  color: #fff;
  margin: 0 auto 1rem auto;
  line-height: 1.2;
  max-width: 900px;
}

.post-hero-meta {
  font-family: 'JetBrains Mono', monospace;
  color: #8b949e;
  font-size: 0.9rem;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap; /* Va a capo su mobile */
}

.post-tags {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.tag-pill {
  background: rgba(255,255,255,0.1); color: #cfcfcf; padding: 4px 12px;
  border-radius: 20px; font-size: 0.8rem; font-family: 'JetBrains Mono', monospace;
  text-decoration: none; transition: all 0.2s;
}
.tag-pill:hover { background: #00d400; color: #000; }

/* === POST CONTENT (FLUIDO) === */
.post-content {
  width: 100%;
  max-width: 740px; /* Colonna di lettura */
  margin: 0 auto;
  padding: 0 1.5rem; /* Margini laterali di sicurezza */
  
  font-size: 1.15rem;
  line-height: 1.8;
  color: #e6edf3;
  text-align: left;
}

.post-content h2 { font-size: 1.8rem; color: #fff; margin-top: 3rem; margin-bottom: 1rem; border-bottom: 1px solid rgba(255,255,255,0.1); }
.post-content h3 { font-size: 1.4rem; color: #00d400; margin-top: 2.5rem; }
.post-content p { margin-bottom: 2rem; }
.post-content blockquote { border-left: 4px solid #00d400; background: rgba(255, 255, 255, 0.03); margin: 2rem 0; padding: 1.5rem; font-style: italic; color: #cfcfcf; }

.post-content pre {
  background: #161b22;
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto; /* Scroll orizzontale vitale su mobile */
  margin-bottom: 2rem;
  max-width: 100%; /* Impedisce overflow */
}
.post-content code { font-family: 'JetBrains Mono', monospace; font-size: 0.9rem; background: rgba(255,255,255,0.1); padding: 2px 6px; border-radius: 4px; }
.post-content pre code { background: transparent; padding: 0; }
.post-content img { max-width: 100%; height: auto; border-radius: 8px; }

/* === NAVIGAZIONE === */
.post-navigation {
  width: 100%;
  max-width: 800px;
  margin: 4rem auto 0;
  padding: 2rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.nav-link { flex: 1; text-decoration: none; background: rgba(255,255,255,0.03); padding: 1.5rem; border-radius: 8px; min-width: 0; }
.nav-title { display: block; font-size: 1.1rem; color: #e6edf3; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 768px) {
  .post-list { grid-template-columns: 1fr; }
  .post-navigation { flex-direction: column; }
  .post-content { padding: 0 1rem; font-size: 1rem; }
}