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

:root {
  --bg:        #0d0d0d;
  --bg-card:   #141414;
  --bg-card2:  #1a1a1a;
  --accent:    #00ffaa;
  --accent2:   #00ccff;
  --text:      #e0e0e0;
  --text-muted:#888;
  --border:    rgba(0,255,170,0.15);
  --border-hover: rgb(0 255 170);
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Syne', sans-serif;
  --radius:    14px;
  --max-w:     780px;
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.7;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Progress bar ─────────────────────────────────────────── */
#read-progress {
  position: fixed; top: 0; left: 0; z-index: 999;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  width: 0%;
  transition: width 0.1s linear;
  box-shadow: 0 0 12px var(--accent);
}

/* ── Breadcrumb index ─────────────────────────────────────── */
.blog-index-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 24px 0;
}

/* ── Hero del blog ────────────────────────────────────────── */
.blog-hero {
  padding: 72px 24px 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.blog-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(0,255,170,0.07), transparent);
  pointer-events: none;
}
.blog-hero h1 {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  text-shadow: 0 0 40px rgba(0,255,170,0.3);
  line-height: 1.1;
}
.blog-hero p {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 1rem;
  font-family: var(--font-mono);
}

/* ── Grid articoli ────────────────────────────────────────── */
.posts-grid {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px 80px;
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(2, 1fr);
  @media (max-width: 640px) {
  grid-template-columns: 1fr;
  }
}
.post-card:first-child { 
  grid-column: span 2; 
  @media (max-width: 640px) {
    grid-column: span 1;
  }
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.post-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  opacity: 0;
  transition: opacity 0.2s;
}
.post-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,255,170,0.08);
}
.post-card:hover::before { opacity: 1; }

.post-card-meta {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.post-card-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}
.post-card-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent2);
  background: rgba(0,204,255,0.08);
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid rgba(0,204,255,0.2);
}
.post-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.3;
}
.post-card h2 a { color: var(--text); }
.post-card h2 a:hover { color: var(--accent); text-decoration: none; }
.post-card p { font-size: 0.92rem; color: var(--text-muted); line-height: 1.6; }

.post-card-tags {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 16px;
}
.tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  border: 1px solid rgba(0,255,170,0.3);
  border-radius: 20px;
  padding: 2px 10px;
  background: rgba(0,255,170,0.05);
}

/* ── Paginazione ──────────────────────────────────────────── */
.pagination {
  display: flex; justify-content: center; align-items: center;
  gap: 8px; padding: 0 24px 60px;
}
.pagination a, .pagination span {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all 0.2s;
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pagination .active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0,255,170,0.08);
}

/* ── Singolo articolo ─────────────────────────────────────── */
.article-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 48px 24px 100px;
}

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

.article-breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 0.78rem;
  color: var(--text-muted); margin-bottom: 20px;
}
.article-breadcrumb a { color: var(--text-muted); }
.article-breadcrumb a:hover { color: var(--accent); }
.article-breadcrumb span { color: var(--border-hover); }

.article-meta {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.article-date {
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted);
}
.article-readtime {
  font-family: var(--font-mono); font-size: 0.8rem;
  color: var(--accent2);
  background: rgba(0,204,255,0.08);
  padding: 3px 10px; border-radius: 20px;
  border: 1px solid rgba(0,204,255,0.2);
}

.article-title {
  font-family: var(--font-mono);
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 700; line-height: 1.2;
  color: var(--text);
  margin-bottom: 12px;
}
.article-description {
  font-size: 1.05rem; color: var(--text-muted); line-height: 1.6;
  border-left: 3px solid var(--accent);
  padding-left: 16px; margin-top: 16px;
}

.article-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }

/* ── Contenuto articolo ───────────────────────────────────── */
.article-body { font-size: 1rem; line-height: 1.85; }

.article-body h2 {
  font-family: var(--font-mono);
  font-size: 1.4rem; font-weight: 700;
  color: var(--accent);
  margin: 2.5em 0 0.8em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.article-body h3 {
  font-family: var(--font-mono);
  font-size: 1.1rem; font-weight: 700;
  color: var(--accent2);
  margin: 2em 0 0.6em;
}
.article-body p { margin-bottom: 1.4em; }
.article-body ul, .article-body ol {
  margin: 1em 0 1.4em 1.5em;
}
.article-body li { margin-bottom: 0.4em; }
.article-body a { color: var(--accent); border-bottom: 1px solid rgba(0,255,170,0.3); }
.article-body a:hover { border-color: var(--accent); text-decoration: none; }

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(0,255,170,0.08);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(0,255,170,0.15);
}

.article-body pre {
  background: #0a0a0a;
  border: 1px solid rgba(0,255,170,0.15);
  border-radius: 10px;
  padding: 20px 24px;
  overflow-x: auto;
  margin: 1.5em 0;
  position: relative;
}
.article-body pre::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 10px 10px 0 0;
}
.article-body pre code {
  background: none; border: none; padding: 0;
  color: #cdd6f4; font-size: 0.88em; line-height: 1.7;
}

.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px;
  margin: 1.5em 0;
  background: rgba(0,255,170,0.03);
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
  font-style: italic;
}

.article-body img {
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin: 1.5em 0;
  display: block;
}

.article-body table {
  width: 100%; border-collapse: collapse; margin: 1.5em 0;
  font-family: var(--font-mono); font-size: 0.88em;
}
.article-body th {
  background: rgba(0,255,170,0.08);
  color: var(--accent); padding: 10px 14px;
  text-align: left; border: 1px solid var(--border);
}
.article-body td {
  padding: 9px 14px; border: 1px solid var(--border); color: var(--text-muted);
}

/* ── Footer articolo ──────────────────────────────────────── */
.article-footer {
  margin-top: 60px; padding-top: 32px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px;
}
.back-link {
  font-family: var(--font-mono); font-size: 0.85rem;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
  transition: color 0.2s;
}
.back-link:hover { color: var(--accent); text-decoration: none; }

/* ── Card thumbnail ───────────────────────────────────────── */
.post-card-thumb {
  width: 100%; height: 180px;
  object-fit: cover;
  border-radius: calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0 0;
  display: block;
  margin: -28px -32px 20px;
  width: calc(100% + 64px);
  border-bottom: 1px solid var(--border);
  opacity: 0.85;
  transition: opacity 0.2s;
}
.post-card:hover .post-card-thumb { opacity: 1; }

/* ── Hero image articolo ──────────────────────────────────── */
.article-hero-img {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 36px;
  display: block;
}

/* ── Breadcrumb: pin su mobile ────────────────────────────── */
.article-breadcrumb .crumb-current {
  /* testo visibile su desktop */
}
.article-breadcrumb .crumb-pin {
  display: none; /* nascosto su desktop */
}

@media (max-width: 640px) {
  .post-card { padding: 20px; }
  .post-card-thumb {
    margin: -20px -20px 16px;
    width: calc(100% + 40px);
  }
  .article-wrap { padding: 32px 16px 80px; }
  .blog-hero { padding: 48px 16px 32px; }

  /* Su mobile: nasconde il testo del titolo nel breadcrumb, mostra il pin */
  .article-breadcrumb .crumb-current { display: none; }
  .blog-index-wrap   .article-breadcrumb .crumb-current { display: block; }
  .article-breadcrumb .crumb-pin {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--accent);
    font-size: 0.85rem;
  }
 
}
