/* ============================================================
   sramp.com — blog (elenco articoli + pagina articolo)
   Si appoggia a /css/style.css e /css/theme.css
   ============================================================ */

/* ── ADS ─────────────────────────────────────────────────── */
.ad-slot { margin: 2.5rem 0; min-height: 100px; text-align: center; }
.ad-slot::before {
  content: 'Advertisement';
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text3);
  margin-bottom: 0.4rem;
}

/* ── ELENCO ARTICOLI ─────────────────────────────────────── */
.blog-index {
  max-width: 1040px;
  margin: 0 auto;
  padding: 5rem 2rem 4rem;
}

.blog-index h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 1rem;
  background: linear-gradient(150deg, #e8e8f0 20%, #8888b0 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.post-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.post-list .ad-slot { grid-column: 1 / -1; margin: 1rem 0; }

.post-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: inherit;
  transition: border-color 0.2s;
}
.post-card:hover { border-color: rgba(79, 142, 247, 0.4); text-decoration: none; }

/* Copertina: le immagini verticali (screenshot) mostrano la parte alta. */
.post-card-cover {
  width: 100%;
  height: 200px;
  object-fit: cover;
  object-position: top;
  background: var(--bg3);
  display: block;
}

.post-card-body { padding: 1.4rem 1.6rem 1.6rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.post-card-date {
  font-size: 0.75rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.post-card h2, .post-card h3 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.35; margin: 0; }
.post-card p { color: var(--text2); font-size: 0.92rem; line-height: 1.6; flex: 1; }
.post-card .product-link { font-size: 0.85rem; color: var(--accent); font-weight: 600; }

.post-card.featured { grid-column: 1 / -1; flex-direction: row; }
.post-card.featured .post-card-cover { width: 42%; height: auto; min-height: 280px; max-height: 360px; }
.post-card.featured .post-card-body { padding: 2rem 2.2rem; justify-content: center; }
.post-card.featured h2 { font-size: clamp(1.3rem, 2.4vw, 1.8rem); }
.post-card.featured p { flex: 0; font-size: 1rem; }

.post-list.compact .post-card-cover { height: 140px; }
.post-list.compact .post-card-body { padding: 1rem 1.2rem 1.2rem; }
.post-list.compact h3 { font-size: 1rem; }

/* ── PAGINA ARTICOLO ─────────────────────────────────────── */
.post-layout {
  max-width: 1120px;
  margin: 0 auto;
  padding: 3.5rem 2rem 4rem;
  display: grid;
  grid-template-columns: minmax(0, 720px) 280px;
  justify-content: center;
  gap: 4rem;
}

.post-header { margin-bottom: 2rem; }
.post-header .section-label { display: inline-block; margin-bottom: 1rem; }
.post-header .section-label:hover { text-decoration: none; opacity: 0.8; }
.post-header h1 {
  font-size: clamp(1.9rem, 4.2vw, 2.9rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.12;
  margin-bottom: 1rem;
  background: linear-gradient(150deg, #e8e8f0 20%, #8888b0 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; color: var(--text3); font-size: 0.88rem; }
.tag {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text2);
}

/* Testo */
.post-body { font-size: 1.07rem; line-height: 1.8; color: var(--text2); }
.post-body > * + * { margin-top: 1.2rem; }
.post-body strong { color: var(--text); }
.post-body h2 {
  color: var(--text);
  font-size: clamp(1.35rem, 2.6vw, 1.75rem);
  margin: 3rem 0 0.4rem;
  scroll-margin-top: 80px;
}
.post-body h3 {
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 2.2rem 0 0.3rem;
  scroll-margin-top: 80px;
}
.post-body h2 + *, .post-body h3 + * { margin-top: 0.6rem; }
.post-body hr { border: none; border-top: 1px solid var(--border); margin: 3rem 0; }
.post-body hr + h2 { margin-top: 0; }
.post-body ul, .post-body ol { padding-left: 1.4rem; }
.post-body li + li { margin-top: 0.4rem; }
.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.2rem 0 0.2rem 1.2rem;
  color: var(--text);
  font-style: italic;
}
.post-body code { background: var(--bg3); border-radius: 5px; padding: 0.1em 0.35em; font-size: 0.9em; }
.post-body pre { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; overflow-x: auto; }
.post-body pre code { background: none; padding: 0; }
.post-body > .ad-slot { margin: 2.5rem 0; }
.post-body .cta { margin-top: 1.6rem; }
.post-body .cta a:hover { text-decoration: none; }

/* Immagini */
.post-body figure { margin: 2rem 0; text-align: center; }
.post-body figure img {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg3);
  display: block;
  margin: 0 auto;
}
.post-body figure img.portrait { width: 300px; border-radius: 28px; }
.post-body figcaption { font-size: 0.86rem; line-height: 1.5; color: var(--text3); margin: 0.75rem auto 0; max-width: 520px; }

.figure-row { display: flex; gap: 1.5rem; justify-content: center; align-items: flex-start; margin: 2rem 0; }
.figure-row figure { margin: 0; flex: 0 1 300px; min-width: 0; }

/* Coda articolo */
.more-posts { margin-top: 3rem; border-top: 1px solid var(--border); padding-top: 2.5rem; }
.more-posts h2 { font-size: 1.3rem; }
.back-link { margin-top: 2.5rem; font-weight: 600; }

/* ── INDICE LATERALE ─────────────────────────────────────── */
.post-sidebar .ad-slot { margin: 0 0 2rem; }
.toc { position: sticky; top: 80px; }
.toc-title {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
  color: var(--text3);
  font-weight: 700;
  margin-bottom: 0.8rem;
}
.toc-list { list-style: none; border-left: 1px solid var(--border); }
.toc-list a {
  display: block;
  padding: 0.35rem 0 0.35rem 1rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--text2);
  font-size: 0.86rem;
  line-height: 1.4;
  transition: color 0.15s, border-color 0.15s;
}
.toc-list .toc-l3 a { padding-left: 1.9rem; font-size: 0.82rem; }
.toc-list a:hover { color: var(--text); text-decoration: none; }
.toc-list a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }

/* Indice a scomparsa per schermi stretti */
.toc-inline { display: none; }
.toc-inline summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
  padding: 0.8rem 1rem;
  list-style: none;
}
.toc-inline summary::-webkit-details-marker { display: none; }
.toc-inline summary::after { content: '▾'; float: right; color: var(--text3); }
.toc-inline[open] summary::after { content: '▴'; }
.toc-inline .toc-list { border-left: none; padding: 0 0.5rem 0.8rem; }

/* ── TEMA CHIARO ─────────────────────────────────────────── */
[data-theme="light"] .blog-index h1,
[data-theme="light"] .post-header h1 {
  background: linear-gradient(135deg, #1d1d1f 30%, #6e6e73 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 1000px) {
  .post-layout { grid-template-columns: minmax(0, 720px); gap: 0; }
  .post-sidebar { display: none; }
  .toc-inline {
    display: block;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 2rem;
  }
}

@media (max-width: 640px) {
  .blog-index { padding: 3.5rem 1.25rem 3rem; }
  .post-layout { padding: 2.5rem 1.25rem 3rem; }
  .post-body { font-size: 1rem; }
  .post-card.featured { flex-direction: column; }
  .post-card.featured .post-card-cover { width: 100%; min-height: 0; height: 220px; }
  .post-card.featured .post-card-body { padding: 1.4rem 1.6rem 1.6rem; }
  .post-body figure img.portrait { width: 260px; }
  .figure-row { gap: 0.75rem; }
  .figure-row figure img.portrait { width: 100%; border-radius: 18px; }
}
